-
I am trying to implement a texture double-buffering pattern for a multi-state compute shader pipeline. My problem is the state transitions between stages; specifially the very first transition. More specifically, I am first creating an "original" texture, which I then copy to two other textures that comprise my double-buffer. When I enter Render(), I want to transition the first buffer texture to RESOURCE_STATE_SHADER_RESOURCE, and the second to RESOURCE_STATE_UNORDERED_ACCESS. I am expecting both textures to be in RESOURCE_STATE_COPY_DEST, as they have just received the copy from the "original", but that does not seem to be the case. I always get some kind of state transition error, like:
Obviously, I am targeting Vulkan here. If I can get the first transition to work, then I persumably control the transition state for the remainder of the chain, but I can't get my foot in the door. I'm assuming that I am running afoul of some Diligent Engine automated transition state logic, but I don't really know. Can somebody point me at the correct implementation of this pattern? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
First of all, why do you need to do this manually? Is there anything specific why automatic transitions don't work?
This message suggests that the previous layout is |
Beta Was this translation helpful? Give feedback.
-
Actually, this was built as a new tutorial, since it provides so much convenient infrastructure. So that’s kind of already done. I’ll just have to strip the shader logic.
…On Fri, Apr 11, 2025 at 20:33, Assiduous ***@***.***(mailto:On Fri, Apr 11, 2025 at 20:33, Assiduous <<a href=)> wrote:
Can you reproduce this issue in one of the tutorials (e.g. 14). Obviously, no real logic is needed, only the resources.
You will need to write something from the shaders (e.g. 0) to resources, or they will be optimized out.
—
Reply to this email directly, [view it on GitHub](#337 (reply in thread)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AG7INTDFM2XUH4EGW7NKYLD2ZBUQLAVCNFSM6AAAAAB25J6LDKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEOBQHE3TMMA).
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
I was able to reproduce it as a tutorial but, in the process, I also finally found the problem. When using the double-buffer pattern, any texture that is used as an input for any compute shader, must pass that texture to the next shader in the chain, even if that shader does not use it, and so on for all intermediate compute shaders until the chain reaches the next shader that actually uses it.
This is exactly the fix you suggested earlier, but I had two bindings in my pipeline setup that were using the wrong index.
Example:
Assume I have three compute shaders CS1, CS2 and CS3, and double-buffered Textures T1, T2, T3, and single-buffered texture T4: