Commit 1aca5386 authored by H. Verbeet's avatar H. Verbeet Committed by Alexandre Julliard

wined3d: Set vertex attribute pointers defined in vertex declarations properly.

parent e7b33b0f
...@@ -325,6 +325,7 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer ...@@ -325,6 +325,7 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
int i; int i;
WINED3DVERTEXELEMENT *element; WINED3DVERTEXELEMENT *element;
DWORD stride; DWORD stride;
int reg;
/* Locate the vertex declaration */ /* Locate the vertex declaration */
if (useVertexShaderFunction && ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->vertexDeclaration) { if (useVertexShaderFunction && ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->vertexDeclaration) {
...@@ -350,8 +351,21 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer ...@@ -350,8 +351,21 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
stride = This->stateBlock->streamStride[element->Stream]; stride = This->stateBlock->streamStride[element->Stream];
data += (BaseVertexIndex * stride); data += (BaseVertexIndex * stride);
data += element->Offset; data += element->Offset;
reg = element->Reg;
TRACE("Offset %d Stream %d UsageIndex %d\n", element->Offset, element->Stream, element->UsageIndex); 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) { switch (element->Usage) {
case D3DDECLUSAGE_POSITION: case D3DDECLUSAGE_POSITION:
switch (element->UsageIndex) { switch (element->UsageIndex) {
......
...@@ -1245,16 +1245,6 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS ...@@ -1245,16 +1245,6 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
/* 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 */ /* 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; 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: * First pass to determine what we need to declare:
* - Temporary variables * - Temporary variables
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment