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

Wii U Render: unsafe to delete a recent render target #76

Open
ds-sloth opened this issue Jun 22, 2024 · 2 comments
Open

Wii U Render: unsafe to delete a recent render target #76

ds-sloth opened this issue Jun 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ds-sloth
Copy link

Bug Report

What's the issue you encountered?

While testing our Wii U port of TheXTech engine (https://github.com/TheXTech/TheXTech), my collaborator @Wohlstand found that the engine crashed when SDL_SetWindowSize is called to resize the window during initialization. We debugged this further and found it was related to similar crashes when the game's render texture is recreated.

For some reason (I couldn't find the root cause), it seems to be entirely unsafe to delete a texture that was used as a render target in the current frame. Perhaps the result is inadequate GPU synchronization, but I don't know.

This affects cases where the user writes code like SDL_RenderSetTarget(renderer, NULL); SDL_RenderDeleteTexture(old_target);, but it also affects seemingly unrelated routines like SDL_WindowResize(window, ...);, which recreate the render target internally. The result is a system hang or an emulator crash.

Our workaround was to disable calls to SDL_WindowResize (which weren't meaningful) on Wii U, and to delete the second-most recent render target (rather than the most recent one) on Wii U. Both of these represent target-specific code which is generally undesirable in our low-maintenance SDL2 ports of the engine.

How can the issue be reproduced?

The easiest way to reproduce this crash is to attempt to resize the SDL window during any code using the renderer. Finding the principles underlying a fix for that crash would likely make fixing the render target deletion crash very easy.

Environment?

I'm using Fedora, but this also affects our CI builds which pull from your Docker image. I really don't think that the environment is related.

Additional context?

N/A

@GaryOderNichts GaryOderNichts added the bug Something isn't working label Jun 22, 2024
@GaryOderNichts
Copy link

I assume by SDL_WindowResize you mean SDL_SetWindowSize?

@ds-sloth
Copy link
Author

Yes, my apologies. I just found this repo today, and wrote these notes from my memory of the issue, which I debugged a few days ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants