Replies: 3 comments 4 replies
-
When you call |
Beta Was this translation helpful? Give feedback.
-
Well, the vertex shader that is active at the time of the error actually needs the texture to be in a render target state. The texture resource is present as a global variable and is part of the resource signature being used by the shadow rendering vertex shaders, but it isn't touched by those shadow rendering vertex shaders.
Is that true even if I use Diligent::RESOURCE_STATE_TRANSITION_MODE_VERIFY only? I'm only using verify in my call. I manually transition my texture between render target and shader resource. Something like this:
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
In my engine, every single shader links to the same global pipeline resource signature, which is pretty convenient. However, my shadowmap rendering vertex shaders are complaining with the following output when I render to my shadowmap depth texture:
For some reason, this message only shows up once during the first shadowmap render, then only shows up again if several frames are skipped before another one is rendered. I'm assuming this is Diligent Engine trying to avoid flooding the output with messages, but haven't been able to confirm that. If not, it may indicate that I'm doing something specific during that frame that is causing an issue.
Another assumption I have is that this message shows up because the shadowmap is a texture resource in the shadowmap rendering vertex shader's resource signature (because all shaders share that signature). Even though the shadow rendering shader is actually writing to this texture as a render target, the resource signature apparently still wants to verify it is in shader resource mode, even with the shader not actually touching the resource.
My question is - is there a way to resolve this? Can I hide the shadowmap texture resource from these specific vertex shaders? Or will I be forced to create another global resource signature for shadow rendering shaders, which is identical in every way except missing that texture? Is there some other way?
EDIT: I believe this error showing up (or not) has something to do with when
CommitShaderResources()
is called. If I typically callCommitShaderResources()
at the very beginning of my frames, I only get the error once (on the first shadow render, then again any time I render shadows again, after stopping for a while). But if I callCommitShaderResources()
(still once per frame) right before the first call toContext.DrawIndexed()
, I will get the error every single frame. Any idea why?EDIT 2: If I call
CommitShaderResources()
(still only once per frame) right before I set my shadowmap depth buffer render target, I never get the error. But if I move it to the line right below the render target assignment (so it happens after), I get the error every frame. These results have left me pretty confused.EDIT 3: Last one, I promise. I just wanted to mention that the reason I was getting a single error message when I stopped rendering shadowmaps is because my environment was being unloaded/reloaded, and its environment textures were being set, forcing
CommitShaderResources()
to be called that frame after the shadow render target was set. So yeah, this seems to be root of the error. It just depends on if my commit is called before or after I set shadowmap render targets. But I don't understand the reason for it. Why is it happy as long as I commit before I set the shadowmap as a render target? Is it because its reading the state of the resource at the time it was committed? That might make sense, but it would mean I'm still doing it wrong even when I don't get the error, but Diligent can't detect it.Appreciate any advice!
Beta Was this translation helpful? Give feedback.
All reactions