Matteo Bruni : wined3d: Fetch currently active texture unit from the wined3d_context.

Alexandre Julliard julliard at winehq.org
Thu Aug 25 13:00:14 CDT 2011


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

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Tue Jul 26 23:01:26 2011 +0200

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 5db7ed8..75e39fc 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));




More information about the wine-cvs mailing list