mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
nak: Add an is_graphics param to nak_const_offsets
Reviewed-by: Mary Guillemard <mary@mary.zone> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40639>
This commit is contained in:
parent
017bb885db
commit
aa782218e5
3 changed files with 9 additions and 7 deletions
|
|
@ -830,12 +830,13 @@ nak_nir_lower_printf_intrin(nir_builder *b, nir_intrinsic_instr *intrin,
|
|||
void *data)
|
||||
{
|
||||
const struct nak_compiler* nak = data;
|
||||
const bool is_graphics = b->shader->info.stage != MESA_SHADER_COMPUTE;
|
||||
b->cursor = nir_before_instr(&intrin->instr);
|
||||
if (intrin->intrinsic == nir_intrinsic_load_printf_buffer_address) {
|
||||
nir_def *buffer_addr = nir_ldc_nv(
|
||||
b, 1, 64,
|
||||
nir_imm_int(b, 0),
|
||||
nir_imm_int(b, nak_const_offsets(nak)->printf_buffer_offset));
|
||||
nir_imm_int(b, nak_const_offsets(nak, is_graphics)->printf_buffer_offset));
|
||||
nir_def_replace(&intrin->def, buffer_addr);
|
||||
return true;
|
||||
} else if (intrin->intrinsic == nir_intrinsic_load_printf_buffer_size) {
|
||||
|
|
|
|||
|
|
@ -99,10 +99,11 @@ static nir_def *
|
|||
load_sample_pos_u4_at(nir_builder *b, nir_def *sample_id,
|
||||
const struct nak_compiler* nak)
|
||||
{
|
||||
const struct nak_constant_offset_info *info = nak_const_offsets(nak, true);
|
||||
nir_def *loc = nir_ldc_nv(b, 1, 8,
|
||||
nir_imm_int(b, nak_const_offsets(nak)->sample_info_cb),
|
||||
nir_imm_int(b, info->sample_info_cb),
|
||||
nir_iadd_imm(b, sample_id,
|
||||
nak_const_offsets(nak)->sample_locations_offset),
|
||||
info->sample_locations_offset),
|
||||
.align_mul = 1, .align_offset = 0);
|
||||
|
||||
/* The rest of these calculations are in 32-bit */
|
||||
|
|
@ -116,13 +117,13 @@ static nir_def *
|
|||
load_pass_sample_mask_at(nir_builder *b, nir_def *sample_id,
|
||||
const struct nak_compiler* nak)
|
||||
{
|
||||
const struct nak_constant_offset_info *info = nak_const_offsets(nak, true);
|
||||
nir_def *offset =
|
||||
nir_imul_imm(b, sample_id, sizeof(struct nak_sample_mask));
|
||||
offset = nir_iadd_imm(b, offset,
|
||||
nak_const_offsets(nak)->sample_masks_offset);
|
||||
offset = nir_iadd_imm(b, offset, info->sample_masks_offset);
|
||||
|
||||
return nir_ldc_nv(b, 1, 8 * sizeof(struct nak_sample_mask),
|
||||
nir_imm_int(b, nak_const_offsets(nak)->sample_info_cb),
|
||||
nir_imm_int(b, info->sample_info_cb),
|
||||
offset,
|
||||
.align_mul = sizeof(struct nak_sample_mask),
|
||||
.align_offset = 0);
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ enum nak_fs_out {
|
|||
#define NAK_FS_OUT_COLOR(n) (NAK_FS_OUT_COLOR0 + (n) * 16)
|
||||
|
||||
static inline const struct nak_constant_offset_info*
|
||||
nak_const_offsets(const struct nak_compiler* nak)
|
||||
nak_const_offsets(const struct nak_compiler* nak, bool is_graphics)
|
||||
{
|
||||
return &nak_const_offsets_base;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue