[virglrenderer-devel] [PATCH 4/8] vrend, feature: Add GLSL version information for GLES 3.1 host

Gert Wollny gert.wollny at collabora.com
Sun Aug 5 14:45:59 UTC 2018


v2: use the glsl version from the caps
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
 src/vrend_renderer.c | 4 +++-
 src/vrend_shader.c   | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 8291db8..501222b 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -7795,7 +7795,9 @@ static void vrend_fill_caps_glsl_version(int gl_ver, int gles_ver,
    if (gles_ver > 0) {
       caps->v1.glsl_level = 120;
 
-      if (gles_ver >= 30)
+      if (gles_ver >= 31)
+         caps->v1.glsl_level = 310;
+      else if (gles_ver >= 30)
          caps->v1.glsl_level = 130;
    }
 
diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index bc846d1..eaf82fe 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -3940,7 +3940,9 @@ prolog(struct tgsi_iterate_context *iter)
 static char *emit_header(struct dump_ctx *ctx, char *glsl_hdr)
 {
    if (ctx->cfg->use_gles) {
-      STRCAT_WITH_RET(glsl_hdr, "#version 300 es\n");
+      char buf[32];
+      snprintf(buf, sizeof(buf), "#version %d es\n", ctx->cfg->glsl_version);
+      STRCAT_WITH_RET(glsl_hdr, buf);
       PAD_GPU_SHADER5(glsl_hdr);
       STRCAT_WITH_RET(glsl_hdr, "precision highp float;\n");
       STRCAT_WITH_RET(glsl_hdr, "precision highp int;\n");
-- 
2.17.1



More information about the virglrenderer-devel mailing list