[PATCH 2/4] wined3d: Pass an IWineD3DBaseTextureImpl pointer to basetexture_bind().
Henri Verbeet
hverbeet at codeweavers.com
Mon Jan 3 11:51:39 CST 2011
---
dlls/wined3d/basetexture.c | 34 ++++++++++++++++++----------------
dlls/wined3d/cubetexture.c | 2 +-
dlls/wined3d/texture.c | 2 +-
dlls/wined3d/volumetexture.c | 2 +-
dlls/wined3d/wined3d_private.h | 2 +-
5 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c
index 608efc9..241d434 100644
--- a/dlls/wined3d/basetexture.c
+++ b/dlls/wined3d/basetexture.c
@@ -243,23 +243,23 @@ BOOL basetexture_set_dirty(IWineD3DBaseTextureImpl *texture, BOOL dirty)
}
/* Context activation is done by the caller. */
-HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc)
+HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb, BOOL *set_surface_desc)
{
- IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
HRESULT hr = WINED3D_OK;
GLenum textureDimensions;
BOOL isNewTexture = FALSE;
struct gl_texture *gl_tex;
- TRACE("(%p) : About to bind texture\n", This);
- This->baseTexture.is_srgb = srgb; /* SRGB mode cache for PreLoad calls outside drawprim */
- if(srgb) {
- gl_tex = &This->baseTexture.texture_srgb;
- } else {
- gl_tex = &This->baseTexture.texture_rgb;
- }
+ TRACE("texture %p, srgb %#x, set_surface_desc %p.\n", texture, srgb, set_surface_desc);
+
+ texture->baseTexture.is_srgb = srgb; /* SRGB mode cache for PreLoad calls outside drawprim */
+ if (srgb)
+ gl_tex = &texture->baseTexture.texture_srgb;
+ else
+ gl_tex = &texture->baseTexture.texture_rgb;
+
+ textureDimensions = texture->baseTexture.target;
- textureDimensions = This->baseTexture.target;
ENTER_GL();
/* Generate a texture name if we don't already have one */
if (!gl_tex->name)
@@ -268,7 +268,8 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac
glGenTextures(1, &gl_tex->name);
checkGLcall("glGenTextures");
TRACE("Generated texture %d\n", gl_tex->name);
- if (This->resource.pool == WINED3DPOOL_DEFAULT) {
+ if (texture->resource.pool == WINED3DPOOL_DEFAULT)
+ {
/* Tell opengl to try and keep this texture in video ram (well mostly) */
GLclampf tmp;
tmp = 0.9f;
@@ -288,10 +289,11 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac
gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] = 1;
gl_tex->states[WINED3DTEXSTA_SRGBTEXTURE] = 0;
gl_tex->states[WINED3DTEXSTA_SHADOW] = FALSE;
- basetexture_set_dirty(This, TRUE);
+ basetexture_set_dirty(texture, TRUE);
isNewTexture = TRUE;
- if(This->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP) {
+ if (texture->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP)
+ {
/* This means double binding the texture at creation, but keeps the code simpler all
* in all, and the run-time path free from additional checks
*/
@@ -319,9 +321,9 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac
*/
if (textureDimensions != GL_TEXTURE_RECTANGLE_ARB)
{
- TRACE("Setting GL_TEXTURE_MAX_LEVEL to %u.\n", This->baseTexture.level_count - 1);
- glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.level_count - 1);
- checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.level_count)");
+ TRACE("Setting GL_TEXTURE_MAX_LEVEL to %u.\n", texture->baseTexture.level_count - 1);
+ glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, texture->baseTexture.level_count - 1);
+ checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, texture->baseTexture.level_count)");
}
if(textureDimensions==GL_TEXTURE_CUBE_MAP_ARB) {
/* Cubemaps are always set to clamp, regardless of the sampler state. */
diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index e3a0583..70fca05 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -283,7 +283,7 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_BindTexture(IWineD3DCubeTexture *i
TRACE("(%p) : relay to BaseTexture\n", This);
- hr = basetexture_bind((IWineD3DBaseTexture *)iface, srgb, &set_gl_texture_desc);
+ hr = basetexture_bind((IWineD3DBaseTextureImpl *)iface, srgb, &set_gl_texture_desc);
if (set_gl_texture_desc && SUCCEEDED(hr))
{
UINT sub_count = This->baseTexture.level_count * This->baseTexture.layer_count;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 232f105..da0e175 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -274,7 +274,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface, BO
TRACE("(%p) : relay to BaseTexture\n", This);
- hr = basetexture_bind((IWineD3DBaseTexture *)iface, srgb, &set_gl_texture_desc);
+ hr = basetexture_bind((IWineD3DBaseTextureImpl *)iface, srgb, &set_gl_texture_desc);
if (set_gl_texture_desc && SUCCEEDED(hr)) {
UINT i;
struct gl_texture *gl_tex;
diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c
index b2ddce1..23694df 100644
--- a/dlls/wined3d/volumetexture.c
+++ b/dlls/wined3d/volumetexture.c
@@ -237,7 +237,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_BindTexture(IWineD3DVolumeTextur
TRACE("iface %p, srgb %#x.\n", iface, srgb);
- return basetexture_bind((IWineD3DBaseTexture *)iface, srgb, &dummy);
+ return basetexture_bind((IWineD3DBaseTextureImpl *)iface, srgb, &dummy);
}
static BOOL WINAPI IWineD3DVolumeTextureImpl_IsCondNP2(IWineD3DVolumeTexture *iface)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e22cc9f..9eb550e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1912,7 +1912,7 @@ typedef struct IWineD3DBaseTextureImpl
void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1],
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
-HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc) DECLSPEC_HIDDEN;
+HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb, BOOL *set_surface_desc) DECLSPEC_HIDDEN;
void basetexture_cleanup(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;
void basetexture_generate_mipmaps(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;
WINED3DTEXTUREFILTERTYPE basetexture_get_autogen_filter_type(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;
--
1.7.2.2
More information about the wine-patches
mailing list