Module: wine Branch: master Commit: a22203adeb22024106980b8721c3cba24baa3522 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a22203adeb22024106980b8721...
Author: Stefan Dösinger stefan@codeweavers.com Date: Sun Apr 6 00:31:39 2008 +0200
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.
---
dlls/wined3d/basetexture.c | 4 ++-- dlls/wined3d/directx.c | 14 ++++++-------- dlls/wined3d/surface.c | 4 ++-- dlls/wined3d/wined3d_private.h | 6 ++++-- 4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c index 7609099..ab7fd55 100644 --- a/dlls/wined3d/basetexture.c +++ b/dlls/wined3d/basetexture.c @@ -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. */ diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index c29fbf1..d39118c 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -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;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 90a05d1..31c8e4f 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -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]); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 077e456..4aeda0c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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;