[6/16] WineD3D: Move WINED3DRS_TEXTUREFACTOR to the state table

Stefan Dösinger stefan at codeweavers.com
Fri Dec 8 11:37:17 CST 2006


-------------- next part --------------
From 9135d58fbe10057c1fc6581e11799e0f641b2037 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Fri, 8 Dec 2006 16:48:41 +0100
Subject: [PATCH] WineD3D: Move WINED3DRS_TEXTUREFACTOR to the state table

---
 dlls/wined3d/device.c |   29 +----------------------------
 dlls/wined3d/state.c  |   30 +++++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6e8203b..1921ad1 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3460,35 +3460,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl
     case WINED3DRS_CLIPPLANEENABLE           :
     case WINED3DRS_CLIPPING                  :
     case WINED3DRS_BLENDOP                   :
-        StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
-        break;
-
     case WINED3DRS_TEXTUREFACTOR             :
-        {
-            unsigned int i;
-
-            /* Note the texture color applies to all textures whereas
-               GL_TEXTURE_ENV_COLOR applies to active only */
-            float col[4];
-            D3DCOLORTOGLFLOAT4(Value, col);
-
-            if (!GL_SUPPORT(NV_REGISTER_COMBINERS)) {
-                /* And now the default texture color as well */
-                for (i = 0; i < GL_LIMITS(texture_stages); i++) {
-                    /* Note the WINED3DRS value applies to all textures, but GL has one
-                       per texture, so apply it now ready to be used!               */
-                    if (GL_SUPPORT(ARB_MULTITEXTURE)) {
-                        GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
-                        checkGLcall("glActiveTextureARB");
-                    } else if (i>0) {
-                        FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
-                    }
-
-                    glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
-                    checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
-                }
-            }
-        }
+        StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
         break;
 
     case WINED3DRS_SPECULARENABLE            :
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 0eaef71..549b120 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -432,6 +432,34 @@ static void state_blendop(DWORD state, I
     checkGLcall("glBlendEquation");
 }
 
+static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock) {
+    unsigned int i;
+
+    /* Note the texture color applies to all textures whereas
+     * GL_TEXTURE_ENV_COLOR applies to active only
+     */
+    float col[4];
+    D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col);
+
+    if (!GL_SUPPORT(NV_REGISTER_COMBINERS)) {
+        /* And now the default texture color as well */
+        for (i = 0; i < GL_LIMITS(texture_stages); i++) {
+            /* Note the WINED3DRS value applies to all textures, but GL has one
+             * per texture, so apply it now ready to be used!
+             */
+            if (GL_SUPPORT(ARB_MULTITEXTURE)) {
+                GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
+                checkGLcall("glActiveTextureARB");
+            } else if (i>0) {
+                FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
+            }
+
+            glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
+            checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
+        }
+    }
+}
+
 const struct StateEntry StateTable[] =
 {
       /* State name                                         representative,                                     apply function */
@@ -495,7 +523,7 @@ const struct StateEntry StateTable[] =
     { /* 57, WINED3DRS_STENCILREF                   */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
     { /* 58, WINED3DRS_STENCILMASK                  */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
     { /* 59, WINED3DRS_STENCILWRITEMASK             */      STATE_RENDER(WINED3DRS_STENCILWRITEMASK),           state_unknown       },
-    { /* 60, WINED3DRS_TEXTUREFACTOR                */      STATE_RENDER(WINED3DRS_TEXTUREFACTOR),              state_unknown       },
+    { /* 60, WINED3DRS_TEXTUREFACTOR                */      STATE_RENDER(WINED3DRS_TEXTUREFACTOR),              state_texfactor     },
     /* A BIG hole. If wanted, 'fixed' states like the vertex type or the bound shaders can be put here */
     { /* 61, Undefined                              */      0,                                                  state_undefined     },
     { /* 62, Undefined                              */      0,                                                  state_undefined     },
-- 
1.4.2.4



More information about the wine-patches mailing list