@@ -105,6 +105,7 @@ static const u8 _gxteximg1ids[8] = {0x8C,0x8D,0x8E,0x8F,0xAC,0xAD,0xAE,0xAF};
105
105
static const u8 _gxteximg2ids [8 ] = {0x90 ,0x91 ,0x92 ,0x93 ,0xB0 ,0xB1 ,0xB2 ,0xB3 };
106
106
static const u8 _gxteximg3ids [8 ] = {0x94 ,0x95 ,0x96 ,0x97 ,0xB4 ,0xB5 ,0xB6 ,0xB7 };
107
107
static const u8 _gxtextlutids [8 ] = {0x98 ,0x99 ,0x9A ,0x9B ,0xB8 ,0xB9 ,0xBA ,0xBB };
108
+ static const u8 _gx2HWFiltConv [] = {0x00 ,0x04 ,0x01 ,0x05 ,0x02 ,0x06 ,0x00 ,0x00 };
108
109
109
110
#if defined(HW_RVL )
110
111
@@ -3034,6 +3035,22 @@ void GX_GetTexObjLOD(const GXTexObj *obj, f32 *minlod, f32 *maxlod)
3034
3035
* maxlod = _SHIFTR (ptr -> tex_lod , 8 , 8 ) / 16.0f ;
3035
3036
}
3036
3037
3038
+ void GX_GetTexObjFilterMode (const GXTexObj * obj , u8 * minfilt , u8 * magfilt )
3039
+ {
3040
+ const struct __gx_texobj * ptr = (const struct __gx_texobj * )obj ;
3041
+ u8 hw_filt , i ;
3042
+
3043
+ * magfilt = ptr -> tex_filt & 0x10 ? GX_LINEAR : GX_NEAR ;
3044
+ hw_filt = _SHIFTR (ptr -> tex_filt , 5 , 3 );
3045
+ for (i = 0 ; i < sizeof (_gx2HWFiltConv ); i ++ )
3046
+ if (_gx2HWFiltConv [i ] == hw_filt ) {
3047
+ * minfilt = i ;
3048
+ break ;
3049
+ }
3050
+ if (i == sizeof (_gx2HWFiltConv )) /* we didn't find it */
3051
+ * minfilt = GX_NEAR ;
3052
+ }
3053
+
3037
3054
void GX_GetTexObjAll (const GXTexObj * obj , void * * image_ptr , u16 * width , u16 * height ,
3038
3055
u8 * format , u8 * wrap_s , u8 * wrap_t , u8 * mipmap )
3039
3056
{
@@ -3290,15 +3307,13 @@ void GX_InitTexObjCI(GXTexObj *obj,void *img_ptr,u16 wd,u16 ht,u8 fmt,u8 wrap_s,
3290
3307
void GX_InitTexObjLOD (GXTexObj * obj ,u8 minfilt ,u8 magfilt ,f32 minlod ,f32 maxlod ,f32 lodbias ,u8 biasclamp ,u8 edgelod ,u8 maxaniso )
3291
3308
{
3292
3309
struct __gx_texobj * ptr = (struct __gx_texobj * )obj ;
3293
- static const u8 GX2HWFiltConv [] = {0x00 ,0x04 ,0x01 ,0x05 ,0x02 ,0x06 ,0x00 ,0x00 };
3294
- //static const u8 HW2GXFiltConv[] = {0x00,0x02,0x04,0x00,0x01,0x03,0x05,0x00};
3295
3310
3296
3311
if (lodbias < -4.0f ) lodbias = -4.0f ;
3297
3312
else if (lodbias == 4.0f ) lodbias = 3.99f ;
3298
3313
3299
3314
ptr -> tex_filt = (ptr -> tex_filt & ~0x1fe00 )|(_SHIFTL (((u32 )(32.0f * lodbias )),9 ,8 ));
3300
3315
ptr -> tex_filt = (ptr -> tex_filt & ~0x10 )|(_SHIFTL ((magfilt == GX_LINEAR ?1 :0 ),4 ,1 ));
3301
- ptr -> tex_filt = (ptr -> tex_filt & ~0xe0 )|(_SHIFTL (GX2HWFiltConv [minfilt ],5 ,3 ));
3316
+ ptr -> tex_filt = (ptr -> tex_filt & ~0xe0 )|(_SHIFTL (_gx2HWFiltConv [minfilt ],5 ,3 ));
3302
3317
ptr -> tex_filt = (ptr -> tex_filt & ~0x100 )|(_SHIFTL (!(edgelod & 0xff ),8 ,1 ));
3303
3318
ptr -> tex_filt = (ptr -> tex_filt & ~0x180000 )|(_SHIFTL (maxaniso ,19 ,2 ));
3304
3319
ptr -> tex_filt = (ptr -> tex_filt & ~0x200000 )|(_SHIFTL (biasclamp ,21 ,1 ));
@@ -3335,10 +3350,9 @@ void GX_InitTexObjWrapMode(GXTexObj *obj,u8 wrap_s,u8 wrap_t)
3335
3350
void GX_InitTexObjFilterMode (GXTexObj * obj ,u8 minfilt ,u8 magfilt )
3336
3351
{
3337
3352
struct __gx_texobj * ptr = (struct __gx_texobj * )obj ;
3338
- static const u8 GX2HWFiltConv [] = {0x00 ,0x04 ,0x01 ,0x05 ,0x02 ,0x06 ,0x00 ,0x00 };
3339
3353
3340
3354
ptr -> tex_filt = (ptr -> tex_filt & ~0x10 )|(_SHIFTL ((magfilt == GX_LINEAR ?1 :0 ),4 ,1 ));
3341
- ptr -> tex_filt = (ptr -> tex_filt & ~0xe0 )|(_SHIFTL (GX2HWFiltConv [minfilt ],5 ,3 ));
3355
+ ptr -> tex_filt = (ptr -> tex_filt & ~0xe0 )|(_SHIFTL (_gx2HWFiltConv [minfilt ],5 ,3 ));
3342
3356
}
3343
3357
3344
3358
void GX_InitTexObjMinLOD (GXTexObj * obj ,f32 minlod )
0 commit comments