We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4250 - SDL_RenderSetLogicalSize not working as expected with metal renderer (on window resize)
Summary: SDL_RenderSetLogicalSize not working as expected with metal renderer (on wind...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.8
Hardware: x86_64 macOS 10.13
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-05 21:24 UTC by SuperZazu
Modified: 2018-10-12 20:57 UTC (History)
2 users (show)

See Also:


Attachments
minimal code to reproduce the bug (1.83 KB, text/plain)
2018-09-05 21:24 UTC, SuperZazu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description SuperZazu 2018-09-05 21:24:07 UTC
Good evening,

I found a bug while using "SDL_RenderSetLogicalSize" with the Metal renderer on macOS. The bug is there on 2.0.8 and on default branch (latest changeset 12175:0061cfbdd0c5).

I've wrote a minimal code to reproduce the problem (in attachment). Please comment/uncomment the line "SDL_RenderSetLogicalSize(renderer, 160, 144);" and resize the window to notice the difference between OpenGL and Metal (the blue texture in the center of the screen is not displayed the same way).

Maybe something is wrong with the viewport?

Thank you,
Nicolas
Comment 1 SuperZazu 2018-09-05 21:24:55 UTC
Created attachment 3297 [details]
minimal code to reproduce the bug
Comment 2 Ryan C. Gordon 2018-09-05 22:52:54 UTC
I can reproduce it here, I'll take a look.

--ryan.
Comment 3 Ryan C. Gordon 2018-09-06 19:18:33 UTC
Ok, it's not the viewport, it's the Metal layer that isn't resizing...so we render the correct thing to a wrong-size backbuffer and then the OS scales it to fit.

This is now fixed by https://hg.libsdl.org/SDL/rev/c06be57c5a01, but I'm CC'ing Alex to make sure this is the correct way to handle this.

--ryan.
Comment 4 Alex Szpakowski 2018-09-06 21:35:15 UTC
If I'm understanding the issue correctly, I think it might make more sense to resize the metal layer in the Cocoa view resize callback, rather than in a custom callback.

I think the code used to do that, but it looks like this commit removed that behaviour for some reason: https://hg.libsdl.org/SDL/rev/27d81cb6e6af
Comment 5 Alex Szpakowski 2018-10-12 20:57:13 UTC
This should be fixed now I think, via https://hg.libsdl.org/SDL/rev/758d4e1222a7