Commit f8c8498f authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Cleanup draw_primitive_arrays() a bit.

parent 41717a14
...@@ -44,27 +44,29 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct ...@@ -44,27 +44,29 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct
unsigned int instanced_elements[ARRAY_SIZE(si->elements)]; unsigned int instanced_elements[ARRAY_SIZE(si->elements)];
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
unsigned int instanced_element_count = 0; unsigned int instanced_element_count = 0;
GLenum mode = state->gl_primitive_type;
const void *indices;
unsigned int i, j; unsigned int i, j;
indices = (const char *)idx_data + idx_size * start_idx;
if (!instance_count) if (!instance_count)
{ {
if (!idx_size) if (!idx_size)
{ {
gl_info->gl_ops.gl.p_glDrawArrays(state->gl_primitive_type, start_idx, count); gl_info->gl_ops.gl.p_glDrawArrays(mode, start_idx, count);
checkGLcall("glDrawArrays"); checkGLcall("glDrawArrays");
return; return;
} }
if (gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]) if (gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX])
{ {
GL_EXTCALL(glDrawElementsBaseVertex(state->gl_primitive_type, count, idx_type, GL_EXTCALL(glDrawElementsBaseVertex(mode, count, idx_type, indices, base_vertex_idx));
(const char *)idx_data + (idx_size * start_idx), base_vertex_idx));
checkGLcall("glDrawElementsBaseVertex"); checkGLcall("glDrawElementsBaseVertex");
return; return;
} }
gl_info->gl_ops.gl.p_glDrawElements(state->gl_primitive_type, count, gl_info->gl_ops.gl.p_glDrawElements(mode, count, idx_type, indices);
idx_type, (const char *)idx_data + (idx_size * start_idx));
checkGLcall("glDrawElements"); checkGLcall("glDrawElements");
return; return;
} }
...@@ -78,33 +80,32 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct ...@@ -78,33 +80,32 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct
{ {
if (gl_info->supported[ARB_BASE_INSTANCE]) if (gl_info->supported[ARB_BASE_INSTANCE])
{ {
GL_EXTCALL(glDrawArraysInstancedBaseInstance(state->gl_primitive_type, start_idx, count, instance_count, start_instance)); GL_EXTCALL(glDrawArraysInstancedBaseInstance(mode, start_idx, count, instance_count, start_instance));
checkGLcall("glDrawArraysInstancedBaseInstance"); checkGLcall("glDrawArraysInstancedBaseInstance");
return; return;
} }
GL_EXTCALL(glDrawArraysInstanced(state->gl_primitive_type, start_idx, count, instance_count)); GL_EXTCALL(glDrawArraysInstanced(mode, start_idx, count, instance_count));
checkGLcall("glDrawArraysInstanced"); checkGLcall("glDrawArraysInstanced");
return; return;
} }
if (gl_info->supported[ARB_BASE_INSTANCE]) if (gl_info->supported[ARB_BASE_INSTANCE])
{ {
GL_EXTCALL(glDrawElementsInstancedBaseVertexBaseInstance(state->gl_primitive_type, count, idx_type, GL_EXTCALL(glDrawElementsInstancedBaseVertexBaseInstance(mode, count, idx_type,
(const char *)idx_data + (idx_size * start_idx), instance_count, base_vertex_idx, start_instance)); indices, instance_count, base_vertex_idx, start_instance));
checkGLcall("glDrawElementsInstancedBaseVertexBaseInstance"); checkGLcall("glDrawElementsInstancedBaseVertexBaseInstance");
return; return;
} }
if (gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]) if (gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX])
{ {
GL_EXTCALL(glDrawElementsInstancedBaseVertex(state->gl_primitive_type, count, idx_type, GL_EXTCALL(glDrawElementsInstancedBaseVertex(mode, count, idx_type,
(const char *)idx_data + (idx_size * start_idx), instance_count, base_vertex_idx)); indices, instance_count, base_vertex_idx));
checkGLcall("glDrawElementsInstancedBaseVertex"); checkGLcall("glDrawElementsInstancedBaseVertex");
return; return;
} }
GL_EXTCALL(glDrawElementsInstanced(state->gl_primitive_type, count, idx_type, GL_EXTCALL(glDrawElementsInstanced(mode, count, idx_type, indices, instance_count));
(const char *)idx_data + (idx_size * start_idx), instance_count));
checkGLcall("glDrawElementsInstanced"); checkGLcall("glDrawElementsInstanced");
return; return;
} }
...@@ -120,7 +121,7 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct ...@@ -120,7 +121,7 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct
* has a different meaning in that situation. */ * has a different meaning in that situation. */
if (!idx_size) if (!idx_size)
{ {
FIXME("Non-indexed instanced drawing is not supported\n"); FIXME("Non-indexed instanced drawing is not supported.\n");
return; return;
} }
...@@ -152,14 +153,12 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct ...@@ -152,14 +153,12 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct
if (gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]) if (gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX])
{ {
GL_EXTCALL(glDrawElementsBaseVertex(state->gl_primitive_type, count, idx_type, GL_EXTCALL(glDrawElementsBaseVertex(mode, count, idx_type, indices, base_vertex_idx));
(const char *)idx_data + (idx_size * start_idx), base_vertex_idx));
checkGLcall("glDrawElementsBaseVertex"); checkGLcall("glDrawElementsBaseVertex");
} }
else else
{ {
gl_info->gl_ops.gl.p_glDrawElements(state->gl_primitive_type, count, idx_type, gl_info->gl_ops.gl.p_glDrawElements(mode, count, idx_type, indices);
(const char *)idx_data + (idx_size * start_idx));
checkGLcall("glDrawElements"); checkGLcall("glDrawElements");
} }
} }
......
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