pan/midgard: Use shader stage in mir_op_computes_derivative

A 'normal' texture op may be emitted in a vertex shader on T720 but it
still doesn't take any derivatives.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig
2019-11-18 08:02:58 -05:00
parent 6f17fe0606
commit 3663340049
3 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -621,7 +621,7 @@ midgard_emit_derivatives(compiler_context *ctx, nir_alu_instr *instr);
void
midgard_lower_derivatives(compiler_context *ctx, midgard_block *block);
bool mir_op_computes_derivatives(unsigned op);
bool mir_op_computes_derivatives(gl_shader_stage stage, unsigned op);
/* Final emission */
+8 -1
View File
@@ -72,12 +72,19 @@ mir_derivative_op(nir_op op)
* implicitly */
bool
mir_op_computes_derivatives(unsigned op)
mir_op_computes_derivatives(gl_shader_stage stage, unsigned op)
{
/* Only fragment shaders may compute derivatives, but the sense of
* "normal" changes in vertex shaders on certain GPUs */
if (op == TEXTURE_OP_NORMAL && stage != MESA_SHADER_FRAGMENT)
return false;
switch (op) {
case TEXTURE_OP_NORMAL:
case TEXTURE_OP_DFDX:
case TEXTURE_OP_DFDY:
assert(stage == MESA_SHADER_FRAGMENT);
return true;
default:
return false;
+1 -1
View File
@@ -430,7 +430,7 @@ emit_binary_bundle(compiler_context *ctx,
ctx->texture_op_count--;
if (mir_op_computes_derivatives(ins->texture.op)) {
if (mir_op_computes_derivatives(ctx->stage, ins->texture.op)) {
bool continues = ctx->texture_op_count > 0;
/* Control flow complicates helper invocation