wined3d: Make the mag filter lookup a separate array.
This makes it easier to make this a per texture / per adapter property. Somewhen we should rename the remaining lookup type in the general lookup table to wraplookup.
This commit is contained in:
parent
0cbd08b2b9
commit
a22203adeb
|
@ -431,10 +431,10 @@ void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface
|
|||
if(samplerStates[WINED3DSAMP_MAGFILTER] != This->baseTexture.states[WINED3DTEXSTA_MAGFILTER]) {
|
||||
GLint glValue;
|
||||
state = samplerStates[WINED3DSAMP_MAGFILTER];
|
||||
if (state < minLookup[WINELOOKUP_MAGFILTER] || state > maxLookup[WINELOOKUP_MAGFILTER]) {
|
||||
if (state < WINED3DTEXF_NONE || state > WINED3DTEXF_ANISOTROPIC) {
|
||||
FIXME("Unrecognized or unsupported MAGFILTER* value %d\n", state);
|
||||
}
|
||||
glValue = stateLookup[WINELOOKUP_MAGFILTER][state - minLookup[WINELOOKUP_MAGFILTER]];
|
||||
glValue = magLookup[state - WINED3DTEXF_NONE];
|
||||
TRACE("ValueMAG=%d setting MAGFILTER to %x\n", state, glValue);
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_MAG_FILTER, glValue);
|
||||
/* We need to reset the Anisotropic filtering state when we change the mag filter to WINED3DTEXF_ANISOTROPIC (this seems a bit weird, check the documentation to see how it should be switched off. */
|
||||
|
|
|
@ -162,6 +162,8 @@ DWORD minMipLookup_noFilter[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1]
|
|||
{GL_NEAREST, GL_NEAREST, GL_NEAREST},
|
||||
};
|
||||
|
||||
DWORD magLookup[WINED3DTEXF_ANISOTROPIC + 1];
|
||||
|
||||
/* drawStridedSlow attributes */
|
||||
glAttribFunc position_funcs[WINED3DDECLTYPE_UNUSED];
|
||||
glAttribFunc diffuse_funcs[WINED3DDECLTYPE_UNUSED];
|
||||
|
@ -1302,10 +1304,6 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
|
|||
minLookup[WINELOOKUP_WARPPARAM] = WINED3DTADDRESS_WRAP;
|
||||
maxLookup[WINELOOKUP_WARPPARAM] = WINED3DTADDRESS_MIRRORONCE;
|
||||
|
||||
minLookup[WINELOOKUP_MAGFILTER] = WINED3DTEXF_NONE;
|
||||
maxLookup[WINELOOKUP_MAGFILTER] = WINED3DTEXF_ANISOTROPIC;
|
||||
|
||||
|
||||
for (i = 0; i < MAX_LOOKUPS; i++) {
|
||||
stateLookup[i] = HeapAlloc(GetProcessHeap(), 0, sizeof(*stateLookup[i]) * (1 + maxLookup[i] - minLookup[i]) );
|
||||
}
|
||||
|
@ -1321,10 +1319,10 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
|
|||
stateLookup[WINELOOKUP_WARPPARAM][WINED3DTADDRESS_MIRRORONCE - minLookup[WINELOOKUP_WARPPARAM]] =
|
||||
gl_info->supported[ATI_TEXTURE_MIRROR_ONCE] ? GL_MIRROR_CLAMP_TO_EDGE_ATI : GL_REPEAT;
|
||||
|
||||
stateLookup[WINELOOKUP_MAGFILTER][WINED3DTEXF_NONE - minLookup[WINELOOKUP_MAGFILTER]] = GL_NEAREST;
|
||||
stateLookup[WINELOOKUP_MAGFILTER][WINED3DTEXF_POINT - minLookup[WINELOOKUP_MAGFILTER]] = GL_NEAREST;
|
||||
stateLookup[WINELOOKUP_MAGFILTER][WINED3DTEXF_LINEAR - minLookup[WINELOOKUP_MAGFILTER]] = GL_LINEAR;
|
||||
stateLookup[WINELOOKUP_MAGFILTER][WINED3DTEXF_ANISOTROPIC - minLookup[WINELOOKUP_MAGFILTER]] =
|
||||
magLookup[WINED3DTEXF_NONE - WINED3DTEXF_NONE] = GL_NEAREST;
|
||||
magLookup[WINED3DTEXF_POINT - WINED3DTEXF_NONE] = GL_NEAREST;
|
||||
magLookup[WINED3DTEXF_LINEAR - WINED3DTEXF_NONE] = GL_LINEAR;
|
||||
magLookup[WINED3DTEXF_ANISOTROPIC - WINED3DTEXF_NONE] =
|
||||
gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC] ? GL_LINEAR : GL_NEAREST;
|
||||
|
||||
|
||||
|
|
|
@ -2799,7 +2799,7 @@ static inline void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *This, IWine
|
|||
|
||||
/* No issue with overriding these - the sampler is dirty due to blit usage */
|
||||
glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER,
|
||||
stateLookup[WINELOOKUP_MAGFILTER][Filter - minLookup[WINELOOKUP_MAGFILTER]]);
|
||||
magLookup[Filter - WINED3DTEXF_NONE]);
|
||||
checkGLcall("glTexParameteri");
|
||||
glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER,
|
||||
minMipLookup[Filter][WINED3DTEXF_NONE]);
|
||||
|
@ -3321,7 +3321,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *
|
|||
|
||||
/* Filtering for StretchRect */
|
||||
glTexParameteri(Src->glDescription.target, GL_TEXTURE_MAG_FILTER,
|
||||
stateLookup[WINELOOKUP_MAGFILTER][Filter - minLookup[WINELOOKUP_MAGFILTER]]);
|
||||
magLookup[Filter - WINED3DTEXF_NONE]);
|
||||
checkGLcall("glTexParameteri");
|
||||
glTexParameteri(Src->glDescription.target, GL_TEXTURE_MIN_FILTER,
|
||||
minMipLookup[Filter][WINED3DTEXF_NONE]);
|
||||
|
|
|
@ -104,14 +104,16 @@ extern const DWORD SavedVertexStates_S[NUM_SAVEDVERTEXSTATES_S];
|
|||
|
||||
typedef enum _WINELOOKUP {
|
||||
WINELOOKUP_WARPPARAM = 0,
|
||||
WINELOOKUP_MAGFILTER = 1,
|
||||
MAX_LOOKUPS = 2
|
||||
MAX_LOOKUPS = 1
|
||||
} WINELOOKUP;
|
||||
|
||||
extern int minLookup[MAX_LOOKUPS];
|
||||
extern int maxLookup[MAX_LOOKUPS];
|
||||
extern DWORD *stateLookup[MAX_LOOKUPS];
|
||||
|
||||
typedef DWORD magLookup_t[WINED3DTEXF_ANISOTROPIC + 1];
|
||||
extern magLookup_t magLookup;
|
||||
|
||||
typedef DWORD minMipLookup_t[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1];
|
||||
extern minMipLookup_t minMipLookup;
|
||||
extern minMipLookup_t minMipLookup_noFilter;
|
||||
|
|
Loading…
Reference in New Issue