[2/5] wined3d: Pass around the context instead of gl_info.

Matteo Bruni matteo.mystral at gmail.com
Tue Aug 23 16:58:00 CDT 2011


-------------- next part --------------
From 1e2c3e677d7c1196e7600fa1e695c0759eb733dc Mon Sep 17 00:00:00 2001
From: Matteo Bruni <mbruni at codeweavers.com>
Date: Wed, 27 Jul 2011 23:21:25 +0200
Subject: wined3d: Pass around the context instead of gl_info.

---
 dlls/wined3d/arb_program_shader.c |    5 ++-
 dlls/wined3d/context.c            |    8 +++---
 dlls/wined3d/device.c             |    4 +-
 dlls/wined3d/state.c              |    2 +-
 dlls/wined3d/surface.c            |   54 ++++++++++++++++++------------------
 dlls/wined3d/swapchain.c          |    2 +-
 dlls/wined3d/texture.c            |   28 +++++++++---------
 dlls/wined3d/volume.c             |   16 +++++-----
 dlls/wined3d/wined3d_private.h    |   10 +++---
 9 files changed, 65 insertions(+), 64 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 1d5b0c4..07da3dd 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -7064,13 +7064,14 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_
 }
 
 /* Context activation is done by the caller. */
-static HRESULT arbfp_blit_set(void *blit_priv, const struct wined3d_gl_info *gl_info, struct wined3d_surface *surface)
+static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context, struct wined3d_surface *surface)
 {
     GLenum shader;
     float size[4] = {(float) surface->pow2Width, (float) surface->pow2Height, 1.0f, 1.0f};
     struct arbfp_blit_priv *priv = blit_priv;
     enum complex_fixup fixup;
     GLenum textype = surface->texture_target;
+    const struct wined3d_gl_info *gl_info = context->gl_info;
 
     if (!is_complex_fixup(surface->resource.format->color_fixup))
     {
@@ -7228,7 +7229,7 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
     if (!surface_is_offscreen(dst_surface))
         surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect);
 
-    arbfp_blit_set(device->blit_priv, context->gl_info, src_surface);
+    arbfp_blit_set(device->blit_priv, context, src_surface);
 
     ENTER_GL();
 
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 42d26bc..cfdc5e6 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -112,7 +112,7 @@ static void context_destroy_fbo(struct wined3d_context *context, GLuint *fbo)
 }
 
 /* GL locking is done by the caller */
-static void context_attach_depth_stencil_fbo(const struct wined3d_context *context,
+static void context_attach_depth_stencil_fbo(struct wined3d_context *context,
         GLenum fbo_target, struct wined3d_surface *depth_stencil)
 {
     const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -141,7 +141,7 @@ static void context_attach_depth_stencil_fbo(const struct wined3d_context *conte
         }
         else
         {
-            surface_prepare_texture(depth_stencil, gl_info, FALSE);
+            surface_prepare_texture(depth_stencil, context, FALSE);
 
             if (format_flags & WINED3DFMT_FLAG_DEPTH)
             {
@@ -183,7 +183,7 @@ static void context_attach_depth_stencil_fbo(const struct wined3d_context *conte
 }
 
 /* GL locking is done by the caller */
-static void context_attach_surface_fbo(const struct wined3d_context *context,
+static void context_attach_surface_fbo(struct wined3d_context *context,
         GLenum fbo_target, DWORD idx, struct wined3d_surface *surface, DWORD location)
 {
     const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -199,7 +199,7 @@ static void context_attach_surface_fbo(const struct wined3d_context *context,
             case SFLAG_INTEXTURE:
             case SFLAG_INSRGBTEX:
                 srgb = location == SFLAG_INSRGBTEX;
-                surface_prepare_texture(surface, gl_info, srgb);
+                surface_prepare_texture(surface, context, srgb);
                 gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_COLOR_ATTACHMENT0 + idx,
                         surface->texture_target, surface_get_texture_name(surface, gl_info, srgb),
                         surface->texture_level);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 3a3692b..a7e6890 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4841,10 +4841,10 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
      * the texture wouldn't be the current location, and we'd upload zeroes
      * just to overwrite them again. */
     if (update_w == dst_w && update_h == dst_h)
-        surface_prepare_texture(dst_surface, gl_info, FALSE);
+        surface_prepare_texture(dst_surface, context, FALSE);
     else
         surface_load_location(dst_surface, SFLAG_INTEXTURE, NULL);
-    surface_bind(dst_surface, gl_info, FALSE);
+    surface_bind(dst_surface, context, FALSE);
 
     data.buffer_object = 0;
     data.addr = src_surface->resource.allocatedMemory;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index b3c1270..db77bc3 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -3546,7 +3546,7 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state
         struct wined3d_texture *texture = state->textures[sampler];
         BOOL srgb = state->sampler_states[sampler][WINED3DSAMP_SRGBTEXTURE];
 
-        texture->texture_ops->texture_bind(texture, gl_info, srgb);
+        texture->texture_ops->texture_bind(texture, context, srgb);
         wined3d_texture_apply_state_changes(texture, state->sampler_states[sampler], gl_info);
 
         if (gl_info->supported[EXT_TEXTURE_LOD_BIAS])
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 1d0d31e..7708a24 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -590,7 +590,7 @@ static void surface_evict_sysmem(struct wined3d_surface *surface)
 
 /* Context activation is done by the caller. */
 static void surface_bind_and_dirtify(struct wined3d_surface *surface,
-        const struct wined3d_gl_info *gl_info, BOOL srgb)
+        struct wined3d_context *context, BOOL srgb)
 {
     struct wined3d_device *device = surface->resource.device;
     DWORD active_sampler;
@@ -616,7 +616,7 @@ static void surface_bind_and_dirtify(struct wined3d_surface *surface,
 
     if (active_sampler != WINED3D_UNMAPPED_STAGE)
         device_invalidate_state(device, STATE_SAMPLER(active_sampler));
-    surface_bind(surface, gl_info, srgb);
+    surface_bind(surface, context, srgb);
 }
 
 static void surface_force_reload(struct wined3d_surface *surface)
@@ -632,13 +632,13 @@ static void surface_release_client_storage(struct wined3d_surface *surface)
     glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
     if (surface->texture_name)
     {
-        surface_bind_and_dirtify(surface, context->gl_info, FALSE);
+        surface_bind_and_dirtify(surface, context, FALSE);
         glTexImage2D(surface->texture_target, surface->texture_level,
                 GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
     }
     if (surface->texture_name_srgb)
     {
-        surface_bind_and_dirtify(surface, context->gl_info, TRUE);
+        surface_bind_and_dirtify(surface, context, TRUE);
         glTexImage2D(surface->texture_target, surface->texture_level,
                 GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
     }
@@ -2222,16 +2222,16 @@ void surface_set_texture_target(struct wined3d_surface *surface, GLenum target)
 }
 
 /* Context activation is done by the caller. */
-void surface_bind(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL srgb)
+void surface_bind(struct wined3d_surface *surface, struct wined3d_context *context, BOOL srgb)
 {
-    TRACE("surface %p, gl_info %p, srgb %#x.\n", surface, gl_info, srgb);
+    TRACE("surface %p, context %p, srgb %#x.\n", surface, context, srgb);
 
     if (surface->container.type == WINED3D_CONTAINER_TEXTURE)
     {
         struct wined3d_texture *texture = surface->container.u.texture;
 
         TRACE("Passing to container (%p).\n", texture);
-        texture->texture_ops->texture_bind(texture, gl_info, srgb);
+        texture->texture_ops->texture_bind(texture, context, srgb);
     }
     else
     {
@@ -4202,8 +4202,8 @@ static void read_from_framebuffer_texture(struct wined3d_surface *surface, BOOL
     gl_info = context->gl_info;
     device_invalidate_state(device, STATE_FRAMEBUFFER);
 
-    surface_prepare_texture(surface, gl_info, srgb);
-    surface_bind_and_dirtify(surface, gl_info, srgb);
+    surface_prepare_texture(surface, context, srgb);
+    surface_bind_and_dirtify(surface, context, srgb);
 
     TRACE("Reading back offscreen render target %p.\n", surface);
 
@@ -4223,7 +4223,7 @@ static void read_from_framebuffer_texture(struct wined3d_surface *surface, BOOL
 
 /* Context activation is done by the caller. */
 static void surface_prepare_texture_internal(struct wined3d_surface *surface,
-        const struct wined3d_gl_info *gl_info, BOOL srgb)
+        struct wined3d_context *context, BOOL srgb)
 {
     DWORD alloc_flag = srgb ? SFLAG_SRGBALLOCATED : SFLAG_ALLOCATED;
     CONVERT_TYPES convert;
@@ -4235,13 +4235,13 @@ static void surface_prepare_texture_internal(struct wined3d_surface *surface,
     if (convert != NO_CONVERSION || format.convert) surface->flags |= SFLAG_CONVERTED;
     else surface->flags &= ~SFLAG_CONVERTED;
 
-    surface_bind_and_dirtify(surface, gl_info, srgb);
-    surface_allocate_surface(surface, gl_info, &format, srgb);
+    surface_bind_and_dirtify(surface, context, srgb);
+    surface_allocate_surface(surface, context->gl_info, &format, srgb);
     surface->flags |= alloc_flag;
 }
 
 /* Context activation is done by the caller. */
-void surface_prepare_texture(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL srgb)
+void surface_prepare_texture(struct wined3d_surface *surface, struct wined3d_context *context, BOOL srgb)
 {
     if (surface->container.type == WINED3D_CONTAINER_TEXTURE)
     {
@@ -4254,13 +4254,13 @@ void surface_prepare_texture(struct wined3d_surface *surface, const struct wined
         for (i = 0; i < sub_count; ++i)
         {
             struct wined3d_surface *s = surface_from_resource(texture->sub_resources[i]);
-            surface_prepare_texture_internal(s, gl_info, srgb);
+            surface_prepare_texture_internal(s, context, srgb);
         }
 
         return;
     }
 
-    surface_prepare_texture_internal(surface, gl_info, srgb);
+    surface_prepare_texture_internal(surface, context, srgb);
 }
 
 static void flush_to_framebuffer_drawpixels(struct wined3d_surface *surface,
@@ -5230,7 +5230,7 @@ static void surface_blt_to_drawable(struct wined3d_device *device,
     if (!surface_is_offscreen(dst_surface))
         surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect);
 
-    device->blitter->set_shader(device->blit_priv, context->gl_info, src_surface);
+    device->blitter->set_shader(device->blit_priv, context, src_surface);
 
     ENTER_GL();
 
@@ -5577,10 +5577,11 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(struct wined3d_surface *dst_surfa
 }
 
 /* GL locking is done by the caller */
-static void surface_depth_blt(const struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info,
+static void surface_depth_blt(const struct wined3d_surface *surface, struct wined3d_context *context,
         GLuint texture, GLint x, GLint y, GLsizei w, GLsizei h, GLenum target)
 {
     struct wined3d_device *device = surface->resource.device;
+    const struct wined3d_gl_info *gl_info = context->gl_info;
     GLint compare_mode = GL_NONE;
     struct blt_info info;
     GLint old_binding = 0;
@@ -5650,7 +5651,6 @@ void surface_modify_ds_location(struct wined3d_surface *surface,
 void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location)
 {
     struct wined3d_device *device = surface->resource.device;
-    const struct wined3d_gl_info *gl_info = context->gl_info;
     GLsizei w, h;
 
     TRACE("surface %p, new location %#x.\n", surface, location);
@@ -5756,7 +5756,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
         glReadBuffer(GL_NONE);
 
         /* Do the actual blit */
-        surface_depth_blt(surface, gl_info, device->depth_blt_texture, 0, 0, w, h, bind_target);
+        surface_depth_blt(surface, context, device->depth_blt_texture, 0, 0, w, h, bind_target);
         checkGLcall("depth_blt");
 
         context_invalidate_state(context, STATE_FRAMEBUFFER);
@@ -5773,7 +5773,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
 
         context_apply_fbo_state_blit(context, GL_FRAMEBUFFER,
                 context->swapchain->front_buffer, NULL, SFLAG_INDRAWABLE);
-        surface_depth_blt(surface, gl_info, surface->texture_name,
+        surface_depth_blt(surface, context, surface->texture_name,
                 0, surface->pow2Height - h, w, h, surface->texture_target);
         checkGLcall("depth_blt");
 
@@ -5894,7 +5894,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface,
         /* TODO: Use already acquired context when possible. */
         context = context_acquire(device, NULL);
 
-        surface_bind_and_dirtify(surface, gl_info, !(surface->flags & SFLAG_INTEXTURE));
+        surface_bind_and_dirtify(surface, context, !(surface->flags & SFLAG_INTEXTURE));
         surface_download_data(surface, gl_info);
 
         context_release(context);
@@ -6069,8 +6069,8 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
     /* TODO: Use already acquired context when possible. */
     context = context_acquire(device, NULL);
 
-    surface_prepare_texture(surface, gl_info, srgb);
-    surface_bind_and_dirtify(surface, gl_info, srgb);
+    surface_prepare_texture(surface, context, srgb);
+    surface_bind_and_dirtify(surface, context, srgb);
 
     if (surface->CKeyFlags & WINEDDSD_CKSRCBLT)
     {
@@ -6289,15 +6289,15 @@ static void ffp_blit_p8_upload_palette(const struct wined3d_surface *surface, co
 }
 
 /* Context activation is done by the caller. */
-static HRESULT ffp_blit_set(void *blit_priv, const struct wined3d_gl_info *gl_info, struct wined3d_surface *surface)
+static HRESULT ffp_blit_set(void *blit_priv, struct wined3d_context *context, struct wined3d_surface *surface)
 {
     enum complex_fixup fixup = get_complex_fixup(surface->resource.format->color_fixup);
 
     /* When EXT_PALETTED_TEXTURE is around, palette conversion is done by the GPU
      * else the surface is converted in software at upload time in LoadLocation.
      */
-    if(fixup == COMPLEX_FIXUP_P8 && gl_info->supported[EXT_PALETTED_TEXTURE])
-        ffp_blit_p8_upload_palette(surface, gl_info);
+    if(fixup == COMPLEX_FIXUP_P8 && context->gl_info->supported[EXT_PALETTED_TEXTURE])
+        ffp_blit_p8_upload_palette(surface, context->gl_info);
 
     ENTER_GL();
     glEnable(surface->texture_target);
@@ -6438,7 +6438,7 @@ static void cpu_blit_free(struct wined3d_device *device)
 }
 
 /* Context activation is done by the caller. */
-static HRESULT cpu_blit_set(void *blit_priv, const struct wined3d_gl_info *gl_info, struct wined3d_surface *surface)
+static HRESULT cpu_blit_set(void *blit_priv, struct wined3d_context *context, struct wined3d_surface *surface)
 {
     return WINED3D_OK;
 }
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 20c2323..adcf7de 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -354,7 +354,7 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
 
         /* Set up the texture. The surface is not in a wined3d_texture
          * container, so there are no D3D texture settings to dirtify. */
-        device->blitter->set_shader(device->blit_priv, context2->gl_info, backbuffer);
+        device->blitter->set_shader(device->blit_priv, context2, backbuffer);
         glTexParameteri(backbuffer->texture_target, GL_TEXTURE_MIN_FILTER, gl_filter);
         glTexParameteri(backbuffer->texture_target, GL_TEXTURE_MAG_FILTER, gl_filter);
 
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 48d64c7..dfb2f77 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -133,14 +133,14 @@ void wined3d_texture_set_dirty(struct wined3d_texture *texture, BOOL dirty)
 
 /* Context activation is done by the caller. */
 static HRESULT wined3d_texture_bind(struct wined3d_texture *texture,
-        const struct wined3d_gl_info *gl_info, BOOL srgb, BOOL *set_surface_desc)
+        struct wined3d_context *context, BOOL srgb, BOOL *set_surface_desc)
 {
     struct gl_texture *gl_tex;
     BOOL new_texture = FALSE;
     HRESULT hr = WINED3D_OK;
     GLenum target;
 
-    TRACE("texture %p, srgb %#x, set_surface_desc %p.\n", texture, srgb, set_surface_desc);
+    TRACE("texture %p, context %p, srgb %#x, set_surface_desc %p.\n", texture, context, srgb, set_surface_desc);
 
     /* sRGB mode cache for preload() calls outside drawprim. */
     if (srgb)
@@ -148,7 +148,7 @@ static HRESULT wined3d_texture_bind(struct wined3d_texture *texture,
     else
         texture->flags &= ~WINED3D_TEXTURE_IS_SRGB;
 
-    gl_tex = wined3d_texture_get_gl_texture(texture, gl_info, srgb);
+    gl_tex = wined3d_texture_get_gl_texture(texture, context->gl_info, srgb);
     target = texture->target;
 
     ENTER_GL();
@@ -176,7 +176,7 @@ static HRESULT wined3d_texture_bind(struct wined3d_texture *texture,
         gl_tex->states[WINED3DTEXSTA_MIPFILTER] = WINED3DTEXF_LINEAR; /* GL_NEAREST_MIPMAP_LINEAR */
         gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL] = 0;
         gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] = 1;
-        if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
+        if (context->gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
             gl_tex->states[WINED3DTEXSTA_SRGBTEXTURE] = TRUE;
         else
             gl_tex->states[WINED3DTEXSTA_SRGBTEXTURE] = srgb;
@@ -590,23 +590,23 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
 
 /* Context activation is done by the caller. */
 static HRESULT texture2d_bind(struct wined3d_texture *texture,
-        const struct wined3d_gl_info *gl_info, BOOL srgb)
+        struct wined3d_context *context, BOOL srgb)
 {
     BOOL set_gl_texture_desc;
     HRESULT hr;
 
-    TRACE("texture %p, gl_info %p, srgb %#x.\n", texture, gl_info, srgb);
+    TRACE("texture %p, context %p, srgb %#x.\n", texture, context, srgb);
 
-    hr = wined3d_texture_bind(texture, gl_info, srgb, &set_gl_texture_desc);
+    hr = wined3d_texture_bind(texture, context, srgb, &set_gl_texture_desc);
     if (set_gl_texture_desc && SUCCEEDED(hr))
     {
         UINT sub_count = texture->level_count * texture->layer_count;
-        BOOL srgb_tex = !gl_info->supported[EXT_TEXTURE_SRGB_DECODE]
+        BOOL srgb_tex = !context->gl_info->supported[EXT_TEXTURE_SRGB_DECODE]
                 && (texture->flags & WINED3D_TEXTURE_IS_SRGB);
         struct gl_texture *gl_tex;
         UINT i;
 
-        gl_tex = wined3d_texture_get_gl_texture(texture, gl_info, srgb_tex);
+        gl_tex = wined3d_texture_get_gl_texture(texture, context->gl_info, srgb_tex);
 
         for (i = 0; i < sub_count; ++i)
         {
@@ -1055,13 +1055,13 @@ static HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT he
 
 /* Context activation is done by the caller. */
 static HRESULT texture3d_bind(struct wined3d_texture *texture,
-        const struct wined3d_gl_info *gl_info, BOOL srgb)
+        struct wined3d_context *context, BOOL srgb)
 {
     BOOL dummy;
 
-    TRACE("texture %p, gl_info %p, srgb %#x.\n", texture, gl_info, srgb);
+    TRACE("texture %p, context %p, srgb %#x.\n", texture, context, srgb);
 
-    return wined3d_texture_bind(texture, gl_info, srgb, &dummy);
+    return wined3d_texture_bind(texture, context, srgb, &dummy);
 }
 
 /* Do not call while under the GL lock. */
@@ -1097,7 +1097,7 @@ static void texture3d_preload(struct wined3d_texture *texture, enum WINED3DSRGB
     {
         for (i = 0; i < texture->level_count; ++i)
         {
-            volume_load(volume_from_resource(texture->sub_resources[i]), i,
+            volume_load(volume_from_resource(texture->sub_resources[i]), context, i,
                     texture->flags & WINED3D_TEXTURE_IS_SRGB);
         }
     }
@@ -1107,7 +1107,7 @@ static void texture3d_preload(struct wined3d_texture *texture, enum WINED3DSRGB
         {
             struct wined3d_volume *volume = volume_from_resource(texture->sub_resources[i]);
             volume_add_dirty_box(volume, NULL);
-            volume_load(volume, i, texture->flags & WINED3D_TEXTURE_IS_SRGB);
+            volume_load(volume, context, i, texture->flags & WINED3D_TEXTURE_IS_SRGB);
         }
     }
     else
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index e7fdce8..be1c1b1 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -25,7 +25,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
 
 /* Context activation is done by the caller. */
-static void volume_bind_and_dirtify(const struct wined3d_volume *volume, const struct wined3d_gl_info *gl_info)
+static void volume_bind_and_dirtify(const struct wined3d_volume *volume, struct wined3d_context *context)
 {
     struct wined3d_texture *container = volume->container;
     DWORD active_sampler;
@@ -41,7 +41,7 @@ static void volume_bind_and_dirtify(const struct wined3d_volume *volume, const s
      *
      * TODO: Track the current active texture per GL context instead of using glGet
      */
-    if (gl_info->supported[ARB_MULTITEXTURE])
+    if (context->gl_info->supported[ARB_MULTITEXTURE])
     {
         GLint active_texture;
         ENTER_GL();
@@ -55,7 +55,7 @@ static void volume_bind_and_dirtify(const struct wined3d_volume *volume, const s
     if (active_sampler != WINED3D_UNMAPPED_STAGE)
         device_invalidate_state(volume->resource.device, STATE_SAMPLER(active_sampler));
 
-    container->texture_ops->texture_bind(container, gl_info, FALSE);
+    container->texture_ops->texture_bind(container, context, FALSE);
 }
 
 void volume_add_dirty_box(struct wined3d_volume *volume, const WINED3DBOX *dirty_box)
@@ -89,15 +89,15 @@ void volume_set_container(struct wined3d_volume *volume, struct wined3d_texture
 }
 
 /* Context activation is done by the caller. */
-void volume_load(const struct wined3d_volume *volume, UINT level, BOOL srgb_mode)
+void volume_load(const struct wined3d_volume *volume, struct wined3d_context *context, UINT level, BOOL srgb_mode)
 {
-    const struct wined3d_gl_info *gl_info = &volume->resource.device->adapter->gl_info;
+    const struct wined3d_gl_info *gl_info = context->gl_info;
     const struct wined3d_format *format = volume->resource.format;
 
-    TRACE("volume %p, level %u, srgb %#x, format %s (%#x).\n",
-            volume, level, srgb_mode, debug_d3dformat(format->id), format->id);
+    TRACE("volume %p, context %p, level %u, srgb %#x, format %s (%#x).\n",
+            volume, context, level, srgb_mode, debug_d3dformat(format->id), format->id);
 
-    volume_bind_and_dirtify(volume, gl_info);
+    volume_bind_and_dirtify(volume, context);
 
     ENTER_GL();
     GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, level, format->glInternal,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 754d49e..f143ca7 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1198,7 +1198,7 @@ struct blit_shader
 {
     HRESULT (*alloc_private)(struct wined3d_device *device);
     void (*free_private)(struct wined3d_device *device);
-    HRESULT (*set_shader)(void *blit_priv, const struct wined3d_gl_info *gl_info, struct wined3d_surface *surface);
+    HRESULT (*set_shader)(void *blit_priv, struct wined3d_context *context, struct wined3d_surface *surface);
     void (*unset_shader)(const struct wined3d_gl_info *gl_info);
     BOOL (*blit_supported)(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op,
             const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format,
@@ -1853,7 +1853,7 @@ struct gl_texture
 struct wined3d_texture_ops
 {
     HRESULT (*texture_bind)(struct wined3d_texture *texture,
-            const struct wined3d_gl_info *gl_info, BOOL srgb);
+            struct wined3d_context *context, BOOL srgb);
     void (*texture_preload)(struct wined3d_texture *texture, enum WINED3DSRGB srgb);
     void (*texture_sub_resource_add_dirty_region)(struct wined3d_resource *sub_resource,
             const WINED3DBOX *dirty_region);
@@ -1917,7 +1917,7 @@ static inline struct wined3d_volume *volume_from_resource(struct wined3d_resourc
 }
 
 void volume_add_dirty_box(struct wined3d_volume *volume, const WINED3DBOX *dirty_box) DECLSPEC_HIDDEN;
-void volume_load(const struct wined3d_volume *volume, UINT level, BOOL srgb_mode) DECLSPEC_HIDDEN;
+void volume_load(const struct wined3d_volume *volume, struct wined3d_context *context, UINT level, BOOL srgb_mode) DECLSPEC_HIDDEN;
 void volume_set_container(struct wined3d_volume *volume, struct wined3d_texture *container) DECLSPEC_HIDDEN;
 
 /*****************************************************************************
@@ -2060,7 +2060,7 @@ static inline GLuint surface_get_texture_name(const struct wined3d_surface *surf
 }
 
 void surface_add_dirty_rect(struct wined3d_surface *surface, const WINED3DBOX *dirty_rect) DECLSPEC_HIDDEN;
-void surface_bind(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL srgb) DECLSPEC_HIDDEN;
+void surface_bind(struct wined3d_surface *surface, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
 HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN;
 GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 BOOL surface_init_sysmem(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
@@ -2073,7 +2073,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location, c
 void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN;
 void surface_modify_location(struct wined3d_surface *surface, DWORD location, BOOL persistent) DECLSPEC_HIDDEN;
 void surface_prepare_texture(struct wined3d_surface *surface,
-        const struct wined3d_gl_info *gl_info, BOOL srgb) DECLSPEC_HIDDEN;
+        struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
 void surface_set_compatible_renderbuffer(struct wined3d_surface *surface,
         const struct wined3d_surface *rt) DECLSPEC_HIDDEN;
 void surface_set_container(struct wined3d_surface *surface,
-- 
1.7.3.4


More information about the wine-patches mailing list