wined3d: state->user_stream is always FALSE in device_stream_info_from_declaration().

Since user pointer draws were removed, state->user_stream will only ever be
set for "strided" draws, and device_stream_info_from_declaration() is never
called for those.
This commit is contained in:
Henri Verbeet 2013-01-04 12:02:59 +01:00 committed by Alexandre Julliard
parent 29cb3c1d90
commit 76a2864a3b
1 changed files with 40 additions and 60 deletions

View File

@ -181,9 +181,11 @@ void device_stream_info_from_declaration(struct wined3d_device *device, struct w
struct wined3d_vertex_declaration *declaration = state->vertex_declaration; struct wined3d_vertex_declaration *declaration = state->vertex_declaration;
BOOL use_vshader; BOOL use_vshader;
unsigned int i; unsigned int i;
WORD map;
stream_info->use_map = 0; stream_info->use_map = 0;
stream_info->swizzle_map = 0; stream_info->swizzle_map = 0;
stream_info->all_vbo = 1;
/* Check for transformed vertices, disable vertex shader if present. */ /* Check for transformed vertices, disable vertex shader if present. */
stream_info->position_transformed = declaration->position_transformed; stream_info->position_transformed = declaration->position_transformed;
@ -205,38 +207,26 @@ void device_stream_info_from_declaration(struct wined3d_device *device, struct w
if (!buffer) continue; if (!buffer) continue;
data.buffer_object = 0;
data.addr = NULL;
stride = stream->stride; stride = stream->stride;
if (state->user_stream)
{ TRACE("Stream %u, buffer %p.\n", element->input_slot, buffer);
TRACE("Stream %u is UP, %p\n", element->input_slot, buffer);
data.buffer_object = 0;
data.addr = (BYTE *)buffer;
}
else
{
TRACE("Stream %u isn't UP, %p\n", element->input_slot, buffer);
buffer_get_memory(buffer, &device->adapter->gl_info, &data); buffer_get_memory(buffer, &device->adapter->gl_info, &data);
/* Can't use vbo's if the base vertex index is negative. OpenGL doesn't accept negative offsets /* We can't use VBOs if the base vertex index is negative. OpenGL
* (or rather offsets bigger than the vbo, because the pointer is unsigned), so use system memory * doesn't accept negative offsets (or rather offsets bigger than the
* sources. In most sane cases the pointer - offset will still be > 0, otherwise it will wrap * VBO, because the pointer is unsigned), so use system memory
* around to some big value. Hope that with the indices, the driver wraps it back internally. If * sources. In most sane cases the pointer - offset will still be > 0,
* not, drawStridedSlow is needed, including a vertex buffer path. */ * otherwise it will wrap around to some big value. Hope that with the
* indices, the driver wraps it back internally. If not,
* drawStridedSlow() is needed, including a vertex buffer path. */
if (state->load_base_vertex_index < 0) if (state->load_base_vertex_index < 0)
{ {
WARN("load_base_vertex_index is < 0 (%d), not using VBOs.\n", WARN("load_base_vertex_index is < 0 (%d), not using VBOs.\n", state->load_base_vertex_index);
state->load_base_vertex_index);
data.buffer_object = 0; data.buffer_object = 0;
data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info); data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info);
if ((UINT_PTR)data.addr < -state->load_base_vertex_index * stride) if ((UINT_PTR)data.addr < -state->load_base_vertex_index * stride)
{
FIXME("System memory vertex data load offset is negative!\n"); FIXME("System memory vertex data load offset is negative!\n");
} }
}
}
data.addr += element->offset; data.addr += element->offset;
TRACE("offset %u input_slot %u usage_idx %d\n", element->offset, element->input_slot, element->usage_idx); TRACE("offset %u input_slot %u usage_idx %d\n", element->offset, element->input_slot, element->usage_idx);
@ -295,19 +285,15 @@ void device_stream_info_from_declaration(struct wined3d_device *device, struct w
} }
} }
/* Preload the vertex buffers. */
device->num_buffer_queries = 0; device->num_buffer_queries = 0;
if (!state->user_stream) for (i = 0, map = stream_info->use_map; map; map >>= 1, ++i)
{
WORD map = stream_info->use_map;
stream_info->all_vbo = 1;
/* PreLoad all the vertex buffers. */
for (i = 0; map; map >>= 1, ++i)
{ {
struct wined3d_stream_info_element *element; struct wined3d_stream_info_element *element;
struct wined3d_buffer *buffer; struct wined3d_buffer *buffer;
if (!(map & 1)) continue; if (!(map & 1))
continue;
element = &stream_info->elements[i]; element = &stream_info->elements[i];
buffer = state->streams[element->stream_idx].buffer; buffer = state->streams[element->stream_idx].buffer;
@ -317,8 +303,7 @@ void device_stream_info_from_declaration(struct wined3d_device *device, struct w
if (buffer->buffer_object != element->data.buffer_object) if (buffer->buffer_object != element->data.buffer_object)
{ {
element->data.buffer_object = 0; element->data.buffer_object = 0;
element->data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info) element->data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info) + (ptrdiff_t)element->data.addr;
+ (ptrdiff_t)element->data.addr;
} }
if (!buffer->buffer_object) if (!buffer->buffer_object)
@ -327,11 +312,6 @@ void device_stream_info_from_declaration(struct wined3d_device *device, struct w
if (buffer->query) if (buffer->query)
device->buffer_queries[device->num_buffer_queries++] = buffer->query; device->buffer_queries[device->num_buffer_queries++] = buffer->query;
} }
}
else
{
stream_info->all_vbo = 0;
}
} }
static void stream_info_element_from_strided(const struct wined3d_gl_info *gl_info, static void stream_info_element_from_strided(const struct wined3d_gl_info *gl_info,