Commit 702eeb6b authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Add separate methods for setting the primitive type.

parent 3b07e705
...@@ -210,7 +210,11 @@ static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D ...@@ -210,7 +210,11 @@ static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D
static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology) static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
{ {
FIXME("iface %p, topology %s stub!\n", iface, debug_d3d10_primitive_topology(topology)); struct d3d10_device *This = (struct d3d10_device *)iface;
TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
IWineD3DDevice_SetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE)topology);
} }
static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface, static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
...@@ -424,7 +428,11 @@ static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D ...@@ -424,7 +428,11 @@ static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D
static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology) static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
{ {
FIXME("iface %p, topology %p stub!\n", iface, topology); struct d3d10_device *This = (struct d3d10_device *)iface;
TRACE("iface %p, topology %p\n", iface, topology);
IWineD3DDevice_GetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE *)topology);
} }
static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface, static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
......
...@@ -1538,7 +1538,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitive(LPDIRECT3DDEVICE8 iface ...@@ -1538,7 +1538,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitive(LPDIRECT3DDEVICE8 iface
TRACE("(%p) Relay\n" , This); TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d8_cs); EnterCriticalSection(&d3d8_cs);
hr = IWineD3DDevice_DrawPrimitive(This->WineD3DDevice, PrimitiveType, StartVertex, IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
hr = IWineD3DDevice_DrawPrimitive(This->WineD3DDevice, StartVertex,
vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount)); vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount));
LeaveCriticalSection(&d3d8_cs); LeaveCriticalSection(&d3d8_cs);
return hr; return hr;
...@@ -1551,7 +1552,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE ...@@ -1551,7 +1552,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE
TRACE("(%p) Relay\n" , This); TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d8_cs); EnterCriticalSection(&d3d8_cs);
hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, PrimitiveType, MinVertexIndex, NumVertices, IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, MinVertexIndex, NumVertices,
startIndex, vertex_count_from_primitive_count(PrimitiveType, primCount)); startIndex, vertex_count_from_primitive_count(PrimitiveType, primCount));
LeaveCriticalSection(&d3d8_cs); LeaveCriticalSection(&d3d8_cs);
return hr; return hr;
...@@ -1563,7 +1565,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE8 ifa ...@@ -1563,7 +1565,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE8 ifa
TRACE("(%p) Relay\n" , This); TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d8_cs); EnterCriticalSection(&d3d8_cs);
hr = IWineD3DDevice_DrawPrimitiveUP(This->WineD3DDevice, PrimitiveType, IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
hr = IWineD3DDevice_DrawPrimitiveUP(This->WineD3DDevice,
vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount),
pVertexStreamZeroData, VertexStreamZeroStride); pVertexStreamZeroData, VertexStreamZeroStride);
LeaveCriticalSection(&d3d8_cs); LeaveCriticalSection(&d3d8_cs);
...@@ -1579,8 +1582,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVI ...@@ -1579,8 +1582,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVI
TRACE("(%p) Relay\n" , This); TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d8_cs); EnterCriticalSection(&d3d8_cs);
hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, PrimitiveType, MinVertexIndex, IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
NumVertexIndices, vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pIndexData, hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, MinVertexIndex, NumVertexIndices,
vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pIndexData,
wined3dformat_from_d3dformat(IndexDataFormat), pVertexStreamZeroData, VertexStreamZeroStride); wined3dformat_from_d3dformat(IndexDataFormat), pVertexStreamZeroData, VertexStreamZeroStride);
LeaveCriticalSection(&d3d8_cs); LeaveCriticalSection(&d3d8_cs);
return hr; return hr;
......
...@@ -1383,7 +1383,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(LPDIRECT3DDEVICE9EX ifa ...@@ -1383,7 +1383,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(LPDIRECT3DDEVICE9EX ifa
TRACE("(%p) Relay\n" , This); TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d9_cs); EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_DrawPrimitive(This->WineD3DDevice, PrimitiveType, StartVertex, IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
hr = IWineD3DDevice_DrawPrimitive(This->WineD3DDevice, StartVertex,
vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount)); vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount));
LeaveCriticalSection(&d3d9_cs); LeaveCriticalSection(&d3d9_cs);
return hr; return hr;
...@@ -1398,7 +1399,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVI ...@@ -1398,7 +1399,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVI
/* D3D8 passes the baseVertexIndex in SetIndices, and due to the stateblock functions wined3d has to work that way */ /* D3D8 passes the baseVertexIndex in SetIndices, and due to the stateblock functions wined3d has to work that way */
EnterCriticalSection(&d3d9_cs); EnterCriticalSection(&d3d9_cs);
IWineD3DDevice_SetBaseVertexIndex(This->WineD3DDevice, BaseVertexIndex); IWineD3DDevice_SetBaseVertexIndex(This->WineD3DDevice, BaseVertexIndex);
hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, PrimitiveType, MinVertexIndex, NumVertices, IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, MinVertexIndex, NumVertices,
startIndex, vertex_count_from_primitive_count(PrimitiveType, primCount)); startIndex, vertex_count_from_primitive_count(PrimitiveType, primCount));
LeaveCriticalSection(&d3d9_cs); LeaveCriticalSection(&d3d9_cs);
return hr; return hr;
...@@ -1410,7 +1412,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE9EX ...@@ -1410,7 +1412,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE9EX
TRACE("(%p) Relay\n" , This); TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d9_cs); EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_DrawPrimitiveUP(This->WineD3DDevice, PrimitiveType, IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
hr = IWineD3DDevice_DrawPrimitiveUP(This->WineD3DDevice,
vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount),
pVertexStreamZeroData, VertexStreamZeroStride); pVertexStreamZeroData, VertexStreamZeroStride);
LeaveCriticalSection(&d3d9_cs); LeaveCriticalSection(&d3d9_cs);
...@@ -1425,8 +1428,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDE ...@@ -1425,8 +1428,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDE
TRACE("(%p) Relay\n" , This); TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d9_cs); EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, PrimitiveType, MinVertexIndex, IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
NumVertexIndices, vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pIndexData, hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, MinVertexIndex, NumVertexIndices,
vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pIndexData,
wined3dformat_from_d3dformat(IndexDataFormat), pVertexStreamZeroData, VertexStreamZeroStride); wined3dformat_from_d3dformat(IndexDataFormat), pVertexStreamZeroData, VertexStreamZeroStride);
LeaveCriticalSection(&d3d9_cs); LeaveCriticalSection(&d3d9_cs);
return hr; return hr;
......
...@@ -3484,11 +3484,8 @@ IDirect3DDeviceImpl_7_DrawPrimitive(IDirect3DDevice7 *iface, ...@@ -3484,11 +3484,8 @@ IDirect3DDeviceImpl_7_DrawPrimitive(IDirect3DDevice7 *iface,
} }
/* This method translates to the user pointer draw of WineD3D */ /* This method translates to the user pointer draw of WineD3D */
hr = IWineD3DDevice_DrawPrimitiveUP(This->wineD3DDevice, IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType);
PrimitiveType, hr = IWineD3DDevice_DrawPrimitiveUP(This->wineD3DDevice, VertexCount, Vertices, stride);
VertexCount,
Vertices,
stride);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return hr; return hr;
} }
...@@ -3610,9 +3607,10 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitive(IDirect3DDevice7 *iface, ...@@ -3610,9 +3607,10 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
return hr; return hr;
} }
hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->wineD3DDevice, PrimitiveType, 0 /* MinVertexIndex */, IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType);
VertexCount /* UINT NumVertexIndex */, IndexCount, Indices, WINED3DFMT_R16_UINT, Vertices, hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->wineD3DDevice, 0 /* MinVertexIndex */,
get_flexible_vertex_size(VertexType)); VertexCount /* UINT NumVertexIndex */, IndexCount, Indices, WINED3DFMT_R16_UINT,
Vertices, get_flexible_vertex_size(VertexType));
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return hr; return hr;
} }
...@@ -3878,10 +3876,8 @@ IDirect3DDeviceImpl_7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, ...@@ -3878,10 +3876,8 @@ IDirect3DDeviceImpl_7_DrawPrimitiveStrided(IDirect3DDevice7 *iface,
/* WineD3D doesn't need the FVF here */ /* WineD3D doesn't need the FVF here */
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
hr = IWineD3DDevice_DrawPrimitiveStrided(This->wineD3DDevice, IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType);
PrimitiveType, hr = IWineD3DDevice_DrawPrimitiveStrided(This->wineD3DDevice, VertexCount, &WineD3DStrided);
VertexCount,
&WineD3DStrided);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return hr; return hr;
} }
...@@ -4021,7 +4017,8 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface, ...@@ -4021,7 +4017,8 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface,
/* WineD3D doesn't need the FVF here */ /* WineD3D doesn't need the FVF here */
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
hr = IWineD3DDevice_DrawIndexedPrimitiveStrided(This->wineD3DDevice, PrimitiveType, IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType);
hr = IWineD3DDevice_DrawIndexedPrimitiveStrided(This->wineD3DDevice,
IndexCount, &WineD3DStrided, VertexCount, Indices, WINED3DFMT_R16_UINT); IndexCount, &WineD3DStrided, VertexCount, Indices, WINED3DFMT_R16_UINT);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return hr; return hr;
...@@ -4153,10 +4150,8 @@ IDirect3DDeviceImpl_7_DrawPrimitiveVB(IDirect3DDevice7 *iface, ...@@ -4153,10 +4150,8 @@ IDirect3DDeviceImpl_7_DrawPrimitiveVB(IDirect3DDevice7 *iface,
} }
/* Now draw the primitives */ /* Now draw the primitives */
hr = IWineD3DDevice_DrawPrimitive(This->wineD3DDevice, IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType);
PrimitiveType, hr = IWineD3DDevice_DrawPrimitive(This->wineD3DDevice, StartVertex, NumVertices);
StartVertex,
NumVertices);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return hr; return hr;
} }
...@@ -4317,12 +4312,9 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, ...@@ -4317,12 +4312,9 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
} }
IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType);
hr = IWineD3DDevice_DrawIndexedPrimitive(This->wineD3DDevice, hr = IWineD3DDevice_DrawIndexedPrimitive(This->wineD3DDevice,
PrimitiveType, 0 /* minIndex */, NumVertices, 0 /* StartIndex */, IndexCount);
0 /* minIndex */,
NumVertices,
0 /* StartIndex */,
IndexCount);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return hr; return hr;
......
...@@ -32,48 +32,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_draw); ...@@ -32,48 +32,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_draw);
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
/* Note that except for WINED3DPT_POINTLIST and WINED3DPT_LINELIST these
* actually have the same values in GL and D3D. */
static GLenum primitive_to_gl(WINED3DPRIMITIVETYPE primitive_type)
{
switch(primitive_type)
{
case WINED3DPT_POINTLIST:
return GL_POINTS;
case WINED3DPT_LINELIST:
return GL_LINES;
case WINED3DPT_LINESTRIP:
return GL_LINE_STRIP;
case WINED3DPT_TRIANGLELIST:
return GL_TRIANGLES;
case WINED3DPT_TRIANGLESTRIP:
return GL_TRIANGLE_STRIP;
case WINED3DPT_TRIANGLEFAN:
return GL_TRIANGLE_FAN;
case WINED3DPT_LINELIST_ADJ:
return GL_LINES_ADJACENCY_ARB;
case WINED3DPT_LINESTRIP_ADJ:
return GL_LINE_STRIP_ADJACENCY_ARB;
case WINED3DPT_TRIANGLELIST_ADJ:
return GL_TRIANGLES_ADJACENCY_ARB;
case WINED3DPT_TRIANGLESTRIP_ADJ:
return GL_TRIANGLE_STRIP_ADJACENCY_ARB;
default:
FIXME("Unhandled primitive type %s\n", debug_d3dprimitivetype(primitive_type));
return GL_NONE;
}
}
static BOOL fixed_get_input( static BOOL fixed_get_input(
BYTE usage, BYTE usage_idx, BYTE usage, BYTE usage_idx,
unsigned int* regnum) { unsigned int* regnum) {
...@@ -819,8 +777,8 @@ static inline void remove_vbos(IWineD3DDeviceImpl *This, WineDirect3DVertexStrid ...@@ -819,8 +777,8 @@ static inline void remove_vbos(IWineD3DDeviceImpl *This, WineDirect3DVertexStrid
} }
/* Routine common to the draw primitive and draw indexed primitive routines */ /* Routine common to the draw primitive and draw indexed primitive routines */
void drawPrimitive(IWineD3DDevice *iface, WINED3DPRIMITIVETYPE PrimitiveType, UINT index_count, void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT numberOfVertices,
UINT numberOfVertices, UINT StartIdx, UINT idxSize, const void *idxData, UINT minIndex) UINT StartIdx, UINT idxSize, const void *idxData, UINT minIndex)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
...@@ -854,13 +812,10 @@ void drawPrimitive(IWineD3DDevice *iface, WINED3DPRIMITIVETYPE PrimitiveType, UI ...@@ -854,13 +812,10 @@ void drawPrimitive(IWineD3DDevice *iface, WINED3DPRIMITIVETYPE PrimitiveType, UI
/* Ok, we will be updating the screen from here onwards so grab the lock */ /* Ok, we will be updating the screen from here onwards so grab the lock */
ENTER_GL(); ENTER_GL();
{ {
GLenum glPrimType; GLenum glPrimType = This->stateBlock->gl_primitive_type;
BOOL emulation = FALSE; BOOL emulation = FALSE;
const WineDirect3DVertexStridedData *strided = &This->strided_streams; const WineDirect3DVertexStridedData *strided = &This->strided_streams;
WineDirect3DVertexStridedData stridedlcl; WineDirect3DVertexStridedData stridedlcl;
/* Ok, Work out which primitive is requested and how many vertexes that
will be */
glPrimType = primitive_to_gl(PrimitiveType);
if (!numberOfVertices) numberOfVertices = index_count; if (!numberOfVertices) numberOfVertices = index_count;
......
...@@ -77,6 +77,7 @@ static void stateblock_savedstates_copy(IWineD3DStateBlock* iface, SAVEDSTATES * ...@@ -77,6 +77,7 @@ static void stateblock_savedstates_copy(IWineD3DStateBlock* iface, SAVEDSTATES *
unsigned bsize = sizeof(BOOL); unsigned bsize = sizeof(BOOL);
/* Single values */ /* Single values */
dest->primitive_type = source->primitive_type;
dest->indices = source->indices; dest->indices = source->indices;
dest->material = source->material; dest->material = source->material;
dest->viewport = source->viewport; dest->viewport = source->viewport;
...@@ -121,6 +122,7 @@ void stateblock_savedstates_set( ...@@ -121,6 +122,7 @@ void stateblock_savedstates_set(
unsigned bsize = sizeof(BOOL); unsigned bsize = sizeof(BOOL);
/* Single values */ /* Single values */
states->primitive_type = value;
states->indices = value; states->indices = value;
states->material = value; states->material = value;
states->viewport = value; states->viewport = value;
...@@ -188,6 +190,7 @@ void stateblock_copy( ...@@ -188,6 +190,7 @@ void stateblock_copy(
stateblock_savedstates_copy(source, &Dest->changed, &This->changed); stateblock_savedstates_copy(source, &Dest->changed, &This->changed);
/* Single items */ /* Single items */
Dest->gl_primitive_type = This->gl_primitive_type;
Dest->vertexDecl = This->vertexDecl; Dest->vertexDecl = This->vertexDecl;
Dest->vertexShader = This->vertexShader; Dest->vertexShader = This->vertexShader;
Dest->streamIsUP = This->streamIsUP; Dest->streamIsUP = This->streamIsUP;
...@@ -499,6 +502,8 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) ...@@ -499,6 +502,8 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
targetStateBlock->transforms[This->contained_transform_states[i]]; targetStateBlock->transforms[This->contained_transform_states[i]];
} }
if (This->changed.primitive_type) This->gl_primitive_type = targetStateBlock->gl_primitive_type;
if (This->changed.indices && ((This->pIndexData != targetStateBlock->pIndexData) if (This->changed.indices && ((This->pIndexData != targetStateBlock->pIndexData)
|| (This->baseVertexIndex != targetStateBlock->baseVertexIndex))) { || (This->baseVertexIndex != targetStateBlock->baseVertexIndex))) {
TRACE("Updating pIndexData to %p, baseVertexIndex to %d\n", TRACE("Updating pIndexData to %p, baseVertexIndex to %d\n",
...@@ -628,6 +633,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) ...@@ -628,6 +633,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
memcpy(This->vertexShaderConstantB, targetStateBlock->vertexShaderConstantB, sizeof(This->vertexShaderConstantI)); memcpy(This->vertexShaderConstantB, targetStateBlock->vertexShaderConstantB, sizeof(This->vertexShaderConstantI));
memcpy(This->vertexShaderConstantI, targetStateBlock->vertexShaderConstantI, sizeof(This->vertexShaderConstantF)); memcpy(This->vertexShaderConstantI, targetStateBlock->vertexShaderConstantI, sizeof(This->vertexShaderConstantF));
memcpy(This->vertexShaderConstantF, targetStateBlock->vertexShaderConstantF, sizeof(float) * GL_LIMITS(vshader_constantsF) * 4); memcpy(This->vertexShaderConstantF, targetStateBlock->vertexShaderConstantF, sizeof(float) * GL_LIMITS(vshader_constantsF) * 4);
This->gl_primitive_type = targetStateBlock->gl_primitive_type;
memcpy(This->streamStride, targetStateBlock->streamStride, sizeof(This->streamStride)); memcpy(This->streamStride, targetStateBlock->streamStride, sizeof(This->streamStride));
memcpy(This->streamOffset, targetStateBlock->streamOffset, sizeof(This->streamOffset)); memcpy(This->streamOffset, targetStateBlock->streamOffset, sizeof(This->streamOffset));
memcpy(This->streamFreq, targetStateBlock->streamFreq, sizeof(This->streamFreq)); memcpy(This->streamFreq, targetStateBlock->streamFreq, sizeof(This->streamFreq));
...@@ -827,6 +833,12 @@ should really perform a delta so that only the changes get updated*/ ...@@ -827,6 +833,12 @@ should really perform a delta so that only the changes get updated*/
&This->transforms[This->contained_transform_states[i]]); &This->transforms[This->contained_transform_states[i]]);
} }
if (This->changed.primitive_type)
{
This->wineD3DDevice->updateStateBlock->changed.primitive_type = TRUE;
This->wineD3DDevice->updateStateBlock->gl_primitive_type = This->gl_primitive_type;
}
if (This->changed.indices) { if (This->changed.indices) {
IWineD3DDevice_SetIndices(pDevice, This->pIndexData); IWineD3DDevice_SetIndices(pDevice, This->pIndexData);
IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex); IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex);
...@@ -1009,6 +1021,7 @@ should really perform a delta so that only the changes get updated*/ ...@@ -1009,6 +1021,7 @@ should really perform a delta so that only the changes get updated*/
for(i = 1; i <= HIGHEST_TRANSFORMSTATE; i++) { for(i = 1; i <= HIGHEST_TRANSFORMSTATE; i++) {
IWineD3DDevice_SetTransform(pDevice, i, &This->transforms[i]); IWineD3DDevice_SetTransform(pDevice, i, &This->transforms[i]);
} }
This->wineD3DDevice->updateStateBlock->gl_primitive_type = This->gl_primitive_type;
IWineD3DDevice_SetIndices(pDevice, This->pIndexData); IWineD3DDevice_SetIndices(pDevice, This->pIndexData);
IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex); IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex);
IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl); IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl);
......
...@@ -653,8 +653,8 @@ extern LONG primCounter; ...@@ -653,8 +653,8 @@ extern LONG primCounter;
*/ */
/* Routine common to the draw primitive and draw indexed primitive routines */ /* Routine common to the draw primitive and draw indexed primitive routines */
void drawPrimitive(IWineD3DDevice *iface, WINED3DPRIMITIVETYPE PrimitiveType, UINT index_count, void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT numberOfVertices,
UINT numberOfVertices, UINT start_idx, UINT idxBytes, const void *idxData, UINT minIndex); UINT start_idx, UINT idxBytes, const void *idxData, UINT minIndex);
void primitiveDeclarationConvertToStridedData( void primitiveDeclarationConvertToStridedData(
IWineD3DDevice *iface, IWineD3DDevice *iface,
...@@ -1796,14 +1796,15 @@ typedef struct SAVEDSTATES { ...@@ -1796,14 +1796,15 @@ typedef struct SAVEDSTATES {
WORD vertexShaderConstantsB; /* MAX_CONST_B, 16 */ WORD vertexShaderConstantsB; /* MAX_CONST_B, 16 */
WORD vertexShaderConstantsI; /* MAX_CONST_I, 16 */ WORD vertexShaderConstantsI; /* MAX_CONST_I, 16 */
BOOL *vertexShaderConstantsF; BOOL *vertexShaderConstantsF;
BYTE indices : 1; WORD primitive_type : 1;
BYTE material : 1; WORD indices : 1;
BYTE viewport : 1; WORD material : 1;
BYTE vertexDecl : 1; WORD viewport : 1;
BYTE pixelShader : 1; WORD vertexDecl : 1;
BYTE vertexShader : 1; WORD pixelShader : 1;
BYTE scissorRect : 1; WORD vertexShader : 1;
BYTE padding : 1; WORD scissorRect : 1;
WORD padding : 1;
} SAVEDSTATES; } SAVEDSTATES;
struct StageState { struct StageState {
...@@ -1835,6 +1836,9 @@ struct IWineD3DStateBlockImpl ...@@ -1835,6 +1836,9 @@ struct IWineD3DStateBlockImpl
INT vertexShaderConstantI[MAX_CONST_I * 4]; INT vertexShaderConstantI[MAX_CONST_I * 4];
float *vertexShaderConstantF; float *vertexShaderConstantF;
/* primitive type */
GLenum gl_primitive_type;
/* Stream Source */ /* Stream Source */
BOOL streamIsUP; BOOL streamIsUP;
UINT streamStride[MAX_STREAMS]; UINT streamStride[MAX_STREAMS];
......
...@@ -3485,26 +3485,28 @@ interface IWineD3DDevice : IWineD3DBase ...@@ -3485,26 +3485,28 @@ interface IWineD3DDevice : IWineD3DBase
[in] IWineD3DRendertargetView *rendertarget_view, [in] IWineD3DRendertargetView *rendertarget_view,
[in] const float color[4] [in] const float color[4]
); );
void SetPrimitiveType(
[in] WINED3DPRIMITIVETYPE primitive_topology
);
void GetPrimitiveType(
[out] WINED3DPRIMITIVETYPE *primitive_topology
);
HRESULT DrawPrimitive( HRESULT DrawPrimitive(
[in] WINED3DPRIMITIVETYPE primitive_type,
[in] UINT start_vertex, [in] UINT start_vertex,
[in] UINT vertex_count [in] UINT vertex_count
); );
HRESULT DrawIndexedPrimitive( HRESULT DrawIndexedPrimitive(
[in] WINED3DPRIMITIVETYPE primitive_type,
[in] UINT min_vertex_idx, [in] UINT min_vertex_idx,
[in] UINT vertex_count, [in] UINT vertex_count,
[in] UINT start_idx, [in] UINT start_idx,
[in] UINT index_count [in] UINT index_count
); );
HRESULT DrawPrimitiveUP( HRESULT DrawPrimitiveUP(
[in] WINED3DPRIMITIVETYPE primitive_type,
[in] UINT vertex_count, [in] UINT vertex_count,
[in] const void *stream_data, [in] const void *stream_data,
[in] UINT stream_stride [in] UINT stream_stride
); );
HRESULT DrawIndexedPrimitiveUP( HRESULT DrawIndexedPrimitiveUP(
[in] WINED3DPRIMITIVETYPE primitive_type,
[in] UINT min_vertex_idx, [in] UINT min_vertex_idx,
[in] UINT vertex_count, [in] UINT vertex_count,
[in] UINT index_count, [in] UINT index_count,
...@@ -3514,12 +3516,10 @@ interface IWineD3DDevice : IWineD3DBase ...@@ -3514,12 +3516,10 @@ interface IWineD3DDevice : IWineD3DBase
[in] UINT stream_stride [in] UINT stream_stride
); );
HRESULT DrawPrimitiveStrided( HRESULT DrawPrimitiveStrided(
[in] WINED3DPRIMITIVETYPE primitive_type,
[in] UINT vertex_count, [in] UINT vertex_count,
[in] const WineDirect3DVertexStridedData *strided_data [in] const WineDirect3DVertexStridedData *strided_data
); );
HRESULT DrawIndexedPrimitiveStrided( HRESULT DrawIndexedPrimitiveStrided(
[in] WINED3DPRIMITIVETYPE primitive_type,
[in] UINT index_count, [in] UINT index_count,
[in] const WineDirect3DVertexStridedData *strided_data, [in] const WineDirect3DVertexStridedData *strided_data,
[in] UINT vertex_count, [in] UINT vertex_count,
......
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