Commit 1be54d8b authored by Oliver Stieber's avatar Oliver Stieber Committed by Alexandre Julliard

Integrate hardware vertex shaders into the drawing pipeline.

parent 516a577d
...@@ -1456,7 +1456,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface, CON ...@@ -1456,7 +1456,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface, CON
IWineD3DVertexShaderImpl *object; /* NOTE: impl usage is ok, this is a create */ IWineD3DVertexShaderImpl *object; /* NOTE: impl usage is ok, this is a create */
D3DCREATEOBJECTINSTANCE(object, VertexShader) D3DCREATEOBJECTINSTANCE(object, VertexShader)
TRACE("(%p) : Created Vertex shader %p\n", This, ppVertexShader); TRACE("(%p) : Created Vertex shader %p\n", This, *ppVertexShader);
IWineD3DVertexShader_SetFunction(*ppVertexShader, pFunction); IWineD3DVertexShader_SetFunction(*ppVertexShader, pFunction);
return D3D_OK; return D3D_OK;
...@@ -4334,7 +4334,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, D3DPRIMIT ...@@ -4334,7 +4334,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, D3DPRIMIT
TRACE("(%p) : Type=(%d,%s), Start=%d, Count=%d\n", This, PrimitiveType, TRACE("(%p) : Type=(%d,%s), Start=%d, Count=%d\n", This, PrimitiveType,
debug_d3dprimitivetype(PrimitiveType), debug_d3dprimitivetype(PrimitiveType),
StartVertex, PrimitiveCount); StartVertex, PrimitiveCount);
drawPrimitive(iface, PrimitiveType, PrimitiveCount, StartVertex, -1, 0, NULL, 0); drawPrimitive(iface, PrimitiveType, PrimitiveCount, StartVertex, 0/* NumVertices */, -1 /* indxStart */,
0 /* indxSize */, NULL /* indxData */, 0 /* minIndex */);
return D3D_OK; return D3D_OK;
} }
...@@ -4343,7 +4345,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, D3DPRIMIT ...@@ -4343,7 +4345,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, D3DPRIMIT
HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface, HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface,
D3DPRIMITIVETYPE PrimitiveType, D3DPRIMITIVETYPE PrimitiveType,
INT baseVIndex, UINT minIndex, INT baseVIndex, UINT minIndex,
UINT NumVertices,UINT startIndex,UINT primCount) { UINT NumVertices, UINT startIndex, UINT primCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
UINT idxStride = 2; UINT idxStride = 2;
...@@ -4364,10 +4366,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface, ...@@ -4364,10 +4366,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface,
idxStride = 4; idxStride = 4;
} }
drawPrimitive(iface, PrimitiveType, primCount, baseVIndex, drawPrimitive(iface, PrimitiveType, primCount, baseVIndex, NumVertices, startIndex,
startIndex, idxStride, idxStride, ((IWineD3DIndexBufferImpl *) pIB)->resource.allocatedMemory, minIndex);
((IWineD3DIndexBufferImpl *) pIB)->resource.allocatedMemory,
minIndex);
return D3D_OK; return D3D_OK;
} }
...@@ -4392,7 +4392,12 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface, D3DPRIM ...@@ -4392,7 +4392,12 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface, D3DPRIM
This->stateBlock->streamSource[0] = (IWineD3DVertexBuffer *)pVertexStreamZeroData; This->stateBlock->streamSource[0] = (IWineD3DVertexBuffer *)pVertexStreamZeroData;
This->stateBlock->streamStride[0] = VertexStreamZeroStride; This->stateBlock->streamStride[0] = VertexStreamZeroStride;
This->stateBlock->streamIsUP = TRUE; This->stateBlock->streamIsUP = TRUE;
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0, 0, 0, NULL, 0);
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* start vertex */, 0 /* NumVertices */,
0 /* indxStart*/, 0 /* indxSize*/, NULL /* indxData */, 0 /* indxMin */);
/* stream zero settings set to null at end, as per the msdn
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/graphics/reference/d3d/interfaces/idirect3ddevice9/DrawPrimitiveUP.asp
*/
This->stateBlock->streamStride[0] = 0; This->stateBlock->streamStride[0] = 0;
This->stateBlock->streamSource[0] = NULL; This->stateBlock->streamSource[0] = NULL;
...@@ -4401,16 +4406,16 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface, D3DPRIM ...@@ -4401,16 +4406,16 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface, D3DPRIM
} }
HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType, HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType,
UINT MinVertexIndex, UINT MinVertexIndex, UINT NumVertices,
UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData, UINT PrimitiveCount, CONST void* pIndexData,
WINED3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, WINED3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,
UINT VertexStreamZeroStride) { UINT VertexStreamZeroStride) {
int idxStride; int idxStride;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : Type=(%d,%s), MinVtxIdx=%d, NumVIdx=%d, PCount=%d, pidxdata=%p, IdxFmt=%d, pVtxdata=%p, stride=%d\n", TRACE("(%p) : Type=(%d,%s), MinVtxIdx=%d, NumVIdx=%d, PCount=%d, pidxdata=%p, IdxFmt=%d, pVtxdata=%p, stride=%d\n",
This, PrimitiveType, debug_d3dprimitivetype(PrimitiveType), This, PrimitiveType, debug_d3dprimitivetype(PrimitiveType),
MinVertexIndex, NumVertexIndices, PrimitiveCount, pIndexData, MinVertexIndex, NumVertices, PrimitiveCount, pIndexData,
IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride); IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
if (IndexDataFormat == WINED3DFMT_INDEX16) { if (IndexDataFormat == WINED3DFMT_INDEX16) {
...@@ -4440,7 +4445,10 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface, ...@@ -4440,7 +4445,10 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface,
This->stateBlock->streamIsUP = TRUE; This->stateBlock->streamIsUP = TRUE;
This->stateBlock->streamStride[0] = VertexStreamZeroStride; This->stateBlock->streamStride[0] = VertexStreamZeroStride;
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0, 0, idxStride, pIndexData, MinVertexIndex); drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* vertexStart */, NumVertices, 0 /* indxStart */, idxStride, pIndexData, MinVertexIndex);
/* stream zero settings set to null at end as per the msdn
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/graphics/reference/d3d/interfaces/idirect3ddevice9/DrawPrimitiveUP.asp
*/
/* stream zero settings set to null at end as per the msdn */ /* stream zero settings set to null at end as per the msdn */
This->stateBlock->streamSource[0] = NULL; This->stateBlock->streamSource[0] = NULL;
......
...@@ -1990,7 +1990,7 @@ ULONG WINAPI IWineD3DVertexShaderImpl_Release(IWineD3DVertexShader *iface) { ...@@ -1990,7 +1990,7 @@ ULONG WINAPI IWineD3DVertexShaderImpl_Release(IWineD3DVertexShader *iface) {
HRESULT WINAPI IWineD3DVertexShaderImpl_GetParent(IWineD3DVertexShader *iface, IUnknown** parent){ HRESULT WINAPI IWineD3DVertexShaderImpl_GetParent(IWineD3DVertexShader *iface, IUnknown** parent){
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface; IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
*parent= (IUnknown*) parent; *parent = (IUnknown*)This->parent;
IUnknown_AddRef(*parent); IUnknown_AddRef(*parent);
TRACE("(%p) : returning %p\n", This, *parent); TRACE("(%p) : returning %p\n", This, *parent);
return D3D_OK; return D3D_OK;
......
...@@ -80,7 +80,6 @@ extern DWORD *stateLookup[MAX_LOOKUPS]; ...@@ -80,7 +80,6 @@ extern DWORD *stateLookup[MAX_LOOKUPS];
extern DWORD minMipLookup[D3DTEXF_ANISOTROPIC + 1][D3DTEXF_LINEAR + 1]; extern DWORD minMipLookup[D3DTEXF_ANISOTROPIC + 1][D3DTEXF_LINEAR + 1];
#if 0
/* NOTE: Make sure these are in the correct numerical order. (see /include/d3d9types.h typedef enum _D3DDECLTYPE) */ /* NOTE: Make sure these are in the correct numerical order. (see /include/d3d9types.h typedef enum _D3DDECLTYPE) */
UINT static const glTypeLookup[D3DDECLTYPE_UNUSED][5] = { UINT static const glTypeLookup[D3DDECLTYPE_UNUSED][5] = {
{D3DDECLTYPE_FLOAT1, 1, GL_FLOAT , GL_FALSE ,sizeof(float)}, {D3DDECLTYPE_FLOAT1, 1, GL_FLOAT , GL_FALSE ,sizeof(float)},
...@@ -104,9 +103,8 @@ UINT static const glTypeLookup[D3DDECLTYPE_UNUSED][5] = { ...@@ -104,9 +103,8 @@ UINT static const glTypeLookup[D3DDECLTYPE_UNUSED][5] = {
#define WINED3D_ATR_TYPE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][0] #define WINED3D_ATR_TYPE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][0]
#define WINED3D_ATR_SIZE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][1] #define WINED3D_ATR_SIZE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][1]
#define WINED3D_ATR_GLTYPE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][2] #define WINED3D_ATR_GLTYPE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][2]
#define WINED3D_ATR_GLSOMETHING(_attribute) glTypeLookup[sd->u.s._attribute.dwType][3] #define WINED3D_ATR_NORMALIZED(_attribute) glTypeLookup[sd->u.s._attribute.dwType][3]
#define WINED3D_ATR_TYPESIZE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][4] #define WINED3D_ATR_TYPESIZE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][4]
#endif
/** /**
* Settings * Settings
...@@ -343,9 +341,9 @@ extern LONG primCounter; ...@@ -343,9 +341,9 @@ extern LONG primCounter;
void drawPrimitive(IWineD3DDevice *iface, void drawPrimitive(IWineD3DDevice *iface,
int PrimitiveType, int PrimitiveType,
long NumPrimitives, long NumPrimitives,
/* for Indexed: */ /* for Indexed: */
long StartVertexIndex, long StartVertexIndex,
UINT numberOfVertices,
long StartIdx, long StartIdx,
short idxBytes, short idxBytes,
const void *idxData, const void *idxData,
......
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