-
Notifications
You must be signed in to change notification settings - Fork 715
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
[SPIR-V] Copying ConstantBuffer data doesn't actually copy anything. #6952
Comments
I do not see any problem in the SPIR-V. The copy is removed through copy propagation. The final spir-v is:
SPIR-V can be hard to read. It loads descriptor array I'm not sure how the code should be generated differently. This is the same code that is generated when the two resources are declared separately. See https://godbolt.org/z/TPj7qKn5h. This is also the came code as if the copy is removed: https://godbolt.org/z/rK1b7d6bb. Note that this features requires VK_EXT_mutable_descriptor_type. Make sure that is enabled an correctly handled by the driver. If the problem is that RenderDoc shows the value of We will be waiting to hear what the specific problem is. |
Hello! Sorry, I might have been unclear. When I do this:
And But if I declare the ConstantBuffer as its own binding:
The output of the StructuredBuffer is correct. The extension is setup properly, if the SPIR-V looks correct to you, the issue is probably elsewhere, maybe something in the driver. |
Now I understand the problem better. I still think the SPIR-V looks correct. However, this feature has a big caveat. It allocates two different resource arrays at the same binding, with different types. For this to work, you need to use "mutable descriptors" on the application side. I'll close for now. Let me know if you come across a more specific problem in the spir-v that I am not seeing. |
Hello! The 2 examples you gave are yielding different results:
I tried the following code, and tested in a small VK application and I do get the expected behavior: the CS contains my values, and the SB[0] entry gets written with the value in the CB.
|
Description
I am trying to copy data from a ConstantBuffer fetched from the ResourceDescriptorHeap into another variable, however, the data always becomes zeroed.
I can see the ConstantBuffer in RenderDoc, but when debugging in RenderDoc, the copied values are zero.
Steps to Reproduce
Simple reproduction shader.
https://godbolt.org/z/axzMhz5MT
Actual Behavior
When copying from the ConstantBuffer into the temp variable the data becomes zero.
Environment
The text was updated successfully, but these errors were encountered: