color fix

Kovács András andras at csevego.net
Mon Jul 9 13:03:01 CDT 2007


Hi,

This will fix Beyond Good & Evil color (bgr<=>rgb) problem.
Based on stefand's suggestion.

-- 
----------------------------
Kovács András (andras)
NetClub Vezető Rendszergazda
Lamarr
csevego.net
andras at csevego.net
----------------------------
-------------- next part --------------
From a26c0a023d55b9175b6c8d9172cc80590f36f81b Mon Sep 17 00:00:00 2001
From: Andras Kovacs <andras at csevego.net>
Date: Mon, 9 Jul 2007 18:52:07 +0200
Subject: [PATCH] color fix

---
 dlls/wined3d/drawprim.c        |   17 +++++++++++------
 dlls/wined3d/wined3d_private.h |    1 +
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 1b03528..61a76a6 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -159,6 +159,8 @@ void primitiveDeclarationConvertToStridedData(
     char isPreLoaded[MAX_STREAMS];
     DWORD preLoadStreams[MAX_STREAMS], numPreloadStreams = 0;
 
+    This->vertex_partially_fixed = FALSE;
+
     memset(isPreLoaded, 0, sizeof(isPreLoaded));
 
     /* Check for transformed vertices, disable vertex shader if present */
@@ -199,9 +201,12 @@ void primitiveDeclarationConvertToStridedData(
             data    = IWineD3DVertexBufferImpl_GetMemory(This->stateBlock->streamSource[element->Stream], 0, &streamVBO);
             if(fixup) {
                 if( streamVBO != 0) *fixup = TRUE;
-                else if(*fixup && !useVertexShaderFunction) {
+                else if(*fixup && !useVertexShaderFunction &&
+                       (element->Usage == WINED3DDECLUSAGE_COLOR ||
+                        element->Usage == WINED3DDECLUSAGE_POSITIONT)) {
                     /* This may be bad with the fixed function pipeline */
-                    FIXME("Missing fixed and unfixed vertices, expect graphics glitches\n");
+                    This->vertex_partially_fixed = TRUE;
+                    TRACE("Missing vbo streams with unfixed colors or transformed position, we will use drawStridedSlow\n");
                 }
             }
         }
@@ -1049,12 +1054,12 @@ void drawPrimitive(IWineD3DDevice *iface,
         if (numberOfVertices == 0 )
             numberOfVertices = calculatedNumberOfindices;
 
-        if(!This->strided_streams.u.s.position_transformed && !use_vs(This)) {
-            if(This->activeContext->num_untracked_materials &&
-               This->stateBlock->renderState[WINED3DRS_LIGHTING]) {
+        if((!This->strided_streams.u.s.position_transformed && !use_vs(This)) || This->vertex_partially_fixed) {
+            if((This->activeContext->num_untracked_materials &&
+               This->stateBlock->renderState[WINED3DRS_LIGHTING]) || This->vertex_partially_fixed) {
                 IWineD3DVertexBufferImpl *vb;
 
-                FIXME("Using software emulation because not all material properties could be tracked\n");
+                FIXME("Using software emulation because not all material properties could be tracked, or missing vbo streams with unfixed colors or transformed position.\n");
                 emulation = TRUE;
 
                 strided = &stridedlcl;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 86cad0b..defa86e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -749,6 +749,7 @@ struct IWineD3DDeviceImpl
     WineDirect3DVertexStridedData *up_strided;
     BOOL                      useDrawStridedSlow;
     BOOL                      instancedDraw;
+    BOOL                      vertex_partially_fixed;
 
     /* Context management */
     WineD3DContext          **contexts;                  /* Dynamic array containing pointers to context structures */
-- 
1.4.4.4



More information about the wine-patches mailing list