mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 17:30:20 +01:00
ac, radeonsi: add and use ac_get_ps_iter_mask
It is more natural for ac_get_ps_iter_mask to take sample count. Replace samplemask_log_ps_iter by ps_iter_smples in ac_nir_lower_ps_options accordingly. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23265>
This commit is contained in:
parent
750d641ca6
commit
0bba0eb0df
6 changed files with 24 additions and 22 deletions
|
|
@ -293,7 +293,7 @@ typedef struct {
|
|||
bool force_linear_sample_interp;
|
||||
bool force_persp_center_interp;
|
||||
bool force_linear_center_interp;
|
||||
unsigned samplemask_log_ps_iter;
|
||||
unsigned ps_iter_samples;
|
||||
|
||||
/* OpenGL only */
|
||||
bool clamp_color;
|
||||
|
|
|
|||
|
|
@ -248,16 +248,7 @@ lower_ps_load_sample_mask_in(nir_builder *b, nir_intrinsic_instr *intrin, lower_
|
|||
|
||||
b->cursor = nir_before_instr(&intrin->instr);
|
||||
|
||||
/* The bit pattern matches that used by fixed function fragment
|
||||
* processing.
|
||||
*/
|
||||
static const uint16_t ps_iter_masks[] = {
|
||||
0xffff, /* not used */
|
||||
0x5555, 0x1111, 0x0101, 0x0001,
|
||||
};
|
||||
assert(s->options->samplemask_log_ps_iter < ARRAY_SIZE(ps_iter_masks));
|
||||
uint32_t ps_iter_mask = ps_iter_masks[s->options->samplemask_log_ps_iter];
|
||||
|
||||
uint32_t ps_iter_mask = ac_get_ps_iter_mask(s->options->ps_iter_samples);
|
||||
nir_ssa_def *sampleid = nir_load_sample_id(b);
|
||||
nir_ssa_def *submask = nir_ishl(b, nir_imm_int(b, ps_iter_mask), sampleid);
|
||||
|
||||
|
|
@ -290,7 +281,7 @@ lower_ps_intrinsic(nir_builder *b, nir_instr *instr, void *state)
|
|||
return lower_ps_load_barycentric(b, intrin, s);
|
||||
break;
|
||||
case nir_intrinsic_load_sample_mask_in:
|
||||
if (s->options->samplemask_log_ps_iter)
|
||||
if (s->options->ps_iter_samples > 1)
|
||||
return lower_ps_load_sample_mask_in(b, intrin, s);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -678,6 +678,22 @@ unsigned ac_get_fs_input_vgpr_cnt(const struct ac_shader_config *config,
|
|||
return num_input_vgprs;
|
||||
}
|
||||
|
||||
uint16_t ac_get_ps_iter_mask(unsigned ps_iter_samples)
|
||||
{
|
||||
/* The bit pattern matches that used by fixed function fragment
|
||||
* processing.
|
||||
*/
|
||||
switch (ps_iter_samples) {
|
||||
case 1: return 0xffff;
|
||||
case 2: return 0x5555;
|
||||
case 4: return 0x1111;
|
||||
case 8: return 0x0101;
|
||||
case 16: return 0x0001;
|
||||
default:
|
||||
unreachable("invalid sample count");
|
||||
}
|
||||
}
|
||||
|
||||
void ac_choose_spi_color_formats(unsigned format, unsigned swap, unsigned ntype,
|
||||
bool is_depth, bool use_rbplus,
|
||||
struct ac_spi_color_formats *formats)
|
||||
|
|
|
|||
|
|
@ -173,6 +173,8 @@ unsigned ac_get_fs_input_vgpr_cnt(const struct ac_shader_config *config,
|
|||
signed char *face_vgpr_index, signed char *ancillary_vgpr_index,
|
||||
signed char *sample_coverage_vgpr_index_ptr);
|
||||
|
||||
uint16_t ac_get_ps_iter_mask(unsigned ps_iter_samples);
|
||||
|
||||
void ac_choose_spi_color_formats(unsigned format, unsigned swap, unsigned ntype,
|
||||
bool is_depth, bool use_rbplus,
|
||||
struct ac_spi_color_formats *formats);
|
||||
|
|
|
|||
|
|
@ -2242,7 +2242,7 @@ struct nir_shader *si_get_nir_shader(struct si_shader *shader,
|
|||
.force_linear_sample_interp = key->ps.part.prolog.force_linear_sample_interp,
|
||||
.force_persp_center_interp = key->ps.part.prolog.force_persp_center_interp,
|
||||
.force_linear_center_interp = key->ps.part.prolog.force_linear_center_interp,
|
||||
.samplemask_log_ps_iter = key->ps.part.prolog.samplemask_log_ps_iter,
|
||||
.ps_iter_samples = 1 << key->ps.part.prolog.samplemask_log_ps_iter,
|
||||
};
|
||||
|
||||
NIR_PASS_V(nir, ac_nir_lower_ps, &options);
|
||||
|
|
|
|||
|
|
@ -687,15 +687,8 @@ void si_llvm_build_ps_prolog(struct si_shader_context *ctx, union si_shader_part
|
|||
* entire pixel/fragment, so mask bits out based on the sample ID.
|
||||
*/
|
||||
if (key->ps_prolog.states.samplemask_log_ps_iter) {
|
||||
/* The bit pattern matches that used by fixed function fragment
|
||||
* processing. */
|
||||
static const uint16_t ps_iter_masks[] = {
|
||||
0xffff, /* not used */
|
||||
0x5555, 0x1111, 0x0101, 0x0001,
|
||||
};
|
||||
assert(key->ps_prolog.states.samplemask_log_ps_iter < ARRAY_SIZE(ps_iter_masks));
|
||||
|
||||
uint32_t ps_iter_mask = ps_iter_masks[key->ps_prolog.states.samplemask_log_ps_iter];
|
||||
uint32_t ps_iter_mask =
|
||||
ac_get_ps_iter_mask(1 << key->ps_prolog.states.samplemask_log_ps_iter);
|
||||
LLVMValueRef sampleid = si_unpack_param(ctx, ancillary, 8, 4);
|
||||
LLVMValueRef samplemask = ac_get_arg(&ctx->ac, param_sample_mask);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue