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

direct3d renderer becomes invalid on windows resize #3052

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

direct3d renderer becomes invalid on windows resize #3052

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

SDLBugzilla commented Feb 11, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: Windows 10, All

Comments on the original bug report:

On 2018-11-05 00:18:32 +0000, Anthony @ POW Games wrote:

Created attachment 3446
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.

On 2018-11-08 12:42:59 +0000, Anthony @ POW Games wrote:

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:

On 2018-11-08 12:44:20 +0000, Anthony @ POW Games wrote:

Created attachment 3464
This test code shows the problem more clearly

On 2018-11-08 13:50:42 +0000, Ozkan Sezer wrote:

(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.

On 2018-11-18 23:10:25 +0000, Malte Kießling wrote:

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.

On 2018-11-19 19:59:33 +0000, Malte Kießling wrote:

Created attachment 3500
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

On 2018-11-22 08:32:35 +0000, Ryan C. Gordon wrote:

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.

On 2018-12-03 02:04:46 +0000, Ryan C. Gordon wrote:

This patch is now https://hg.libsdl.org/SDL/rev/088f52a4e1b2, thanks!

--ryan.

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

1 participant