shader: rework precise-emitting for built-ins

In 4732489 (shader: do not redeclare built-ins as precise), I confused a
mesa shader-compiler bug with a spec problem. Turns out, redeclaring
built-ins as precise is allowed by the spec, just the same as invariant
variables. And even mesa allows this.

What mesa doesn't currently allow, is to redeclare a variable as *both*
invariant *and* precise. This problem does not extend to new
declarations, where this is already handled correctly.

So, let's avoid emitting both; it's not really needed to emit both, as
they essentially have the same effect (disable reordering), just with
some different usage-semantics. And for the cases we support, these are
effectively the same.

This fixes dEQP-GLES31.functional.tessellation.common_edge.*_precise
without breaking dEQP-GLES2.functional.shaders.algorithm.hsl_to_rgb_vertex
this time.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Erik Faye-Lund 6 years ago committed by Dave Airlie
parent 10ae7e399c
commit 36c919e139
  1. 7
      src/vrend_shader.c

@ -4577,9 +4577,10 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr)
ctx->outputs[i].fbfetch_used ? "inout" : "out",
ctx->outputs[i].glsl_name);
STRCAT_WITH_RET(glsl_hdr, buf);
} else if (ctx->outputs[i].invariant) {
snprintf(buf, 255, "%s %s;\n",
ctx->outputs[i].invariant ? "invariant " : "",
} else if (ctx->outputs[i].invariant || ctx->outputs[i].precise) {
snprintf(buf, 255, "%s%s;\n",
ctx->outputs[i].precise ? "precise " :
(ctx->outputs[i].invariant ? "invariant " : ""),
ctx->outputs[i].glsl_name);
STRCAT_WITH_RET(glsl_hdr, buf);
}

Loading…
Cancel
Save