Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Address structured buffer GetDimensions issues for WGSL, GLSL and SPIRV #7010

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

fairywreath
Copy link
Contributor

@fairywreath fairywreath commented May 6, 2025

There are a few issues for structured buffer GetDimensions:

  • Stride value relies from IRSizeAndAlignmentDecoration but this decoration is not always created. This causes the compiler to crash when targetting WGSL and silently giving incorrect stride results when targetting GLSL.
  • Stride value is always zero when targetting SPIRV because this decoration is not checked properly.

This PR fixes these by always creating a IRSizeAndAlignmentDecoration for structured buffers and properly accessing the size and alignment decoration when targetting SPIRV.

Fixes #6842.

@fairywreath fairywreath requested a review from a team as a code owner May 6, 2025 05:19
@fairywreath fairywreath changed the title Wgsl get dimensions fix Address Issues for structured buffer GetDimension for WGSL, GLSL and SPIRV May 6, 2025
@fairywreath fairywreath changed the title Address Issues for structured buffer GetDimension for WGSL, GLSL and SPIRV Address Issues for structured buffer GetDimensions for WGSL, GLSL and SPIRV May 6, 2025
@fairywreath fairywreath changed the title Address Issues for structured buffer GetDimensions for WGSL, GLSL and SPIRV Address structured buffer GetDimensions issues for WGSL, GLSL and SPIRV May 6, 2025
@fairywreath fairywreath added the pr: non-breaking PRs without breaking changes label May 6, 2025
csyonghe
csyonghe previously approved these changes May 6, 2025
Copy link
Collaborator

@csyonghe csyonghe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slang exits without error and without generating wgsl output (2025.6.3)
2 participants