Commit f50b4c7d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Move "wrap_lookup" to struct wined3d_gl_info.

parent b6e8e135
...@@ -323,7 +323,8 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac ...@@ -323,7 +323,8 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac
} }
/* GL locking is done by the caller */ /* 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; GLint gl_wrap;
...@@ -341,7 +342,7 @@ static void apply_wrap(GLenum target, WINED3DTEXTUREADDRESS d3d_wrap, GLenum par ...@@ -341,7 +342,7 @@ static void apply_wrap(GLenum target, WINED3DTEXTUREADDRESS d3d_wrap, GLenum par
} }
else 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); 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 ...@@ -352,7 +353,8 @@ static void apply_wrap(GLenum target, WINED3DTEXTUREADDRESS d3d_wrap, GLenum par
/* GL locking is done by the caller (state handler) */ /* GL locking is done by the caller (state handler) */
void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1], 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; IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
DWORD state; DWORD state;
...@@ -373,19 +375,19 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, ...@@ -373,19 +375,19 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
if(samplerStates[WINED3DSAMP_ADDRESSU] != gl_tex->states[WINED3DTEXSTA_ADDRESSU]) { if(samplerStates[WINED3DSAMP_ADDRESSU] != gl_tex->states[WINED3DTEXSTA_ADDRESSU]) {
state = samplerStates[WINED3DSAMP_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; gl_tex->states[WINED3DTEXSTA_ADDRESSU] = state;
} }
if(samplerStates[WINED3DSAMP_ADDRESSV] != gl_tex->states[WINED3DTEXSTA_ADDRESSV]) { if(samplerStates[WINED3DSAMP_ADDRESSV] != gl_tex->states[WINED3DTEXSTA_ADDRESSV]) {
state = samplerStates[WINED3DSAMP_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; gl_tex->states[WINED3DTEXSTA_ADDRESSV] = state;
} }
if(samplerStates[WINED3DSAMP_ADDRESSW] != gl_tex->states[WINED3DTEXSTA_ADDRESSW]) { if(samplerStates[WINED3DSAMP_ADDRESSW] != gl_tex->states[WINED3DTEXSTA_ADDRESSW]) {
state = samplerStates[WINED3DSAMP_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; gl_tex->states[WINED3DTEXSTA_ADDRESSW] = state;
} }
...@@ -475,9 +477,6 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, ...@@ -475,9 +477,6 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
if (gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] != aniso) 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]) if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC])
{ {
glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso); glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso);
......
...@@ -156,8 +156,6 @@ static const struct { ...@@ -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); 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[] = const struct min_lookup minMipLookup[] =
{ {
/* NONE POINT LINEAR */ /* NONE POINT LINEAR */
...@@ -2123,13 +2121,13 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_driver_info *driver_info, str ...@@ -2123,13 +2121,13 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_driver_info *driver_info, str
else else
gl_info->vidmem = WINE_DEFAULT_VIDMEM; gl_info->vidmem = WINE_DEFAULT_VIDMEM;
wrap_lookup[WINED3DTADDRESS_WRAP - WINED3DTADDRESS_WRAP] = GL_REPEAT; gl_info->wrap_lookup[WINED3DTADDRESS_WRAP - WINED3DTADDRESS_WRAP] = GL_REPEAT;
wrap_lookup[WINED3DTADDRESS_MIRROR - WINED3DTADDRESS_WRAP] = gl_info->wrap_lookup[WINED3DTADDRESS_MIRROR - WINED3DTADDRESS_WRAP] =
gl_info->supported[ARB_TEXTURE_MIRRORED_REPEAT] ? GL_MIRRORED_REPEAT_ARB : GL_REPEAT; gl_info->supported[ARB_TEXTURE_MIRRORED_REPEAT] ? GL_MIRRORED_REPEAT_ARB : GL_REPEAT;
wrap_lookup[WINED3DTADDRESS_CLAMP - WINED3DTADDRESS_WRAP] = GL_CLAMP_TO_EDGE; gl_info->wrap_lookup[WINED3DTADDRESS_CLAMP - WINED3DTADDRESS_WRAP] = GL_CLAMP_TO_EDGE;
wrap_lookup[WINED3DTADDRESS_BORDER - WINED3DTADDRESS_WRAP] = gl_info->wrap_lookup[WINED3DTADDRESS_BORDER - WINED3DTADDRESS_WRAP] =
gl_info->supported[ARB_TEXTURE_BORDER_CLAMP] ? GL_CLAMP_TO_BORDER_ARB : GL_REPEAT; 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; 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 */ /* Make sure there's an active HDC else the WGL extensions will fail */
......
...@@ -3520,7 +3520,7 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wine ...@@ -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); tex_impl->baseTexture.internal_preload(stateblock->textures[sampler], srgb ? SRGB_SRGB : SRGB_RGB);
IWineD3DBaseTexture_BindTexture(stateblock->textures[sampler], srgb); IWineD3DBaseTexture_BindTexture(stateblock->textures[sampler], srgb);
basetexture_apply_state_changes(stateblock->textures[sampler], 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]) if (context->gl_info->supported[EXT_TEXTURE_LOD_BIAS])
{ {
......
...@@ -4101,6 +4101,7 @@ struct wined3d_gl_info ...@@ -4101,6 +4101,7 @@ struct wined3d_gl_info
DWORD reserved_glsl_constants; DWORD reserved_glsl_constants;
DWORD quirks; DWORD quirks;
BOOL supported[WINED3D_GL_EXT_COUNT]; BOOL supported[WINED3D_GL_EXT_COUNT];
GLint wrap_lookup[WINED3DTADDRESS_MIRRORONCE - WINED3DTADDRESS_WRAP + 1];
struct wined3d_fbo_ops fbo_ops; struct wined3d_fbo_ops fbo_ops;
/* GL function pointers */ /* GL function pointers */
......
...@@ -149,8 +149,6 @@ void wined3d_rb_free(void *ptr) DECLSPEC_HIDDEN; ...@@ -149,8 +149,6 @@ void wined3d_rb_free(void *ptr) DECLSPEC_HIDDEN;
#define MAX_ACTIVE_LIGHTS 8 #define MAX_ACTIVE_LIGHTS 8
#define MAX_CLIPPLANES WINED3DMAXUSERCLIPPLANES #define MAX_CLIPPLANES WINED3DMAXUSERCLIPPLANES
extern GLint wrap_lookup[WINED3DTADDRESS_MIRRORONCE - WINED3DTADDRESS_WRAP + 1] DECLSPEC_HIDDEN;
struct min_lookup struct min_lookup
{ {
GLenum mip[WINED3DTEXF_LINEAR + 1]; GLenum mip[WINED3DTEXF_LINEAR + 1];
...@@ -1758,8 +1756,9 @@ typedef struct IWineD3DBaseTextureImpl ...@@ -1758,8 +1756,9 @@ typedef struct IWineD3DBaseTextureImpl
} IWineD3DBaseTextureImpl; } IWineD3DBaseTextureImpl;
void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
const DWORD texture_states[WINED3D_HIGHEST_TEXTURE_STATE + 1], const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1],
const DWORD sampler_states[WINED3D_HIGHEST_SAMPLER_STATE + 1]) DECLSPEC_HIDDEN; 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; HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc) DECLSPEC_HIDDEN;
void basetexture_cleanup(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; void basetexture_cleanup(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN;
void basetexture_generate_mipmaps(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; void basetexture_generate_mipmaps(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment