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 <hoegsberg@chromium.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
}
struct ir3 * ir3_create(struct ir3_compiler *compiler,
- unsigned nin, unsigned nout)
+ gl_shader_stage type, unsigned nin, unsigned nout)
{
struct ir3 *shader = rzalloc(compiler, struct ir3);
shader->compiler = compiler;
+ shader->type = type;
shader->ninputs = nin;
shader->inputs = ir3_alloc(shader, sizeof(shader->inputs[0]) * nin);
struct ir3 {
struct ir3_compiler *compiler;
+ gl_shader_stage type;
unsigned ninputs, noutputs;
struct ir3_instruction **inputs;
}
struct ir3 * ir3_create(struct ir3_compiler *compiler,
- unsigned nin, unsigned nout);
+ gl_shader_stage type, unsigned nin, unsigned nout);
void ir3_destroy(struct ir3 *shader);
void * ir3_assemble(struct ir3 *shader,
struct ir3_info *info, uint32_t gpu_id);
compiler->gpu_id = gpu_id;
compiler->set = ir3_ra_alloc_reg_set(compiler);
+ if (compiler->gpu_id >= 600) {
+ compiler->samgq_workaround = true;
+ }
+
if (compiler->gpu_id >= 400) {
/* need special handling for "flat" */
compiler->flat_bypass = true;
* index coordinate:
*/
bool array_index_add_half;
+
+ /* on a6xx, rewrite samgp to sequence of samgq0-3 in vertex shaders:
+ */
+ bool samgq_workaround;
};
struct ir3_compiler * ir3_compiler_create(struct fd_device *dev, uint32_t gpu_id);
*/
ninputs += max_sysvals[ctx->so->type];
- ctx->ir = ir3_create(ctx->compiler, ninputs, noutputs);
+ ctx->ir = ir3_create(ctx->compiler, ctx->so->type, ninputs, noutputs);
/* Create inputs in first block: */
ctx->block = get_block(ctx, nir_start_block(fxn));
struct ir3_legalize_ctx {
struct ir3_compiler *compiler;
+ gl_shader_stage type;
bool has_ssbo;
bool need_pixlod;
int max_bary;
}
}
- 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]);
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) {