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;
BOOL use_vshader;
unsigned int i;
WORD map;
stream_info->use_map = 0;
stream_info->swizzle_map = 0;
stream_info->all_vbo = 1;
/* Check for transformed vertices, disable vertex shader if present. */
stream_info->position_transformed = declaration->position_transformed;
@ -205,37 +207,25 @@ void device_stream_info_from_declaration(struct wined3d_device *device, struct w
if (!buffer) continue;
data.buffer_object = 0;
data.addr = NULL;
stride = stream->stride;
if (state->user_stream)
{
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);
/* 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
* sources. In most sane cases the pointer - offset will still be > 0, 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)
{
WARN("load_base_vertex_index is < 0 (%d), not using VBOs.\n",
state->load_base_vertex_index);
data.buffer_object = 0;
data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info);
if ((UINT_PTR)data.addr < -state->load_base_vertex_index * stride)
{
FIXME("System memory vertex data load offset is negative!\n");
}
}
TRACE("Stream %u, buffer %p.\n", element->input_slot, buffer);
buffer_get_memory(buffer, &device->adapter->gl_info, &data);
/* We can't use VBOs 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
* sources. In most sane cases the pointer - offset will still be > 0,
* 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)
{
WARN("load_base_vertex_index is < 0 (%d), not using VBOs.\n", state->load_base_vertex_index);
data.buffer_object = 0;
data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info);
if ((UINT_PTR)data.addr < -state->load_base_vertex_index * stride)
FIXME("System memory vertex data load offset is negative!\n");
}
data.addr += element->offset;
@ -295,42 +285,32 @@ void device_stream_info_from_declaration(struct wined3d_device *device, struct w
}
}
/* Preload the vertex buffers. */
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;
struct wined3d_stream_info_element *element;
struct wined3d_buffer *buffer;
/* PreLoad all the vertex buffers. */
for (i = 0; map; map >>= 1, ++i)
if (!(map & 1))
continue;
element = &stream_info->elements[i];
buffer = state->streams[element->stream_idx].buffer;
wined3d_buffer_preload(buffer);
/* If the preload dropped the buffer object, update the stream info. */
if (buffer->buffer_object != element->data.buffer_object)
{
struct wined3d_stream_info_element *element;
struct wined3d_buffer *buffer;
if (!(map & 1)) continue;
element = &stream_info->elements[i];
buffer = state->streams[element->stream_idx].buffer;
wined3d_buffer_preload(buffer);
/* If the preload dropped the buffer object, update the stream info. */
if (buffer->buffer_object != element->data.buffer_object)
{
element->data.buffer_object = 0;
element->data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info)
+ (ptrdiff_t)element->data.addr;
}
if (!buffer->buffer_object)
stream_info->all_vbo = 0;
if (buffer->query)
device->buffer_queries[device->num_buffer_queries++] = buffer->query;
element->data.buffer_object = 0;
element->data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info) + (ptrdiff_t)element->data.addr;
}
}
else
{
stream_info->all_vbo = 0;
if (!buffer->buffer_object)
stream_info->all_vbo = 0;
if (buffer->query)
device->buffer_queries[device->num_buffer_queries++] = buffer->query;
}
}