summaryrefslogtreecommitdiffstats
path: root/src/freedreno/ir3/ir3_legalize.c
diff options
context:
space:
mode:
authorKristian H. Kristensen <[email protected]>2019-03-27 15:31:49 -0700
committerKristian H. Kristensen <[email protected]>2019-03-28 10:26:32 -0700
commit107a8ec3b331f0b9bbaa489689ffd080100ef6e9 (patch)
treed5e697fda78e0062af3c67a7e5522b1cf935538a /src/freedreno/ir3/ir3_legalize.c
parentf30d4a1ccaece3578fb92d245cc44a5c7dccdd7d (diff)
freedreno/ir3: Add workaround for VS samgq
This instruction needs a workaround when used from vertex shaders. Fixes: dEQP-GLES3.functional.shaders.texture_functions.texturegradoffset.sampler2dshadow_vertex dEQP-GLES3.functional.shaders.texture_functions.texturegradoffset.sampler3d_fixed_vertex dEQP-GLES3.functional.shaders.texture_functions.texturegradoffset.sampler3d_float_vertex dEQP-GLES3.functional.shaders.texture_functions.textureprojgradoffset.sampler2dshadow_vertex dEQP-GLES3.functional.shaders.texture_functions.textureprojgradoffset.sampler3d_fixed_vertex dEQP-GLES3.functional.shaders.texture_functions.textureprojgradoffset.sampler3d_float_vertex dEQP-GLES3.functional.shaders.texture_functions.textureprojgrad.sampler2dshadow_vertex Signed-off-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/freedreno/ir3/ir3_legalize.c')
-rw-r--r--src/freedreno/ir3/ir3_legalize.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/freedreno/ir3/ir3_legalize.c b/src/freedreno/ir3/ir3_legalize.c
index cb9a3f97292..e28cac216b5 100644
--- a/src/freedreno/ir3/ir3_legalize.c
+++ b/src/freedreno/ir3/ir3_legalize.c
@@ -41,6 +41,7 @@
struct ir3_legalize_ctx {
struct ir3_compiler *compiler;
+ gl_shader_stage type;
bool has_ssbo;
bool need_pixlod;
int max_bary;
@@ -212,7 +213,20 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
}
}
- list_addtail(&n->node, &block->instr_list);
+ if (ctx->compiler->samgq_workaround &&
+ ctx->type == MESA_SHADER_VERTEX && n->opc == OPC_SAMGQ) {
+ struct ir3_instruction *samgp;
+
+ for (i = 0; i < 4; i++) {
+ samgp = ir3_instr_clone(n);
+ samgp->opc = OPC_SAMGP0 + i;
+ if (i > 1)
+ samgp->flags |= IR3_INSTR_SY;
+ }
+ list_delinit(&n->node);
+ } else {
+ list_addtail(&n->node, &block->instr_list);
+ }
if (is_sfu(n))
regmask_set(&state->needs_ss, n->regs[0]);
@@ -480,6 +494,7 @@ ir3_legalize(struct ir3 *ir, bool *has_ssbo, bool *need_pixlod, int *max_bary)
ctx->max_bary = -1;
ctx->compiler = ir->compiler;
+ ctx->type = ir->type;
/* allocate per-block data: */
list_for_each_entry (struct ir3_block, block, &ir->block_list, node) {