mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-01 01:00:10 +01:00
v3d/compiler: remove int/uint tracking
We don't need this anymore as we do not support anything older than 4.2. Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34742>
This commit is contained in:
parent
d8624e6a79
commit
b39fc710ee
5 changed files with 26 additions and 93 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue