wined3d: Figure out the index data pointer inside drawPrimitive().
We want to do this after context_apply_draw_state(), when resource locations are all setup.
This commit is contained in:
parent
64e41dae8a
commit
a8a201cf61
|
@ -4008,14 +4008,11 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
|
||||||
|
|
||||||
HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
|
HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
|
||||||
{
|
{
|
||||||
struct wined3d_buffer *index_buffer;
|
|
||||||
GLuint vbo;
|
|
||||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||||
|
|
||||||
TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count);
|
TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count);
|
||||||
|
|
||||||
index_buffer = device->stateBlock->state.index_buffer;
|
if (!device->stateBlock->state.index_buffer)
|
||||||
if (!index_buffer)
|
|
||||||
{
|
{
|
||||||
/* D3D9 returns D3DERR_INVALIDCALL when DrawIndexedPrimitive is called
|
/* D3D9 returns D3DERR_INVALIDCALL when DrawIndexedPrimitive is called
|
||||||
* without an index buffer set. (The first time at least...)
|
* without an index buffer set. (The first time at least...)
|
||||||
|
@ -4036,7 +4033,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
|
||||||
device_invalidate_state(device, STATE_INDEXBUFFER);
|
device_invalidate_state(device, STATE_INDEXBUFFER);
|
||||||
device->stateBlock->state.user_stream = FALSE;
|
device->stateBlock->state.user_stream = FALSE;
|
||||||
}
|
}
|
||||||
vbo = index_buffer->buffer_object;
|
|
||||||
|
|
||||||
if (!gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX] &&
|
if (!gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX] &&
|
||||||
device->stateBlock->state.load_base_vertex_index != device->stateBlock->state.base_vertex_index)
|
device->stateBlock->state.load_base_vertex_index != device->stateBlock->state.base_vertex_index)
|
||||||
|
@ -4045,8 +4041,7 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
|
||||||
device_invalidate_state(device, STATE_BASEVERTEXINDEX);
|
device_invalidate_state(device, STATE_BASEVERTEXINDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawPrimitive(device, index_count, start_idx, TRUE,
|
drawPrimitive(device, index_count, start_idx, TRUE, NULL);
|
||||||
vbo ? NULL : index_buffer->resource.allocatedMemory);
|
|
||||||
|
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -669,14 +669,24 @@ void drawPrimitive(struct wined3d_device *device, UINT index_count, UINT StartId
|
||||||
BOOL emulation = FALSE;
|
BOOL emulation = FALSE;
|
||||||
const struct wined3d_stream_info *stream_info = &device->strided_streams;
|
const struct wined3d_stream_info *stream_info = &device->strided_streams;
|
||||||
struct wined3d_stream_info stridedlcl;
|
struct wined3d_stream_info stridedlcl;
|
||||||
UINT idx_size;
|
UINT idx_size = 0;
|
||||||
|
|
||||||
if (!indexed)
|
if (indexed)
|
||||||
idx_size = 0;
|
{
|
||||||
else if (state->index_format == WINED3DFMT_R16_UINT)
|
if (!state->user_stream)
|
||||||
idx_size = 2;
|
{
|
||||||
else
|
struct wined3d_buffer *index_buffer = state->index_buffer;
|
||||||
idx_size = 4;
|
if (!index_buffer->buffer_object)
|
||||||
|
idxData = index_buffer->resource.allocatedMemory;
|
||||||
|
else
|
||||||
|
idxData = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state->index_format == WINED3DFMT_R16_UINT)
|
||||||
|
idx_size = 2;
|
||||||
|
else
|
||||||
|
idx_size = 4;
|
||||||
|
}
|
||||||
|
|
||||||
if (!use_vs(state))
|
if (!use_vs(state))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue