[virglrenderer-devel] [PATCH 06/21] features: add base instance feature.

Dave Airlie airlied at gmail.com
Tue Jul 24 03:38:58 UTC 2018


From: Dave Airlie <airlied at redhat.com>

If we get a draw with a start instance and we don't have the feature
reject it.
---
 src/vrend_renderer.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 7672269..90a4f5c 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -91,6 +91,7 @@ enum features_id
 {
    feat_arb_or_gles_ext_texture_buffer,
    feat_arb_robustness,
+   feat_base_instance,
    feat_bit_encoding,
    feat_copy_image,
    feat_debug_cb,
@@ -128,6 +129,7 @@ static const  struct {
 } feature_list[] = {
    [feat_arb_or_gles_ext_texture_buffer] = { 31, UNAVAIL, { "GL_ARB_texture_buffer_object", "GL_EXT_texture_buffer", NULL } },
    [feat_arb_robustness] = { UNAVAIL, UNAVAIL, { "GL_ARB_robustness" } },
+   [feat_base_instance] = { 42, UNAVAIL, { "GL_ARB_base_instance" } },
    [feat_bit_encoding] = { 33, UNAVAIL, { "GL_ARB_shader_bit_encoding" } },
    [feat_copy_image] = { 43, 32, { "GL_ARB_copy_image", "GL_EXT_copy_image", "GL_OES_copy_image" } },
    [feat_debug_cb] = { UNAVAIL, UNAVAIL, {} }, /* special case */
@@ -3343,6 +3345,9 @@ int vrend_draw_vbo(struct vrend_context *ctx,
    if (info->instance_count && !has_feature(feat_draw_instance))
       return EINVAL;
 
+   if (info->start_instance && !has_feature(feat_base_instance))
+      return EINVAL;
+
    if (indirect_handle) {
       indirect_res = vrend_renderer_ctx_res_lookup(ctx, indirect_handle);
       if (!indirect_res) {
@@ -7639,11 +7644,8 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
          caps->v1.bset.has_fp64 = 1;
    }
 
-   if (gl_ver >= 42) {
+   if (has_feature(feat_base_instance))
       caps->v1.bset.start_instance = 1;
-   } else if (epoxy_has_gl_extension("GL_ARB_base_instance")) {
-      caps->v1.bset.start_instance = 1;
-   }
 
    if (epoxy_has_gl_extension("GL_ARB_shader_stencil_export")) {
       caps->v1.bset.shader_stencil_export = 1;
-- 
2.17.1



More information about the virglrenderer-devel mailing list