diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index 2499b3d3a4a..aa413059285 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -1865,31 +1865,16 @@ vir_emit_tlb_color_write(struct v3d_compile *c, unsigned rt) num_components = MAX2(num_components, 3); assert(num_components != 0); - enum glsl_base_type type = glsl_get_base_type(var->type); - bool is_int_format = type == GLSL_TYPE_INT || type == GLSL_TYPE_UINT; - bool is_32b_tlb_format = is_int_format || - (c->fs_key->f32_color_rb & (1 << rt)); - - if (is_int_format) { - /* The F32 vs I32 distinction was dropped in 4.2. */ - if (c->devinfo->ver < 42) - conf |= TLB_TYPE_I32_COLOR; - else - conf |= TLB_TYPE_F32_COLOR; + if (c->fs_key->f32_color_rb & (1 << rt)) { + conf |= TLB_TYPE_F32_COLOR; conf |= ((num_components - 1) << TLB_VEC_SIZE_MINUS_1_SHIFT); } else { - if (c->fs_key->f32_color_rb & (1 << rt)) { - conf |= TLB_TYPE_F32_COLOR; - conf |= ((num_components - 1) << - TLB_VEC_SIZE_MINUS_1_SHIFT); - } else { - conf |= TLB_TYPE_F16_COLOR; - conf |= TLB_F16_SWAP_HI_LO; - if (num_components >= 3) - conf |= TLB_VEC_SIZE_4_F16; - else - conf |= TLB_VEC_SIZE_2_F16; - } + conf |= TLB_TYPE_F16_COLOR; + conf |= TLB_F16_SWAP_HI_LO; + if (num_components >= 3) + conf |= TLB_VEC_SIZE_4_F16; + else + conf |= TLB_VEC_SIZE_2_F16; } int num_samples = c->msaa_per_sample_output ? V3D_MAX_SAMPLES : 1; @@ -1911,7 +1896,7 @@ vir_emit_tlb_color_write(struct v3d_compile *c, unsigned rt) if (c->fs_key->sample_alpha_to_one) a = vir_uniform_f(c, 1.0); - if (is_32b_tlb_format) { + if (c->fs_key->f32_color_rb & (1 << rt)) { if (i == 0) { inst = vir_MOV_dest(c, tlbu_reg, r); inst->uniform = @@ -2618,15 +2603,6 @@ vir_emit_tlb_color_read(struct v3d_compile *c, nir_intrinsic_instr *instr) if (swap_rb) num_components = MAX2(num_components, 3); - nir_variable *var = c->output_color_var[rt]; - enum glsl_base_type type = glsl_get_base_type(var->type); - - bool is_int_format = type == GLSL_TYPE_INT || - type == GLSL_TYPE_UINT; - - bool is_32b_tlb_format = is_int_format || - (c->fs_key->f32_color_rb & (1 << rt)); - int num_samples = c->fs_key->msaa ? V3D_MAX_SAMPLES : 1; uint32_t conf = 0xffffff00; @@ -2634,11 +2610,8 @@ vir_emit_tlb_color_read(struct v3d_compile *c, nir_intrinsic_instr *instr) TLB_SAMPLE_MODE_PER_PIXEL; conf |= (7 - rt) << TLB_RENDER_TARGET_SHIFT; - if (is_32b_tlb_format) { - /* The F32 vs I32 distinction was dropped in 4.2. */ - conf |= (c->devinfo->ver < 42 && is_int_format) ? - TLB_TYPE_I32_COLOR : TLB_TYPE_F32_COLOR; - + if (c->fs_key->f32_color_rb & (1 << rt)) { + conf |= TLB_TYPE_F32_COLOR; conf |= ((num_components - 1) << TLB_VEC_SIZE_MINUS_1_SHIFT); } else { @@ -2654,7 +2627,7 @@ vir_emit_tlb_color_read(struct v3d_compile *c, nir_intrinsic_instr *instr) for (int i = 0; i < num_samples; i++) { struct qreg r, g, b, a; - if (is_32b_tlb_format) { + if (c->fs_key->f32_color_rb & (1 << rt)) { r = conf != 0xffffffff && i == 0? vir_TLBU_COLOR_READ(c, conf) : vir_TLB_COLOR_READ(c); diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h index ed4efd62055..d55b4a95483 100644 --- a/src/broadcom/compiler/v3d_compiler.h +++ b/src/broadcom/compiler/v3d_compiler.h @@ -441,11 +441,6 @@ struct v3d_fs_key { uint8_t swap_color_rb; /* Mask of which render targets need to be written as 32-bit floats */ uint8_t f32_color_rb; - /* Masks of which render targets need to be written as ints/uints. - * Used by gallium to work around lost information in TGSI. - */ - uint8_t int_color_rb; - uint8_t uint_color_rb; /* Color format information per render target. Only set when logic * operations are enabled, when fbfetch is in use or when falling back diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index 435d84de7a8..b75af23203d 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -1100,46 +1100,9 @@ v3d_nir_lower_gs_early(struct v3d_compile *c) NIR_PASS(_, c->s, nir_opt_constant_folding); } -static void -v3d_fixup_fs_output_types(struct v3d_compile *c) -{ - nir_foreach_shader_out_variable(var, c->s) { - uint32_t mask = 0; - - switch (var->data.location) { - case FRAG_RESULT_COLOR: - mask = ~0; - break; - case FRAG_RESULT_DATA0: - case FRAG_RESULT_DATA1: - case FRAG_RESULT_DATA2: - case FRAG_RESULT_DATA3: - case FRAG_RESULT_DATA4: - case FRAG_RESULT_DATA5: - case FRAG_RESULT_DATA6: - case FRAG_RESULT_DATA7: - mask = 1 << (var->data.location - FRAG_RESULT_DATA0); - break; - } - - if (c->fs_key->int_color_rb & mask) { - var->type = - glsl_vector_type(GLSL_TYPE_INT, - glsl_get_components(var->type)); - } else if (c->fs_key->uint_color_rb & mask) { - var->type = - glsl_vector_type(GLSL_TYPE_UINT, - glsl_get_components(var->type)); - } - } -} - static void v3d_nir_lower_fs_early(struct v3d_compile *c) { - if (c->fs_key->int_color_rb || c->fs_key->uint_color_rb) - v3d_fixup_fs_output_types(c); - if (c->fs_key->line_smoothing) { NIR_PASS(_, c->s, v3d_nir_lower_line_smooth); NIR_PASS(_, c->s, nir_lower_global_vars_to_local); diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index 6ce49f6657a..52d84407156 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -32,6 +32,7 @@ #include "compiler/nir/nir_lower_blend.h" #include "nir/nir_serialize.h" +#include "util/format/u_format.h" #include "util/shader_stats.h" #include "util/u_atomic.h" #include "util/os_time.h" @@ -1163,12 +1164,10 @@ v3d_fs_key_set_color_attachment(struct v3d_fs_key *key, key->f32_color_rb |= 1 << index; } - if (p_stage->nir->info.fs.untyped_color_outputs) { - if (util_format_is_pure_uint(fb_pipe_format)) - key->uint_color_rb |= 1 << index; - else if (util_format_is_pure_sint(fb_pipe_format)) - key->int_color_rb |= 1 << index; - } + if (util_format_is_pure_uint(fb_pipe_format)) + key->f32_color_rb |= 1 << index; + else if (util_format_is_pure_sint(fb_pipe_format)) + key->f32_color_rb |= 1 << index; } static void @@ -2069,6 +2068,11 @@ pipeline_populate_graphics_key(struct v3dv_pipeline *pipeline, desc->channel[0].size == 32) { key->f32_color_rb |= 1 << i; } + + if (util_format_is_pure_uint(fb_pipe_format)) + key->f32_color_rb |= 1 << i; + else if (util_format_is_pure_sint(fb_pipe_format)) + key->f32_color_rb |= 1 << i; } const VkPipelineVertexInputStateCreateInfo *vi_info = diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c index c2a02b745ae..a0813d204ea 100644 --- a/src/gallium/drivers/v3d/v3d_program.c +++ b/src/gallium/drivers/v3d/v3d_program.c @@ -746,12 +746,10 @@ v3d_update_compiled_fs(struct v3d_context *v3d, uint8_t prim_mode) key->f32_color_rb |= 1 << i; } - if (s->info.fs.untyped_color_outputs) { - if (util_format_is_pure_uint(cbuf->format)) - key->uint_color_rb |= 1 << i; - else if (util_format_is_pure_sint(cbuf->format)) - key->int_color_rb |= 1 << i; - } + if (util_format_is_pure_uint(cbuf->format)) + key->f32_color_rb |= 1 << i; + else if (util_format_is_pure_sint(cbuf->format)) + key->f32_color_rb |= 1 << i; } if (key->is_points) {