| Summary: | direct3d renderer becomes invalid on windows resize | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Anthony @ POW Games <ant> |
| Component: | render | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | icculus, mkalte, sezeroz |
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | Windows 10 | ||
| Attachments: |
This test code will reproduce the bug
This test code shows the problem more clearly patch that frees all vbos before reset is called |
||
revising this bug since I've found it's not related to scaling. This is quite serious. 2.0.9 release works OK, but this happens in the current mercurial source. No special conditions needed to trigger bug. Simply create a direct3d renderer and resize the window and all drawing stops. SDL_RenderPresent can't return an error, but it does set one: Present(): INVALIDCALL Also maybe related, but when the window is fullscreen-desktop, alt-tabbing away causes the window to not restore and stay the size of a tab on top-left of the screen. I've submitted a recent bug that may also be related: Created attachment 3464 [details]
This test code shows the problem more clearly
(In reply to Anthony @ POW Games from comment #1) > 2.0.9 release works OK, but this happens in the > current mercurial source. Changing version to hg/2.0 then. I also managed to observe this with the current hg source. For me the drawing does not stop however, the size of the area drawn to just becomes that of the smallest size of the window. If i resize it back to something bigger the rest just stays black. It is as if constantly calling SDL_RenderSetViewport with the size of the smallest window. I also tried calling SDL_RenderSetViewport explicitly after receiving the resize event without success. Tested with SDL_ SDL_RenderDrawLine and SDL_RenderCopyEx. Created attachment 3500 [details] patch that frees all vbos before reset is called I could identify the problem. When D3D_Reset is called, it does not release the vertex buffers. As a result, IDirect3DDevice9_Reset fails with D3DERR_INVALIDCALL (https://docs.microsoft.com/en-us/windows/desktop/direct3d9/d3dpool, at the end of the D3DPOOL_DEFAULT notes) To fix this, vbos need to be created either with D3DPOOL_MANAGED or be explicitly freed. I attatched a patch that does use the latter. It solves the problem, at least on my machine. As far as i can see, the vbos are allocated as they are needed anyways, so that, to me, appears as the cleaner solution. ~mkalte
> To fix this, vbos need to be created either with D3DPOOL_MANAGED or be
> explicitly freed.
Whoops, this is a good catch. I'll apply this fix soon.
--ryan.
This patch is now https://hg.libsdl.org/SDL/rev/088f52a4e1b2, thanks! --ryan. |
Created attachment 3446 [details] This test code will reproduce the bug This only happens on the Direct3D renderer when using: SDL_SetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE, "overscan"); and the window is a different aspect to the SDL_RenderSetLogicalSize(). It may affect other drawing methods, but I've only been using SDL_RenderFillRect. It works ok on OpenGL, GLES, and software renderers. It works ok when using letterbox mode.