Skip to content

[0037] Describe semantic diagnostics for textures and samplers#423

Open
Icohedron wants to merge 3 commits into
llvm:mainfrom
Icohedron:texture-sema-diagnostics
Open

[0037] Describe semantic diagnostics for textures and samplers#423
Icohedron wants to merge 3 commits into
llvm:mainfrom
Icohedron:texture-sema-diagnostics

Conversation

@Icohedron
Copy link
Copy Markdown
Contributor

@Icohedron Icohedron commented May 19, 2026

This PR updates proposal 0037 to include documentation of semantic diagnostics specific to textures and samplers and describes how Clang will implement them.

This includes:

  • a section detailing valid element types for textures
  • applicable texture element types for samplers
  • a table of expected dimensionality and types for the parameters to texture sampling methods
  • a Vulkan/SPIRV-specific GatherCmp component restriction
  • shader model requirements and shader stage restrictions for sampling methods

The section on Clang HLSL builtins has also been edited to be more general rather than specific to Texture2D, referring to the newly added table of expected dimensionality and types for specific vector parameter sizes.

I have also added myself as an author to the proposal, since I have made significant edits and contributions to it.

@Icohedron Icohedron requested a review from s-perron May 19, 2026 21:46
Comment on lines +598 to +601
Clang will diagnose use of derivative-requiring methods in unsupported shader
stages at the sema level using [availability attributes](0001-availability-diagnostics.md)).
This differs from DXC which defers the rejection of `Sample`, `SampleBias`,
`SampleCmp`, and `SampleCmpBias` in unsupported shaders to the DXIL validator
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I assume this is how we want to do this in Clang so that we don't have to rely on the DXIL validator to report errors.

Copy link
Copy Markdown
Contributor

@alsepkow alsepkow left a comment

Choose a reason for hiding this comment

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

LGTUS @bob80905

Comment thread proposals/0037-texture-and-sampler-types.md
Comment on lines +578 to +581
On the Vulkan target, `GatherCmp` operations only support component 0 (Red).
`GatherCmpGreen`, `GatherCmpBlue`, and `GatherCmpAlpha` are rejected.
This is because SPIR-V's [OpImageDrefGather](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpImageDrefGather)
does not have a Component operand and always gathers component 0.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should explicitly state what happens with GatherCmpRed I think. Calling out that the others are rejected without saying what that one does is confusing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread proposals/0037-texture-and-sampler-types.md Outdated
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.

3 participants