From 0e22aea01e768ccf7bb66fbe7088e48ee8725ea6 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 28 Mar 2011 21:58:44 +0200 Subject: [PATCH] wined3d: Replace "pow2_matrix_identity" in wined3d_texture with a flag. --- dlls/wined3d/shader.c | 2 +- dlls/wined3d/state.c | 6 ++---- dlls/wined3d/texture.c | 9 ++++----- dlls/wined3d/wined3d_private.h | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 1c01a42b4df..0641b271bc9 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -2101,7 +2101,7 @@ void find_ps_compile_args(const struct wined3d_state *state, args->shadow |= 1 << i; /* Flag samplers that need NP2 texcoord fixup. */ - if (!texture->pow2_matrix_identity) + if (!(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT)) args->np2_fixup |= (1 << i); } if (shader->baseShader.reg_maps.shader_version.major >= 3) diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index e1de0722aca..315705c5999 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -3600,7 +3600,7 @@ static void sampler_texmatrix(DWORD state, struct wined3d_stateblock *stateblock */ if (sampler < MAX_TEXTURES) { - const BOOL texIsPow2 = !texture->pow2_matrix_identity; + const BOOL texIsPow2 = !(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT); if (texIsPow2 || (context->lastWasPow2Texture & (1 << sampler))) { @@ -3671,10 +3671,8 @@ static void sampler(DWORD state_id, struct wined3d_stateblock *stateblock, struc } /* Trigger shader constant reloading (for NP2 texcoord fixup) */ - if (!texture->pow2_matrix_identity) - { + if (!(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT)) device->shader_backend->shader_load_np2fixup_constants(device->shader_priv, gl_info, state); - } } else if (mapped_stage < gl_info->limits.textures) { diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index e16d72d291f..10edf4a9080 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -58,8 +58,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc texture->texture_rgb.dirty = TRUE; texture->texture_srgb.dirty = TRUE; texture->is_srgb = FALSE; - texture->pow2_matrix_identity = TRUE; - texture->flags = 0; + texture->flags = WINED3D_TEXTURE_POW2_MAT_IDENT; if (texture->resource.format->flags & WINED3DFMT_FLAG_FILTERING) { @@ -900,7 +899,7 @@ HRESULT cubetexture_init(struct wined3d_texture *texture, UINT edge_length, UINT texture->pow2_matrix[5] = ((float)edge_length) / ((float)pow2_edge_length); texture->pow2_matrix[10] = ((float)edge_length) / ((float)pow2_edge_length); texture->pow2_matrix[15] = 1.0f; - texture->pow2_matrix_identity = FALSE; + texture->flags &= ~WINED3D_TEXTURE_POW2_MAT_IDENT; } texture->target = GL_TEXTURE_CUBE_MAP_ARB; @@ -1037,7 +1036,7 @@ HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT height, U && wined3d_settings.rendertargetlock_mode == RTL_READTEX)) { if (width != 1 || height != 1) - texture->pow2_matrix_identity = FALSE; + texture->flags &= ~WINED3D_TEXTURE_POW2_MAT_IDENT; texture->pow2_matrix[0] = (float)width; texture->pow2_matrix[5] = (float)height; @@ -1055,9 +1054,9 @@ HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT height, U { if ((width != pow2_width) || (height != pow2_height)) { - texture->pow2_matrix_identity = FALSE; texture->pow2_matrix[0] = (((float)width) / ((float)pow2_width)); texture->pow2_matrix[5] = (((float)height) / ((float)pow2_height)); + texture->flags &= ~WINED3D_TEXTURE_POW2_MAT_IDENT; } else { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index de5093076c8..4ec25e67259 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1889,6 +1889,7 @@ struct wined3d_texture_ops }; #define WINED3D_TEXTURE_COND_NP2 0x1 +#define WINED3D_TEXTURE_POW2_MAT_IDENT 0x2 struct wined3d_texture { @@ -1905,7 +1906,6 @@ struct wined3d_texture DWORD sampler; BOOL is_srgb; DWORD flags; - BOOL pow2_matrix_identity; const struct min_lookup *min_mip_lookup; const GLenum *mag_lookup; GLenum target;