CommitShaderResources() frequency #231
-
Hey, I just had a few questions about In some of the sample files, it mentions it should be called after using Today, I ran into a situation where I needed to load new textures in during the middle of a frame, and Diligent Engine did not seem to like that I tried to draw polygons after loading new textures without calling Is there any documentation or general notes about this process that I can read? I'd like to have a firm grasp of the general events that would invalidate resource bindings and require the method to be called. I'm currently exclusively DirectX 12, but would prefer to keep things as compatible as possible for the future, if that matters. I appreciate any information! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
No, this is not the case. You can commit resource any time. Note only that binding a PSO that is not compatible with a signature, makes all incompatible SRBs invalid. If you can point to the document, this should be fixed.
Yes, this is the exactly correct use case.
You need call |
Beta Was this translation helpful? Give feedback.
-
That's great. I was hoping the behavior would be something along those lines. Thanks for the information. I'm still not exactly sure which specific thing is triggering the need for the commit. I automatically create shader resource views for my textures as soon as they are created. The textures this happens with are cube maps, and I'm also binding them to a texture array. And these are the first cube maps that are ever loaded, which means I'm probably mapping the texture array for the first time. Maybe even creating a dynamic buffer for the first time (to upload environment map details). I tried committing right before the binding part, immediately following the texture load, and it still corrects the warning (everything works). But I'm not sure how accurate the exception testing of stale data is. I'm not sure if I can just move my Edit: After a little more testing, I can almost say for certain that the exception was triggered because my newly loaded textures were being binded to my texture array. The reason it still worked when I called commit before the binding section was because there were multiple environment maps going through the whole process, so regardless of where I moved the call, it was being called multiple times before the draw. Doh! So I added a little state when textures are registered to remember to commit before the next draw. |
Beta Was this translation helpful? Give feedback.
No, this is not the case. You can commit resource any time. Note only that binding a PSO that is not compatible with a signature, makes all incompatible SRBs invalid. If you can point to the document, this should be fixed.
Yes, this is the exactly correct use case.
You need call
CommitShaderResources
after you change any variable - the changes are not automatically visible to GPU. If you loaded a new texture and set it …