Module: Mesa Branch: main Commit: d280160a1352e8f05be27a9573fead98c617e2ac URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d280160a1352e8f05be27a9573fead98c617e2ac
Author: Faith Ekstrand <faith.ekstr...@collabora.com> Date: Wed Jan 10 10:11:06 2024 -0600 nak: Disallow gl_FragData and set MRT correctly Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27049> --- src/nouveau/compiler/nak/sph.rs | 9 ++++++++- src/nouveau/compiler/nak_nir.c | 3 +-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/nouveau/compiler/nak/sph.rs b/src/nouveau/compiler/nak/sph.rs index 034ab999e6f..e5f70b42f9d 100644 --- a/src/nouveau/compiler/nak/sph.rs +++ b/src/nouveau/compiler/nak/sph.rs @@ -533,7 +533,14 @@ pub fn encode_header( let zs_self_dep = fs_key.map_or(false, |key| key.zs_self_dep); - sph.set_multiple_render_target_enable(io.writes_color > 0xf); + // This isn't so much a "Do we write multiple render targets?" bit + // as a "Should color0 be broadcast to all render targets?" bit. In + // other words, it's the gl_FragCoord behavior, not gl_FragData. + // + // For now, we always set it to true because Vulkan requires + // explicit fragment output locations. + sph.set_multiple_render_target_enable(true); + sph.set_kills_pixels(io.uses_kill || zs_self_dep); sph.set_omap_sample_mask(io.writes_sample_mask); sph.set_omap_depth(io.writes_depth); diff --git a/src/nouveau/compiler/nak_nir.c b/src/nouveau/compiler/nak_nir.c index 22df7a5a774..ac736a73098 100644 --- a/src/nouveau/compiler/nak_nir.c +++ b/src/nouveau/compiler/nak_nir.c @@ -986,8 +986,7 @@ nak_nir_lower_fs_outputs(nir_shader *nir) unreachable("EXT_shader_stencil_export not supported"); break; case FRAG_RESULT_COLOR: - assert(var->data.index == 0); - var->data.driver_location = NAK_FS_OUT_COLOR0; + unreachable("Vulkan alway uses explicit locations"); break; case FRAG_RESULT_SAMPLE_MASK: assert(var->data.index == 0);