[1/4] wined3d: Don't set Parm when isDiffuseSupplied is FALSE in state_colormat(), it isn't used anyway

H. Verbeet hverbeet at gmail.com
Wed Jan 17 14:41:21 CST 2007


Also set Parm to 0 by default, since it's not a valid material
property value and it makes the next patch slightly easier.

Changelog:
  - Don't set Parm when isDiffuseSupplied is FALSE in
state_colormat(), it isn't used anyway
-------------- next part --------------
---

 dlls/wined3d/state.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 8d74006..b0f74c7 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -812,7 +812,7 @@ static void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock) {
 
 /* TODO: Merge with primitive type + init_materials()!! */
 static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock) {
-    GLenum Parm = -1;
+    GLenum Parm = 0;
     WineDirect3DStridedData *diffuse = &stateblock->wineD3DDevice->strided_streams.u.s.diffuse;
     BOOL isDiffuseSupplied;
 
@@ -825,7 +825,7 @@ static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock) {
 
     isDiffuseSupplied = diffuse->lpData || diffuse->VBO;
 
-    if (stateblock->renderState[WINED3DRS_COLORVERTEX]) {
+    if (isDiffuseSupplied && stateblock->renderState[WINED3DRS_COLORVERTEX]) {
         TRACE("diff %d, amb %d, emis %d, spec %d\n",
               stateblock->renderState[WINED3DRS_DIFFUSEMATERIALSOURCE],
               stateblock->renderState[WINED3DRS_AMBIENTMATERIALSOURCE],
@@ -847,7 +847,7 @@ static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock) {
         }
     }
 
-    if(Parm == -1 || !isDiffuseSupplied) {
+    if(!Parm) {
         glDisable(GL_COLOR_MATERIAL);
         checkGLcall("glDisable GL_COLOR_MATERIAL");
     } else {


More information about the wine-patches mailing list