wined3d: Determine index buffer location based on vertex buffer locations.

This commit is contained in:
Henri Verbeet 2012-05-02 21:47:58 +02:00 committed by Alexandre Julliard
parent 9267148705
commit 29893d8162
3 changed files with 14 additions and 2 deletions

View File

@ -404,6 +404,7 @@ void device_update_stream_info(struct wined3d_device *device, const struct wined
{
struct wined3d_stream_info *stream_info = &device->strided_streams;
const struct wined3d_state *state = &device->stateBlock->state;
DWORD prev_all_vbo = stream_info->all_vbo;
if (device->up_strided)
{
@ -445,6 +446,16 @@ void device_update_stream_info(struct wined3d_device *device, const struct wined
device->useDrawStridedSlow = FALSE;
}
}
if (state->index_buffer && !state->user_stream)
{
if (prev_all_vbo != stream_info->all_vbo)
device_invalidate_state(device, STATE_INDEXBUFFER);
if (stream_info->all_vbo)
wined3d_buffer_preload(state->index_buffer);
else
buffer_get_sysmem(state->index_buffer, gl_info);
}
}
static void device_preload_texture(const struct wined3d_state *state, unsigned int idx)

View File

@ -676,7 +676,7 @@ void drawPrimitive(struct wined3d_device *device, UINT index_count, UINT StartId
if (!state->user_stream)
{
struct wined3d_buffer *index_buffer = state->index_buffer;
if (!index_buffer->buffer_object)
if (!index_buffer->buffer_object || !stream_info->all_vbo)
idxData = index_buffer->resource.allocatedMemory;
else
idxData = NULL;

View File

@ -4817,9 +4817,10 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st
static void indexbuffer(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
const struct wined3d_stream_info *stream_info = &context->swapchain->device->strided_streams;
const struct wined3d_gl_info *gl_info = context->gl_info;
if (state->user_stream || !state->index_buffer)
if (state->user_stream || !state->index_buffer || !stream_info->all_vbo)
{
GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0));
}