[WINED3D] Allow null streams in the vertex declaration

Ivan Gyurdiev ivg231 at gmail.com
Sun Sep 17 15:26:18 CDT 2006


The InfiniteTerrainII demo has a null stream for one of its elements 
when running in VTF mode. However, Roderick tried it on an Nvidia card 
(in VTF mode), and it seems to work on Windows. This indicates that we 
shouldn't crash when encountering a null stream like we currently do.

Also fix wrong indices/spelling in the trace.

Demo on:  http://www.humus.ca/index.php?page=3D

-------------- next part --------------
---
 dlls/wined3d/drawprim.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index aa022e2..9a5b507 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -441,7 +441,12 @@ void primitiveDeclarationConvertToStride
         unsigned int idx;
 
         element = vertexDeclaration->pDeclarationWine + i;
-        TRACE("%p Elements %p %d or %d\n", vertexDeclaration->pDeclarationWine, element,  i, vertexDeclaration->declarationWNumElements);
+        TRACE("%p Element %p (%d of %d)\n", vertexDeclaration->pDeclarationWine,
+            element,  i + 1, vertexDeclaration->declarationWNumElements - 1);
+
+        if (This->stateBlock->streamSource[element->Stream] == NULL)
+            continue;
+
         if (This->stateBlock->streamIsUP) {
             TRACE("Stream is up %d, %p\n", element->Stream, This->stateBlock->streamSource[element->Stream]);
             streamVBO = 0;
-- 
1.4.1



More information about the wine-patches mailing list