radv/nir: fix radv_nir_remap_color_attachment progress

And switch to SPDX header.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38853>
This commit is contained in:
Georg Lehmann 2025-12-07 18:11:33 +01:00 committed by Marge Bot
parent da197c3d55
commit a1fbf91ff2
2 changed files with 9 additions and 22 deletions

View file

@ -1,24 +1,7 @@
/*
* Copyright © 2024 Valve Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
* SPDX-License-Identifier: MIT
*/
#include "nir/nir.h"
@ -44,11 +27,14 @@ remap_color_attachment(nir_builder *b, nir_intrinsic_instr *intrin, void *state)
const unsigned location = io_sem.location - FRAG_RESULT_DATA0;
if (color_remap[location] == MESA_VK_ATTACHMENT_UNUSED) {
nir_instr_remove(&intrin->instr);
return false;
return true;
}
const unsigned new_location = FRAG_RESULT_DATA0 + color_remap[location];
if (io_sem.location == new_location)
return false;
io_sem.location = new_location;
nir_intrinsic_set_io_semantics(intrin, io_sem);
@ -68,5 +54,5 @@ radv_nir_remap_color_attachment(nir_shader *shader, const struct radv_graphics_s
color_remap[gfx_state->ps.epilog.color_map[i]] = i;
}
return nir_shader_intrinsics_pass(shader, remap_color_attachment, nir_metadata_all, &color_remap);
return nir_shader_intrinsics_pass(shader, remap_color_attachment, nir_metadata_control_flow, &color_remap);
}

View file

@ -2894,8 +2894,9 @@ radv_graphics_shaders_compile(struct radv_device *device, struct vk_pipeline_cac
NIR_PASS(update_info, stages[MESA_SHADER_FRAGMENT].nir, nir_lower_poly_line_smooth,
RADV_NUM_SMOOTH_AA_SAMPLES);
if (!gfx_state->ps.has_epilog)
radv_nir_remap_color_attachment(stages[MESA_SHADER_FRAGMENT].nir, gfx_state);
if (!gfx_state->ps.has_epilog) {
NIR_PASS(update_info, stages[MESA_SHADER_FRAGMENT].nir, radv_nir_remap_color_attachment, gfx_state);
}
NIR_PASS(update_info, stages[MESA_SHADER_FRAGMENT].nir, radv_nir_lower_fs_input_attachment);