vrend: Lie yet a bit more about the GLSL feature level on GLES hosts

To properly use compute shaders in the guest when running on a GL ES host
it is better to advertice GLSL level 430, because otherwise compute shaders
that don't explicitely add the extension ARB_compute_shaders to the shader
will not compile.

Fixes #99

v2: Add comment about why we want to advertise this feature level (Gurchetan)
v3: Don't bypass checks for level 400

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Gert Wollny 6 years ago
parent c98a7ea3b3
commit 4a4f04827c
  1. 20
      src/vrend_renderer.c

@ -8557,13 +8557,29 @@ static void vrend_fill_caps_glsl_version(int gl_ver, int gles_ver,
if (caps->v1.glsl_level < 400) { if (caps->v1.glsl_level < 400) {
if (has_feature(feat_tessellation) && if (has_feature(feat_tessellation) &&
has_feature(feat_geometry_shader) && has_feature(feat_geometry_shader) &&
has_feature(feat_gpu_shader5)) has_feature(feat_gpu_shader5)) {
/* This is probably a lie, but Gallium enables /* This is probably a lie, but Gallium enables
* OES_geometry_shader and ARB_gpu_shader5 * OES_geometry_shader and ARB_gpu_shader5
* based on this value, apart from that it doesn't * based on this value, apart from that it doesn't
* seem to be a crucial value */ * seem to be a crucial value */
caps->v1.glsl_level = has_feature(feat_separate_shader_objects) ? 410 : 400; caps->v1.glsl_level = 400;
/* Let's lie a bit more */
if (has_feature(feat_separate_shader_objects)) {
caps->v1.glsl_level = 410;
/* Compute shaders require GLSL 4.30 unless the shader explicitely
* specifies GL_ARB_compute_shader as required. However, on OpenGL ES
* they are already supported with version 3.10, so if we already
* advertise a feature level of 410, just lie a bit more to make
* compute shaders available to GL programs that don't specify the
* extension within the shaders. */
if (has_feature(feat_compute_shader))
caps->v1.glsl_level = 430;
}
}
} }
vrend_printf("GLSL feature level %d\n", caps->v1.glsl_level);
} }
static void set_format_bit(struct virgl_supported_format_mask *mask, enum virgl_formats fmt) static void set_format_bit(struct virgl_supported_format_mask *mask, enum virgl_formats fmt)

Loading…
Cancel
Save