[3/4] wined3d: Skip WINED3DTSS_TEXCOORDINDEX state application for stages that aren't mapped to a texture unit

H. Verbeet hverbeet at gmail.com
Wed Jan 3 12:18:51 CST 2007


Changelog:
  - Skip WINED3DTSS_TEXCOORDINDEX state application for stages that
aren't mapped to a texture unit
-------------- next part --------------
---

 dlls/wined3d/state.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 56c234e..dd997b1 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -1499,13 +1499,18 @@ static void transform_texture(DWORD stat
 
 static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock) {
     DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
+    DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
+
+    if (mapped_stage == -1) {
+        TRACE("No texture unit mapped to stage %d. Skipping texture coordinates.\n", stage);
+        return;
+    }
 
     if (GL_SUPPORT(ARB_MULTITEXTURE)) {
-        /* TODO: register combiners! */
         if(stage >= GL_LIMITS(sampler_stages)) {
             return;
         }
-        GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + stateblock->wineD3DDevice->texUnitMap[stage]));
+        GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
         checkGLcall("glActiveTextureARB");
     } else if (stage > 0) {
         /* We can't do anything here */


More information about the wine-patches mailing list