[13/23] wined3d: Add support for draw with start instance location.

Andrew Wesie awesie at gmail.com
Sun Nov 13 12:35:13 CST 2016


Signed-off-by: Andrew Wesie <awesie at gmail.com>
---
 dlls/wined3d/directx.c    |  3 +++
 dlls/wined3d/drawprim.c   | 12 ++++++++++++
 dlls/wined3d/wined3d_gl.h |  1 +
 3 files changed, 16 insertions(+)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index c930cf6..fe6b499 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -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_clip_control",                 ARB_CLIP_CONTROL              },
     {"GL_ARB_color_buffer_float",           ARB_COLOR_BUFFER_FLOAT        },
@@ -2599,6 +2600,8 @@ 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(glDrawElementsInstancedBaseVertexBaseInstance)
     /* GL_ARB_blend_func_extended */
     USE_GL_FUNC(glBindFragDataLocationIndexed)
     USE_GL_FUNC(glGetFragDataIndex)
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 36c8d98..757809d 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -72,6 +72,18 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct
         return;
     }
 
+    if (gl_info->supported[ARB_BASE_INSTANCE])
+    {
+        if (start_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 (start_instance)
         FIXME("Start instance (%u) not supported.\n", start_instance);
 
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index 038c781..48a7509 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -43,6 +43,7 @@ enum wined3d_gl_extension
     APPLE_FLUSH_BUFFER_RANGE,
     APPLE_YCBCR_422,
     /* ARB */
+    ARB_BASE_INSTANCE,
     ARB_BLEND_FUNC_EXTENDED,
     ARB_CLIP_CONTROL,
     ARB_COLOR_BUFFER_FLOAT,
-- 
2.7.4




More information about the wine-patches mailing list