Advertisement

DirectX11 Sprite textures accumulating with each draw call, overwriting previous draw

Started by January 14, 2021 01:04 AM
2 comments, last by captaintechnicality 4 years ago

I am currently working on a sprite renderer using textured quads in DirectX11. I'm doing this instead of using DirectXTK because I need to use shaders for some of my sprites.

I'm experiencing 2 issues (which may be linked) with my renderer. I believe these are linked because these issues are not reflected in the thumbnail preview for the graphics debugger.

Actual output. Shows up like this in the window and in the debugger.
Preview Thumbnail. Looks Correct!

As you can see, the bigger issue is that only the last thing drawn to the screen shows up in the output. All other content is replaced with the background color, set using ClearRenderTargetView.

The second issue is that at each stage, the sprite that is rendered is rendered over a stack of all previously rendered textures. Checking the pipeline stages, this is not reflected in the pixel shader or Output Merger, but there is a bound resource in the Output Merger which shows this output.

Newest sprite is on top of all previous sprites
Pipeline shows normal outputs in all of the previews.

 

I know I haven't provided any code yet, but that's just because I'm at a loss for where in my graphics code this could be happening, and I don't want to just dump my code here. If anyone has any idea what might be going wrong here, please let me know.

dear @captaintechnicality -lol-

one thing u can try to do in your code is:

  • try and comment out the line that calls ClearRenderTargetView( )

and see what happens;

if u understand what happens by commenting out this line, u should be able to fix your problem

enjoy ?

Advertisement

I've been doing some more debugging. Commenting out ClearRenderTargetView didn't help fix my issue. The same behavior that I described above still happens, although it does keep the result of the previous draw call in the back buffer.

As you can see, when I look at a pixel that shouldn't be drawn red, the pixel shader and render target are both putting out the correct color, but the output merger is drawing red from one of the other textures in my program.

This is the blend state my program is using. If anyone has ANY idea why the output merger would be exhibiting this behavior, please reply I am absolutely at a loss trying to figure out what would cause this error.

This topic is closed to new replies.

Advertisement