glsl: don't lower to mediump for desktop OpenGL
authorMarek Olšák <marek.olsak@amd.com>
Sat, 25 Jul 2020 00:31:07 +0000 (20:31 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 5 Aug 2020 22:04:47 +0000 (22:04 +0000)
Desktop OpenGL ignores all precision qualifiers.

Also, the lowering pass doesn't work if precision qualifiers are not set,
which is only possible with desktop OpenGL, causing random behavior.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6073>

src/compiler/glsl/glsl_parser_extras.cpp

index e9130d16d254eb4686729de1cf358b8439c10612..cb206e32a499e63fea8dc0279edc7410fe7ae0b4 100644 (file)
@@ -2249,7 +2249,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
       &ctx->Const.ShaderCompilerOptions[shader->Stage];
 
    if (!state->error && !shader->ir->is_empty()) {
-      if (options->LowerPrecisionFloat16 || options->LowerPrecisionInt16)
+      if (state->es_shader &&
+          (options->LowerPrecisionFloat16 || options->LowerPrecisionInt16))
          lower_precision(options, shader->ir);
       lower_builtins(shader->ir);
       assign_subroutine_indexes(state);