Commit 3046a2cb authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of some useless braces in draw_primitive().

parent 85d12b32
...@@ -580,9 +580,13 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co ...@@ -580,9 +580,13 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co
UINT start_instance, UINT instance_count, BOOL indexed, const void *idx_data) UINT start_instance, UINT instance_count, BOOL indexed, const void *idx_data)
{ {
const struct wined3d_state *state = &device->stateBlock->state; const struct wined3d_state *state = &device->stateBlock->state;
const struct wined3d_stream_info *stream_info;
struct wined3d_event_query *ib_query = NULL; struct wined3d_event_query *ib_query = NULL;
struct wined3d_stream_info si_emulated;
const struct wined3d_gl_info *gl_info; const struct wined3d_gl_info *gl_info;
struct wined3d_context *context; struct wined3d_context *context;
BOOL emulation = FALSE;
UINT idx_size = 0;
unsigned int i; unsigned int i;
if (!index_count) return; if (!index_count) return;
...@@ -666,106 +670,97 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co ...@@ -666,106 +670,97 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co
FIXME("Point sprite coordinate origin switching not supported.\n"); FIXME("Point sprite coordinate origin switching not supported.\n");
} }
{ stream_info = &device->strided_streams;
GLenum glPrimType = state->gl_primitive_type; if (device->instance_count)
INT base_vertex_index = state->base_vertex_index; instance_count = device->instance_count;
BOOL emulation = FALSE;
const struct wined3d_stream_info *stream_info = &device->strided_streams;
struct wined3d_stream_info stridedlcl;
UINT idx_size = 0;
if (device->instance_count)
instance_count = device->instance_count;
if (indexed) if (indexed)
{
if (!state->user_stream)
{ {
if (!state->user_stream) struct wined3d_buffer *index_buffer = state->index_buffer;
if (!index_buffer->buffer_object || !stream_info->all_vbo)
idx_data = index_buffer->resource.allocatedMemory;
else
{ {
struct wined3d_buffer *index_buffer = state->index_buffer; ib_query = index_buffer->query;
if (!index_buffer->buffer_object || !stream_info->all_vbo) idx_data = NULL;
idx_data = index_buffer->resource.allocatedMemory;
else
{
ib_query = index_buffer->query;
idx_data = NULL;
}
} }
}
if (state->index_format == WINED3DFMT_R16_UINT)
idx_size = 2;
else
idx_size = 4;
}
if (state->index_format == WINED3DFMT_R16_UINT) if (!use_vs(state))
idx_size = 2; {
if (!stream_info->position_transformed && context->num_untracked_materials
&& state->render_states[WINED3D_RS_LIGHTING])
{
static BOOL warned;
if (!warned++)
FIXME("Using software emulation because not all material properties could be tracked.\n");
else else
idx_size = 4; WARN("Using software emulation because not all material properties could be tracked.\n");
emulation = TRUE;
} }
else if (context->fog_coord && state->render_states[WINED3D_RS_FOGENABLE])
if (!use_vs(state))
{ {
if (!stream_info->position_transformed && context->num_untracked_materials static BOOL warned;
&& state->render_states[WINED3D_RS_LIGHTING])
{
static BOOL warned;
if (!warned) {
FIXME("Using software emulation because not all material properties could be tracked\n");
warned = TRUE;
} else {
TRACE("Using software emulation because not all material properties could be tracked\n");
}
emulation = TRUE;
}
else if (context->fog_coord && state->render_states[WINED3D_RS_FOGENABLE])
{
/* Either write a pipeline replacement shader or convert the specular alpha from unsigned byte
* to a float in the vertex buffer
*/
static BOOL warned;
if (!warned) {
FIXME("Using software emulation because manual fog coordinates are provided\n");
warned = TRUE;
} else {
TRACE("Using software emulation because manual fog coordinates are provided\n");
}
emulation = TRUE;
}
if(emulation) { /* Either write a pipeline replacement shader or convert the
stream_info = &stridedlcl; * specular alpha from unsigned byte to a float in the vertex
memcpy(&stridedlcl, &device->strided_streams, sizeof(stridedlcl)); * buffer. */
remove_vbos(gl_info, state, &stridedlcl); if (!warned++)
} FIXME("Using software emulation because manual fog coordinates are provided.\n");
else
WARN("Using software emulation because manual fog coordinates are provided.\n");
emulation = TRUE;
} }
if (device->useDrawStridedSlow || emulation) if (emulation)
{ {
/* Immediate mode drawing */ si_emulated = device->strided_streams;
if (use_vs(state)) remove_vbos(gl_info, state, &si_emulated);
{ stream_info = &si_emulated;
static BOOL warned;
if (!warned) {
FIXME("Using immediate mode with vertex shaders for half float emulation\n");
warned = TRUE;
} else {
TRACE("Using immediate mode with vertex shaders for half float emulation\n");
}
drawStridedSlowVs(gl_info, state, stream_info, index_count,
glPrimType, idx_data, idx_size, start_idx);
}
else
{
drawStridedSlow(device, context, stream_info, index_count,
glPrimType, idx_data, idx_size, start_idx);
}
} }
else if (!gl_info->supported[ARB_INSTANCED_ARRAYS] && instance_count) }
if (device->useDrawStridedSlow || emulation)
{
/* Immediate mode drawing. */
if (use_vs(state))
{ {
/* Instancing emulation with mixing immediate mode and arrays */ static BOOL warned;
drawStridedInstanced(gl_info, state, stream_info, index_count, glPrimType,
idx_data, idx_size, start_idx, base_vertex_index, instance_count); if (!warned++)
FIXME("Using immediate mode with vertex shaders for half float emulation.\n");
else
WARN("Using immediate mode with vertex shaders for half float emulation.\n");
drawStridedSlowVs(gl_info, state, stream_info, index_count,
state->gl_primitive_type, idx_data, idx_size, start_idx);
} }
else else
{ {
drawStridedFast(gl_info, glPrimType, index_count, idx_size, idx_data, drawStridedSlow(device, context, stream_info, index_count,
start_idx, base_vertex_index, start_instance, instance_count); state->gl_primitive_type, idx_data, idx_size, start_idx);
} }
} }
else if (!gl_info->supported[ARB_INSTANCED_ARRAYS] && instance_count)
{
/* Instancing emulation by mixing immediate mode and arrays. */
drawStridedInstanced(gl_info, state, stream_info, index_count, state->gl_primitive_type,
idx_data, idx_size, start_idx, state->base_vertex_index, instance_count);
}
else
{
drawStridedFast(gl_info, state->gl_primitive_type, index_count, idx_size, idx_data,
start_idx, state->base_vertex_index, start_instance, instance_count);
}
if (ib_query) if (ib_query)
wined3d_event_query_issue(ib_query, device); wined3d_event_query_issue(ib_query, device);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment