[2/2] wined3d: Make use of the texUnitMap in drawStridedSlow as well

H. Verbeet hverbeet at gmail.com
Wed Jun 20 17:01:05 CDT 2007


Currently drawStridedSlow breaks pretty badly when the algorithm for
assigning textures to stages in FindTexUnitMap is changed (and it will
be when VTF support is added).

Changelog:
  - Make use of the texUnitMap in drawStridedSlow as well
-------------- next part --------------
---

 dlls/wined3d/drawprim.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 16504d5..e842c41 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -448,7 +448,6 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
                      const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, ULONG startVertex) {
 
     unsigned int               textureNo    = 0;
-    unsigned int               texture_idx  = 0;
     const WORD                *pIdxBufS     = NULL;
     const DWORD               *pIdxBufL     = NULL;
     LONG                       vx_index;
@@ -482,7 +481,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
     /* Adding the stream offset once is cheaper than doing it every iteration. Do not modify the strided data, it is a pointer
      * to the strided Data in the device and might be needed intact on the next draw
      */
-    for (textureNo = 0, texture_idx = 0; textureNo < GL_LIMITS(texture_stages); ++textureNo) {
+    for (textureNo = 0; textureNo < GL_LIMITS(texture_stages); ++textureNo) {
         if(sd->u.s.texCoords[textureNo].lpData) {
             texCoords[textureNo] = sd->u.s.texCoords[textureNo].lpData + streamOffset[sd->u.s.texCoords[textureNo].streamNo];
         } else {
@@ -547,7 +546,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
         }
 
         /* Texture coords --------------------------- */
-        for (textureNo = 0, texture_idx = 0; textureNo < GL_LIMITS(texture_stages); ++textureNo) {
+        for (textureNo = 0; textureNo < GL_LIMITS(texture_stages); ++textureNo) {
 
             if (!GL_SUPPORT(ARB_MULTITEXTURE) && textureNo > 0) {
                 FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
@@ -563,23 +562,22 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
 
                 if (coordIdx > 7) {
                     VTRACE(("tex: %d - Skip tex coords, as being system generated\n", textureNo));
-                    ++texture_idx;
                     continue;
                 } else if (coordIdx < 0) {
                     FIXME("tex: %d - Coord index %d is less than zero, expect a crash.\n", textureNo, coordIdx);
-                    ++texture_idx;
                     continue;
                 }
 
                 ptrToCoords = (float *)(texCoords[coordIdx] + (SkipnStrides * sd->u.s.texCoords[coordIdx].dwStride));
                 if (texCoords[coordIdx] == NULL) {
                     TRACE("tex: %d - Skipping tex coords, as no data supplied\n", textureNo);
-                    ++texture_idx;
                     continue;
                 } else {
-
+                    int texture_idx = This->texUnitMap[textureNo];
                     int coordsToUse = sd->u.s.texCoords[coordIdx].dwType + 1; /* 0 == WINED3DDECLTYPE_FLOAT1 etc */
 
+                    if (texture_idx == -1) continue;
+
                     /* The coords to supply depend completely on the fvf / vertex shader */
                     switch (coordsToUse) {
                     case 4: q = ptrToCoords[3]; /* drop through */
@@ -656,7 +654,6 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
                     }
                 }
             }
-            if (/*!GL_SUPPORT(NV_REGISTER_COMBINERS) || This->stateBlock->textures[textureNo]*/TRUE) ++texture_idx;
         } /* End of textures */
 
         /* Diffuse -------------------------------- */


More information about the wine-patches mailing list