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 <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26876>
This commit is contained in:
Konstantin Seurer 2024-01-03 17:46:18 +01:00 committed by Marge Bot
parent 0541a57517
commit 8050b89819

View file

@ -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);