[virglrenderer-devel] [RFC PATCH 3/5] vrend, features: add ARB_texture_gather to feature test

Gert Wollny gert.wollny at collabora.com
Thu Aug 2 08:48:25 UTC 2018


The extension is also provied by GL 4.0 and GLES 3.1.

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
 src/vrend_renderer.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 23db693..af1a306 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -128,6 +128,7 @@ enum features_id
    feat_tessellation,
    feat_texture_array,
    feat_texture_buffer_range,
+   feat_texture_gather,
    feat_texture_multisample,
    feat_texture_storage,
    feat_texture_view,
@@ -188,6 +189,7 @@ static const  struct {
    [feat_tessellation] = { 40, UNAVAIL, { "GL_ARB_tessellation_shader" } },
    [feat_texture_array] = { 30, 30, { "GL_EXT_texture_array" } },
    [feat_texture_buffer_range] = { 43, UNAVAIL, { "GL_ARB_texture_buffer_range" } },
+   [feat_texture_gather] = { 40, 31, { "GL_ARB_texture_gather" } },
    [feat_texture_multisample] = { 32, 30, { "GL_ARB_texture_multisample" } },
    [feat_texture_storage] = { 42, 30, { "GL_ARB_texture_storage" } },
    [feat_texture_view] = { 43, UNAVAIL, { "GL_ARB_texture_view" } },
@@ -7976,9 +7978,13 @@ static void vrend_renderer_fill_caps_v1(int gl_ver, int gles_ver, union virgl_ca
       caps->v1.max_tbo_size = max;
    }
 
-   if (epoxy_has_gl_extension("GL_ARB_texture_gather")) {
-      glGetIntegerv(GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB, &max);
-      caps->v1.max_texture_gather_components = max;
+   if (has_feature(feat_texture_gather)) {
+      if (gl_ver > 0) {
+         glGetIntegerv(GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB, &max);
+         caps->v1.max_texture_gather_components = max;
+      } else {
+         caps->v1.max_texture_gather_components = 4;
+      }
    }
 
    if (has_feature(feat_viewport_array)) {
@@ -8059,7 +8065,7 @@ static void vrend_renderer_fill_caps_v2(int gl_ver, int gles_ver,  union virgl_c
    } else
       caps->v2.max_shader_patch_varyings = 0;
 
-   if (epoxy_has_gl_extension("GL_ARB_texture_gather")) {
+   if (has_feature(feat_texture_gather)) {
        glGetIntegerv(GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET, &caps->v2.min_texture_gather_offset);
        glGetIntegerv(GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET, &caps->v2.max_texture_gather_offset);
    }
-- 
2.17.1



More information about the virglrenderer-devel mailing list