[PATCH 3/5] wined3d: Track texture coordinate normalization per-texture.
Henri Verbeet
hverbeet at codeweavers.com
Thu Oct 9 04:50:47 CDT 2014
---
dlls/wined3d/surface.c | 4 +---
dlls/wined3d/swapchain.c | 2 +-
dlls/wined3d/texture.c | 4 ++--
dlls/wined3d/wined3d_private.h | 4 ++--
4 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 8019a11..75f48de 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -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)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 1eb2abb..25e2107 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -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;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 420355b..4f962f1 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -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;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d7e8fb4..25d2406 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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
{
--
1.7.10.4
More information about the wine-patches
mailing list