From b8dd5839efe0d40d1e85a826f127f5034b800135 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20D=C3=B6singer?= Date: Mon, 30 Jul 2007 12:35:33 +0200 Subject: [PATCH] wined3d: Store the position_transformed flag in the vdecl. --- dlls/wined3d/drawprim.c | 11 +++-------- dlls/wined3d/vertexdeclaration.c | 12 ++++++++---- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 98cc4ec385a..c35ce698d74 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -160,14 +160,9 @@ void primitiveDeclarationConvertToStridedData( DWORD *streams = vertexDeclaration->streams; /* Check for transformed vertices, disable vertex shader if present */ - strided->u.s.position_transformed = FALSE; - for (i = 0; i < vertexDeclaration->declarationWNumElements - 1; ++i) { - element = vertexDeclaration->pDeclarationWine + i; - - if (element->Usage == WINED3DDECLUSAGE_POSITIONT) { - strided->u.s.position_transformed = TRUE; - useVertexShaderFunction = FALSE; - } + strided->u.s.position_transformed = vertexDeclaration->position_transformed; + if(vertexDeclaration->position_transformed) { + useVertexShaderFunction = FALSE; } /* Translate the declaration into strided data */ diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c index 2bbca7df7f3..292f1f0ae3b 100644 --- a/dlls/wined3d/vertexdeclaration.c +++ b/dlls/wined3d/vertexdeclaration.c @@ -143,14 +143,18 @@ static HRESULT WINAPI IWineD3DVertexDeclarationImpl_SetDeclaration(IWineD3DVerte /* Do some static analysis on the elements to make reading the declaration more comfortable * for the drawing code - * - * First, find the Streams used in the declaration. The vertex buffers have to be loaded - * when drawing. */ This->num_streams = 0; + This->position_transformed = FALSE; for (i = 0; i < element_count; ++i) { - /* Filter tesselation pseudo streams*/ + if(This->pDeclarationWine[i].Usage == WINED3DDECLUSAGE_POSITIONT) { + This->position_transformed = TRUE; + } + + /* Find the Streams used in the declaration. The vertex buffers have to be loaded + * when drawing, but filter tesselation pseudo streams + */ if(This->pDeclarationWine[i].Stream >= MAX_STREAMS) continue; if(!isPreLoaded[This->pDeclarationWine[i].Stream]) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 240dca5bf4a..83915ff217d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1228,6 +1228,7 @@ typedef struct IWineD3DVertexDeclarationImpl { DWORD streams[MAX_STREAMS]; UINT num_streams; + BOOL position_transformed; } IWineD3DVertexDeclarationImpl; extern const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl; -- 2.11.4.GIT