wined3d: Track texture coordinate normalization per-texture.

This commit is contained in:
Henri Verbeet 2014-10-09 11:50:47 +02:00 committed by Alexandre Julliard
parent c5459881a3
commit 1800712298
4 changed files with 6 additions and 8 deletions

View File

@ -3299,7 +3299,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
bottom = src_surface->resource.height - src_rect->top;
}
if (src_surface->flags & SFLAG_NORMCOORD)
if (src_surface->container->flags & WINED3D_TEXTURE_NORMALIZED_COORDS)
{
left /= src_surface->pow2Width;
right /= src_surface->pow2Width;
@ -5547,8 +5547,6 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
list_init(&surface->overlays);
/* Flags */
if (target != GL_TEXTURE_RECTANGLE_ARB)
surface->flags |= SFLAG_NORMCOORD;
if (flags & WINED3D_SURFACE_DISCARD)
surface->flags |= SFLAG_DISCARD;
if (lockable || desc->format == WINED3DFMT_D16_LOCKABLE)

View File

@ -349,7 +349,7 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
context2 = context_acquire(device, backbuffer);
context_apply_blit_state(context2, device);
if (backbuffer->flags & SFLAG_NORMCOORD)
if (backbuffer->container->flags & WINED3D_TEXTURE_NORMALIZED_COORDS)
{
tex_left /= src_w;
tex_right /= src_w;

View File

@ -81,7 +81,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
texture->level_count = level_count;
texture->filter_type = (desc->usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3D_TEXF_LINEAR : WINED3D_TEXF_NONE;
texture->lod = 0;
texture->flags = WINED3D_TEXTURE_POW2_MAT_IDENT;
texture->flags = WINED3D_TEXTURE_POW2_MAT_IDENT | WINED3D_TEXTURE_NORMALIZED_COORDS;
if (surface_flags & WINED3D_SURFACE_PIN_SYSMEM)
texture->flags |= WINED3D_TEXTURE_PIN_SYSMEM;
@ -1209,7 +1209,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
texture->pow2_matrix[15] = 1.0f;
texture->target = GL_TEXTURE_RECTANGLE_ARB;
texture->flags |= WINED3D_TEXTURE_COND_NP2;
texture->flags &= ~WINED3D_TEXTURE_POW2_MAT_IDENT;
texture->flags &= ~(WINED3D_TEXTURE_POW2_MAT_IDENT | WINED3D_TEXTURE_NORMALIZED_COORDS);
if (texture->resource.format->flags & WINED3DFMT_FLAG_FILTERING)
texture->min_mip_lookup = minMipLookup_noMip;

View File

@ -2131,6 +2131,7 @@ struct wined3d_texture_ops
#define WINED3D_TEXTURE_CONVERTED 0x00000080
#define WINED3D_TEXTURE_PIN_SYSMEM 0x00000100
#define WINED3D_TEXTURE_DYNAMIC_MAP 0x00000200
#define WINED3D_TEXTURE_NORMALIZED_COORDS 0x00000400
struct wined3d_texture
{
@ -2351,11 +2352,10 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) D
#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_NORMCOORD 0x00000008 /* Set if GL texture coordinates are normalized (non-texture rectangle). */
#define SFLAG_LOST 0x00000008 /* Surface lost flag for ddraw. */
#define SFLAG_GLCKEY 0x00000010 /* The GL texture was created with a color key. */
#define SFLAG_CLIENT 0x00000020 /* GL_APPLE_client_storage is used with this surface. */
#define SFLAG_DCINUSE 0x00000040 /* Set between GetDC and ReleaseDC calls. */
#define SFLAG_LOST 0x00000080 /* Surface lost flag for ddraw. */
struct wined3d_sampler
{