[virglrenderer-devel] [PATCH v3 8/8] vrend, caps: unify GLSL version evaluation

Gert Wollny gert.wollny at collabora.com
Thu Jul 26 09:16:09 UTC 2018


Since the gles code path is now reduced to just setting the gles
version, move all the glsl stuff into one place.

v3: remove now unused parameter gl_ver
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
 src/vrend_renderer.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 70bf806..4207ff7 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -7402,9 +7402,6 @@ static void vrend_renderer_fill_caps_common(union virgl_caps *caps)
     */
    caps->v1.bset.occlusion_query = 1;
 
-   /* Set an initial level here, will be updated later */
-   caps->v1.glsl_level = 130;
-
    /* Set supported prims here as we now know what shaders we support. */
    caps->v1.prim_mask = (1 << PIPE_PRIM_POINTS) | (1 << PIPE_PRIM_LINES) |
                         (1 << PIPE_PRIM_LINE_STRIP) | (1 << PIPE_PRIM_LINE_LOOP) |
@@ -7456,7 +7453,7 @@ static void vrend_renderer_fill_caps_common(union virgl_caps *caps)
    }
 }
 
-static void vrend_renderer_fill_caps_gles(UNUSED bool fill_capset2, int gles_ver,
+static void vrend_fill_caps_glsl_version(int gl_ver, int gles_ver,
 					  union virgl_caps *caps)
 {
    if (gles_ver >= 30) {
@@ -7464,12 +7461,6 @@ static void vrend_renderer_fill_caps_gles(UNUSED bool fill_capset2, int gles_ver
    } else {
       caps->v1.glsl_level = 120;
    }
-}
-
-static void vrend_renderer_fill_caps_gl(bool fill_capset2, int gl_ver,
-					  union virgl_caps *caps)
-{
-   GLfloat range[2];
 
    if (gl_ver == 31)
       caps->v1.glsl_level = 140;
@@ -7481,6 +7472,13 @@ static void vrend_renderer_fill_caps_gl(bool fill_capset2, int gl_ver,
       caps->v1.glsl_level = 400;
    else if (gl_ver >= 41)
       caps->v1.glsl_level = 410;
+   else
+      caps->v1.glsl_level = 130;
+}
+
+static void vrend_renderer_fill_caps_gl(bool fill_capset2, union virgl_caps *caps)
+{
+   GLfloat range[2];
 
    if (!vrend_state.use_core_profile) {
       caps->v1.bset.poly_stipple = 1;
@@ -7537,12 +7535,10 @@ void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,
    }
 
    vrend_renderer_fill_caps_common(caps);
+   vrend_fill_caps_glsl_version(gl_ver, gles_ver, caps);
 
-   /* GLES has it's own path */
-   if (vrend_state.use_gles) {
-      vrend_renderer_fill_caps_gles(fill_capset2, gles_ver, caps);
-   } else
-      vrend_renderer_fill_caps_gl(fill_capset2, gl_ver, caps);
+   if (!vrend_state.use_gles)
+      vrend_renderer_fill_caps_gl(fill_capset2, caps);
 
    if (caps->v1.glsl_level >= 150) {
       caps->v1.prim_mask |= (1 << PIPE_PRIM_LINES_ADJACENCY) |
-- 
2.16.4



More information about the virglrenderer-devel mailing list