wined3d: Set vertex attribute pointers defined in vertex declarations properly.
This commit is contained in:
parent
e7b33b0f37
commit
1aca53860a
|
@ -325,6 +325,7 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
|||
int i;
|
||||
WINED3DVERTEXELEMENT *element;
|
||||
DWORD stride;
|
||||
int reg;
|
||||
|
||||
/* Locate the vertex declaration */
|
||||
if (useVertexShaderFunction && ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->vertexDeclaration) {
|
||||
|
@ -350,8 +351,21 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
|||
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) {
|
||||
|
|
|
@ -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 */
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue