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

This commit is contained in:
Henri Verbeet 2011-03-28 21:58:43 +02:00 committed by Alexandre Julliard
parent c5bf96c951
commit e111acdf11
2 changed files with 8 additions and 6 deletions

View File

@ -59,6 +59,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
texture->texture_srgb.dirty = TRUE;
texture->is_srgb = FALSE;
texture->pow2_matrix_identity = TRUE;
texture->flags = 0;
if (texture->resource.format->flags & WINED3DFMT_FLAG_FILTERING)
{
@ -262,7 +263,7 @@ void wined3d_texture_apply_state_changes(struct wined3d_texture *texture,
const DWORD sampler_states[WINED3D_HIGHEST_SAMPLER_STATE + 1],
const struct wined3d_gl_info *gl_info)
{
BOOL cond_np2 = texture->cond_np2;
BOOL cond_np2 = texture->flags & WINED3D_TEXTURE_COND_NP2;
GLenum target = texture->target;
struct gl_texture *gl_tex;
DWORD state;
@ -666,7 +667,7 @@ static HRESULT texture2d_bind(struct wined3d_texture *texture,
* state. The same applies to filtering. Even if the texture has only
* one mip level, the default LINEAR_MIPMAP_LINEAR filter causes a SW
* fallback on macos. */
if (texture->cond_np2)
if (texture->flags & WINED3D_TEXTURE_COND_NP2)
{
GLenum target = texture->target;
@ -1028,7 +1029,7 @@ HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT height, U
texture->pow2_matrix[10] = 1.0f;
texture->pow2_matrix[15] = 1.0f;
texture->target = GL_TEXTURE_2D;
texture->cond_np2 = TRUE;
texture->flags |= WINED3D_TEXTURE_COND_NP2;
texture->min_mip_lookup = minMipLookup_noFilter;
}
else if (gl_info->supported[ARB_TEXTURE_RECTANGLE] && (width != pow2_width || height != pow2_height)
@ -1043,7 +1044,7 @@ HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT height, U
texture->pow2_matrix[10] = 1.0f;
texture->pow2_matrix[15] = 1.0f;
texture->target = GL_TEXTURE_RECTANGLE_ARB;
texture->cond_np2 = TRUE;
texture->flags |= WINED3D_TEXTURE_COND_NP2;
if (texture->resource.format->flags & WINED3DFMT_FLAG_FILTERING)
texture->min_mip_lookup = minMipLookup_noMip;
@ -1067,7 +1068,6 @@ HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT height, U
texture->pow2_matrix[10] = 1.0f;
texture->pow2_matrix[15] = 1.0f;
texture->target = GL_TEXTURE_2D;
texture->cond_np2 = FALSE;
}
TRACE("xf(%f) yf(%f)\n", texture->pow2_matrix[0], texture->pow2_matrix[5]);

View File

@ -1888,6 +1888,8 @@ struct wined3d_texture_ops
void (*texture_sub_resource_cleanup)(struct wined3d_resource *sub_resource);
};
#define WINED3D_TEXTURE_COND_NP2 0x1
struct wined3d_texture
{
struct wined3d_resource resource;
@ -1902,8 +1904,8 @@ struct wined3d_texture
LONG bind_count;
DWORD sampler;
BOOL is_srgb;
DWORD flags;
BOOL pow2_matrix_identity;
BOOL cond_np2;
const struct min_lookup *min_mip_lookup;
const GLenum *mag_lookup;
GLenum target;