-
Notifications
You must be signed in to change notification settings - Fork 42
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
Clarify SDL_Texture life cycle #669
Comments
yeah, it stopped crashing after I started to destroy and create texture after every single resize event, even if the window size didn't really change at all. I don't really know the difference between |
Are you also getting a SDL_EVENT_RENDER_TARGETS_RESET, SDL_EVENT_RENDER_DEVICE_RESET, or SDL_EVENT_RENDER_DEVICE_LOST event? |
Hey. I did a short test where I resized my window many times, and I minimized and maximized a couple times, and I closed the lid of my notebook once. Reading https://wiki.libsdl.org/SDL2/SDL_EventType requires to all textures to be recreated for I think that consistent nomenclature is a nice to have. To avoid synonyms such as "recreate", "restore", "regenerate", "updated". Just one jargon. Thinking about SDL3: https://wiki.libsdl.org/SDL3/SDL_EventType It says for Thus, this single line of documentation doesn't seem to suggest about recreating texture. but you know better!! I don't even know if recreating my textures during this event will stop crashing. I'll test later. but most importantly. I think the documentation should explain if, upon a device or targets reset, if the existing SDL_Texture pointers become invalid and must not be used, and the user must not destroy them manually; or whether one should call |
okay, I have no idea how this works. I read here: https://stackoverflow.com/a/78803079 I think I will write a MRE |
hey @icculus turns out it was all my fault! I was indexing an array out of bounds. sorry for the wall of text!! once again I'm fooled by Windows. I run my program with GDB and address and undefined sanitizer, they never caught the root cause of my SIGSEGV. from my slim experience, I guess Windows tries to make wrong programs survive for very long... so when they finally crash, the problem appears in a unrelated place, such as |
specifically, I wanted to know if there is any chance a
SDL_Texture
to become invalid after a window is resized on Windows 10 usingdirect3d
renderer.my toy code crashes with SIGSEGV when resizing window, GDB says it happens after calling
SDL_DestroyTexture
, something-somethingLocalFree
. maybe it is my fault, I'm still debugging. I'm actually using SDL2 on MSYS2, but anyway, it is only useful to improve current documentation.places this information could be added to:
The text was updated successfully, but these errors were encountered: