Skip to content

Add SDL_SHADERCROSS_PROP_HLSL_SKIP_SPIRV_ROUNDTRIP_BOOLEAN to opt out of SPIRV roundtrip#204

Merged
thatcosmonaut merged 2 commits into
libsdl-org:mainfrom
lammmab:feat/skip-roundtrip
Apr 6, 2026
Merged

Add SDL_SHADERCROSS_PROP_HLSL_SKIP_SPIRV_ROUNDTRIP_BOOLEAN to opt out of SPIRV roundtrip#204
thatcosmonaut merged 2 commits into
libsdl-org:mainfrom
lammmab:feat/skip-roundtrip

Conversation

@lammmab

@lammmab lammmab commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

What?

Some HLSL constructs survive the SPIRV roundtrip without issue, and for those cases the roundtrip adds unnecessary compile time and an extra SPIRV-Cross transformation. This adds a property that lets callers opt out when they know their HLSL is clean.

Changelog

  • Added functionality for skipping the SPIRV roundtrip based on the boolean property
  • Added SDL_SHADERCROSS_PROP_HLSL_SKIP_SPIRV_ROUNDTRIP_BOOLEAN to SDL_shadercross.h
  • Added docstrings explaining the two entry points for the SPIRV roundtrip skip
  • Quickly fixed a pre-existing copy-paste docstring error

Notes

Callers should only set this property if their HLSL does not rely on constructs that require SPIRV normalization, such as Structured Buffers. Incorrect use may produce invalid or unexpected output.

References

#202
#203

@lammmab

lammmab commented Apr 6, 2026

Copy link
Copy Markdown
Contributor Author

Bump for visibility–
Once this is merged, we can drop our compile times in half :).

@Pucas01

Pucas01 commented Apr 6, 2026

Copy link
Copy Markdown

I would love for this to get merged

@thatcosmonaut thatcosmonaut requested a review from madebr April 6, 2026 23:13
@thatcosmonaut

Copy link
Copy Markdown
Collaborator

Looks good, could we add a note that this shouldn't be used with Stuctured Buffers in the prop comment?

Also requesting comment from @madebr

@madebr madebr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My only comment would've been about API design and long-term stability, but a property is very non-intrusive.

@lammmab

lammmab commented Apr 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks guys! I'll add the note and we can get this merged.

Added a note about avoiding the property when using Structured Buffers.
@thatcosmonaut thatcosmonaut merged commit 1ca46e0 into libsdl-org:main Apr 6, 2026
@lammmab lammmab deleted the feat/skip-roundtrip branch April 6, 2026 23:24
@thatcosmonaut

Copy link
Copy Markdown
Collaborator

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants