mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 09:18:04 +02:00
ac,radeonsi: don't use nir_intrinsic_base for FS outputs
It was only used by the PS epilog in radeonsi. Acked-by: Pierre-Eric Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40556>
This commit is contained in:
parent
99546f7bad
commit
ef44d8e9c8
5 changed files with 16 additions and 17 deletions
|
|
@ -2035,7 +2035,8 @@ static LLVMValueRef visit_load_ubo_buffer(struct ac_nir_context *ctx, nir_intrin
|
|||
|
||||
static void visit_store_output(struct ac_nir_context *ctx, nir_intrinsic_instr *instr)
|
||||
{
|
||||
unsigned base = nir_intrinsic_base(instr);
|
||||
nir_shader *nir = nir_cf_node_get_function(&instr->instr.block->cf_node)->function->shader;
|
||||
unsigned base = ac_nir_get_io_driver_location(nir, nir_intrinsic_io_semantics(instr).location, false);
|
||||
unsigned writemask = nir_intrinsic_write_mask(instr);
|
||||
unsigned component = nir_intrinsic_component(instr);
|
||||
LLVMValueRef src = ac_to_float(&ctx->ac, get_src(ctx, instr->src[0]));
|
||||
|
|
|
|||
|
|
@ -202,14 +202,13 @@ static void gather_io_instrinsic(const nir_shader *nir, struct si_shader_info *i
|
|||
}
|
||||
}
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT && !is_input) {
|
||||
/* Never use FRAG_RESULT_COLOR directly. */
|
||||
if (semantic == FRAG_RESULT_COLOR)
|
||||
semantic = FRAG_RESULT_DATA0;
|
||||
}
|
||||
|
||||
unsigned driver_location = nir_intrinsic_base(intr);
|
||||
unsigned num_slots = indirect ? nir_intrinsic_io_semantics(intr).num_slots : 1;
|
||||
unsigned driver_location;
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT && !is_input)
|
||||
driver_location = ac_nir_get_io_driver_location(nir, semantic, is_input);
|
||||
else
|
||||
driver_location = nir_intrinsic_base(intr);
|
||||
|
||||
if (is_input) {
|
||||
assert(driver_location + num_slots <= ARRAY_SIZE(info->input_semantic));
|
||||
|
|
|
|||
|
|
@ -571,7 +571,7 @@ static bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shade
|
|||
|
||||
case MESA_SHADER_FRAGMENT:
|
||||
if (!shader->is_monolithic)
|
||||
si_llvm_ps_build_end(ctx);
|
||||
si_llvm_ps_build_end(ctx, nir);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -66,6 +66,6 @@ void si_llvm_init_tcs_callbacks(struct si_shader_context *ctx);
|
|||
/* si_shader_llvm_ps.c */
|
||||
void si_llvm_build_ps_prolog(struct si_shader_context *ctx, union si_shader_part_key *key);
|
||||
void si_llvm_build_ps_epilog(struct si_shader_context *ctx, union si_shader_part_key *key);
|
||||
void si_llvm_ps_build_end(struct si_shader_context *ctx);
|
||||
void si_llvm_ps_build_end(struct si_shader_context *ctx, const nir_shader *nir);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "si_shader_internal.h"
|
||||
#include "si_shader_llvm.h"
|
||||
#include "sid.h"
|
||||
#include "nir.h"
|
||||
|
||||
static LLVMValueRef si_build_fs_interp(struct si_shader_context *ctx, unsigned attr_index,
|
||||
unsigned chan, LLVMValueRef prim_mask, LLVMValueRef i,
|
||||
|
|
@ -346,12 +347,10 @@ static void si_export_mrt_color(struct si_shader_context *ctx, LLVMValueRef *col
|
|||
*
|
||||
* The alpha-ref SGPR is returned via its original location.
|
||||
*/
|
||||
void si_llvm_ps_build_end(struct si_shader_context *ctx)
|
||||
void si_llvm_ps_build_end(struct si_shader_context *ctx, const nir_shader *nir)
|
||||
{
|
||||
struct si_shader *shader = ctx->shader;
|
||||
struct si_shader_info *info = &shader->selector->info;
|
||||
LLVMBuilderRef builder = ctx->ac.builder;
|
||||
unsigned i, j, vgpr;
|
||||
unsigned j, vgpr;
|
||||
|
||||
LLVMValueRef color[8][4] = {};
|
||||
uint8_t color_output_mask = 0, is_16bit_mask = 0;
|
||||
|
|
@ -359,8 +358,8 @@ void si_llvm_ps_build_end(struct si_shader_context *ctx)
|
|||
LLVMValueRef ret;
|
||||
|
||||
/* Read the output values. */
|
||||
for (i = 0; i < info->num_outputs; i++) {
|
||||
unsigned semantic = info->output_semantic[i];
|
||||
u_foreach_bit(semantic, (uint32_t)nir->info.outputs_written) {
|
||||
unsigned i = ac_nir_get_io_driver_location(nir, semantic, false);
|
||||
|
||||
switch (semantic) {
|
||||
case FRAG_RESULT_DEPTH:
|
||||
|
|
@ -373,7 +372,7 @@ void si_llvm_ps_build_end(struct si_shader_context *ctx)
|
|||
samplemask = LLVMBuildLoad2(builder, ctx->ac.f32, ctx->abi.outputs[4 * i + 0], "");
|
||||
break;
|
||||
default:
|
||||
if (semantic >= FRAG_RESULT_DATA0) {
|
||||
if (semantic == FRAG_RESULT_COLOR || semantic >= FRAG_RESULT_DATA0) {
|
||||
int index = mesa_frag_result_get_color_index(semantic);
|
||||
|
||||
for (j = 0; j < 4; j++) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue