wined3d: Move "wrap_lookup" to struct wined3d_gl_info.

This commit is contained in:
Henri Verbeet 2010-01-03 21:18:22 +01:00 committed by Alexandre Julliard
parent b6e8e13599
commit f50b4c7d71
5 changed files with 18 additions and 21 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -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])
{

View File

@ -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 */

View File

@ -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;