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

Implemented Combined-texture for WGSL #5130

Conversation

jkwak-work
Copy link
Collaborator

@jkwak-work jkwak-work commented Sep 21, 2024

The implementation in hlsl.meta.slang for combined texture was already committed and it appears to be working fine.
The trouble was more on the layout rule where the synthesized textures and samplers were not getting the binding offset values correctly.

When the combined-texture is used, it is replaced with a texture and a sampler.
For WGSL, both cases get layout info as LayoutResourceKind::DescriptorTableSlot.
This is little different from how it is handled in HLSL where Texture got LayoutResourceKind::ShaderResource and Sampler got LayoutResourceKind::SamplerState

This commit also adds a new layout-rule for WGSL.
It is mostly identical to the layout-rule for GLSL.
The difference is that Combined-texture is handled little differently.
This is because for GLSL, there is an actual combined sampler from GLSL language level and Slang don't need to synthesize one. For WGSL, there isn't combined sampler and Slang has to synthesize one.

@jkwak-work jkwak-work added the pr: non-breaking PRs without breaking changes label Sep 21, 2024
@jkwak-work jkwak-work self-assigned this Sep 21, 2024
source/slang/slang-type-layout.cpp Outdated Show resolved Hide resolved
source/slang/slang-type-layout.cpp Show resolved Hide resolved
source/slang/slang-type-layout.cpp Outdated Show resolved Hide resolved
tests/wgsl/texture-sampler-less.slang Show resolved Hide resolved
@csyonghe csyonghe merged commit 3e950e1 into shader-slang:master Sep 23, 2024
11 of 12 checks passed
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.

2 participants