Closed st0rmbtw closed 1 month ago
Thanks for providing the sample code. Regarding this validation warning:
Forcing PS shader resource slot 6 to NULL.
Which of your shader resources is at slot 6? And does this warning only show up in the first frame after the resize or permanently?
Which of your shader resources is at slot 6?
Oh, I have a quite a lot of render targets, so to simplify the code sample I removed some. But the warning complains about random render target.
And does this warning only show up in the first frame after the resize or permanently?
Permanently, until I resize the window again.
With all the resource testing in TestResourceBinding I completely forgot to test delete/recreate. But that should be a relatively easy fix. I see what I can do tonight or tomorrow.
If you need a workaround now, you could add the following to D3D11RenderSystem::Release(RenderTarget&)
to clear the device context and state manager cache:
void D3D11RenderSystem::Release(RenderTarget& renderTarget)
{
renderTargets_.erase(&renderTarget);
stateMngr_->ClearState(); // FIXME - workaround to clear binding table cache after render target is deleted
}
Potentially the same for the Texture release function.
Hm. I added this line
stateMngr_->ClearState();
to release functions for Texture and RenderTarget, but it didn't help
Does your render pipeline rely on deferred command buffers or can you also create your command buffer with the flag LLGL::CommandBufferFlags::ImmediateSubmit
? Does the issue persist if you use an immediate context (including the workaround)?
Yes, the command buffer was deferred, I changed it to be immediate and it helped! No warnings now.
I submitted a fix and updated the ResourceBinding unit test to incorporate delete/re-create operations on the test resources. The unit test still shows a lot of warnings of D3D resources being alive after D3D device is released, but that is a different issue I can take care of another time. You should be able to revert your workaround with this fix as it also handles deferred contexts, i.e. no need to switch to an immediate context.
Thank you!
Sometimes this warning shows up when I resize the window:
I use the
GLFW
library for window handling.Here's the rendering code for context:
UPD: It happens after I resize the textures. To resize a texture, I have to release the previous one and create the new one with the new size, and then recreate render targets as well. Here's the resizing code: