vrend,caps: unify GLSL version evaluation (v4)

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
v4: rebase after image and compute shader patches landed
v5: rework logic a bit taking Eriks suggestion into account

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v3)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
macos/master
Gert Wollny 6 years ago committed by Jakob Bornecrantz
parent 0bed90c245
commit e9a1d25a60
  1. 34
      src/vrend_renderer.c

@ -7797,9 +7797,6 @@ static void vrend_renderer_fill_caps_common(union virgl_caps *caps)
*/ */
caps->v1.bset.occlusion_query = 1; 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. */ /* Set supported prims here as we now know what shaders we support. */
caps->v1.prim_mask = (1 << PIPE_PRIM_POINTS) | (1 << PIPE_PRIM_LINES) | caps->v1.prim_mask = (1 << PIPE_PRIM_POINTS) | (1 << PIPE_PRIM_LINES) |
(1 << PIPE_PRIM_LINE_STRIP) | (1 << PIPE_PRIM_LINE_LOOP) | (1 << PIPE_PRIM_LINE_STRIP) | (1 << PIPE_PRIM_LINE_LOOP) |
@ -7857,19 +7854,18 @@ static void vrend_renderer_fill_caps_v2_common(union virgl_caps *caps)
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, (GLint*)&caps->v2.uniform_buffer_offset_alignment); glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, (GLint*)&caps->v2.uniform_buffer_offset_alignment);
} }
static void vrend_renderer_fill_caps_gles(int gles_ver, union virgl_caps *caps) static void vrend_fill_caps_glsl_version(int gl_ver, int gles_ver,
union virgl_caps *caps)
{ {
if (gles_ver >= 30) { if (gles_ver > 0) {
caps->v1.glsl_level = 130;
} else {
caps->v1.glsl_level = 120; caps->v1.glsl_level = 120;
}
if (gles_ver >= 30)
caps->v1.glsl_level = 130;
} }
static void vrend_renderer_fill_caps_gl(bool fill_capset2, int gl_ver, if (gl_ver > 0) {
union virgl_caps *caps) caps->v1.glsl_level = 130;
{
GLfloat range[2];
if (gl_ver == 31) if (gl_ver == 31)
caps->v1.glsl_level = 140; caps->v1.glsl_level = 140;
@ -7885,6 +7881,12 @@ static void vrend_renderer_fill_caps_gl(bool fill_capset2, int gl_ver,
caps->v1.glsl_level = 420; caps->v1.glsl_level = 420;
else if (gl_ver >= 43) else if (gl_ver >= 43)
caps->v1.glsl_level = 430; caps->v1.glsl_level = 430;
}
}
static void vrend_renderer_fill_caps_gl(bool fill_capset2, union virgl_caps *caps)
{
GLfloat range[2];
if (!vrend_state.use_core_profile) { if (!vrend_state.use_core_profile) {
caps->v1.bset.poly_stipple = 1; caps->v1.bset.poly_stipple = 1;
@ -7939,12 +7941,10 @@ void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,
} }
vrend_renderer_fill_caps_common(caps); 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)
if (vrend_state.use_gles) { vrend_renderer_fill_caps_gl(fill_capset2, caps);
vrend_renderer_fill_caps_gles(gles_ver, caps);
} else
vrend_renderer_fill_caps_gl(fill_capset2, gl_ver, caps);
if (caps->v1.glsl_level >= 150) { if (caps->v1.glsl_level >= 150) {
caps->v1.prim_mask |= (1 << PIPE_PRIM_LINES_ADJACENCY) | caps->v1.prim_mask |= (1 << PIPE_PRIM_LINES_ADJACENCY) |

Loading…
Cancel
Save