Stefan Dösinger : wined3d: Move WINED3DRS_BLENDOP to the state table.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Dec 11 07:44:59 CST 2006


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Fri Dec  8 20:21:43 2006 +0100

wined3d: Move WINED3DRS_BLENDOP to the state table.

---

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

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 8fd36f6..86a4252 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3459,31 +3459,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl
     case WINED3DRS_COLORKEYENABLE            :
     case WINED3DRS_CLIPPLANEENABLE           :
     case WINED3DRS_CLIPPING                  :
-        StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
-        break;
-
     case WINED3DRS_BLENDOP                   :
-        {
-            int glParm = GL_FUNC_ADD;
-
-            switch ((WINED3DBLENDOP) Value) {
-            case WINED3DBLENDOP_ADD              : glParm = GL_FUNC_ADD;              break;
-            case WINED3DBLENDOP_SUBTRACT         : glParm = GL_FUNC_SUBTRACT;         break;
-            case WINED3DBLENDOP_REVSUBTRACT      : glParm = GL_FUNC_REVERSE_SUBTRACT; break;
-            case WINED3DBLENDOP_MIN              : glParm = GL_MIN;                   break;
-            case WINED3DBLENDOP_MAX              : glParm = GL_MAX;                   break;
-            default:
-                FIXME("Unrecognized/Unhandled WINED3DBLENDOP value %d\n", Value);
-            }
-
-            if(GL_SUPPORT(EXT_BLEND_MINMAX)) {
-                TRACE("glBlendEquation(%x)\n", glParm);
-                GL_EXTCALL(glBlendEquation(glParm));
-                checkGLcall("glBlendEquation");
-            } else {
-                WARN("Unsupported in local OpenGL implementation: glBlendEquation\n");
-            }
-        }
+        StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
         break;
 
     case WINED3DRS_TEXTUREFACTOR             :
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 01c24ff..0eaef71 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -27,6 +27,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
 
+#define GLINFO_LOCATION ((IWineD3DImpl *)(stateblock->wineD3DDevice->wineD3D))->gl_info
+
 static void state_unknown(DWORD state, IWineD3DStateBlockImpl *stateblock) {
     /* State which does exist, but wined3d doesn't know about */
     if(STATE_IS_RENDER(state)) {
@@ -407,6 +409,29 @@ static void state_clipping(DWORD state,
     }
 }
 
+static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock) {
+    int glParm = GL_FUNC_ADD;
+
+    if(!GL_SUPPORT(EXT_BLEND_MINMAX)) {
+        WARN("Unsupported in local OpenGL implementation: glBlendEquation\n");
+        return;
+    }
+
+    switch ((WINED3DBLENDOP) stateblock->renderState[WINED3DRS_BLENDOP]) {
+        case WINED3DBLENDOP_ADD              : glParm = GL_FUNC_ADD;              break;
+        case WINED3DBLENDOP_SUBTRACT         : glParm = GL_FUNC_SUBTRACT;         break;
+        case WINED3DBLENDOP_REVSUBTRACT      : glParm = GL_FUNC_REVERSE_SUBTRACT; break;
+        case WINED3DBLENDOP_MIN              : glParm = GL_MIN;                   break;
+        case WINED3DBLENDOP_MAX              : glParm = GL_MAX;                   break;
+        default:
+            FIXME("Unrecognized/Unhandled D3DBLENDOP value %d\n", stateblock->renderState[WINED3DRS_BLENDOP]);
+    }
+
+    TRACE("glBlendEquation(%x)\n", glParm);
+    GL_EXTCALL(glBlendEquation(glParm));
+    checkGLcall("glBlendEquation");
+}
+
 const struct StateEntry StateTable[] =
 {
       /* State name                                         representative,                                     apply function */
@@ -583,7 +608,7 @@ const struct StateEntry StateTable[] =
     { /*168, WINED3DRS_COLORWRITEENABLE             */      STATE_RENDER(WINED3DRS_COLORWRITEENABLE),           state_unknown       },
     { /*169, Undefined                              */      0,                                                  state_undefined     },
     { /*170, WINED3DRS_TWEENFACTOR                  */      0,                                                  state_nogl          },
-    { /*171, WINED3DRS_BLENDOP                      */      STATE_RENDER(WINED3DRS_BLENDOP),                    state_unknown       },
+    { /*171, WINED3DRS_BLENDOP                      */      STATE_RENDER(WINED3DRS_BLENDOP),                    state_blendop       },
     { /*172, WINED3DRS_POSITIONDEGREE               */      STATE_RENDER(WINED3DRS_POSITIONDEGREE),             state_unknown       },
     { /*173, WINED3DRS_NORMALDEGREE                 */      STATE_RENDER(WINED3DRS_NORMALDEGREE),               state_unknown       },
       /*172, WINED3DRS_POSITIONORDER                */      /* Value assigned to 2 state names */




More information about the wine-cvs mailing list