wined3d: Move the texture's target field to the base texture struct.

This commit is contained in:
Henri Verbeet 2010-09-17 11:59:38 +02:00 committed by Alexandre Julliard
parent cdf8d455c2
commit 2e119ecd28
4 changed files with 14 additions and 8 deletions

View File

@ -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;

View File

@ -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. */

View File

@ -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;

View File

@ -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;