Bindless Texture Array Update Pattern #213
-
I'm wondering what the best approach would be for updating bindless textures through the SRB SetArray() function, such as in a situation where there are already an unknown number of textures binded, and we are now needing to bind different textures? If I have 20+ pipeline states, and they all share the same texture array bindings, then I need to iterate all of my pipeline states and update all of these bindings each time a new object is added or removed from the scene that uses different textures - is that right? One improvement would be to wait until something is about to render before doing the GPU updates, in case many objects are removed/added before the next render takes place. Anyway, if I have a lot of textures in my array, and I add, say, 8 more, what would be the best way to update these in the array? Would it be better to iterate the entire array and update the exact entries that changed? Or would it make more sense to find the full range of modified slots, and do one single update, even if many textures in that range didn't change? Or would it be better to just update the entire array, regardless of how many textures changed? Unfortunately, I'm not sure how much processing is involved with changing a single texture binding within the array. On top of that, some GPU data doesn't like to mix new data with old data, preferring us to "discard" the old stuff. If this is one of those cases, it may make more sense to just send the entire array at once? Any advice on this would be really appreciated! Edit: Right after posting, I went into the source code and notice that SetArray() just calls BindResource() for each individual element of the array, so that pretty much answers my question. Anyway, I would still appreciate any information/advice on how to manage bindless textures. I've looked into D3D12 info, but most of the advice for that won't directly work with Diligent. For example, I'm not sure how large to set my texture array in HLSL. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You likely need to use a pipeline resource signature that defines a resource layout that can be shared between multiple pipelines. This way all your 20 PSOs will be able to use the same SRB and you will only need to update one SRB. Take a look at Tutorial 22.
Just update the entries that have changed.
This largely depends on how you use your array which is reflected in the type of the variable:
There are many options that depend on what you need.
If you are using DX12/Vulkan, the array may be pretty large. Updating the entire SRB will be expensive if you have a lot of textures, so you will likely need to use the |
Beta Was this translation helpful? Give feedback.
You likely need to use a pipeline resource signature that defines a resource layout that can be shared between multiple pipelines. This way all your 20 PSOs will be able to use the same SRB and you will only need to update one SRB. Take a look at Tutorial 22.
Just update the entries that have …