Commit cdefb5cc authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Track SFLAG_NONPOW2 per-texture.

parent e580d748
......@@ -594,7 +594,7 @@ static BOOL surface_use_pbo(const struct wined3d_surface *surface)
&& gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]
&& !texture->resource.format->convert
&& !(texture->flags & WINED3D_TEXTURE_PIN_SYSMEM)
&& !(surface->flags & SFLAG_NONPOW2);
&& !(texture->flags & WINED3D_TEXTURE_COND_NP2_EMULATED);
}
static HRESULT surface_private_setup(struct wined3d_surface *surface)
......@@ -635,12 +635,6 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
}
}
if (pow2Width != surface->resource.width
|| pow2Height != surface->resource.height)
{
surface->flags |= SFLAG_NONPOW2;
}
if ((surface->pow2Width > gl_info->limits.texture_size || surface->pow2Height > gl_info->limits.texture_size)
&& !(surface->resource.usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL)))
{
......@@ -1321,7 +1315,7 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
GLenum gl_type = format->glType;
void *mem;
if (surface->flags & SFLAG_NONPOW2)
if (surface->container->flags & WINED3D_TEXTURE_COND_NP2_EMULATED)
{
wined3d_texture_get_pitch(surface->container, surface->texture_level, &dst_row_pitch, &dst_slice_pitch);
wined3d_format_calculate_pitch(format, surface->resource.device->surface_alignment,
......@@ -1355,7 +1349,7 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
checkGLcall("glGetTexImage");
}
if (surface->flags & SFLAG_NONPOW2)
if (surface->container->flags & WINED3D_TEXTURE_COND_NP2_EMULATED)
{
const BYTE *src_data;
BYTE *dst_data;
......@@ -1880,11 +1874,6 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, const struc
surface->pow2Height <<= 1;
}
if (surface->pow2Width != width || surface->pow2Height != height)
surface->flags |= SFLAG_NONPOW2;
else
surface->flags &= ~SFLAG_NONPOW2;
if (surface->container->user_memory)
{
surface->resource.map_binding = WINED3D_LOCATION_USER_MEMORY;
......
......@@ -663,6 +663,11 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
wined3d_format_calculate_pitch(format, 1, width, height,
&texture->row_pitch, &texture->slice_pitch);
texture->flags &= ~WINED3D_TEXTURE_COND_NP2_EMULATED;
if (((width & (width - 1)) || (height & (height - 1))) && !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]
&& !gl_info->supported[ARB_TEXTURE_RECTANGLE] && !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
texture->flags |= WINED3D_TEXTURE_COND_NP2_EMULATED;
return wined3d_surface_update_desc(surface, gl_info);
}
......@@ -1074,6 +1079,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
texture->pow2_matrix[0] = (((float)desc->width) / ((float)pow2_width));
texture->pow2_matrix[5] = (((float)desc->height) / ((float)pow2_height));
texture->flags &= ~WINED3D_TEXTURE_POW2_MAT_IDENT;
texture->flags |= WINED3D_TEXTURE_COND_NP2_EMULATED;
}
texture->pow2_matrix[10] = 1.0f;
texture->pow2_matrix[15] = 1.0f;
......
......@@ -2336,16 +2336,17 @@ struct wined3d_texture_ops
};
#define WINED3D_TEXTURE_COND_NP2 0x00000001
#define WINED3D_TEXTURE_POW2_MAT_IDENT 0x00000002
#define WINED3D_TEXTURE_IS_SRGB 0x00000004
#define WINED3D_TEXTURE_RGB_ALLOCATED 0x00000008
#define WINED3D_TEXTURE_RGB_VALID 0x00000010
#define WINED3D_TEXTURE_SRGB_ALLOCATED 0x00000020
#define WINED3D_TEXTURE_SRGB_VALID 0x00000040
#define WINED3D_TEXTURE_CONVERTED 0x00000080
#define WINED3D_TEXTURE_PIN_SYSMEM 0x00000100
#define WINED3D_TEXTURE_DYNAMIC_MAP 0x00000200
#define WINED3D_TEXTURE_NORMALIZED_COORDS 0x00000400
#define WINED3D_TEXTURE_COND_NP2_EMULATED 0x00000002
#define WINED3D_TEXTURE_POW2_MAT_IDENT 0x00000004
#define WINED3D_TEXTURE_IS_SRGB 0x00000008
#define WINED3D_TEXTURE_RGB_ALLOCATED 0x00000010
#define WINED3D_TEXTURE_RGB_VALID 0x00000020
#define WINED3D_TEXTURE_SRGB_ALLOCATED 0x00000040
#define WINED3D_TEXTURE_SRGB_VALID 0x00000080
#define WINED3D_TEXTURE_CONVERTED 0x00000100
#define WINED3D_TEXTURE_PIN_SYSMEM 0x00000200
#define WINED3D_TEXTURE_DYNAMIC_MAP 0x00000400
#define WINED3D_TEXTURE_NORMALIZED_COORDS 0x00000800
#define WINED3D_TEXTURE_ASYNC_COLOR_KEY 0x00000001
......@@ -2596,7 +2597,6 @@ void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3
/* Surface flags: */
#define SFLAG_DIBSECTION 0x00000001 /* Has a DIB section attached for GetDC. */
#define SFLAG_DISCARD 0x00000002 /* ??? */
#define SFLAG_NONPOW2 0x00000004 /* Surface sizes are not a power of 2 */
#define SFLAG_DCINUSE 0x00000020 /* Set between GetDC and ReleaseDC calls. */
struct wined3d_sampler
......
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