wined3d: Pass gl_info to basetexture_bind().
authorHenri Verbeet <hverbeet@codeweavers.com>
Thu, 3 Mar 2011 08:24:11 +0000 (09:24 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Thu, 3 Mar 2011 16:47:14 +0000 (17:47 +0100)
dlls/wined3d/basetexture.c
dlls/wined3d/cubetexture.c
dlls/wined3d/state.c
dlls/wined3d/surface.c
dlls/wined3d/texture.c
dlls/wined3d/volume.c
dlls/wined3d/volumetexture.c
dlls/wined3d/wined3d_private.h

index 534847fad5402b99d9a39888c3476f55e1d6ac95..e14185b40807e5c4035bdac54395eea5a3b11a96 100644 (file)
@@ -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;
index 2500650ffb8e8f6b0b4fcb59378db7009690eb04..765c11aeb0a574f710677a3af3649610d64bfc4c 100644 (file)
 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;
index 1f9a7fd7713366c1920016ab58afc6b63ba72a3c..daecba2fc80d20526080653bc7716593ba2e0ad8 100644 (file)
@@ -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);
 
index 30e1d647e26452944b0f48dd4e38f9854ea3d843..7f0a42c72c0aba8ce2413780ae3276306bcbe52f 100644 (file)
@@ -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
     {
index 0491a8ec5b9f646a1556c34f8606b05040e8d3b8..8f98739c77f565a688fdaf48daba655d71faa3c8 100644 (file)
 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;
index e877cfb709640ed284c58d41f8eb5de7bb741c1e..03bc5e667a862f67f7067e7a9ac031caf84eb9fb 100644 (file)
@@ -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)
index 2ac609136752ac47f2be86d824e334e173ec6e22..e24ff7996117c4e12290624208ac56dac0bba7cd 100644 (file)
 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. */
index cb619a5016fe022756a646f35441e57e7894e826..709ffc55a4d322a7849fd24556adc03cbeb90f81 100644 (file)
@@ -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;