My renderer is multi-threaded, but the renderer itself runs on a single core. Not on the main thread though.
At the start of a render pass I render an environment cube by rendering each face into a texture cube using SetRenderTarget(RenderTargetCube,CubeMapFace)
Then I render the sky, and all the other geometry is rendered by pass number.
So think
Render environment map
Render sky
Render terrain
Render objects
etc.
I then use the rendered environment map as an input to a few shaders. Glass, water, ocean, etc.
Every shader that uses the environment map glitches. Every second or two it just goes horribly wrong.
It is driving me mad.
I wondered if my code was interfering with the graphics device on the main thread, but I have built in a profiler to my engine and even with a bunch of game objects , huge ocean, and sky … it’s not even reaching 4 mS .
I can also see my synchronisation is working well and I am not getting threading issues.
So … lost.
Anyone have any ideas what I can try?
Extra info, just tried rendering the environment map once at the start of the run, and the glitch goes away.
Not a lot of use as a dynamic environment map though.
It looks like one face of the texture cube is at the wrong memory address most of the time.
I have checked that all rendering is done on the render thread, nothing anywhere else touches the graphics device , but I have left the base.Draw(gameTime) call in… maybe it’s in there…
I won’t be able to help you for sure, but maybe you should make a minimal example showing the problem so that it can be reproduced by people who knows what is doing
Have you tried the Visual Studio Graphics Debugging a part of RenderDoc? Maybe the problem is reproduced there…