[PATCH 1/4] wined3d: Move the texture's target field to the base texture struct.
Henri Verbeet
hverbeet at codeweavers.com
Fri Sep 17 04:59:38 CDT 2010
---
dlls/wined3d/cubetexture.c | 5 ++++-
dlls/wined3d/texture.c | 10 +++++-----
dlls/wined3d/volumetexture.c | 5 ++++-
dlls/wined3d/wined3d_private.h | 2 +-
4 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index 13ec3a8..b64eab7 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -308,9 +308,11 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_BindTexture(IWineD3DCubeTexture *i
static UINT WINAPI IWineD3DCubeTextureImpl_GetTextureDimensions(IWineD3DCubeTexture *iface)
{
+ IWineD3DCubeTextureImpl *texture = (IWineD3DCubeTextureImpl *)iface;
+
TRACE("iface %p.\n", iface);
- return GL_TEXTURE_CUBE_MAP_ARB;
+ return texture->baseTexture.target;
}
static BOOL WINAPI IWineD3DCubeTextureImpl_IsCondNP2(IWineD3DCubeTexture *iface)
@@ -538,6 +540,7 @@ HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UIN
texture->baseTexture.pow2Matrix[15] = 1.0f;
texture->baseTexture.pow2Matrix_identity = FALSE;
}
+ texture->baseTexture.target = GL_TEXTURE_CUBE_MAP_ARB;
/* Generate all the surfaces. */
tmp_w = edge_length;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index a52d7c4..ff57104 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -327,7 +327,7 @@ static UINT WINAPI IWineD3DTextureImpl_GetTextureDimensions(IWineD3DTexture *ifa
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
TRACE("(%p)\n", This);
- return This->target;
+ return This->baseTexture.target;
}
static BOOL WINAPI IWineD3DTextureImpl_IsCondNP2(IWineD3DTexture *iface) {
@@ -556,7 +556,7 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
texture->baseTexture.pow2Matrix[5] = 1.0f;
texture->baseTexture.pow2Matrix[10] = 1.0f;
texture->baseTexture.pow2Matrix[15] = 1.0f;
- texture->target = GL_TEXTURE_2D;
+ texture->baseTexture.target = GL_TEXTURE_2D;
texture->cond_np2 = TRUE;
texture->baseTexture.minMipLookup = minMipLookup_noFilter;
}
@@ -570,7 +570,7 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
texture->baseTexture.pow2Matrix[5] = (float)height;
texture->baseTexture.pow2Matrix[10] = 1.0f;
texture->baseTexture.pow2Matrix[15] = 1.0f;
- texture->target = GL_TEXTURE_RECTANGLE_ARB;
+ texture->baseTexture.target = GL_TEXTURE_RECTANGLE_ARB;
texture->cond_np2 = TRUE;
if(texture->resource.format->Flags & WINED3DFMT_FLAG_FILTERING)
@@ -598,7 +598,7 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
texture->baseTexture.pow2Matrix[10] = 1.0f;
texture->baseTexture.pow2Matrix[15] = 1.0f;
- texture->target = GL_TEXTURE_2D;
+ texture->baseTexture.target = GL_TEXTURE_2D;
texture->cond_np2 = FALSE;
}
TRACE("xf(%f) yf(%f)\n", texture->baseTexture.pow2Matrix[0], texture->baseTexture.pow2Matrix[5]);
@@ -621,7 +621,7 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
}
surface_set_container((IWineD3DSurfaceImpl *)surface, WINED3D_CONTAINER_TEXTURE, (IWineD3DBase *)texture);
- surface_set_texture_target((IWineD3DSurfaceImpl *)surface, texture->target);
+ surface_set_texture_target((IWineD3DSurfaceImpl *)surface, texture->baseTexture.target);
texture->baseTexture.sub_resources[i] = (IWineD3DResourceImpl *)surface;
TRACE("Created surface level %u @ %p.\n", i, surface);
/* Calculate the next mipmap level. */
diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c
index a69ff68..742ac2f 100644
--- a/dlls/wined3d/volumetexture.c
+++ b/dlls/wined3d/volumetexture.c
@@ -244,9 +244,11 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_BindTexture(IWineD3DVolumeTextur
static UINT WINAPI IWineD3DVolumeTextureImpl_GetTextureDimensions(IWineD3DVolumeTexture *iface)
{
+ IWineD3DVolumeTextureImpl *texture = (IWineD3DVolumeTextureImpl *)iface;
+
TRACE("iface %p.\n", iface);
- return GL_TEXTURE_3D;
+ return texture->baseTexture.target;
}
static BOOL WINAPI IWineD3DVolumeTextureImpl_IsCondNP2(IWineD3DVolumeTexture *iface)
@@ -453,6 +455,7 @@ HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT
texture->baseTexture.pow2Matrix[5] = 1.0f;
texture->baseTexture.pow2Matrix[10] = 1.0f;
texture->baseTexture.pow2Matrix[15] = 1.0f;
+ texture->baseTexture.target = GL_TEXTURE_3D;
/* Generate all the surfaces. */
tmp_w = width;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 90082ba..d542de0 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1871,6 +1871,7 @@ typedef struct IWineD3DBaseTextureClass
BOOL pow2Matrix_identity;
const struct min_lookup *minMipLookup;
const GLenum *magLookup;
+ GLenum target;
void (*internal_preload)(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb);
} IWineD3DBaseTextureClass;
@@ -1917,7 +1918,6 @@ typedef struct IWineD3DTextureImpl
IWineD3DBaseTextureClass baseTexture;
/* IWineD3DTexture */
- UINT target;
BOOL cond_np2;
} IWineD3DTextureImpl;
--
1.7.1
More information about the wine-patches
mailing list