You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add warning for ignored binding attributes on uniforms
When binding attributes (like [[vk::binding]]) are specified
on
uniforms that get packed into the default constant buffer, these binding
attributes are effectively ignored since the uniform will always be
placed
at descriptor set 0, binding 0. This can be confusing for users who
expect
their explicit bindings to take effect.
This change adds a new warning (71) that informs users when their
binding
attributes on uniforms will be ignored, and suggests declaring the
uniform
inside a constant buffer to preserve the explicit binding.
The warning helps users understand:
1. Why their binding attribute isn't having the expected effect
2. That the uniform is being packed into the default constant buffer
3. How to fix it by using a constant buffer declaration
Added test case in tests/bugs/binding-attribute-ignored.slang to verify
the warning behavior.
(cherry picked from commit 82f66e7)
Copy file name to clipboardexpand all lines: source/slang/slang-diagnostic-defs.h
+6
Original file line number
Diff line number
Diff line change
@@ -248,6 +248,12 @@ DIAGNOSTIC(
248
248
"the output path '$0' is not associated with any entry point; a '-o' option for a compiled "
249
249
"kernel must follow the '-entry' option for its corresponding entry point")
250
250
251
+
DIAGNOSTIC(
252
+
71,
253
+
Warning,
254
+
bindingAttributeIgnoredOnUniform,
255
+
"binding attribute on uniform '$0' will be ignored since it will be packed into the default constant buffer at descriptor set 0 binding 0. To use explicit bindings, declare the uniform inside a constant buffer.")
0 commit comments