Module: Mesa Branch: main Commit: 8050b89819fadc69fb4f3693217ae6c9e1aa57dd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8050b89819fadc69fb4f3693217ae6c9e1aa57dd
Author: Konstantin Seurer <konstantin.seu...@gmail.com> Date: Wed Jan 3 17:46:18 2024 +0100 vtn: Handle DepthReplacing correctly The meaning of DepthReplacing was clarified in https://gitlab.khronos.org/spirv/SPIR-V/-/issues/342 . TLDR: It just means that the shader can write to FragDepth. We should therefore only overwrite depth_layout if it is equal to NONE, since NONE means "not written" and all other modes mean "written" plus some additional information. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10344 Reviewed-by: Alyssa Rosenzweig <aly...@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26876> --- src/compiler/spirv/spirv_to_nir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 74f96a64b1f..b2b910cb7a5 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -5252,7 +5252,8 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point, case SpvExecutionModeDepthReplacing: vtn_assert(b->shader->info.stage == MESA_SHADER_FRAGMENT); - b->shader->info.fs.depth_layout = FRAG_DEPTH_LAYOUT_ANY; + if (b->shader->info.fs.depth_layout == FRAG_DEPTH_LAYOUT_NONE) + b->shader->info.fs.depth_layout = FRAG_DEPTH_LAYOUT_ANY; break; case SpvExecutionModeDepthGreater: vtn_assert(b->shader->info.stage == MESA_SHADER_FRAGMENT);