[4/5] wined3d: Fetch currently active texture unit from the wined3d_context.

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


-------------- next part --------------
From f6102ebcdc87a726a9751e4d9aefbc2a9288a4bf Mon Sep 17 00:00:00 2001
From: Matteo Bruni <mbruni at codeweavers.com>
Date: Tue, 26 Jul 2011 23:01:26 +0200
Subject: wined3d: Fetch currently active texture unit from the wined3d_context.

---
 dlls/wined3d/surface.c |   12 ++----------
 dlls/wined3d/volume.c  |   16 ++--------------
 2 files changed, 4 insertions(+), 24 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 4fef975..4c71c9f 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -594,7 +594,6 @@ static void surface_bind_and_dirtify(struct wined3d_surface *surface,
 {
     struct wined3d_device *device = surface->resource.device;
     DWORD active_sampler;
-    GLint active_texture;
 
     /* We don't need a specific texture unit, but after binding the texture
      * the current unit is dirty. Read the unit back instead of switching to
@@ -604,15 +603,8 @@ static void surface_bind_and_dirtify(struct wined3d_surface *surface,
      * To be more specific, this is tricky because we can implicitly be
      * called from sampler() in state.c. This means we can't touch anything
      * other than whatever happens to be the currently active texture, or we
-     * would risk marking already applied sampler states dirty again.
-     *
-     * TODO: Track the current active texture per GL context instead of using
-     * glGet(). */
-
-    ENTER_GL();
-    glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
-    LEAVE_GL();
-    active_sampler = device->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB];
+     * would risk marking already applied sampler states dirty again. */
+    active_sampler = device->rev_tex_unit_map[context->active_texture];
 
     if (active_sampler != WINED3D_UNMAPPED_STAGE)
         device_invalidate_state(device, STATE_SAMPLER(active_sampler));
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index be1c1b1..d36d6c3 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -37,20 +37,8 @@ static void volume_bind_and_dirtify(const struct wined3d_volume *volume, struct
      * To be more specific, this is tricky because we can implicitly be called
      * from sampler() in state.c. This means we can't touch anything other than
      * whatever happens to be the currently active texture, or we would risk
-     * marking already applied sampler states dirty again.
-     *
-     * TODO: Track the current active texture per GL context instead of using glGet
-     */
-    if (context->gl_info->supported[ARB_MULTITEXTURE])
-    {
-        GLint active_texture;
-        ENTER_GL();
-        glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
-        LEAVE_GL();
-        active_sampler = volume->resource.device->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB];
-    } else {
-        active_sampler = 0;
-    }
+     * marking already applied sampler states dirty again. */
+    active_sampler = volume->resource.device->rev_tex_unit_map[context->active_texture];
 
     if (active_sampler != WINED3D_UNMAPPED_STAGE)
         device_invalidate_state(volume->resource.device, STATE_SAMPLER(active_sampler));
-- 
1.7.3.4


More information about the wine-patches mailing list