[virglrenderer-devel] [PATCH 20/21] feature: add ubo feature

Dave Airlie airlied at gmail.com
Tue Jul 24 03:39:12 UTC 2018


From: Dave Airlie <airlied at redhat.com>

don't bind ubos if we don't have feature
---
 src/vrend_renderer.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 8b924a4..309fe4d 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -127,6 +127,7 @@ enum features_id
    feat_transform_feedback2,
    feat_transform_feedback3,
    feat_transform_feedback_overflow_query,
+   feat_ubo,
    feat_viewport_array,
    feat_last,
 };
@@ -177,6 +178,7 @@ static const  struct {
    [feat_transform_feedback2] = { 40, UNAVAIL, { "GL_ARB_transform_feedback2" } },
    [feat_transform_feedback3] = { 40, UNAVAIL, { "GL_ARB_transform_feedback3" } },
    [feat_transform_feedback_overflow_query] = { 46, UNAVAIL, { "GL_ARB_transform_feedback_overflow_query" } },
+   [feat_ubo] = { 31, 30, { "GL_ARB_uniform_buffer_object" } },
    [feat_viewport_array] = { 41, UNAVAIL, { "GL_ARB_viewport_array" } },
 };
 
@@ -1048,6 +1050,8 @@ static void bind_const_locs(struct vrend_linked_shader_program *sprog,
 static void bind_ubo_locs(struct vrend_linked_shader_program *sprog,
                           int id)
 {
+   if (has_feature(feat_ubo))
+      return;
    if (sprog->ss[id]->sel->sinfo.num_ubos) {
       const char *prefix = pipe_shader_to_prefix(id);
 
@@ -2176,6 +2180,9 @@ void vrend_set_uniform_buffer(struct vrend_context *ctx,
 {
    struct vrend_resource *res;
 
+   if (!has_feature(feat_ubo))
+      return;
+
    if (res_handle) {
       res = vrend_renderer_ctx_res_lookup(ctx, res_handle);
 
@@ -3267,6 +3274,9 @@ static void vrend_draw_bind_ubo_shader(struct vrend_context *ctx,
    struct vrend_resource *res;
    struct vrend_shader_info* sinfo;
 
+   if (has_feature(feat_ubo))
+      return;
+
    if (!ctx->sub->const_bufs_used_mask[shader_type])
       return;
 
@@ -7649,7 +7659,7 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
    if (has_feature(feat_draw_instance))
       caps->v1.bset.instanceid = 1;
 
-   if (gl_ver >= 31) {
+   if (has_feature(feat_ubo)) {
       glGetIntegerv(GL_MAX_VERTEX_UNIFORM_BLOCKS, &max);
       vrend_state.max_uniform_blocks = max;
       caps->v1.max_uniform_blocks = max + 1;
-- 
2.17.1



More information about the virglrenderer-devel mailing list