From 36ac335cfae48c939d54b834ee575ae74dd226ca Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 24 Jul 2018 11:19:08 +1000 Subject: [PATCH] features: add base instance feature. If we get a draw with a start instance and we don't have the feature reject it. Reviewed-by: Gert Wollny --- 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 4f3b7b0..d837694 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", "GL_EXT_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;