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

Image stops rendering in window after closing another #236

Open
tadashibashi opened this issue May 18, 2022 · 4 comments
Open

Image stops rendering in window after closing another #236

tadashibashi opened this issue May 18, 2022 · 4 comments

Comments

@tadashibashi
Copy link

tadashibashi commented May 18, 2022

I'm running into an issue where one window stops showing blitted images after closing another one.
What's strange is that this only happens when the first opened window is closed that the second's images disappear, and not the other way around.

To close windows, I'm calling SDL_DestroyWindow and GPU_FreeTarget on the target.
And I've made sure to call GPU_MakeCurrent on the correct window before loading each GPU_Image.
The loaded matrix appears to be unaffected at this point.
Images are rendered with GPU_BlitRectX, and it appears that the parameters I'm passing are unchanged.

(Also the secondary window is opened using SDL_CreateWindow and GPU_CreateTargetFromWindow, although I've tried opening both this way after creating a dummy window with GPU_InitRenderer, but the problem persists.)

I'm out of ideas. Would anyone have any clue what might be causing this?
Thank you.

@grimfang4
Copy link
Owner

I think I've seen this too. Are you able to put together a minimal repro case? This should be a high priority fix.

@tadashibashi
Copy link
Author

tadashibashi commented May 18, 2022

I'm glad to hear that. It might take some time since all the calls are wrapped in other objects, but I can put one together. Would you prefer I make a repository with SDL_gpu as a submodule and share it here?

Also, I forgot to mention–during my attempt to figure out how to handle multiple windows, I added a null check inside SetActiveTarget in src/renderer_GL_Common.inl, that I think fixed a crash case where the GPU_Renderer's current_context_target was null after a window closed, and the function was attempting to access its members.
I'm not sure if that rightly solved the issue or if it's contributing to any other problems since I'm not familiar with the code.
Would making a pull request be the best way to share this change? I could just submodule the fork in the minimal repro case.

@grimfang4
Copy link
Owner

@tadashibashi Whatever works for you. A pull request, a snippet, or a repo are good options.

@tadashibashi
Copy link
Author

tadashibashi commented Jun 18, 2022

@grimfang4 Thanks for the clarification. I just wanted to update that my computer, which is an intel Mac, is under repairs, so I'm running on a Windows 10 machine now, and strangely, the issue entirely disappeared, so I'm thinking it could be some platform-specific issue.
I'll start working on the repro case when I can get the computer back.

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

No branches or pull requests

2 participants