Module: wine Branch: refs/heads/master Commit: 1aca53860a4c7549fda3d798a50f0512ac36b4c5 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=1aca53860a4c7549fda3d798...
Author: H. Verbeet hverbeet@gmail.com Date: Wed Mar 22 19:47:54 2006 +0000
wined3d: Set vertex attribute pointers defined in vertex declarations properly.
---
dlls/wined3d/drawprim.c | 14 ++++++++++++++ dlls/wined3d/vertexshader.c | 10 ---------- 2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 6f14dff..34241bd 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -325,6 +325,7 @@ void primitiveDeclarationConvertToStride int i; WINED3DVERTEXELEMENT *element; DWORD stride; + int reg;
/* Locate the vertex declaration */ if (useVertexShaderFunction && ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->vertexDeclaration) { @@ -350,8 +351,21 @@ void primitiveDeclarationConvertToStride stride = This->stateBlock->streamStride[element->Stream]; data += (BaseVertexIndex * stride); data += element->Offset; + reg = element->Reg;
TRACE("Offset %d Stream %d UsageIndex %d\n", element->Offset, element->Stream, element->UsageIndex); + + if (useVertexShaderFunction && reg != -1 && data) { + WINED3DGLTYPE glType = glTypeLookup[element->Type]; + + TRACE("(%p) : Set vertex attrib pointer: reg 0x%08x, d3d type 0x%08x, stride 0x%08lx, data %p)\n", This, reg, element->Type, stride, data); + + GL_EXTCALL(glVertexAttribPointerARB(reg, glType.size, glType.glType, glType.normalized, stride, data)); + checkGLcall("glVertexAttribPointerARB"); + GL_EXTCALL(glEnableVertexAttribArrayARB(reg)); + checkGLcall("glEnableVertexAttribArrayARB"); + } + switch (element->Usage) { case D3DDECLUSAGE_POSITION: switch (element->UsageIndex) { diff --git a/dlls/wined3d/vertexshader.c b/dlls/wined3d/vertexshader.c index d3e3801..c4732bc 100644 --- a/dlls/wined3d/vertexshader.c +++ b/dlls/wined3d/vertexshader.c @@ -1245,16 +1245,6 @@ inline static VOID IWineD3DVertexShaderI /* TODO: renumbering of attributes if the values are higher than the highest supported attribute but the total number of attributes is less than the highest supported attribute */ This->highestConstant = -1;
- /* Parse the vertex declaration and store the used elements in arrayUsageMap. */ - if(This->vertexDeclaration) { - for (i = 0 ; i < ((IWineD3DVertexDeclarationImpl*)This->vertexDeclaration)->declarationWNumElements - 1; ++i) { - WINED3DVERTEXELEMENT *element = ((IWineD3DVertexDeclarationImpl*)This->vertexDeclaration)->pDeclarationWine + i; - INT usage = element->Usage | (element->UsageIndex << 16); - BYTE arrayNo = element->Reg; - parse_decl_usage(This, usage, arrayNo); - } - } - /** * First pass to determine what we need to declare: * - Temporary variables