-
Notifications
You must be signed in to change notification settings - Fork 178
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
Overlapping explicit binding of uniform buffer produces incorrect values #4700
Comments
edit: answered in another comment. |
Aliasing binding is allowed, but the code isn’t using the right syntax to define buffers. A buffer should be declared as StructuredBuffer, but the vk_binding in the provided code is declared directly on an ordinary data field that will be placed in the default constant buffer, the vk_binding will have no meaning in this case. you probably want: [vk::binding(0,0)] ConstantBuffer<uint[1000]> addresses; which defines two constant buffer resources that maps to a same binding. Note that global ordinary iniform data cannot have a binding. |
@csyonghe should this also produce a warning? |
or should we allow automatically mapping (or maybe do both?) |
I would say a warning for now on binding attributes declared on uniform data. |
I was reading our user guide and it seems we don't explicitly support or don't support the behavior described in this issue, this should be changed as per discussion and issue
into
|
@csyonghe ahh got you, didnt know ordinary uniforms couldnt have an explicit binding, I tried out using ConstantBuffer, but I am getting a segfault
my usage should be correct now ? I am using u64 to debug because those are VkDeviceAddresses. |
What would be the compile command used if I may ask? |
Looks like it is the array directly inside a ConstantBuffer causing error. This works:
|
@ArielG-NV I am using the c++ api, DebugInformation SLANG_DEBUG_INFO_LEVEL_MAXIMAL |
it compiles now, but I am still getting a validation error while trying to create the shader module
if you are able to run it, may I know the commit you are on ? |
I will look into why
crashes. (issue #4704) |
Update: #4704 has a PR out,
I will now checkout this issue. |
@sivansh11 I recommend updating your Vulkan SDK to the latest one. I seem to have no trouble compiling the suggested code with Vulkan SDK version 1.3.283.0
|
Fixes: shader-slang#4700 Changes: * If global uniform has explicit bindings code will warn to use `ConstantBuffer<T>` instead where possible.
Fixes: shader-slang#4700 Changes: * If a uniform object (which uses uniform locations) has explicit bindings we will warn to use `ConstantBuffer<T>` instead
Yes, I am on 1.3.283.0
|
Try updating Slang to 2024.1.30 It looks like the Slang version being used is affected by a spirv-opt change which was solved by Slang in a later revision. If this does-not fix your issue, please add a comment here so I can look into the problem further. (note: issue was closed due to solving the original problem) |
explictly setting the same binding and space for multiple uniform buffers doesnt work (gives nonsensical values)
gives
I doubt this is intentional, do let me know if I am wrong.
on commit 5da06d4
The text was updated successfully, but these errors were encountered: