File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ typedef struct TextureBinding {
80
80
bool border_color_set ;
81
81
GLenum gl_target ;
82
82
GLuint gl_texture ;
83
+ uint32_t lod_bias ;
83
84
} TextureBinding ;
84
85
85
86
typedef struct ShaderModuleCacheKey {
Original file line number Diff line number Diff line change @@ -120,6 +120,8 @@ static void apply_texture_parameters(TextureBinding *binding,
120
120
unsigned int addru = GET_MASK (address , NV_PGRAPH_TEXADDRESS0_ADDRU );
121
121
unsigned int addrv = GET_MASK (address , NV_PGRAPH_TEXADDRESS0_ADDRV );
122
122
unsigned int addrp = GET_MASK (address , NV_PGRAPH_TEXADDRESS0_ADDRP );
123
+ unsigned int lod_bias =
124
+ GET_MASK (filter , NV_PGRAPH_TEXFILTER0_MIPMAP_LOD_BIAS );
123
125
124
126
if (f -> linear ) {
125
127
/* somtimes games try to set mipmap min filters on linear textures.
@@ -146,6 +148,15 @@ static void apply_texture_parameters(TextureBinding *binding,
146
148
pgraph_texture_mag_filter_gl_map [mag_filter ]);
147
149
binding -> mag_filter = mag_filter ;
148
150
}
151
+ if (lod_bias != binding -> lod_bias ) {
152
+ binding -> lod_bias = lod_bias ;
153
+ int sign_extended_bias = lod_bias ;
154
+ if (lod_bias & (1 << 12 )) {
155
+ sign_extended_bias |= ~NV_PGRAPH_TEXFILTER0_MIPMAP_LOD_BIAS ;
156
+ }
157
+ float gl_bias = (float )sign_extended_bias / 256.f ;
158
+ glTexParameterf (binding -> gl_target , GL_TEXTURE_LOD_BIAS , gl_bias );
159
+ }
149
160
150
161
/* Texture wrapping */
151
162
assert (addru < ARRAY_SIZE (pgraph_texture_addr_gl_map ));
You can’t perform that action at this time.
0 commit comments