[PATCH 2/4] wined3d: Directly pass the texture to texture_activate_dimensions().

Henri Verbeet hverbeet at codeweavers.com
Thu Sep 23 14:33:27 CDT 2010


---
 dlls/wined3d/ati_fragment_shader.c   |    2 +-
 dlls/wined3d/nvidia_texture_shader.c |    2 +-
 dlls/wined3d/state.c                 |   10 ++++------
 dlls/wined3d/utils.c                 |   10 ++++------
 dlls/wined3d/wined3d_private.h       |    4 ++--
 5 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c
index 3498718..cf85608 100644
--- a/dlls/wined3d/ati_fragment_shader.c
+++ b/dlls/wined3d/ati_fragment_shader.c
@@ -838,7 +838,7 @@ static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, st
         {
             GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
             checkGLcall("glActiveTextureARB");
-            texture_activate_dimensions(i, stateblock, context);
+            texture_activate_dimensions(stateblock->state.textures[i], gl_info);
         }
     }
 
diff --git a/dlls/wined3d/nvidia_texture_shader.c b/dlls/wined3d/nvidia_texture_shader.c
index 6576e61..0f1bbb1 100644
--- a/dlls/wined3d/nvidia_texture_shader.c
+++ b/dlls/wined3d/nvidia_texture_shader.c
@@ -532,7 +532,7 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
             }
             else
             {
-                texture_activate_dimensions(stage, stateblock, context);
+                texture_activate_dimensions(stateblock->state.textures[stage], gl_info);
             }
         }
     }
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 992638a..1e49d36 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -3146,12 +3146,10 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
         return;
     }
 
-    /* The sampler will also activate the correct texture dimensions, so no need to do it here
-     * if the sampler for this stage is dirty
-     */
-    if(!isStateDirty(context, STATE_SAMPLER(stage))) {
-        if (tex_used) texture_activate_dimensions(stage, stateblock, context);
-    }
+    /* The sampler will also activate the correct texture dimensions, so no
+     * need to do it here if the sampler for this stage is dirty. */
+    if (!isStateDirty(context, STATE_SAMPLER(stage)) && tex_used)
+        texture_activate_dimensions(stateblock->state.textures[stage], gl_info);
 
     set_tex_op(gl_info, &stateblock->state, FALSE, stage,
             stateblock->state.texture_states[stage][WINED3DTSS_COLOROP],
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 01ca1f9..1317abd 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -2979,13 +2979,11 @@ void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *des
  * Requires the caller to activate the correct unit before
  */
 /* GL locking is done by the caller (state handler) */
-void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+void texture_activate_dimensions(IWineD3DBaseTextureImpl *texture, const struct wined3d_gl_info *gl_info)
 {
-    const struct wined3d_gl_info *gl_info = context->gl_info;
-
-    if (stateblock->state.textures[stage])
+    if (texture)
     {
-        switch (stateblock->state.textures[stage]->baseTexture.target)
+        switch (texture->baseTexture.target)
         {
             case GL_TEXTURE_2D:
                 glDisable(GL_TEXTURE_3D);
@@ -3079,7 +3077,7 @@ void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wine
     if (sampler >= stateblock->state.lowest_disabled_stage) return;
     if (isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) return;
 
-    texture_activate_dimensions(sampler, stateblock, context);
+    texture_activate_dimensions(stateblock->state.textures[sampler], context->gl_info);
 }
 
 void *wined3d_rb_alloc(size_t size)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6685412..61cd60d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2646,8 +2646,8 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
         INT texture_idx, DWORD dst) DECLSPEC_HIDDEN;
 void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords,
         BOOL transformed, enum wined3d_format_id coordtype, BOOL ffp_can_disable_proj) DECLSPEC_HIDDEN;
-void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock,
-        struct wined3d_context *context) DECLSPEC_HIDDEN;
+void texture_activate_dimensions(IWineD3DBaseTextureImpl *texture,
+        const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
 void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock,
         struct wined3d_context *context) DECLSPEC_HIDDEN;
 void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock,
-- 
1.7.2.2




More information about the wine-patches mailing list