Commit 0e22aea0 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Replace "pow2_matrix_identity" in wined3d_texture with a flag.

parent e111acdf
......@@ -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)
......
......@@ -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,11 +3671,9 @@ 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)
{
if (sampler < state->lowest_disabled_stage)
......
......@@ -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
{
......
......@@ -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;
......
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