wined3d: Move stream state to wined3d_state.
This commit is contained in:
parent
d911622722
commit
153d8d43aa
@ -231,7 +231,7 @@ 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 offset = This->resource.device->stateBlock->state.streams[attrib->stream_idx].offset;
|
||||||
DWORD attrib_size;
|
DWORD attrib_size;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -191,7 +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;
|
struct wined3d_buffer *buffer = This->stateBlock->state.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;
|
||||||
@ -203,8 +203,8 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
|
|||||||
|
|
||||||
if (!buffer) continue;
|
if (!buffer) continue;
|
||||||
|
|
||||||
stride = This->stateBlock->streams[element->input_slot].stride;
|
stride = This->stateBlock->state.streams[element->input_slot].stride;
|
||||||
if (This->stateBlock->streamIsUP)
|
if (This->stateBlock->state.user_stream)
|
||||||
{
|
{
|
||||||
TRACE("Stream %u is UP, %p\n", element->input_slot, buffer);
|
TRACE("Stream %u is UP, %p\n", element->input_slot, buffer);
|
||||||
buffer_object = 0;
|
buffer_object = 0;
|
||||||
@ -306,7 +306,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
|
|||||||
}
|
}
|
||||||
|
|
||||||
This->num_buffer_queries = 0;
|
This->num_buffer_queries = 0;
|
||||||
if (!This->stateBlock->streamIsUP)
|
if (!This->stateBlock->state.user_stream)
|
||||||
{
|
{
|
||||||
WORD map = stream_info->use_map;
|
WORD map = stream_info->use_map;
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
|
|||||||
if (!(map & 1)) continue;
|
if (!(map & 1)) continue;
|
||||||
|
|
||||||
element = &stream_info->elements[i];
|
element = &stream_info->elements[i];
|
||||||
buffer = This->stateBlock->streams[element->stream_idx].buffer;
|
buffer = This->stateBlock->state.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. */
|
||||||
@ -2278,7 +2278,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface,
|
|||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = &This->updateStateBlock->streams[StreamNumber];
|
stream = &This->updateStateBlock->state.streams[StreamNumber];
|
||||||
oldSrc = (IWineD3DBuffer *)stream->buffer;
|
oldSrc = (IWineD3DBuffer *)stream->buffer;
|
||||||
|
|
||||||
This->updateStateBlock->changed.streamSource |= 1 << StreamNumber;
|
This->updateStateBlock->changed.streamSource |= 1 << StreamNumber;
|
||||||
@ -2337,7 +2337,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSource(IWineD3DDevice *iface,
|
|||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = &This->stateBlock->streams[StreamNumber];
|
stream = &This->stateBlock->state.streams[StreamNumber];
|
||||||
*pStream = (IWineD3DBuffer *)stream->buffer;
|
*pStream = (IWineD3DBuffer *)stream->buffer;
|
||||||
*pStride = stream->stride;
|
*pStride = stream->stride;
|
||||||
if (pOffset) *pOffset = stream->offset;
|
if (pOffset) *pOffset = stream->offset;
|
||||||
@ -2371,7 +2371,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSourceFreq(IWineD3DDevice *ifa
|
|||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = &This->updateStateBlock->streams[StreamNumber];
|
stream = &This->updateStateBlock->state.streams[StreamNumber];
|
||||||
oldFlags = stream->flags;
|
oldFlags = stream->flags;
|
||||||
oldFreq = stream->frequency;
|
oldFreq = stream->frequency;
|
||||||
|
|
||||||
@ -2392,7 +2392,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSourceFreq(IWineD3DDevice *ifa
|
|||||||
|
|
||||||
TRACE("iface %p, stream_idx %u, divider %p.\n", iface, StreamNumber, Divider);
|
TRACE("iface %p, stream_idx %u, divider %p.\n", iface, StreamNumber, Divider);
|
||||||
|
|
||||||
stream = &This->updateStateBlock->streams[StreamNumber];
|
stream = &This->updateStateBlock->state.streams[StreamNumber];
|
||||||
*Divider = stream->flags | stream->frequency;
|
*Divider = stream->flags | stream->frequency;
|
||||||
|
|
||||||
TRACE("Returning %#x.\n", *Divider);
|
TRACE("Returning %#x.\n", *Divider);
|
||||||
@ -4140,7 +4140,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface,
|
|||||||
struct wined3d_stream_info stream_info;
|
struct wined3d_stream_info stream_info;
|
||||||
const struct wined3d_gl_info *gl_info;
|
const struct wined3d_gl_info *gl_info;
|
||||||
struct wined3d_context *context;
|
struct wined3d_context *context;
|
||||||
BOOL vbo = FALSE, streamWasUP = This->stateBlock->streamIsUP;
|
BOOL vbo = FALSE, streamWasUP = This->stateBlock->state.user_stream;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("(%p)->(%d,%d,%d,%p,%p,%d\n", This, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags);
|
TRACE("(%p)->(%d,%d,%d,%p,%p,%d\n", This, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags);
|
||||||
@ -4156,9 +4156,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface,
|
|||||||
/* ProcessVertices reads from vertex buffers, which have to be assigned. DrawPrimitive and DrawPrimitiveUP
|
/* ProcessVertices reads from vertex buffers, which have to be assigned. DrawPrimitive and DrawPrimitiveUP
|
||||||
* control the streamIsUP flag, thus restore it afterwards.
|
* control the streamIsUP flag, thus restore it afterwards.
|
||||||
*/
|
*/
|
||||||
This->stateBlock->streamIsUP = FALSE;
|
This->stateBlock->state.user_stream = FALSE;
|
||||||
device_stream_info_from_declaration(This, FALSE, &stream_info, &vbo);
|
device_stream_info_from_declaration(This, FALSE, &stream_info, &vbo);
|
||||||
This->stateBlock->streamIsUP = streamWasUP;
|
This->stateBlock->state.user_stream = streamWasUP;
|
||||||
|
|
||||||
if(vbo || SrcStartIndex) {
|
if(vbo || SrcStartIndex) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -4176,7 +4176,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 = This->stateBlock->streams[e->stream_idx].buffer;
|
struct wined3d_buffer *vb = This->stateBlock->state.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();
|
||||||
@ -4681,9 +4681,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The index buffer is not needed here, but restore it, otherwise it is hell to keep track of */
|
/* The index buffer is not needed here, but restore it, otherwise it is hell to keep track of */
|
||||||
if(This->stateBlock->streamIsUP) {
|
if (This->stateBlock->state.user_stream)
|
||||||
|
{
|
||||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
|
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
|
||||||
This->stateBlock->streamIsUP = FALSE;
|
This->stateBlock->state.user_stream = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (This->stateBlock->loadBaseVertexIndex)
|
if (This->stateBlock->loadBaseVertexIndex)
|
||||||
@ -4719,9 +4720,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *if
|
|||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(This->stateBlock->streamIsUP) {
|
if (This->stateBlock->state.user_stream)
|
||||||
|
{
|
||||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
|
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
|
||||||
This->stateBlock->streamIsUP = FALSE;
|
This->stateBlock->state.user_stream = FALSE;
|
||||||
}
|
}
|
||||||
vbo = ((struct wined3d_buffer *) pIB)->buffer_object;
|
vbo = ((struct wined3d_buffer *) pIB)->buffer_object;
|
||||||
|
|
||||||
@ -4761,13 +4763,13 @@ 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 */
|
||||||
stream = &This->stateBlock->streams[0];
|
stream = &This->stateBlock->state.streams[0];
|
||||||
vb = (IWineD3DBuffer *)stream->buffer;
|
vb = (IWineD3DBuffer *)stream->buffer;
|
||||||
stream->buffer = (struct wined3d_buffer *)pVertexStreamZeroData;
|
stream->buffer = (struct wined3d_buffer *)pVertexStreamZeroData;
|
||||||
if (vb) IWineD3DBuffer_Release(vb);
|
if (vb) IWineD3DBuffer_Release(vb);
|
||||||
stream->offset = 0;
|
stream->offset = 0;
|
||||||
stream->stride = VertexStreamZeroStride;
|
stream->stride = VertexStreamZeroStride;
|
||||||
This->stateBlock->streamIsUP = TRUE;
|
This->stateBlock->state.user_stream = TRUE;
|
||||||
This->stateBlock->loadBaseVertexIndex = 0;
|
This->stateBlock->loadBaseVertexIndex = 0;
|
||||||
|
|
||||||
/* TODO: Only mark dirty if drawing from a different UP address */
|
/* TODO: Only mark dirty if drawing from a different UP address */
|
||||||
@ -4810,14 +4812,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
|
|||||||
idxStride = 4;
|
idxStride = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note in the following, it's not this type, but that's the purpose of streamIsUP */
|
stream = &This->stateBlock->state.streams[0];
|
||||||
stream = &This->stateBlock->streams[0];
|
|
||||||
vb = (IWineD3DBuffer *)stream->buffer;
|
vb = (IWineD3DBuffer *)stream->buffer;
|
||||||
stream->buffer = (struct wined3d_buffer *)pVertexStreamZeroData;
|
stream->buffer = (struct wined3d_buffer *)pVertexStreamZeroData;
|
||||||
if (vb) IWineD3DBuffer_Release(vb);
|
if (vb) IWineD3DBuffer_Release(vb);
|
||||||
stream->offset = 0;
|
stream->offset = 0;
|
||||||
stream->stride = VertexStreamZeroStride;
|
stream->stride = VertexStreamZeroStride;
|
||||||
This->stateBlock->streamIsUP = TRUE;
|
This->stateBlock->state.user_stream = TRUE;
|
||||||
|
|
||||||
/* 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;
|
||||||
@ -4874,7 +4875,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided(IWineD3DDev
|
|||||||
*/
|
*/
|
||||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL);
|
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL);
|
||||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
|
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
|
||||||
This->stateBlock->streamIsUP = TRUE;
|
This->stateBlock->state.user_stream = TRUE;
|
||||||
This->stateBlock->baseVertexIndex = 0;
|
This->stateBlock->baseVertexIndex = 0;
|
||||||
This->up_strided = DrawPrimStrideData;
|
This->up_strided = DrawPrimStrideData;
|
||||||
drawPrimitive(iface, vertex_count, 0 /* start_idx */, idxSize, pIndexData);
|
drawPrimitive(iface, vertex_count, 0 /* start_idx */, idxSize, pIndexData);
|
||||||
@ -6621,19 +6622,20 @@ 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->streams[i].buffer == (struct wined3d_buffer *)resource)
|
if (device->stateBlock
|
||||||
|
&& device->stateBlock->state.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->streams[i].buffer = NULL;
|
device->stateBlock->state.streams[i].buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->updateStateBlock != device->stateBlock
|
if (device->updateStateBlock != device->stateBlock
|
||||||
&& device->updateStateBlock->streams[i].buffer == (struct wined3d_buffer *)resource)
|
&& device->updateStateBlock->state.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->streams[i].buffer = NULL;
|
device->updateStateBlock->state.streams[i].buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ 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 struct wined3d_stream_state *streams = This->stateBlock->streams;
|
const struct wined3d_stream_state *streams = This->stateBlock->state.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;
|
||||||
@ -464,9 +464,9 @@ static void drawStridedSlowVs(IWineD3DDevice *iface, const struct wined3d_stream
|
|||||||
{
|
{
|
||||||
if (!(si->use_map & (1 << i))) continue;
|
if (!(si->use_map & (1 << i))) continue;
|
||||||
|
|
||||||
ptr = si->elements[i].data +
|
ptr = si->elements[i].data
|
||||||
si->elements[i].stride * SkipnStrides +
|
+ si->elements[i].stride * SkipnStrides
|
||||||
stateblock->streams[si->elements[i].stream_idx].offset;
|
+ stateblock->state.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,14 @@ 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->streams[i].buffer && ((stateblock->streams[i].flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
if (stateblock->state.streams[i].buffer
|
||||||
|| (stateblock->streams[i].flags & WINED3DSTREAMSOURCE_INDEXEDDATA)))
|
&& ((stateblock->state.streams[i].flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
||||||
|
|| (stateblock->state.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->streams[i].frequency ? stateblock->streams[i].frequency : 1;
|
numInstances = stateblock->state.streams[i].frequency ? stateblock->state.streams[i].frequency : 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -520,7 +521,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->streams[si->elements[i].stream_idx].flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
if (stateblock->state.streams[si->elements[i].stream_idx].flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
||||||
{
|
{
|
||||||
instancedData[numInstancedAttribs] = i;
|
instancedData[numInstancedAttribs] = i;
|
||||||
numInstancedAttribs++;
|
numInstancedAttribs++;
|
||||||
@ -531,12 +532,12 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, const struct wine
|
|||||||
for(i = 0; i < numInstances; i++) {
|
for(i = 0; i < numInstances; i++) {
|
||||||
/* Specify the instanced attributes using immediate mode calls */
|
/* Specify the instanced attributes using immediate mode calls */
|
||||||
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->streams[si->elements[instancedData[j]].stream_idx].offset;
|
+ stateblock->state.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 = stateblock->streams[si->elements[instancedData[j]].stream_idx].buffer;
|
struct wined3d_buffer *vb = stateblock->state.streams[si->elements[instancedData[j]].stream_idx].buffer;
|
||||||
ptr += (ULONG_PTR)buffer_get_sysmem(vb, &This->adapter->gl_info);
|
ptr += (ULONG_PTR)buffer_get_sysmem(vb, &This->adapter->gl_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,7 +564,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 = This->stateBlock->streams[e->stream_idx].buffer;
|
struct wined3d_buffer *vb = This->stateBlock->state.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));
|
||||||
}
|
}
|
||||||
@ -800,7 +801,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 = This->stateBlock->streams[e->stream_idx].buffer;
|
struct wined3d_buffer *vb = This->stateBlock->state.streams[e->stream_idx].buffer;
|
||||||
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;
|
||||||
|
@ -3333,7 +3333,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];
|
const struct wined3d_stream_state *stream = &stateblock->state.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);
|
||||||
@ -4148,7 +4148,7 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = &stateblock->streams[stream_info->elements[i].stream_idx];
|
stream = &stateblock->state.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 (stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
if (stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
||||||
@ -4327,7 +4327,7 @@ 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];
|
stream = &stateblock->state.streams[e->stream_idx];
|
||||||
|
|
||||||
if (gl_info->supported[ARB_VERTEX_BLEND])
|
if (gl_info->supported[ARB_VERTEX_BLEND])
|
||||||
{
|
{
|
||||||
@ -4394,7 +4394,7 @@ 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];
|
stream = &stateblock->state.streams[e->stream_idx];
|
||||||
|
|
||||||
if (curVBO != e->buffer_object)
|
if (curVBO != e->buffer_object)
|
||||||
{
|
{
|
||||||
@ -4435,7 +4435,7 @@ 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];
|
stream = &stateblock->state.streams[e->stream_idx];
|
||||||
|
|
||||||
if (curVBO != e->buffer_object)
|
if (curVBO != e->buffer_object)
|
||||||
{
|
{
|
||||||
@ -4469,7 +4469,7 @@ 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];
|
stream = &stateblock->state.streams[e->stream_idx];
|
||||||
|
|
||||||
if (curVBO != e->buffer_object)
|
if (curVBO != e->buffer_object)
|
||||||
{
|
{
|
||||||
@ -4498,7 +4498,7 @@ 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];
|
stream = &stateblock->state.streams[e->stream_idx];
|
||||||
|
|
||||||
if (gl_info->supported[EXT_SECONDARY_COLOR])
|
if (gl_info->supported[EXT_SECONDARY_COLOR])
|
||||||
{
|
{
|
||||||
@ -4950,7 +4950,7 @@ static void indexbuffer(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
|
|||||||
{
|
{
|
||||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||||
|
|
||||||
if (stateblock->streamIsUP || !stateblock->pIndexData)
|
if (stateblock->state.user_stream || !stateblock->pIndexData)
|
||||||
{
|
{
|
||||||
GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0));
|
GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0));
|
||||||
} else {
|
} else {
|
||||||
|
@ -503,7 +503,7 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
|
|||||||
|
|
||||||
for (counter = 0; counter < MAX_STREAMS; ++counter)
|
for (counter = 0; counter < MAX_STREAMS; ++counter)
|
||||||
{
|
{
|
||||||
struct wined3d_buffer *buffer = This->streams[counter].buffer;
|
struct wined3d_buffer *buffer = This->state.streams[counter].buffer;
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
if (IWineD3DBuffer_Release((IWineD3DBuffer *)buffer))
|
if (IWineD3DBuffer_Release((IWineD3DBuffer *)buffer))
|
||||||
@ -777,18 +777,19 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||||||
{
|
{
|
||||||
if (!(map & 1)) continue;
|
if (!(map & 1)) continue;
|
||||||
|
|
||||||
if (This->streams[i].stride != targetStateBlock->streams[i].stride
|
if (This->state.streams[i].stride != targetStateBlock->state.streams[i].stride
|
||||||
|| This->streams[i].buffer != targetStateBlock->streams[i].buffer)
|
|| This->state.streams[i].buffer != targetStateBlock->state.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->streams[i].buffer, targetStateBlock->streams[i].stride);
|
i, targetStateBlock->state.streams[i].buffer,
|
||||||
|
targetStateBlock->state.streams[i].stride);
|
||||||
|
|
||||||
This->streams[i].stride = targetStateBlock->streams[i].stride;
|
This->state.streams[i].stride = targetStateBlock->state.streams[i].stride;
|
||||||
if (targetStateBlock->streams[i].buffer)
|
if (targetStateBlock->state.streams[i].buffer)
|
||||||
IWineD3DBuffer_AddRef((IWineD3DBuffer *)targetStateBlock->streams[i].buffer);
|
IWineD3DBuffer_AddRef((IWineD3DBuffer *)targetStateBlock->state.streams[i].buffer);
|
||||||
if (This->streams[i].buffer)
|
if (This->state.streams[i].buffer)
|
||||||
IWineD3DBuffer_Release((IWineD3DBuffer *)This->streams[i].buffer);
|
IWineD3DBuffer_Release((IWineD3DBuffer *)This->state.streams[i].buffer);
|
||||||
This->streams[i].buffer = targetStateBlock->streams[i].buffer;
|
This->state.streams[i].buffer = targetStateBlock->state.streams[i].buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -797,14 +798,14 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||||||
{
|
{
|
||||||
if (!(map & 1)) continue;
|
if (!(map & 1)) continue;
|
||||||
|
|
||||||
if (This->streams[i].frequency != targetStateBlock->streams[i].frequency
|
if (This->state.streams[i].frequency != targetStateBlock->state.streams[i].frequency
|
||||||
|| This->streams[i].flags != targetStateBlock->streams[i].flags)
|
|| This->state.streams[i].flags != targetStateBlock->state.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->streams[i].frequency, targetStateBlock->streams[i].flags);
|
i, targetStateBlock->state.streams[i].frequency, targetStateBlock->state.streams[i].flags);
|
||||||
|
|
||||||
This->streams[i].frequency = targetStateBlock->streams[i].frequency;
|
This->state.streams[i].frequency = targetStateBlock->state.streams[i].frequency;
|
||||||
This->streams[i].flags = targetStateBlock->streams[i].flags;
|
This->state.streams[i].flags = targetStateBlock->state.streams[i].flags;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1026,15 +1027,16 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
|
|||||||
{
|
{
|
||||||
if (map & 1)
|
if (map & 1)
|
||||||
IWineD3DDevice_SetStreamSource(device, i,
|
IWineD3DDevice_SetStreamSource(device, i,
|
||||||
(IWineD3DBuffer *)This->streams[i].buffer,
|
(IWineD3DBuffer *)This->state.streams[i].buffer,
|
||||||
0, This->streams[i].stride);
|
0, This->state.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)
|
if (map & 1)
|
||||||
IWineD3DDevice_SetStreamSourceFreq(device, i, This->streams[i].frequency | This->streams[i].flags);
|
IWineD3DDevice_SetStreamSourceFreq(device, i,
|
||||||
|
This->state.streams[i].frequency | This->state.streams[i].flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
map = This->changed.textures;
|
map = This->changed.textures;
|
||||||
|
@ -2350,6 +2350,8 @@ struct wined3d_stream_state
|
|||||||
struct wined3d_state
|
struct wined3d_state
|
||||||
{
|
{
|
||||||
IWineD3DVertexDeclarationImpl *vertex_declaration;
|
IWineD3DVertexDeclarationImpl *vertex_declaration;
|
||||||
|
struct wined3d_stream_state streams[MAX_STREAMS + 1 /* tesselated pseudo-stream */];
|
||||||
|
BOOL user_stream;
|
||||||
|
|
||||||
struct IWineD3DVertexShaderImpl *vertex_shader;
|
struct IWineD3DVertexShaderImpl *vertex_shader;
|
||||||
BOOL vs_consts_b[MAX_CONST_B];
|
BOOL vs_consts_b[MAX_CONST_B];
|
||||||
@ -2391,10 +2393,6 @@ struct IWineD3DStateBlockImpl
|
|||||||
/* primitive type */
|
/* primitive type */
|
||||||
GLenum gl_primitive_type;
|
GLenum gl_primitive_type;
|
||||||
|
|
||||||
/* Stream Source */
|
|
||||||
BOOL streamIsUP;
|
|
||||||
struct wined3d_stream_state streams[MAX_STREAMS + 1 /* tesselated pseudo-stream */];
|
|
||||||
|
|
||||||
/* Indices */
|
/* Indices */
|
||||||
IWineD3DBuffer* pIndexData;
|
IWineD3DBuffer* pIndexData;
|
||||||
enum wined3d_format_id IndexFmt;
|
enum wined3d_format_id IndexFmt;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user