wined3d: Introduce a structure for stream state.
This commit is contained in:
parent
0b15963b4e
commit
6ce848bee4
|
@ -231,10 +231,10 @@ static BOOL buffer_process_converted_attribute(struct wined3d_buffer *This,
|
||||||
const enum wined3d_buffer_conversion_type conversion_type,
|
const enum wined3d_buffer_conversion_type conversion_type,
|
||||||
const struct wined3d_stream_info_element *attrib, DWORD *stride_this_run)
|
const struct wined3d_stream_info_element *attrib, DWORD *stride_this_run)
|
||||||
{
|
{
|
||||||
|
DWORD offset = This->resource.device->stateBlock->streams[attrib->stream_idx].offset;
|
||||||
DWORD attrib_size;
|
DWORD attrib_size;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
DWORD offset = This->resource.device->stateBlock->streamOffset[attrib->stream_idx];
|
|
||||||
DWORD_PTR data;
|
DWORD_PTR data;
|
||||||
|
|
||||||
/* Check for some valid situations which cause us pain. One is if the buffer is used for
|
/* Check for some valid situations which cause us pain. One is if the buffer is used for
|
||||||
|
|
|
@ -191,6 +191,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
|
||||||
for (i = 0; i < declaration->element_count; ++i)
|
for (i = 0; i < declaration->element_count; ++i)
|
||||||
{
|
{
|
||||||
const struct wined3d_vertex_declaration_element *element = &declaration->elements[i];
|
const struct wined3d_vertex_declaration_element *element = &declaration->elements[i];
|
||||||
|
struct wined3d_buffer *buffer = This->stateBlock->streams[element->input_slot].buffer;
|
||||||
GLuint buffer_object = 0;
|
GLuint buffer_object = 0;
|
||||||
const BYTE *data = NULL;
|
const BYTE *data = NULL;
|
||||||
BOOL stride_used;
|
BOOL stride_used;
|
||||||
|
@ -200,20 +201,19 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
|
||||||
TRACE("%p Element %p (%u of %u)\n", declaration->elements,
|
TRACE("%p Element %p (%u of %u)\n", declaration->elements,
|
||||||
element, i + 1, declaration->element_count);
|
element, i + 1, declaration->element_count);
|
||||||
|
|
||||||
if (!This->stateBlock->streamSource[element->input_slot]) continue;
|
if (!buffer) continue;
|
||||||
|
|
||||||
stride = This->stateBlock->streamStride[element->input_slot];
|
stride = This->stateBlock->streams[element->input_slot].stride;
|
||||||
if (This->stateBlock->streamIsUP)
|
if (This->stateBlock->streamIsUP)
|
||||||
{
|
{
|
||||||
TRACE("Stream %u is UP, %p\n", element->input_slot, This->stateBlock->streamSource[element->input_slot]);
|
TRACE("Stream %u is UP, %p\n", element->input_slot, buffer);
|
||||||
buffer_object = 0;
|
buffer_object = 0;
|
||||||
data = (BYTE *)This->stateBlock->streamSource[element->input_slot];
|
data = (BYTE *)buffer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TRACE("Stream %u isn't UP, %p\n", element->input_slot, This->stateBlock->streamSource[element->input_slot]);
|
TRACE("Stream %u isn't UP, %p\n", element->input_slot, buffer);
|
||||||
data = buffer_get_memory(This->stateBlock->streamSource[element->input_slot],
|
data = buffer_get_memory((IWineD3DBuffer *)buffer, &This->adapter->gl_info, &buffer_object);
|
||||||
&This->adapter->gl_info, &buffer_object);
|
|
||||||
|
|
||||||
/* Can't use vbo's if the base vertex index is negative. OpenGL doesn't accept negative offsets
|
/* Can't use vbo's if the base vertex index is negative. OpenGL doesn't accept negative offsets
|
||||||
* (or rather offsets bigger than the vbo, because the pointer is unsigned), so use system memory
|
* (or rather offsets bigger than the vbo, because the pointer is unsigned), so use system memory
|
||||||
|
@ -224,8 +224,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
|
||||||
{
|
{
|
||||||
WARN("loadBaseVertexIndex is < 0 (%d), not using vbos\n", This->stateBlock->loadBaseVertexIndex);
|
WARN("loadBaseVertexIndex is < 0 (%d), not using vbos\n", This->stateBlock->loadBaseVertexIndex);
|
||||||
buffer_object = 0;
|
buffer_object = 0;
|
||||||
data = buffer_get_sysmem((struct wined3d_buffer *)This->stateBlock->streamSource[element->input_slot],
|
data = buffer_get_sysmem(buffer, &This->adapter->gl_info);
|
||||||
&This->adapter->gl_info);
|
|
||||||
if ((UINT_PTR)data < -This->stateBlock->loadBaseVertexIndex * stride)
|
if ((UINT_PTR)data < -This->stateBlock->loadBaseVertexIndex * stride)
|
||||||
{
|
{
|
||||||
FIXME("System memory vertex data load offset is negative!\n");
|
FIXME("System memory vertex data load offset is negative!\n");
|
||||||
|
@ -316,12 +315,11 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
|
||||||
{
|
{
|
||||||
struct wined3d_stream_info_element *element;
|
struct wined3d_stream_info_element *element;
|
||||||
struct wined3d_buffer *buffer;
|
struct wined3d_buffer *buffer;
|
||||||
struct wined3d_event_query *query;
|
|
||||||
|
|
||||||
if (!(map & 1)) continue;
|
if (!(map & 1)) continue;
|
||||||
|
|
||||||
element = &stream_info->elements[i];
|
element = &stream_info->elements[i];
|
||||||
buffer = (struct wined3d_buffer *)This->stateBlock->streamSource[element->stream_idx];
|
buffer = This->stateBlock->streams[element->stream_idx].buffer;
|
||||||
IWineD3DBuffer_PreLoad((IWineD3DBuffer *)buffer);
|
IWineD3DBuffer_PreLoad((IWineD3DBuffer *)buffer);
|
||||||
|
|
||||||
/* If PreLoad dropped the buffer object, update the stream info. */
|
/* If PreLoad dropped the buffer object, update the stream info. */
|
||||||
|
@ -331,11 +329,8 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
|
||||||
element->data = buffer_get_sysmem(buffer, &This->adapter->gl_info) + (ptrdiff_t)element->data;
|
element->data = buffer_get_sysmem(buffer, &This->adapter->gl_info) + (ptrdiff_t)element->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
query = ((struct wined3d_buffer *) buffer)->query;
|
if (buffer->query)
|
||||||
if(query)
|
This->buffer_queries[This->num_buffer_queries++] = buffer->query;
|
||||||
{
|
|
||||||
This->buffer_queries[This->num_buffer_queries++] = query;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2269,8 +2264,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface,
|
||||||
IWineD3DBuffer *pStreamData, UINT OffsetInBytes, UINT Stride)
|
IWineD3DBuffer *pStreamData, UINT OffsetInBytes, UINT Stride)
|
||||||
{
|
{
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
struct wined3d_stream_state *stream;
|
||||||
IWineD3DBuffer *oldSrc;
|
IWineD3DBuffer *oldSrc;
|
||||||
|
|
||||||
|
TRACE("iface %p, stream_idx %u, buffer %p, offset %u, stride %u.\n",
|
||||||
|
iface, StreamNumber, pStreamData, OffsetInBytes, Stride);
|
||||||
|
|
||||||
if (StreamNumber >= MAX_STREAMS) {
|
if (StreamNumber >= MAX_STREAMS) {
|
||||||
WARN("Stream out of range %d\n", StreamNumber);
|
WARN("Stream out of range %d\n", StreamNumber);
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -2279,22 +2278,24 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface,
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
oldSrc = This->updateStateBlock->streamSource[StreamNumber];
|
stream = &This->updateStateBlock->streams[StreamNumber];
|
||||||
TRACE("(%p) : StreamNo: %u, OldStream (%p), NewStream (%p), OffsetInBytes %u, NewStride %u\n", This, StreamNumber, oldSrc, pStreamData, OffsetInBytes, Stride);
|
oldSrc = (IWineD3DBuffer *)stream->buffer;
|
||||||
|
|
||||||
This->updateStateBlock->changed.streamSource |= 1 << StreamNumber;
|
This->updateStateBlock->changed.streamSource |= 1 << StreamNumber;
|
||||||
|
|
||||||
if(oldSrc == pStreamData &&
|
if (oldSrc == pStreamData
|
||||||
This->updateStateBlock->streamStride[StreamNumber] == Stride &&
|
&& stream->stride == Stride
|
||||||
This->updateStateBlock->streamOffset[StreamNumber] == OffsetInBytes) {
|
&& stream->offset == OffsetInBytes)
|
||||||
|
{
|
||||||
TRACE("Application is setting the old values over, nothing to do\n");
|
TRACE("Application is setting the old values over, nothing to do\n");
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
This->updateStateBlock->streamSource[StreamNumber] = pStreamData;
|
stream->buffer = (struct wined3d_buffer *)pStreamData;
|
||||||
if (pStreamData) {
|
if (pStreamData)
|
||||||
This->updateStateBlock->streamStride[StreamNumber] = Stride;
|
{
|
||||||
This->updateStateBlock->streamOffset[StreamNumber] = OffsetInBytes;
|
stream->stride = Stride;
|
||||||
|
stream->offset = OffsetInBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle recording of state blocks */
|
/* Handle recording of state blocks */
|
||||||
|
@ -2325,21 +2326,21 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSource(IWineD3DDevice *iface,
|
||||||
UINT StreamNumber, IWineD3DBuffer **pStream, UINT *pOffset, UINT *pStride)
|
UINT StreamNumber, IWineD3DBuffer **pStream, UINT *pOffset, UINT *pStride)
|
||||||
{
|
{
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
struct wined3d_stream_state *stream;
|
||||||
|
|
||||||
TRACE("(%p) : StreamNo: %u, Stream (%p), Offset %u, Stride %u\n", This, StreamNumber,
|
TRACE("iface %p, stream_idx %u, buffer %p, offset %p, stride %p.\n",
|
||||||
This->stateBlock->streamSource[StreamNumber],
|
iface, StreamNumber, pStream, pOffset, pStride);
|
||||||
This->stateBlock->streamOffset[StreamNumber],
|
|
||||||
This->stateBlock->streamStride[StreamNumber]);
|
|
||||||
|
|
||||||
if (StreamNumber >= MAX_STREAMS) {
|
if (StreamNumber >= MAX_STREAMS)
|
||||||
|
{
|
||||||
WARN("Stream out of range %d\n", StreamNumber);
|
WARN("Stream out of range %d\n", StreamNumber);
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
*pStream = This->stateBlock->streamSource[StreamNumber];
|
|
||||||
*pStride = This->stateBlock->streamStride[StreamNumber];
|
stream = &This->stateBlock->streams[StreamNumber];
|
||||||
if (pOffset) {
|
*pStream = (IWineD3DBuffer *)stream->buffer;
|
||||||
*pOffset = This->stateBlock->streamOffset[StreamNumber];
|
*pStride = stream->stride;
|
||||||
}
|
if (pOffset) *pOffset = stream->offset;
|
||||||
|
|
||||||
if (*pStream) IWineD3DBuffer_AddRef(*pStream);
|
if (*pStream) IWineD3DBuffer_AddRef(*pStream);
|
||||||
|
|
||||||
|
@ -2348,11 +2349,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSource(IWineD3DDevice *iface,
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSourceFreq(IWineD3DDevice *iface, UINT StreamNumber, UINT Divider) {
|
static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSourceFreq(IWineD3DDevice *iface, UINT StreamNumber, UINT Divider) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
UINT oldFlags = This->updateStateBlock->streamFlags[StreamNumber];
|
struct wined3d_stream_state *stream;
|
||||||
UINT oldFreq = This->updateStateBlock->streamFreq[StreamNumber];
|
UINT oldFlags, oldFreq;
|
||||||
|
|
||||||
/* Verify input at least in d3d9 this is invalid*/
|
TRACE("iface %p, stream_idx %u, divider %#x.\n", iface, StreamNumber, Divider);
|
||||||
if( (Divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && (Divider & WINED3DSTREAMSOURCE_INDEXEDDATA)){
|
|
||||||
|
/* Verify input at least in d3d9 this is invalid. */
|
||||||
|
if ((Divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && (Divider & WINED3DSTREAMSOURCE_INDEXEDDATA))
|
||||||
|
{
|
||||||
WARN("INSTANCEDATA and INDEXEDDATA were set, returning D3DERR_INVALIDCALL\n");
|
WARN("INSTANCEDATA and INDEXEDDATA were set, returning D3DERR_INVALIDCALL\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
@ -2367,27 +2371,31 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSourceFreq(IWineD3DDevice *ifa
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("(%p) StreamNumber(%d), Divider(%d)\n", This, StreamNumber, Divider);
|
stream = &This->updateStateBlock->streams[StreamNumber];
|
||||||
This->updateStateBlock->streamFlags[StreamNumber] = Divider & (WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA );
|
oldFlags = stream->flags;
|
||||||
|
oldFreq = stream->frequency;
|
||||||
|
|
||||||
|
stream->flags = Divider & (WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA);
|
||||||
|
stream->frequency = Divider & 0x7FFFFF;
|
||||||
|
|
||||||
This->updateStateBlock->changed.streamFreq |= 1 << StreamNumber;
|
This->updateStateBlock->changed.streamFreq |= 1 << StreamNumber;
|
||||||
This->updateStateBlock->streamFreq[StreamNumber] = Divider & 0x7FFFFF;
|
|
||||||
|
|
||||||
if(This->updateStateBlock->streamFreq[StreamNumber] != oldFreq ||
|
if (stream->frequency != oldFreq || stream->flags != oldFlags)
|
||||||
This->updateStateBlock->streamFlags[StreamNumber] != oldFlags) {
|
|
||||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
|
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
|
||||||
}
|
|
||||||
|
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSourceFreq(IWineD3DDevice *iface, UINT StreamNumber, UINT* Divider) {
|
static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSourceFreq(IWineD3DDevice *iface, UINT StreamNumber, UINT* Divider) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
struct wined3d_stream_state *stream;
|
||||||
|
|
||||||
TRACE("(%p) StreamNumber(%d), Divider(%p)\n", This, StreamNumber, Divider);
|
TRACE("iface %p, stream_idx %u, divider %p.\n", iface, StreamNumber, Divider);
|
||||||
*Divider = This->updateStateBlock->streamFreq[StreamNumber] | This->updateStateBlock->streamFlags[StreamNumber];
|
|
||||||
|
|
||||||
TRACE("(%p) : returning %d\n", This, *Divider);
|
stream = &This->updateStateBlock->streams[StreamNumber];
|
||||||
|
*Divider = stream->flags | stream->frequency;
|
||||||
|
|
||||||
|
TRACE("Returning %#x.\n", *Divider);
|
||||||
|
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
@ -4167,7 +4175,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface,
|
||||||
e = &stream_info.elements[i];
|
e = &stream_info.elements[i];
|
||||||
if (e->buffer_object)
|
if (e->buffer_object)
|
||||||
{
|
{
|
||||||
struct wined3d_buffer *vb = (struct wined3d_buffer *)This->stateBlock->streamSource[e->stream_idx];
|
struct wined3d_buffer *vb = This->stateBlock->streams[e->stream_idx].buffer;
|
||||||
e->buffer_object = 0;
|
e->buffer_object = 0;
|
||||||
e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, gl_info));
|
e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, gl_info));
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
|
@ -4716,6 +4724,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface,
|
||||||
const void *pVertexStreamZeroData, UINT VertexStreamZeroStride)
|
const void *pVertexStreamZeroData, UINT VertexStreamZeroStride)
|
||||||
{
|
{
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
struct wined3d_stream_state *stream;
|
||||||
IWineD3DBuffer *vb;
|
IWineD3DBuffer *vb;
|
||||||
|
|
||||||
TRACE("(%p) : vertex count %u, pVtxData %p, stride %u\n",
|
TRACE("(%p) : vertex count %u, pVtxData %p, stride %u\n",
|
||||||
|
@ -4727,11 +4736,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note in the following, it's not this type, but that's the purpose of streamIsUP */
|
/* Note in the following, it's not this type, but that's the purpose of streamIsUP */
|
||||||
vb = This->stateBlock->streamSource[0];
|
stream = &This->stateBlock->streams[0];
|
||||||
This->stateBlock->streamSource[0] = (IWineD3DBuffer *)pVertexStreamZeroData;
|
vb = (IWineD3DBuffer *)stream->buffer;
|
||||||
|
stream->buffer = (struct wined3d_buffer *)pVertexStreamZeroData;
|
||||||
if (vb) IWineD3DBuffer_Release(vb);
|
if (vb) IWineD3DBuffer_Release(vb);
|
||||||
This->stateBlock->streamOffset[0] = 0;
|
stream->offset = 0;
|
||||||
This->stateBlock->streamStride[0] = VertexStreamZeroStride;
|
stream->stride = VertexStreamZeroStride;
|
||||||
This->stateBlock->streamIsUP = TRUE;
|
This->stateBlock->streamIsUP = TRUE;
|
||||||
This->stateBlock->loadBaseVertexIndex = 0;
|
This->stateBlock->loadBaseVertexIndex = 0;
|
||||||
|
|
||||||
|
@ -4741,8 +4751,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface,
|
||||||
drawPrimitive(iface, vertex_count, 0 /* start_idx */, 0 /* indxSize*/, NULL /* indxData */);
|
drawPrimitive(iface, vertex_count, 0 /* start_idx */, 0 /* indxSize*/, NULL /* indxData */);
|
||||||
|
|
||||||
/* MSDN specifies stream zero settings must be set to NULL */
|
/* MSDN specifies stream zero settings must be set to NULL */
|
||||||
This->stateBlock->streamStride[0] = 0;
|
stream->buffer = NULL;
|
||||||
This->stateBlock->streamSource[0] = NULL;
|
stream->stride = 0;
|
||||||
|
|
||||||
/* stream zero settings set to null at end, as per the msdn. No need to mark dirty here, the app has to set
|
/* stream zero settings set to null at end, as per the msdn. No need to mark dirty here, the app has to set
|
||||||
* the new stream sources or use UP drawing again
|
* the new stream sources or use UP drawing again
|
||||||
|
@ -4756,6 +4766,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
|
||||||
{
|
{
|
||||||
int idxStride;
|
int idxStride;
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
struct wined3d_stream_state *stream;
|
||||||
IWineD3DBuffer *vb;
|
IWineD3DBuffer *vb;
|
||||||
IWineD3DBuffer *ib;
|
IWineD3DBuffer *ib;
|
||||||
|
|
||||||
|
@ -4774,12 +4785,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note in the following, it's not this type, but that's the purpose of streamIsUP */
|
/* Note in the following, it's not this type, but that's the purpose of streamIsUP */
|
||||||
vb = This->stateBlock->streamSource[0];
|
stream = &This->stateBlock->streams[0];
|
||||||
This->stateBlock->streamSource[0] = (IWineD3DBuffer *)pVertexStreamZeroData;
|
vb = (IWineD3DBuffer *)stream->buffer;
|
||||||
|
stream->buffer = (struct wined3d_buffer *)pVertexStreamZeroData;
|
||||||
if (vb) IWineD3DBuffer_Release(vb);
|
if (vb) IWineD3DBuffer_Release(vb);
|
||||||
|
stream->offset = 0;
|
||||||
|
stream->stride = VertexStreamZeroStride;
|
||||||
This->stateBlock->streamIsUP = TRUE;
|
This->stateBlock->streamIsUP = TRUE;
|
||||||
This->stateBlock->streamOffset[0] = 0;
|
|
||||||
This->stateBlock->streamStride[0] = VertexStreamZeroStride;
|
|
||||||
|
|
||||||
/* Set to 0 as per msdn. Do it now due to the stream source loading during drawPrimitive */
|
/* Set to 0 as per msdn. Do it now due to the stream source loading during drawPrimitive */
|
||||||
This->stateBlock->baseVertexIndex = 0;
|
This->stateBlock->baseVertexIndex = 0;
|
||||||
|
@ -4791,8 +4803,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
|
||||||
drawPrimitive(iface, index_count, 0 /* start_idx */, idxStride, pIndexData);
|
drawPrimitive(iface, index_count, 0 /* start_idx */, idxStride, pIndexData);
|
||||||
|
|
||||||
/* MSDN specifies stream zero settings and index buffer must be set to NULL */
|
/* MSDN specifies stream zero settings and index buffer must be set to NULL */
|
||||||
This->stateBlock->streamSource[0] = NULL;
|
stream->buffer = NULL;
|
||||||
This->stateBlock->streamStride[0] = 0;
|
stream->stride = 0;
|
||||||
ib = This->stateBlock->pIndexData;
|
ib = This->stateBlock->pIndexData;
|
||||||
if(ib) {
|
if(ib) {
|
||||||
IWineD3DBuffer_Release(ib);
|
IWineD3DBuffer_Release(ib);
|
||||||
|
@ -6577,19 +6589,19 @@ void device_resource_released(IWineD3DDeviceImpl *device, IWineD3DResource *reso
|
||||||
case WINED3DRTYPE_BUFFER:
|
case WINED3DRTYPE_BUFFER:
|
||||||
for (i = 0; i < MAX_STREAMS; ++i)
|
for (i = 0; i < MAX_STREAMS; ++i)
|
||||||
{
|
{
|
||||||
if (device->stateBlock && device->stateBlock->streamSource[i] == (IWineD3DBuffer *)resource)
|
if (device->stateBlock && device->stateBlock->streams[i].buffer == (struct wined3d_buffer *)resource)
|
||||||
{
|
{
|
||||||
ERR("Buffer %p is still in use by stateblock %p, stream %u.\n",
|
ERR("Buffer %p is still in use by stateblock %p, stream %u.\n",
|
||||||
resource, device->stateBlock, i);
|
resource, device->stateBlock, i);
|
||||||
device->stateBlock->streamSource[i] = NULL;
|
device->stateBlock->streams[i].buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->updateStateBlock != device->stateBlock
|
if (device->updateStateBlock != device->stateBlock
|
||||||
&& device->updateStateBlock->streamSource[i] == (IWineD3DBuffer *)resource)
|
&& device->updateStateBlock->streams[i].buffer == (struct wined3d_buffer *)resource)
|
||||||
{
|
{
|
||||||
ERR("Buffer %p is still in use by stateblock %p, stream %u.\n",
|
ERR("Buffer %p is still in use by stateblock %p, stream %u.\n",
|
||||||
resource, device->updateStateBlock, i);
|
resource, device->updateStateBlock, i);
|
||||||
device->updateStateBlock->streamSource[i] = NULL;
|
device->updateStateBlock->streams[i].buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,9 +69,9 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
||||||
const DWORD *pIdxBufL = NULL;
|
const DWORD *pIdxBufL = NULL;
|
||||||
UINT vx_index;
|
UINT vx_index;
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
const UINT *streamOffset = This->stateBlock->streamOffset;
|
const struct wined3d_stream_state *streams = This->stateBlock->streams;
|
||||||
LONG SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex;
|
LONG SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex;
|
||||||
BOOL pixelShader = use_ps(This->stateBlock);
|
BOOL pixelShader = use_ps(This->stateBlock);
|
||||||
BOOL specular_fog = FALSE;
|
BOOL specular_fog = FALSE;
|
||||||
const BYTE *texCoords[WINED3DDP_MAXTEXCOORD];
|
const BYTE *texCoords[WINED3DDP_MAXTEXCOORD];
|
||||||
const BYTE *diffuse = NULL, *specular = NULL, *normal = NULL, *position = NULL;
|
const BYTE *diffuse = NULL, *specular = NULL, *normal = NULL, *position = NULL;
|
||||||
|
@ -106,13 +106,13 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
||||||
if (si->use_map & (1 << WINED3D_FFP_POSITION))
|
if (si->use_map & (1 << WINED3D_FFP_POSITION))
|
||||||
{
|
{
|
||||||
element = &si->elements[WINED3D_FFP_POSITION];
|
element = &si->elements[WINED3D_FFP_POSITION];
|
||||||
position = element->data + streamOffset[element->stream_idx];
|
position = element->data + streams[element->stream_idx].offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (si->use_map & (1 << WINED3D_FFP_NORMAL))
|
if (si->use_map & (1 << WINED3D_FFP_NORMAL))
|
||||||
{
|
{
|
||||||
element = &si->elements[WINED3D_FFP_NORMAL];
|
element = &si->elements[WINED3D_FFP_NORMAL];
|
||||||
normal = element->data + streamOffset[element->stream_idx];
|
normal = element->data + streams[element->stream_idx].offset;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
||||||
if (si->use_map & (1 << WINED3D_FFP_DIFFUSE))
|
if (si->use_map & (1 << WINED3D_FFP_DIFFUSE))
|
||||||
{
|
{
|
||||||
element = &si->elements[WINED3D_FFP_DIFFUSE];
|
element = &si->elements[WINED3D_FFP_DIFFUSE];
|
||||||
diffuse = element->data + streamOffset[element->stream_idx];
|
diffuse = element->data + streams[element->stream_idx].offset;
|
||||||
|
|
||||||
if (num_untracked_materials && element->format->id != WINED3DFMT_B8G8R8A8_UNORM)
|
if (num_untracked_materials && element->format->id != WINED3DFMT_B8G8R8A8_UNORM)
|
||||||
FIXME("Implement diffuse color tracking from %s\n", debug_d3dformat(element->format->id));
|
FIXME("Implement diffuse color tracking from %s\n", debug_d3dformat(element->format->id));
|
||||||
|
@ -136,7 +136,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
||||||
if (si->use_map & (1 << WINED3D_FFP_SPECULAR))
|
if (si->use_map & (1 << WINED3D_FFP_SPECULAR))
|
||||||
{
|
{
|
||||||
element = &si->elements[WINED3D_FFP_SPECULAR];
|
element = &si->elements[WINED3D_FFP_SPECULAR];
|
||||||
specular = element->data + streamOffset[element->stream_idx];
|
specular = element->data + streams[element->stream_idx].offset;
|
||||||
|
|
||||||
/* special case where the fog density is stored in the specular alpha channel */
|
/* special case where the fog density is stored in the specular alpha channel */
|
||||||
if (This->stateBlock->renderState[WINED3DRS_FOGENABLE]
|
if (This->stateBlock->renderState[WINED3DRS_FOGENABLE]
|
||||||
|
@ -196,7 +196,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
||||||
if (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx)))
|
if (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx)))
|
||||||
{
|
{
|
||||||
element = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx];
|
element = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx];
|
||||||
texCoords[coordIdx] = element->data + streamOffset[element->stream_idx];
|
texCoords[coordIdx] = element->data + streams[element->stream_idx].offset;
|
||||||
tex_mask |= (1 << textureNo);
|
tex_mask |= (1 << textureNo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -466,7 +466,7 @@ static void drawStridedSlowVs(IWineD3DDevice *iface, const struct wined3d_stream
|
||||||
|
|
||||||
ptr = si->elements[i].data +
|
ptr = si->elements[i].data +
|
||||||
si->elements[i].stride * SkipnStrides +
|
si->elements[i].stride * SkipnStrides +
|
||||||
stateblock->streamOffset[si->elements[i].stream_idx];
|
stateblock->streams[si->elements[i].stream_idx].offset;
|
||||||
|
|
||||||
send_attribute(This, si->elements[i].format->id, i, ptr);
|
send_attribute(This, si->elements[i].format->id, i, ptr);
|
||||||
}
|
}
|
||||||
|
@ -505,13 +505,13 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, const struct wine
|
||||||
for (i = 0; i < MAX_STREAMS; ++i)
|
for (i = 0; i < MAX_STREAMS; ++i)
|
||||||
{
|
{
|
||||||
/* Look at the streams and take the first one which matches */
|
/* Look at the streams and take the first one which matches */
|
||||||
if (stateblock->streamSource[i] && ((stateblock->streamFlags[i] & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
if (stateblock->streams[i].buffer && ((stateblock->streams[i].flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
||||||
|| (stateblock->streamFlags[i] & WINED3DSTREAMSOURCE_INDEXEDDATA)))
|
|| (stateblock->streams[i].flags & WINED3DSTREAMSOURCE_INDEXEDDATA)))
|
||||||
{
|
{
|
||||||
/* Use the specified number of instances from the first matched
|
/* Use the specified number of instances from the first matched
|
||||||
* stream. A streamFreq of 0 (with INSTANCEDATA or INDEXEDDATA)
|
* stream. A streamFreq of 0 (with INSTANCEDATA or INDEXEDDATA)
|
||||||
* is handled as 1. See d3d9/tests/visual.c-> stream_test(). */
|
* is handled as 1. See d3d9/tests/visual.c-> stream_test(). */
|
||||||
numInstances = stateblock->streamFreq[i] ? stateblock->streamFreq[i] : 1;
|
numInstances = stateblock->streams[i].frequency ? stateblock->streams[i].frequency : 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -520,7 +520,7 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, const struct wine
|
||||||
{
|
{
|
||||||
if (!(si->use_map & (1 << i))) continue;
|
if (!(si->use_map & (1 << i))) continue;
|
||||||
|
|
||||||
if (stateblock->streamFlags[si->elements[i].stream_idx] & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
if (stateblock->streams[si->elements[i].stream_idx].flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
||||||
{
|
{
|
||||||
instancedData[numInstancedAttribs] = i;
|
instancedData[numInstancedAttribs] = i;
|
||||||
numInstancedAttribs++;
|
numInstancedAttribs++;
|
||||||
|
@ -533,11 +533,10 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, const struct wine
|
||||||
for(j = 0; j < numInstancedAttribs; j++) {
|
for(j = 0; j < numInstancedAttribs; j++) {
|
||||||
const BYTE *ptr = si->elements[instancedData[j]].data +
|
const BYTE *ptr = si->elements[instancedData[j]].data +
|
||||||
si->elements[instancedData[j]].stride * i +
|
si->elements[instancedData[j]].stride * i +
|
||||||
stateblock->streamOffset[si->elements[instancedData[j]].stream_idx];
|
stateblock->streams[si->elements[instancedData[j]].stream_idx].offset;
|
||||||
if (si->elements[instancedData[j]].buffer_object)
|
if (si->elements[instancedData[j]].buffer_object)
|
||||||
{
|
{
|
||||||
struct wined3d_buffer *vb =
|
struct wined3d_buffer *vb = stateblock->streams[si->elements[instancedData[j]].stream_idx].buffer;
|
||||||
(struct wined3d_buffer *)stateblock->streamSource[si->elements[instancedData[j]].stream_idx];
|
|
||||||
ptr += (ULONG_PTR)buffer_get_sysmem(vb, &This->adapter->gl_info);
|
ptr += (ULONG_PTR)buffer_get_sysmem(vb, &This->adapter->gl_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,7 +563,7 @@ static inline void remove_vbos(IWineD3DDeviceImpl *This, const struct wined3d_gl
|
||||||
e = &s->elements[i];
|
e = &s->elements[i];
|
||||||
if (e->buffer_object)
|
if (e->buffer_object)
|
||||||
{
|
{
|
||||||
struct wined3d_buffer *vb = (struct wined3d_buffer *)This->stateBlock->streamSource[e->stream_idx];
|
struct wined3d_buffer *vb = This->stateBlock->streams[e->stream_idx].buffer;
|
||||||
e->buffer_object = 0;
|
e->buffer_object = 0;
|
||||||
e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, gl_info));
|
e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, gl_info));
|
||||||
}
|
}
|
||||||
|
@ -801,8 +800,7 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
|
||||||
e = &stream_info.elements[WINED3D_FFP_POSITION];
|
e = &stream_info.elements[WINED3D_FFP_POSITION];
|
||||||
if (e->buffer_object)
|
if (e->buffer_object)
|
||||||
{
|
{
|
||||||
struct wined3d_buffer *vb;
|
struct wined3d_buffer *vb = This->stateBlock->streams[e->stream_idx].buffer;
|
||||||
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[e->stream_idx];
|
|
||||||
e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, context->gl_info));
|
e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, context->gl_info));
|
||||||
}
|
}
|
||||||
vtxStride = e->stride;
|
vtxStride = e->stride;
|
||||||
|
|
|
@ -3234,7 +3234,6 @@ static void unloadTexCoords(const struct wined3d_gl_info *gl_info)
|
||||||
static void loadTexCoords(const struct wined3d_gl_info *gl_info, IWineD3DStateBlockImpl *stateblock,
|
static void loadTexCoords(const struct wined3d_gl_info *gl_info, IWineD3DStateBlockImpl *stateblock,
|
||||||
const struct wined3d_stream_info *si, GLuint *curVBO)
|
const struct wined3d_stream_info *si, GLuint *curVBO)
|
||||||
{
|
{
|
||||||
const UINT *offset = stateblock->streamOffset;
|
|
||||||
unsigned int mapped_stage = 0;
|
unsigned int mapped_stage = 0;
|
||||||
unsigned int textureNo = 0;
|
unsigned int textureNo = 0;
|
||||||
|
|
||||||
|
@ -3248,6 +3247,7 @@ static void loadTexCoords(const struct wined3d_gl_info *gl_info, IWineD3DStateBl
|
||||||
if (coordIdx < MAX_TEXTURES && (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))))
|
if (coordIdx < MAX_TEXTURES && (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))))
|
||||||
{
|
{
|
||||||
const struct wined3d_stream_info_element *e = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx];
|
const struct wined3d_stream_info_element *e = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx];
|
||||||
|
const struct wined3d_stream_state *stream = &stateblock->streams[e->stream_idx];
|
||||||
|
|
||||||
TRACE("Setting up texture %u, idx %d, cordindx %u, data %p\n",
|
TRACE("Setting up texture %u, idx %d, cordindx %u, data %p\n",
|
||||||
textureNo, mapped_stage, coordIdx, e->data);
|
textureNo, mapped_stage, coordIdx, e->data);
|
||||||
|
@ -3264,7 +3264,7 @@ static void loadTexCoords(const struct wined3d_gl_info *gl_info, IWineD3DStateBl
|
||||||
|
|
||||||
/* The coords to supply depend completely on the fvf / vertex shader */
|
/* The coords to supply depend completely on the fvf / vertex shader */
|
||||||
glTexCoordPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
glTexCoordPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
} else {
|
} else {
|
||||||
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
|
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
|
||||||
|
@ -4041,22 +4041,26 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
|
||||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||||
GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
|
GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
|
||||||
int i;
|
int i;
|
||||||
const UINT *offset = stateblock->streamOffset;
|
|
||||||
struct wined3d_buffer *vb;
|
struct wined3d_buffer *vb;
|
||||||
DWORD_PTR shift_index;
|
DWORD_PTR shift_index;
|
||||||
|
|
||||||
/* Default to no instancing */
|
/* Default to no instancing */
|
||||||
stateblock->device->instancedDraw = FALSE;
|
stateblock->device->instancedDraw = FALSE;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ATTRIBS; i++) {
|
for (i = 0; i < MAX_ATTRIBS; i++)
|
||||||
|
{
|
||||||
|
const struct wined3d_stream_state *stream;
|
||||||
|
|
||||||
if (!(stream_info->use_map & (1 << i)))
|
if (!(stream_info->use_map & (1 << i)))
|
||||||
{
|
{
|
||||||
if (context->numbered_array_mask & (1 << i)) unload_numbered_array(context, i);
|
if (context->numbered_array_mask & (1 << i)) unload_numbered_array(context, i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stream = &stateblock->streams[stream_info->elements[i].stream_idx];
|
||||||
|
|
||||||
/* Do not load instance data. It will be specified using glTexCoord by drawprim */
|
/* Do not load instance data. It will be specified using glTexCoord by drawprim */
|
||||||
if (stateblock->streamFlags[stream_info->elements[i].stream_idx] & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
if (stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
||||||
{
|
{
|
||||||
if (context->numbered_array_mask & (1 << i)) unload_numbered_array(context, i);
|
if (context->numbered_array_mask & (1 << i)) unload_numbered_array(context, i);
|
||||||
stateblock->device->instancedDraw = TRUE;
|
stateblock->device->instancedDraw = TRUE;
|
||||||
|
@ -4073,11 +4077,11 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
|
||||||
checkGLcall("glBindBufferARB");
|
checkGLcall("glBindBufferARB");
|
||||||
curVBO = stream_info->elements[i].buffer_object;
|
curVBO = stream_info->elements[i].buffer_object;
|
||||||
}
|
}
|
||||||
vb = (struct wined3d_buffer *)stateblock->streamSource[stream_info->elements[i].stream_idx];
|
/* Use the VBO to find out if a vertex buffer exists, not the vb
|
||||||
/* Use the VBO to find out if a vertex buffer exists, not the vb pointer. vb can point to a
|
* pointer. vb can point to a user pointer data blob. In that case
|
||||||
* user pointer data blob. In that case curVBO will be 0. If there is a vertex buffer but no
|
* curVBO will be 0. If there is a vertex buffer but no vbo we
|
||||||
* vbo we won't be load converted attributes anyway
|
* won't be load converted attributes anyway. */
|
||||||
*/
|
vb = stream->buffer;
|
||||||
if (curVBO && vb->conversion_shift)
|
if (curVBO && vb->conversion_shift)
|
||||||
{
|
{
|
||||||
TRACE("Loading attribute from shifted buffer\n");
|
TRACE("Loading attribute from shifted buffer\n");
|
||||||
|
@ -4086,14 +4090,14 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
|
||||||
TRACE("Original offset %p, additional offset 0x%08x\n",
|
TRACE("Original offset %p, additional offset 0x%08x\n",
|
||||||
stream_info->elements[i].data, vb->conversion_shift[(DWORD_PTR)stream_info->elements[i].data]);
|
stream_info->elements[i].data, vb->conversion_shift[(DWORD_PTR)stream_info->elements[i].data]);
|
||||||
TRACE("Opengl type %#x\n", stream_info->elements[i].format->gl_vtx_type);
|
TRACE("Opengl type %#x\n", stream_info->elements[i].format->gl_vtx_type);
|
||||||
shift_index = ((DWORD_PTR)stream_info->elements[i].data + offset[stream_info->elements[i].stream_idx]);
|
shift_index = ((DWORD_PTR)stream_info->elements[i].data + stream->offset);
|
||||||
shift_index = shift_index % stream_info->elements[i].stride;
|
shift_index = shift_index % stream_info->elements[i].stride;
|
||||||
GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format->gl_vtx_format,
|
GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format->gl_vtx_format,
|
||||||
stream_info->elements[i].format->gl_vtx_type,
|
stream_info->elements[i].format->gl_vtx_type,
|
||||||
stream_info->elements[i].format->gl_normalized,
|
stream_info->elements[i].format->gl_normalized,
|
||||||
vb->conversion_stride, stream_info->elements[i].data + vb->conversion_shift[shift_index]
|
vb->conversion_stride, stream_info->elements[i].data + vb->conversion_shift[shift_index]
|
||||||
+ stateblock->loadBaseVertexIndex * stream_info->elements[i].stride
|
+ stateblock->loadBaseVertexIndex * stream_info->elements[i].stride
|
||||||
+ offset[stream_info->elements[i].stream_idx]));
|
+ stream->offset));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format->gl_vtx_format,
|
GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format->gl_vtx_format,
|
||||||
|
@ -4101,7 +4105,7 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
|
||||||
stream_info->elements[i].format->gl_normalized,
|
stream_info->elements[i].format->gl_normalized,
|
||||||
stream_info->elements[i].stride, stream_info->elements[i].data
|
stream_info->elements[i].stride, stream_info->elements[i].data
|
||||||
+ stateblock->loadBaseVertexIndex * stream_info->elements[i].stride
|
+ stateblock->loadBaseVertexIndex * stream_info->elements[i].stride
|
||||||
+ offset[stream_info->elements[i].stream_idx]));
|
+ stream->offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(context->numbered_array_mask & (1 << i)))
|
if (!(context->numbered_array_mask & (1 << i)))
|
||||||
|
@ -4109,14 +4113,17 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
|
||||||
GL_EXTCALL(glEnableVertexAttribArrayARB(i));
|
GL_EXTCALL(glEnableVertexAttribArrayARB(i));
|
||||||
context->numbered_array_mask |= (1 << i);
|
context->numbered_array_mask |= (1 << i);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
/* Stride = 0 means always the same values. glVertexAttribPointerARB doesn't do that. Instead disable the pointer and
|
else
|
||||||
* set up the attribute statically. But we have to figure out the system memory address.
|
{
|
||||||
*/
|
/* Stride = 0 means always the same values.
|
||||||
const BYTE *ptr = stream_info->elements[i].data + offset[stream_info->elements[i].stream_idx];
|
* glVertexAttribPointerARB doesn't do that. Instead disable the
|
||||||
|
* pointer and set up the attribute statically. But we have to
|
||||||
|
* figure out the system memory address. */
|
||||||
|
const BYTE *ptr = stream_info->elements[i].data + stream->offset;
|
||||||
if (stream_info->elements[i].buffer_object)
|
if (stream_info->elements[i].buffer_object)
|
||||||
{
|
{
|
||||||
vb = (struct wined3d_buffer *)stateblock->streamSource[stream_info->elements[i].stream_idx];
|
vb = stream->buffer;
|
||||||
ptr += (ULONG_PTR)buffer_get_sysmem(vb, gl_info);
|
ptr += (ULONG_PTR)buffer_get_sysmem(vb, gl_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4215,9 +4222,9 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
const struct wined3d_stream_info *si)
|
const struct wined3d_stream_info *si)
|
||||||
{
|
{
|
||||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||||
const UINT *offset = stateblock->streamOffset;
|
|
||||||
GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
|
GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
|
||||||
const struct wined3d_stream_info_element *e;
|
const struct wined3d_stream_info_element *e;
|
||||||
|
const struct wined3d_stream_state *stream;
|
||||||
|
|
||||||
TRACE("Using fast vertex array code\n");
|
TRACE("Using fast vertex array code\n");
|
||||||
|
|
||||||
|
@ -4229,11 +4236,12 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
|| si->use_map & (1 << WINED3D_FFP_BLENDINDICES))
|
|| si->use_map & (1 << WINED3D_FFP_BLENDINDICES))
|
||||||
{
|
{
|
||||||
e = &si->elements[WINED3D_FFP_BLENDWEIGHT];
|
e = &si->elements[WINED3D_FFP_BLENDWEIGHT];
|
||||||
|
stream = &stateblock->streams[e->stream_idx];
|
||||||
|
|
||||||
if (gl_info->supported[ARB_VERTEX_BLEND])
|
if (gl_info->supported[ARB_VERTEX_BLEND])
|
||||||
{
|
{
|
||||||
TRACE("Blend %u %p %u\n", e->format->component_count,
|
TRACE("Blend %u %p %u\n", e->format->component_count,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride, e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride, e->stride + stream->offset);
|
||||||
|
|
||||||
glEnableClientState(GL_WEIGHT_ARRAY_ARB);
|
glEnableClientState(GL_WEIGHT_ARRAY_ARB);
|
||||||
checkGLcall("glEnableClientState(GL_WEIGHT_ARRAY_ARB)");
|
checkGLcall("glEnableClientState(GL_WEIGHT_ARRAY_ARB)");
|
||||||
|
@ -4251,9 +4259,9 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
e->format->gl_vtx_format,
|
e->format->gl_vtx_format,
|
||||||
e->format->gl_vtx_type,
|
e->format->gl_vtx_type,
|
||||||
e->stride,
|
e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
GL_EXTCALL(glWeightPointerARB(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
GL_EXTCALL(glWeightPointerARB(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]));
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset));
|
||||||
|
|
||||||
checkGLcall("glWeightPointerARB");
|
checkGLcall("glWeightPointerARB");
|
||||||
|
|
||||||
|
@ -4295,6 +4303,8 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
if (si->use_map & (1 << WINED3D_FFP_POSITION))
|
if (si->use_map & (1 << WINED3D_FFP_POSITION))
|
||||||
{
|
{
|
||||||
e = &si->elements[WINED3D_FFP_POSITION];
|
e = &si->elements[WINED3D_FFP_POSITION];
|
||||||
|
stream = &stateblock->streams[e->stream_idx];
|
||||||
|
|
||||||
if (curVBO != e->buffer_object)
|
if (curVBO != e->buffer_object)
|
||||||
{
|
{
|
||||||
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
|
||||||
|
@ -4313,17 +4323,17 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
if (!e->buffer_object)
|
if (!e->buffer_object)
|
||||||
{
|
{
|
||||||
TRACE("glVertexPointer(3, %#x, %#x, %p);\n", e->format->gl_vtx_type, e->stride,
|
TRACE("glVertexPointer(3, %#x, %#x, %p);\n", e->format->gl_vtx_type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
glVertexPointer(3 /* min(e->format->gl_vtx_format, 3) */, e->format->gl_vtx_type, e->stride,
|
glVertexPointer(3 /* min(e->format->gl_vtx_format, 3) */, e->format->gl_vtx_type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TRACE("glVertexPointer(%#x, %#x, %#x, %p);\n",
|
TRACE("glVertexPointer(%#x, %#x, %#x, %p);\n",
|
||||||
e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
glVertexPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
glVertexPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
}
|
}
|
||||||
checkGLcall("glVertexPointer(...)");
|
checkGLcall("glVertexPointer(...)");
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
@ -4334,6 +4344,8 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
if (si->use_map & (1 << WINED3D_FFP_NORMAL))
|
if (si->use_map & (1 << WINED3D_FFP_NORMAL))
|
||||||
{
|
{
|
||||||
e = &si->elements[WINED3D_FFP_NORMAL];
|
e = &si->elements[WINED3D_FFP_NORMAL];
|
||||||
|
stream = &stateblock->streams[e->stream_idx];
|
||||||
|
|
||||||
if (curVBO != e->buffer_object)
|
if (curVBO != e->buffer_object)
|
||||||
{
|
{
|
||||||
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
|
||||||
|
@ -4342,9 +4354,9 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("glNormalPointer(%#x, %#x, %p);\n", e->format->gl_vtx_type, e->stride,
|
TRACE("glNormalPointer(%#x, %#x, %p);\n", e->format->gl_vtx_type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
glNormalPointer(e->format->gl_vtx_type, e->stride,
|
glNormalPointer(e->format->gl_vtx_type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
checkGLcall("glNormalPointer(...)");
|
checkGLcall("glNormalPointer(...)");
|
||||||
glEnableClientState(GL_NORMAL_ARRAY);
|
glEnableClientState(GL_NORMAL_ARRAY);
|
||||||
checkGLcall("glEnableClientState(GL_NORMAL_ARRAY)");
|
checkGLcall("glEnableClientState(GL_NORMAL_ARRAY)");
|
||||||
|
@ -4366,6 +4378,8 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
if (si->use_map & (1 << WINED3D_FFP_DIFFUSE))
|
if (si->use_map & (1 << WINED3D_FFP_DIFFUSE))
|
||||||
{
|
{
|
||||||
e = &si->elements[WINED3D_FFP_DIFFUSE];
|
e = &si->elements[WINED3D_FFP_DIFFUSE];
|
||||||
|
stream = &stateblock->streams[e->stream_idx];
|
||||||
|
|
||||||
if (curVBO != e->buffer_object)
|
if (curVBO != e->buffer_object)
|
||||||
{
|
{
|
||||||
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
|
||||||
|
@ -4375,9 +4389,9 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
|
|
||||||
TRACE("glColorPointer(%#x, %#x %#x, %p);\n",
|
TRACE("glColorPointer(%#x, %#x %#x, %p);\n",
|
||||||
e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
glColorPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
glColorPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
checkGLcall("glColorPointer(4, GL_UNSIGNED_BYTE, ...)");
|
checkGLcall("glColorPointer(4, GL_UNSIGNED_BYTE, ...)");
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
checkGLcall("glEnableClientState(GL_COLOR_ARRAY)");
|
checkGLcall("glEnableClientState(GL_COLOR_ARRAY)");
|
||||||
|
@ -4393,6 +4407,8 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
TRACE("setting specular colour\n");
|
TRACE("setting specular colour\n");
|
||||||
|
|
||||||
e = &si->elements[WINED3D_FFP_SPECULAR];
|
e = &si->elements[WINED3D_FFP_SPECULAR];
|
||||||
|
stream = &stateblock->streams[e->stream_idx];
|
||||||
|
|
||||||
if (gl_info->supported[EXT_SECONDARY_COLOR])
|
if (gl_info->supported[EXT_SECONDARY_COLOR])
|
||||||
{
|
{
|
||||||
GLenum type = e->format->gl_vtx_type;
|
GLenum type = e->format->gl_vtx_type;
|
||||||
|
@ -4413,9 +4429,9 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
* 4 component secondary colors use it
|
* 4 component secondary colors use it
|
||||||
*/
|
*/
|
||||||
TRACE("glSecondaryColorPointer(%#x, %#x, %#x, %p);\n", format, type, e->stride,
|
TRACE("glSecondaryColorPointer(%#x, %#x, %#x, %p);\n", format, type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
GL_EXTCALL(glSecondaryColorPointerEXT(format, type, e->stride,
|
GL_EXTCALL(glSecondaryColorPointerEXT(format, type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]));
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset));
|
||||||
checkGLcall("glSecondaryColorPointerEXT(format, type, ...)");
|
checkGLcall("glSecondaryColorPointerEXT(format, type, ...)");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4424,9 +4440,9 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
{
|
{
|
||||||
case GL_UNSIGNED_BYTE:
|
case GL_UNSIGNED_BYTE:
|
||||||
TRACE("glSecondaryColorPointer(3, GL_UNSIGNED_BYTE, %#x, %p);\n", e->stride,
|
TRACE("glSecondaryColorPointer(3, GL_UNSIGNED_BYTE, %#x, %p);\n", e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
GL_EXTCALL(glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, e->stride,
|
GL_EXTCALL(glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]));
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset));
|
||||||
checkGLcall("glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, ...)");
|
checkGLcall("glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, ...)");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -4434,9 +4450,9 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
||||||
FIXME("Add 4 component specular color pointers for type %x\n", type);
|
FIXME("Add 4 component specular color pointers for type %x\n", type);
|
||||||
/* Make sure that the right color component is dropped */
|
/* Make sure that the right color component is dropped */
|
||||||
TRACE("glSecondaryColorPointer(3, %#x, %#x, %p);\n", type, e->stride,
|
TRACE("glSecondaryColorPointer(3, %#x, %#x, %p);\n", type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset);
|
||||||
GL_EXTCALL(glSecondaryColorPointerEXT(3, type, e->stride,
|
GL_EXTCALL(glSecondaryColorPointerEXT(3, type, e->stride,
|
||||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]));
|
e->data + stateblock->loadBaseVertexIndex * e->stride + stream->offset));
|
||||||
checkGLcall("glSecondaryColorPointerEXT(3, type, ...)");
|
checkGLcall("glSecondaryColorPointerEXT(3, type, ...)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,11 +499,14 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
|
||||||
if (This->textures[counter]) IWineD3DBaseTexture_Release(This->textures[counter]);
|
if (This->textures[counter]) IWineD3DBaseTexture_Release(This->textures[counter]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (counter = 0; counter < MAX_STREAMS; counter++) {
|
for (counter = 0; counter < MAX_STREAMS; ++counter)
|
||||||
if(This->streamSource[counter]) {
|
{
|
||||||
if (IWineD3DBuffer_Release(This->streamSource[counter]))
|
struct wined3d_buffer *buffer = This->streams[counter].buffer;
|
||||||
|
if (buffer)
|
||||||
|
{
|
||||||
|
if (IWineD3DBuffer_Release((IWineD3DBuffer *)buffer))
|
||||||
{
|
{
|
||||||
TRACE("Vertex buffer still referenced by stateblock, applications has leaked Stream %u, buffer %p\n", counter, This->streamSource[counter]);
|
WARN("Buffer %p still referenced by stateblock, stream %u.\n", buffer, counter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -765,16 +768,18 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||||
{
|
{
|
||||||
if (!(map & 1)) continue;
|
if (!(map & 1)) continue;
|
||||||
|
|
||||||
if (This->streamStride[i] != targetStateBlock->streamStride[i]
|
if (This->streams[i].stride != targetStateBlock->streams[i].stride
|
||||||
|| This->streamSource[i] != targetStateBlock->streamSource[i])
|
|| This->streams[i].buffer != targetStateBlock->streams[i].buffer)
|
||||||
{
|
{
|
||||||
TRACE("Updating stream source %u to %p, stride to %u.\n",
|
TRACE("Updating stream source %u to %p, stride to %u.\n",
|
||||||
i, targetStateBlock->streamSource[i], targetStateBlock->streamStride[i]);
|
i, targetStateBlock->streams[i].buffer, targetStateBlock->streams[i].stride);
|
||||||
|
|
||||||
This->streamStride[i] = targetStateBlock->streamStride[i];
|
This->streams[i].stride = targetStateBlock->streams[i].stride;
|
||||||
if (targetStateBlock->streamSource[i]) IWineD3DBuffer_AddRef(targetStateBlock->streamSource[i]);
|
if (targetStateBlock->streams[i].buffer)
|
||||||
if (This->streamSource[i]) IWineD3DBuffer_Release(This->streamSource[i]);
|
IWineD3DBuffer_AddRef((IWineD3DBuffer *)targetStateBlock->streams[i].buffer);
|
||||||
This->streamSource[i] = targetStateBlock->streamSource[i];
|
if (This->streams[i].buffer)
|
||||||
|
IWineD3DBuffer_Release((IWineD3DBuffer *)This->streams[i].buffer);
|
||||||
|
This->streams[i].buffer = targetStateBlock->streams[i].buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,14 +788,14 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||||
{
|
{
|
||||||
if (!(map & 1)) continue;
|
if (!(map & 1)) continue;
|
||||||
|
|
||||||
if (This->streamFreq[i] != targetStateBlock->streamFreq[i]
|
if (This->streams[i].frequency != targetStateBlock->streams[i].frequency
|
||||||
|| This->streamFlags[i] != targetStateBlock->streamFlags[i])
|
|| This->streams[i].flags != targetStateBlock->streams[i].flags)
|
||||||
{
|
{
|
||||||
TRACE("Updating stream frequency %u to %u flags to %#x.\n",
|
TRACE("Updating stream frequency %u to %u flags to %#x.\n",
|
||||||
i, targetStateBlock->streamFreq[i], targetStateBlock->streamFlags[i]);
|
i, targetStateBlock->streams[i].frequency, targetStateBlock->streams[i].flags);
|
||||||
|
|
||||||
This->streamFreq[i] = targetStateBlock->streamFreq[i];
|
This->streams[i].frequency = targetStateBlock->streams[i].frequency;
|
||||||
This->streamFlags[i] = targetStateBlock->streamFlags[i];
|
This->streams[i].flags = targetStateBlock->streams[i].flags;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1001,13 +1006,17 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
|
||||||
map = This->changed.streamSource;
|
map = This->changed.streamSource;
|
||||||
for (i = 0; map; map >>= 1, ++i)
|
for (i = 0; map; map >>= 1, ++i)
|
||||||
{
|
{
|
||||||
if (map & 1) IWineD3DDevice_SetStreamSource(device, i, This->streamSource[i], 0, This->streamStride[i]);
|
if (map & 1)
|
||||||
|
IWineD3DDevice_SetStreamSource(device, i,
|
||||||
|
(IWineD3DBuffer *)This->streams[i].buffer,
|
||||||
|
0, This->streams[i].stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
map = This->changed.streamFreq;
|
map = This->changed.streamFreq;
|
||||||
for (i = 0; map; map >>= 1, ++i)
|
for (i = 0; map; map >>= 1, ++i)
|
||||||
{
|
{
|
||||||
if (map & 1) IWineD3DDevice_SetStreamSourceFreq(device, i, This->streamFreq[i] | This->streamFlags[i]);
|
if (map & 1)
|
||||||
|
IWineD3DDevice_SetStreamSourceFreq(device, i, This->streams[i].frequency | This->streams[i].flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
map = This->changed.textures;
|
map = This->changed.textures;
|
||||||
|
|
|
@ -2338,6 +2338,15 @@ struct StageState {
|
||||||
DWORD state;
|
DWORD state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct wined3d_stream_state
|
||||||
|
{
|
||||||
|
struct wined3d_buffer *buffer;
|
||||||
|
UINT offset;
|
||||||
|
UINT stride;
|
||||||
|
UINT frequency;
|
||||||
|
UINT flags;
|
||||||
|
};
|
||||||
|
|
||||||
struct IWineD3DStateBlockImpl
|
struct IWineD3DStateBlockImpl
|
||||||
{
|
{
|
||||||
/* IUnknown fields */
|
/* IUnknown fields */
|
||||||
|
@ -2366,11 +2375,7 @@ struct IWineD3DStateBlockImpl
|
||||||
|
|
||||||
/* Stream Source */
|
/* Stream Source */
|
||||||
BOOL streamIsUP;
|
BOOL streamIsUP;
|
||||||
UINT streamStride[MAX_STREAMS];
|
struct wined3d_stream_state streams[MAX_STREAMS + 1 /* tesselated pseudo-stream */];
|
||||||
UINT streamOffset[MAX_STREAMS + 1 /* tesselated pseudo-stream */ ];
|
|
||||||
IWineD3DBuffer *streamSource[MAX_STREAMS];
|
|
||||||
UINT streamFreq[MAX_STREAMS + 1];
|
|
||||||
UINT streamFlags[MAX_STREAMS + 1]; /*0 | WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA */
|
|
||||||
|
|
||||||
/* Indices */
|
/* Indices */
|
||||||
IWineD3DBuffer* pIndexData;
|
IWineD3DBuffer* pIndexData;
|
||||||
|
|
Loading…
Reference in New Issue