Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendertarget does not reflect latest spritebatch draw #239

Closed
bitkidinc opened this issue Mar 11, 2025 · 5 comments · Fixed by #243
Closed

Rendertarget does not reflect latest spritebatch draw #239

bitkidinc opened this issue Mar 11, 2025 · 5 comments · Fixed by #243

Comments

@bitkidinc
Copy link

When saving screenshots in my editor, I create a new RenderTarget2D, draw the scene to it with spritebatch, then save the renderTarget to disk. With SDL 3.0 it started being a state behind so to speak, meaning that when it draws the scene, its how it looked before I made the changes. I have to save twice to get it to correctly draw now. Changing graphics driver to D3D11 fixes the problem.

@AlexQ3D
Copy link

AlexQ3D commented Mar 18, 2025

I also ran into this problem, here's a gist with a minimal repro example if it's useful

@flibitijibibo
Copy link
Member

A few more people have run into this, so just as a starting point for anyone willing to dig into FNA3D: This is likely the result of timing issues with the copy pass and render pass; my guess is forcing a command flush and pipeline stall at the top of GetTextureData2D will "fix" it with a significant performance cost. We may need to forcibly end the render pass and flush commands so that we can start a copy pass that's submitted after rendering has occurred.

@flibitijibibo
Copy link
Member

I think we need to do this but with render commands above the Download call: https://github.com/FNA-XNA/FNA3D/blob/master/src/FNA3D_Driver_SDL.c#L3513

@flibitijibibo
Copy link
Member

Once CI is finished the artifacts at #243 may resolve this issue.

@bitkidinc
Copy link
Author

Once CI is finished the artifacts at #243 may resolve this issue.

Awesome, thanks! That seems to have fixed it on my end. Will report back if there's any further issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants