Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPIR-V] Fix mesh payload global variable for VK_EXT_mesh_shaders #6526

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

sudonatalie
Copy link
Collaborator

The existing logic from VK_NV_mesh_shader was incorrectly adapted for the VK_EXT_mesh_shader implementation when it comes to the handling of payloads as in/out variables. Because TaskPayloadWorkgroupEXT must be applied to a single global OpVariable for each task/mesh shader, the struct should not be flattened. Further, Location assignment is not necessary for these input and output variables, so the usual reason for flattening structs does not apply.

This change now removes the inner struct member global variables and ensures the parent payload is decorated with TaskPayloadWorkgroupEXT. Note that for amplification/task shaders, the payload variable is created with the groupshared decl, and then its storage class needs to be updated when that variable is used as a parameter to the DispatchMesh call, as described in: https://docs.vulkan.org/spec/latest/proposals/proposals/VK_EXT_mesh_shader.html#_hlsl_changes

Tested with new validation checks from: KhronosGroup/SPIRV-Tools#5640

Fixes #5981

The existing logic from VK_NV_mesh_shader was incorrectly adapted
for the VK_EXT_mesh_shader implementation when it comes to the handling
of mesh payloads as in/out variables. Because TaskPayloadWorkgroupEXT
must be applied to a single global OpVariable for each Task/Mesh shader,
the struct should not be flattened. Further, as far as I can tell,
Location assignment is not necessary for these input and output
variables, so the usual reason for flattening structs does not apply.

This change now removes the inner struct member global variables and
ensures the parent payload is decorated with TaskPayloadWorkgroupEXT.
Note that for amplification/task shaders, the payload variable is
created with the groupshared decl, and then it's storage class needs to
be updated when that variable is used as a parameter to the DispatchMesh
call, as described in: https://docs.vulkan.org/spec/latest/proposals/proposals/VK_EXT_mesh_shader.html#_hlsl_changes

Tested with updated spirv-val from: KhronosGroup/SPIRV-Tools#5640

Fixes microsoft#5981
@sudonatalie sudonatalie requested a review from a team as a code owner April 12, 2024 18:25
@sudonatalie sudonatalie merged commit 690ec7c into microsoft:main Apr 17, 2024
13 checks passed
@sudonatalie sudonatalie deleted the issue-5981 branch April 17, 2024 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[SPIR-V] Multiple variables with TaskPayloadWorkgroupEXT in task/amplification shaders
3 participants