wined3d: Add support for start instance in draw_primitive_arrays().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Michael Müller 2017-11-01 22:08:45 +01:00 committed by Alexandre Julliard
parent 8151875fcb
commit deae0044f4
3 changed files with 21 additions and 1 deletions

View File

@ -109,6 +109,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
{"GL_APPLE_ycbcr_422", APPLE_YCBCR_422 },
/* ARB */
{"GL_ARB_base_instance", ARB_BASE_INSTANCE },
{"GL_ARB_blend_func_extended", ARB_BLEND_FUNC_EXTENDED },
{"GL_ARB_clear_buffer_object", ARB_CLEAR_BUFFER_OBJECT },
{"GL_ARB_clear_texture", ARB_CLEAR_TEXTURE },
@ -2686,6 +2687,9 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
/* GL_APPLE_flush_buffer_range */
USE_GL_FUNC(glBufferParameteriAPPLE)
USE_GL_FUNC(glFlushMappedBufferRangeAPPLE)
/* GL_ARB_base_instance */
USE_GL_FUNC(glDrawArraysInstancedBaseInstance)
USE_GL_FUNC(glDrawElementsInstancedBaseVertexBaseInstance)
/* GL_ARB_blend_func_extended */
USE_GL_FUNC(glBindFragDataLocationIndexed)
USE_GL_FUNC(glGetFragDataIndex)
@ -3881,6 +3885,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
{ARB_ES2_COMPATIBILITY, MAKEDWORD_VERSION(4, 1)},
{ARB_VIEWPORT_ARRAY, MAKEDWORD_VERSION(4, 1)},
{ARB_BASE_INSTANCE, MAKEDWORD_VERSION(4, 2)},
{ARB_CONSERVATIVE_DEPTH, MAKEDWORD_VERSION(4, 2)},
{ARB_INTERNALFORMAT_QUERY, MAKEDWORD_VERSION(4, 2)},
{ARB_MAP_BUFFER_ALIGNMENT, MAKEDWORD_VERSION(4, 2)},

View File

@ -69,18 +69,32 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct
return;
}
if (start_instance)
if (start_instance && !(gl_info->supported[ARB_BASE_INSTANCE] && gl_info->supported[ARB_INSTANCED_ARRAYS]))
FIXME("Start instance (%u) not supported.\n", start_instance);
if (gl_info->supported[ARB_INSTANCED_ARRAYS])
{
if (!idx_size)
{
if (gl_info->supported[ARB_BASE_INSTANCE])
{
GL_EXTCALL(glDrawArraysInstancedBaseInstance(state->gl_primitive_type, start_idx, count, instance_count, start_instance));
checkGLcall("glDrawArraysInstancedBaseInstance");
return;
}
GL_EXTCALL(glDrawArraysInstanced(state->gl_primitive_type, start_idx, count, instance_count));
checkGLcall("glDrawArraysInstanced");
return;
}
if (gl_info->supported[ARB_BASE_INSTANCE])
{
GL_EXTCALL(glDrawElementsInstancedBaseVertexBaseInstance(state->gl_primitive_type, count, idx_type,
(const char *)idx_data + (idx_size * start_idx), instance_count, base_vertex_idx, start_instance));
checkGLcall("glDrawElementsInstancedBaseVertexBaseInstance");
return;
}
if (gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX])
{
GL_EXTCALL(glDrawElementsInstancedBaseVertex(state->gl_primitive_type, count, idx_type,

View File

@ -42,6 +42,7 @@ enum wined3d_gl_extension
APPLE_FLUSH_BUFFER_RANGE,
APPLE_YCBCR_422,
/* ARB */
ARB_BASE_INSTANCE,
ARB_BLEND_FUNC_EXTENDED,
ARB_CLEAR_BUFFER_OBJECT,
ARB_CLEAR_TEXTURE,