mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 07:10:09 +01:00
pan/mdg: eliminate references to ins->texture.op
This commit makes the `ins->op` the correct field to use with texture instructions. Signed-off-by: Italo Nicola <italonicola@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
This commit is contained in:
parent
83592de7ad
commit
92c808cd47
7 changed files with 23 additions and 15 deletions
|
|
@ -1600,9 +1600,8 @@ emit_control_barrier(compiler_context *ctx)
|
||||||
.type = TAG_TEXTURE_4,
|
.type = TAG_TEXTURE_4,
|
||||||
.dest = ~0,
|
.dest = ~0,
|
||||||
.src = { ~0, ~0, ~0, ~0 },
|
.src = { ~0, ~0, ~0, ~0 },
|
||||||
|
.op = TEXTURE_OP_BARRIER,
|
||||||
.texture = {
|
.texture = {
|
||||||
.op = TEXTURE_OP_BARRIER,
|
|
||||||
|
|
||||||
/* TODO: optimize */
|
/* TODO: optimize */
|
||||||
.out_of_order = MIDGARD_BARRIER_BUFFER |
|
.out_of_order = MIDGARD_BARRIER_BUFFER |
|
||||||
MIDGARD_BARRIER_SHARED ,
|
MIDGARD_BARRIER_SHARED ,
|
||||||
|
|
@ -2094,8 +2093,8 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
|
||||||
.dest_type = dest_type,
|
.dest_type = dest_type,
|
||||||
.swizzle = SWIZZLE_IDENTITY_4,
|
.swizzle = SWIZZLE_IDENTITY_4,
|
||||||
.outmod = outmod,
|
.outmod = outmod,
|
||||||
|
.op = midgard_texop,
|
||||||
.texture = {
|
.texture = {
|
||||||
.op = midgard_texop,
|
|
||||||
.format = midgard_tex_format(instr->sampler_dim),
|
.format = midgard_tex_format(instr->sampler_dim),
|
||||||
.texture_handle = texture_index,
|
.texture_handle = texture_index,
|
||||||
.sampler_handle = sampler_index,
|
.sampler_handle = sampler_index,
|
||||||
|
|
|
||||||
|
|
@ -106,8 +106,8 @@ midgard_emit_derivatives(compiler_context *ctx, nir_alu_instr *instr)
|
||||||
.src = { ~0, nir_src_index(ctx, &instr->src[0].src), ~0, ~0 },
|
.src = { ~0, nir_src_index(ctx, &instr->src[0].src), ~0, ~0 },
|
||||||
.swizzle = SWIZZLE_IDENTITY_4,
|
.swizzle = SWIZZLE_IDENTITY_4,
|
||||||
.src_types = { nir_type_float32, nir_type_float32 },
|
.src_types = { nir_type_float32, nir_type_float32 },
|
||||||
|
.op = mir_derivative_op(instr->op),
|
||||||
.texture = {
|
.texture = {
|
||||||
.op = mir_derivative_op(instr->op),
|
|
||||||
.format = MALI_TEX_2D,
|
.format = MALI_TEX_2D,
|
||||||
.in_reg_full = 1,
|
.in_reg_full = 1,
|
||||||
.out_full = 1,
|
.out_full = 1,
|
||||||
|
|
@ -126,7 +126,7 @@ midgard_lower_derivatives(compiler_context *ctx, midgard_block *block)
|
||||||
{
|
{
|
||||||
mir_foreach_instr_in_block_safe(block, ins) {
|
mir_foreach_instr_in_block_safe(block, ins) {
|
||||||
if (ins->type != TAG_TEXTURE_4) continue;
|
if (ins->type != TAG_TEXTURE_4) continue;
|
||||||
if (!OP_IS_DERIVATIVE(ins->texture.op)) continue;
|
if (!OP_IS_DERIVATIVE(ins->op)) continue;
|
||||||
|
|
||||||
/* Check if we need to split */
|
/* Check if we need to split */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -487,6 +487,14 @@ mir_lower_roundmode(midgard_instruction *ins)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static midgard_texture_word
|
||||||
|
texture_word_from_instr(midgard_instruction *ins)
|
||||||
|
{
|
||||||
|
midgard_texture_word tex = ins->texture;
|
||||||
|
tex.op = ins->op;
|
||||||
|
return tex;
|
||||||
|
}
|
||||||
|
|
||||||
static midgard_vector_alu
|
static midgard_vector_alu
|
||||||
vector_alu_from_instr(midgard_instruction *ins)
|
vector_alu_from_instr(midgard_instruction *ins)
|
||||||
{
|
{
|
||||||
|
|
@ -673,7 +681,7 @@ emit_binary_bundle(compiler_context *ctx,
|
||||||
ins->texture.next_type = next_tag;
|
ins->texture.next_type = next_tag;
|
||||||
|
|
||||||
/* Nothing else to pack for barriers */
|
/* Nothing else to pack for barriers */
|
||||||
if (ins->texture.op == TEXTURE_OP_BARRIER) {
|
if (ins->op == TEXTURE_OP_BARRIER) {
|
||||||
ins->texture.cont = ins->texture.last = 1;
|
ins->texture.cont = ins->texture.last = 1;
|
||||||
util_dynarray_append(emission, midgard_texture_word, ins->texture);
|
util_dynarray_append(emission, midgard_texture_word, ins->texture);
|
||||||
return;
|
return;
|
||||||
|
|
@ -702,14 +710,15 @@ emit_binary_bundle(compiler_context *ctx,
|
||||||
ins->texture.sampler_type = midgard_sampler_type(ins->dest_type);
|
ins->texture.sampler_type = midgard_sampler_type(ins->dest_type);
|
||||||
ins->texture.outmod = ins->outmod;
|
ins->texture.outmod = ins->outmod;
|
||||||
|
|
||||||
if (mir_op_computes_derivatives(ctx->stage, ins->texture.op)) {
|
if (mir_op_computes_derivatives(ctx->stage, ins->op)) {
|
||||||
ins->texture.cont = !ins->helper_terminate;
|
ins->texture.cont = !ins->helper_terminate;
|
||||||
ins->texture.last = ins->helper_terminate || ins->helper_execute;
|
ins->texture.last = ins->helper_terminate || ins->helper_execute;
|
||||||
} else {
|
} else {
|
||||||
ins->texture.cont = ins->texture.last = 1;
|
ins->texture.cont = ins->texture.last = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
util_dynarray_append(emission, midgard_texture_word, ins->texture);
|
midgard_texture_word texture = texture_word_from_instr(ins);
|
||||||
|
util_dynarray_append(emission, midgard_texture_word, texture);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ mir_block_uses_helpers(gl_shader_stage stage, midgard_block *block)
|
||||||
{
|
{
|
||||||
mir_foreach_instr_in_block(block, ins) {
|
mir_foreach_instr_in_block(block, ins) {
|
||||||
if (ins->type != TAG_TEXTURE_4) continue;
|
if (ins->type != TAG_TEXTURE_4) continue;
|
||||||
if (mir_op_computes_derivatives(stage, ins->texture.op))
|
if (mir_op_computes_derivatives(stage, ins->op))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,7 +151,7 @@ mir_analyze_helper_terminate(compiler_context *ctx)
|
||||||
|
|
||||||
mir_foreach_instr_in_block_rev(block, ins) {
|
mir_foreach_instr_in_block_rev(block, ins) {
|
||||||
if (ins->type != TAG_TEXTURE_4) continue;
|
if (ins->type != TAG_TEXTURE_4) continue;
|
||||||
if (!mir_op_computes_derivatives(ctx->stage, ins->texture.op)) continue;
|
if (!mir_op_computes_derivatives(ctx->stage, ins->op)) continue;
|
||||||
|
|
||||||
ins->helper_terminate = true;
|
ins->helper_terminate = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -197,7 +197,7 @@ mir_analyze_helper_requirements(compiler_context *ctx)
|
||||||
mir_foreach_instr_global(ctx, ins) {
|
mir_foreach_instr_global(ctx, ins) {
|
||||||
if (ins->type != TAG_TEXTURE_4) continue;
|
if (ins->type != TAG_TEXTURE_4) continue;
|
||||||
if (ins->dest >= ctx->temp_count) continue;
|
if (ins->dest >= ctx->temp_count) continue;
|
||||||
if (!mir_op_computes_derivatives(ctx->stage, ins->texture.op)) continue;
|
if (!mir_op_computes_derivatives(ctx->stage, ins->op)) continue;
|
||||||
|
|
||||||
mir_foreach_src(ins, s) {
|
mir_foreach_src(ins, s) {
|
||||||
if (ins->src[s] < temp_count)
|
if (ins->src[s] < temp_count)
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ can_dce(midgard_instruction *ins)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (ins->type == TAG_TEXTURE_4)
|
if (ins->type == TAG_TEXTURE_4)
|
||||||
if (ins->texture.op == TEXTURE_OP_BARRIER)
|
if (ins->op == TEXTURE_OP_BARRIER)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -755,7 +755,7 @@ install_registers_instr(
|
||||||
}
|
}
|
||||||
|
|
||||||
case TAG_TEXTURE_4: {
|
case TAG_TEXTURE_4: {
|
||||||
if (ins->texture.op == TEXTURE_OP_BARRIER)
|
if (ins->op == TEXTURE_OP_BARRIER)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Grab RA results */
|
/* Grab RA results */
|
||||||
|
|
|
||||||
|
|
@ -970,9 +970,9 @@ mir_schedule_texture(
|
||||||
mir_update_worklist(worklist, len, instructions, ins);
|
mir_update_worklist(worklist, len, instructions, ins);
|
||||||
|
|
||||||
struct midgard_bundle out = {
|
struct midgard_bundle out = {
|
||||||
.tag = ins->texture.op == TEXTURE_OP_BARRIER ?
|
.tag = ins->op == TEXTURE_OP_BARRIER ?
|
||||||
TAG_TEXTURE_4_BARRIER :
|
TAG_TEXTURE_4_BARRIER :
|
||||||
(ins->texture.op == TEXTURE_OP_TEXEL_FETCH) || is_vertex ?
|
(ins->op == TEXTURE_OP_TEXEL_FETCH) || is_vertex ?
|
||||||
TAG_TEXTURE_4_VTX : TAG_TEXTURE_4,
|
TAG_TEXTURE_4_VTX : TAG_TEXTURE_4,
|
||||||
.instruction_count = 1,
|
.instruction_count = 1,
|
||||||
.instructions = { ins }
|
.instructions = { ins }
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue