[virglrenderer-devel] [PATCH 3/3] use feature mechanism for sample shading

Dave Airlie airlied at gmail.com
Mon Jul 23 02:08:05 UTC 2018


From: Dave Airlie <airlied at redhat.com>

---
 src/vrend_renderer.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 3643550..8fcfc99 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -91,6 +91,7 @@ enum feature_name
 {
    FEAT_START = 0,
    FEAT_TESSELLATION = 0,
+   FEAT_SAMPLE_SHADING,
    FEAT_END,
 };
 
@@ -103,6 +104,7 @@ struct features {
 
 static const struct features features_list[] = {
    [FEAT_TESSELLATION] = { 400, -1, "GL_ARB_tessellation_shader", NULL },
+   [FEAT_SAMPLE_SHADING] = { 400, -1, "GL_ARB_sample_shading", NULL },
 };
 
 #define HAVE_FEATURE(feature) (vrend_state.features[feature] == true)
@@ -135,7 +137,6 @@ struct global_renderer_state {
    bool have_gles31_vertex_attrib_binding;
    bool have_tf2;
    bool have_stencil_texturing;
-   bool have_sample_shading;
    bool have_texture_buffer_range;
    bool have_polygon_offset_clamp;
    bool have_texture_storage;
@@ -4187,7 +4188,7 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx)
             glDisable(GL_MULTISAMPLE);
       }
 
-      if (vrend_state.have_sample_shading) {
+      if (HAVE_FEATURE(FEAT_SAMPLE_SHADING)) {
          if (state->force_persample_interp)
             glEnable(GL_SAMPLE_SHADING);
          else
@@ -4667,9 +4668,6 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
          vrend_state.have_ms_scaled_blit = true;
    }
 
-   if (gl_ver >= 40 || epoxy_has_gl_extension("GL_ARB_sample_shading"))
-      vrend_state.have_sample_shading = true;
-
    if (gl_ver >= 43 || epoxy_has_gl_extension("GL_ARB_texture_buffer_range"))
       vrend_state.have_texture_buffer_range = true;
 
@@ -6252,7 +6250,7 @@ void vrend_set_min_samples(struct vrend_context *ctx, unsigned min_samples)
       min_sample_shading /= MAX2(1, ctx->sub->surf[0]->texture->base.nr_samples);
    }
 
-   if (vrend_state.have_sample_shading)
+   if (HAVE_FEATURE(FEAT_SAMPLE_SHADING))
       glMinSampleShading(min_sample_shading);
 }
 
@@ -7624,12 +7622,14 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
    if (HAVE_FEATURE(FEAT_TESSELLATION))
       caps->v1.bset.has_tessellation_shaders = 1;
 
+   if (HAVE_FEATURE(FEAT_SAMPLE_SHADING))
+      caps->v1.bset.has_sample_shading = 1;
+
    if (gl_ver >= 40) {
       caps->v1.bset.indep_blend_func = 1;
       caps->v1.bset.cube_map_array = 1;
       caps->v1.bset.texture_query_lod = 1;
       caps->v1.bset.has_indirect_draw = 1;
-      caps->v1.bset.has_sample_shading = 1;
       caps->v1.bset.has_fp64 = 1;
    } else {
       if (epoxy_has_gl_extension("GL_ARB_draw_buffers_blend"))
@@ -7640,8 +7640,6 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
          caps->v1.bset.texture_query_lod = 1;
       if (epoxy_has_gl_extension("GL_ARB_indirect_draw"))
          caps->v1.bset.has_indirect_draw = 1;
-      if (epoxy_has_gl_extension("GL_ARB_sample_shading"))
-         caps->v1.bset.has_sample_shading = 1;
       /* need gpu shader 5 for bitfield insert */
       if (epoxy_has_gl_extension("GL_ARB_gpu_shader_fp64") &&
           epoxy_has_gl_extension("GL_ARB_gpu_shader5"))
-- 
2.14.3



More information about the virglrenderer-devel mailing list