Rico Schüller : wined3d: Improve drawStridedInstanced( ).

Alexandre Julliard julliard at winehq.org
Mon Apr 7 14:46:59 CDT 2008


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

Author: Rico Schüller <kgbricola at web.de>
Date:   Sun Apr  6 18:50:52 2008 +0200

wined3d: Improve drawStridedInstanced().

---

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

diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 43ee039..37482fb 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -838,15 +838,15 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, WineDirect3DVerte
 
     /* First, figure out how many instances we have to draw */
     for(i = 0; i < MAX_STREAMS; i++) {
-        /* Look at all non-instanced streams */
-        if(!(stateblock->streamFlags[i] & WINED3DSTREAMSOURCE_INSTANCEDATA) &&
-           stateblock->streamSource[i]) {
-            int inst = stateblock->streamFreq[i];
-
-            if(numInstances && inst != numInstances) {
-                ERR("Two streams specify a different number of instances. Got %d, new is %d\n", numInstances, inst);
+        /* Look at the streams and take the first one which matches */
+        if(((stateblock->streamFlags[i] & WINED3DSTREAMSOURCE_INSTANCEDATA) || (stateblock->streamFlags[i] & WINED3DSTREAMSOURCE_INDEXEDDATA)) && stateblock->streamSource[i]) {
+            /* D3d9 could set StreamFreq 0 with (INSTANCEDATA or INDEXEDDATA) and then it is handled as 1. See d3d9/tests/visual.c-> stream_test() */
+            if(stateblock->streamFreq[i] == 0){
+                numInstances = 1;
+            } else {
+                numInstances = stateblock->streamFreq[i]; /* use the specified number of instances from the first matched stream. See d3d9/tests/visual.c-> stream_test() */
             }
-            numInstances = inst;
+            break; /* break, bacause only the first suitable value is interesting */
         }
     }
 




More information about the wine-cvs mailing list