Henri Verbeet : wined3d: Pass gl_info to basetexture_bind().

Alexandre Julliard julliard at winehq.org
Thu Mar 3 11:46:22 CST 2011


Module: wine
Branch: master
Commit: af0a4b6956b0c9cb44a0c00b479c9cb892b64e6d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=af0a4b6956b0c9cb44a0c00b479c9cb892b64e6d

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Mar  3 09:24:11 2011 +0100

wined3d: Pass gl_info to basetexture_bind().

---

 dlls/wined3d/basetexture.c     |    4 ++--
 dlls/wined3d/cubetexture.c     |    8 ++++----
 dlls/wined3d/state.c           |    2 +-
 dlls/wined3d/surface.c         |    3 ++-
 dlls/wined3d/texture.c         |    8 ++++----
 dlls/wined3d/volume.c          |    2 +-
 dlls/wined3d/volumetexture.c   |    7 ++++---
 dlls/wined3d/wined3d_private.h |    6 ++++--
 8 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c
index 534847f..e14185b 100644
--- a/dlls/wined3d/basetexture.c
+++ b/dlls/wined3d/basetexture.c
@@ -238,9 +238,9 @@ void basetexture_set_dirty(IWineD3DBaseTextureImpl *texture, BOOL dirty)
 }
 
 /* Context activation is done by the caller. */
-HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb, BOOL *set_surface_desc)
+HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture,
+        const struct wined3d_gl_info *gl_info, BOOL srgb, BOOL *set_surface_desc)
 {
-    const struct wined3d_gl_info *gl_info = &texture->resource.device->adapter->gl_info;
     HRESULT hr = WINED3D_OK;
     GLenum textureDimensions;
     BOOL isNewTexture = FALSE;
diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index 2500650..765c11a 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -28,18 +28,18 @@
 WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
 
 /* Context activation is done by the caller. */
-static HRESULT cubetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb)
+static HRESULT cubetexture_bind(IWineD3DBaseTextureImpl *texture,
+        const struct wined3d_gl_info *gl_info, BOOL srgb)
 {
     BOOL set_gl_texture_desc;
     HRESULT hr;
 
-    TRACE("texture %p, srgb %#x.\n", texture, srgb);
+    TRACE("texture %p, gl_info %p, srgb %#x.\n", texture, gl_info, srgb);
 
-    hr = basetexture_bind(texture, srgb, &set_gl_texture_desc);
+    hr = basetexture_bind(texture, gl_info, srgb, &set_gl_texture_desc);
     if (set_gl_texture_desc && SUCCEEDED(hr))
     {
         UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count;
-        const struct wined3d_gl_info *gl_info = &texture->resource.device->adapter->gl_info;
         BOOL srgb_tex = !gl_info->supported[EXT_TEXTURE_SRGB_DECODE] && texture->baseTexture.is_srgb;
         GLuint name = srgb_tex ? texture->baseTexture.texture_srgb.name : texture->baseTexture.texture_rgb.name;
         UINT i;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 1f9a7fd..daecba2 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -3646,7 +3646,7 @@ static void sampler(DWORD state_id, struct wined3d_stateblock *stateblock, struc
         IWineD3DBaseTextureImpl *texture = state->textures[sampler];
         BOOL srgb = state->sampler_states[sampler][WINED3DSAMP_SRGBTEXTURE];
 
-        texture->baseTexture.texture_ops->texture_bind(texture, srgb);
+        texture->baseTexture.texture_ops->texture_bind(texture, gl_info, srgb);
         basetexture_apply_state_changes(texture,
                 state->sampler_states[sampler], gl_info);
 
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 30e1d64..7f0a42c 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -701,9 +701,10 @@ void surface_bind(IWineD3DSurfaceImpl *surface, BOOL srgb)
     if (surface->container.type == WINED3D_CONTAINER_TEXTURE)
     {
         IWineD3DBaseTextureImpl *texture = surface->container.u.texture;
+        const struct wined3d_gl_info *gl_info = &texture->resource.device->adapter->gl_info;
 
         TRACE("Passing to container (%p).\n", texture);
-        texture->baseTexture.texture_ops->texture_bind(texture, srgb);
+        texture->baseTexture.texture_ops->texture_bind(texture, gl_info, srgb);
     }
     else
     {
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 0491a8e..8f98739 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -28,17 +28,17 @@
 WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
 
 /* Context activation is done by the caller. */
-static HRESULT texture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb)
+static HRESULT texture_bind(IWineD3DBaseTextureImpl *texture,
+        const struct wined3d_gl_info *gl_info, BOOL srgb)
 {
     BOOL set_gl_texture_desc;
     HRESULT hr;
 
-    TRACE("texture %p, srgb %#x.\n", texture, srgb);
+    TRACE("texture %p, gl_info %p, srgb %#x.\n", texture, gl_info, srgb);
 
-    hr = basetexture_bind(texture, srgb, &set_gl_texture_desc);
+    hr = basetexture_bind(texture, gl_info, srgb, &set_gl_texture_desc);
     if (set_gl_texture_desc && SUCCEEDED(hr))
     {
-        const struct wined3d_gl_info *gl_info = &texture->resource.device->adapter->gl_info;
         BOOL srgb_tex = !gl_info->supported[EXT_TEXTURE_SRGB_DECODE] && texture->baseTexture.is_srgb;
         struct gl_texture *gl_tex;
         UINT i;
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index e877cfb..03bc5e6 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -60,7 +60,7 @@ static void volume_bind_and_dirtify(struct IWineD3DVolumeImpl *volume)
         IWineD3DDeviceImpl_MarkStateDirty(volume->resource.device, STATE_SAMPLER(active_sampler));
     }
 
-    container->baseTexture.texture_ops->texture_bind(container, FALSE);
+    container->baseTexture.texture_ops->texture_bind(container, gl_info, FALSE);
 }
 
 void volume_add_dirty_box(struct IWineD3DVolumeImpl *volume, const WINED3DBOX *dirty_box)
diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c
index 2ac6091..e24ff79 100644
--- a/dlls/wined3d/volumetexture.c
+++ b/dlls/wined3d/volumetexture.c
@@ -27,13 +27,14 @@
 WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
 
 /* Context activation is done by the caller. */
-static HRESULT volumetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb)
+static HRESULT volumetexture_bind(IWineD3DBaseTextureImpl *texture,
+        const struct wined3d_gl_info *gl_info, BOOL srgb)
 {
     BOOL dummy;
 
-    TRACE("texture %p, srgb %#x.\n", texture, srgb);
+    TRACE("texture %p, gl_info %p, srgb %#x.\n", texture, gl_info, srgb);
 
-    return basetexture_bind(texture, srgb, &dummy);
+    return basetexture_bind(texture, gl_info, srgb, &dummy);
 }
 
 /* Do not call while under the GL lock. */
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index cb619a5..709ffc5 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1871,7 +1871,8 @@ struct gl_texture
 
 struct wined3d_texture_ops
 {
-    HRESULT (*texture_bind)(struct IWineD3DBaseTextureImpl *texture, BOOL srgb);
+    HRESULT (*texture_bind)(struct IWineD3DBaseTextureImpl *texture,
+            const struct wined3d_gl_info *gl_info, BOOL srgb);
     void (*texture_preload)(struct IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb);
 };
 
@@ -1919,7 +1920,8 @@ static inline struct gl_texture *basetexture_get_gl_texture(IWineD3DBaseTextureI
 void basetexture_apply_state_changes(IWineD3DBaseTextureImpl *texture,
         const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1],
         const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
-HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb, BOOL *set_surface_desc) DECLSPEC_HIDDEN;
+HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture,
+        const struct wined3d_gl_info *gl_info, 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;




More information about the wine-cvs mailing list