From f50b4c7d71c8074d0b29b2e9176329bf004942c7 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 3 Jan 2010 21:18:22 +0100 Subject: [PATCH] wined3d: Move "wrap_lookup" to struct wined3d_gl_info. --- dlls/wined3d/basetexture.c | 17 ++++++++--------- dlls/wined3d/directx.c | 12 +++++------- dlls/wined3d/state.c | 2 +- dlls/wined3d/wined3d_gl.h | 1 + dlls/wined3d/wined3d_private.h | 7 +++---- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c index e671ec46a0d..f3c3fe74e1b 100644 --- a/dlls/wined3d/basetexture.c +++ b/dlls/wined3d/basetexture.c @@ -323,7 +323,8 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac } /* GL locking is done by the caller */ -static void apply_wrap(GLenum target, WINED3DTEXTUREADDRESS d3d_wrap, GLenum param, BOOL cond_np2) +static void apply_wrap(const struct wined3d_gl_info *gl_info, GLenum target, + WINED3DTEXTUREADDRESS d3d_wrap, GLenum param, BOOL cond_np2) { GLint gl_wrap; @@ -341,7 +342,7 @@ static void apply_wrap(GLenum target, WINED3DTEXTUREADDRESS d3d_wrap, GLenum par } else { - gl_wrap = wrap_lookup[d3d_wrap - WINED3DTADDRESS_WRAP]; + gl_wrap = gl_info->wrap_lookup[d3d_wrap - WINED3DTADDRESS_WRAP]; } TRACE("Setting param %#x to %#x for target %#x.\n", param, gl_wrap, target); @@ -352,7 +353,8 @@ static void apply_wrap(GLenum target, WINED3DTEXTUREADDRESS d3d_wrap, GLenum par /* GL locking is done by the caller (state handler) */ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1], - const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]) + const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1], + const struct wined3d_gl_info *gl_info) { IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; DWORD state; @@ -373,19 +375,19 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, if(samplerStates[WINED3DSAMP_ADDRESSU] != gl_tex->states[WINED3DTEXSTA_ADDRESSU]) { state = samplerStates[WINED3DSAMP_ADDRESSU]; - apply_wrap(textureDimensions, state, GL_TEXTURE_WRAP_S, cond_np2); + apply_wrap(gl_info, textureDimensions, state, GL_TEXTURE_WRAP_S, cond_np2); gl_tex->states[WINED3DTEXSTA_ADDRESSU] = state; } if(samplerStates[WINED3DSAMP_ADDRESSV] != gl_tex->states[WINED3DTEXSTA_ADDRESSV]) { state = samplerStates[WINED3DSAMP_ADDRESSV]; - apply_wrap(textureDimensions, state, GL_TEXTURE_WRAP_T, cond_np2); + apply_wrap(gl_info, textureDimensions, state, GL_TEXTURE_WRAP_T, cond_np2); gl_tex->states[WINED3DTEXSTA_ADDRESSV] = state; } if(samplerStates[WINED3DSAMP_ADDRESSW] != gl_tex->states[WINED3DTEXSTA_ADDRESSW]) { state = samplerStates[WINED3DSAMP_ADDRESSW]; - apply_wrap(textureDimensions, state, GL_TEXTURE_WRAP_R, cond_np2); + apply_wrap(gl_info, textureDimensions, state, GL_TEXTURE_WRAP_R, cond_np2); gl_tex->states[WINED3DTEXSTA_ADDRESSW] = state; } @@ -475,9 +477,6 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, if (gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] != aniso) { - IWineD3DDeviceImpl *device = This->resource.device; - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC]) { glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 487b43503fe..e0e6880aa4b 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -156,8 +156,6 @@ static const struct { static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat, WINED3DSURFTYPE SurfaceType); -GLint wrap_lookup[WINED3DTADDRESS_MIRRORONCE - WINED3DTADDRESS_WRAP + 1]; - const struct min_lookup minMipLookup[] = { /* NONE POINT LINEAR */ @@ -2123,13 +2121,13 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_driver_info *driver_info, str else gl_info->vidmem = WINE_DEFAULT_VIDMEM; - wrap_lookup[WINED3DTADDRESS_WRAP - WINED3DTADDRESS_WRAP] = GL_REPEAT; - wrap_lookup[WINED3DTADDRESS_MIRROR - WINED3DTADDRESS_WRAP] = + gl_info->wrap_lookup[WINED3DTADDRESS_WRAP - WINED3DTADDRESS_WRAP] = GL_REPEAT; + gl_info->wrap_lookup[WINED3DTADDRESS_MIRROR - WINED3DTADDRESS_WRAP] = gl_info->supported[ARB_TEXTURE_MIRRORED_REPEAT] ? GL_MIRRORED_REPEAT_ARB : GL_REPEAT; - wrap_lookup[WINED3DTADDRESS_CLAMP - WINED3DTADDRESS_WRAP] = GL_CLAMP_TO_EDGE; - wrap_lookup[WINED3DTADDRESS_BORDER - WINED3DTADDRESS_WRAP] = + gl_info->wrap_lookup[WINED3DTADDRESS_CLAMP - WINED3DTADDRESS_WRAP] = GL_CLAMP_TO_EDGE; + gl_info->wrap_lookup[WINED3DTADDRESS_BORDER - WINED3DTADDRESS_WRAP] = gl_info->supported[ARB_TEXTURE_BORDER_CLAMP] ? GL_CLAMP_TO_BORDER_ARB : GL_REPEAT; - wrap_lookup[WINED3DTADDRESS_MIRRORONCE - WINED3DTADDRESS_WRAP] = + gl_info->wrap_lookup[WINED3DTADDRESS_MIRRORONCE - WINED3DTADDRESS_WRAP] = gl_info->supported[ATI_TEXTURE_MIRROR_ONCE] ? GL_MIRROR_CLAMP_TO_EDGE_ATI : GL_REPEAT; /* Make sure there's an active HDC else the WGL extensions will fail */ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 80781186180..e984529bfe1 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -3520,7 +3520,7 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wine tex_impl->baseTexture.internal_preload(stateblock->textures[sampler], srgb ? SRGB_SRGB : SRGB_RGB); IWineD3DBaseTexture_BindTexture(stateblock->textures[sampler], srgb); basetexture_apply_state_changes(stateblock->textures[sampler], - stateblock->textureState[sampler], stateblock->samplerState[sampler]); + stateblock->textureState[sampler], stateblock->samplerState[sampler], gl_info); if (context->gl_info->supported[EXT_TEXTURE_LOD_BIAS]) { diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 4eb57d282ce..49f8114269f 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -4101,6 +4101,7 @@ struct wined3d_gl_info DWORD reserved_glsl_constants; DWORD quirks; BOOL supported[WINED3D_GL_EXT_COUNT]; + GLint wrap_lookup[WINED3DTADDRESS_MIRRORONCE - WINED3DTADDRESS_WRAP + 1]; struct wined3d_fbo_ops fbo_ops; /* GL function pointers */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 361967b534c..3cb0942305c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -149,8 +149,6 @@ void wined3d_rb_free(void *ptr) DECLSPEC_HIDDEN; #define MAX_ACTIVE_LIGHTS 8 #define MAX_CLIPPLANES WINED3DMAXUSERCLIPPLANES -extern GLint wrap_lookup[WINED3DTADDRESS_MIRRORONCE - WINED3DTADDRESS_WRAP + 1] DECLSPEC_HIDDEN; - struct min_lookup { GLenum mip[WINED3DTEXF_LINEAR + 1]; @@ -1758,8 +1756,9 @@ typedef struct IWineD3DBaseTextureImpl } IWineD3DBaseTextureImpl; void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, - const DWORD texture_states[WINED3D_HIGHEST_TEXTURE_STATE + 1], - const DWORD sampler_states[WINED3D_HIGHEST_SAMPLER_STATE + 1]) DECLSPEC_HIDDEN; + const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1], + const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1], + const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc) DECLSPEC_HIDDEN; void basetexture_cleanup(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; void basetexture_generate_mipmaps(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; -- 2.11.4.GIT