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

Default SDL render driver back to opengl on mac os #1725

Closed
ghost opened this issue May 13, 2020 · 4 comments
Closed

Default SDL render driver back to opengl on mac os #1725

ghost opened this issue May 13, 2020 · 4 comments
Labels
easy An easy challenge to solve Platform: MacOS tooling

Comments

@ghost
Copy link

ghost commented May 13, 2020

The default SDL renderer driver seems to be back to opengl on mac os in dev8. It was opengl by default in older versions of pygame2 and it caused some problems on mac os. (see issue #1032 )
It was "fixed" in pygame2.0.0.dev4 with SDL 2.0.10 when the default renderer changed to metal in the SDL.

Simply running the setmodescale.py example
With pygame2.0.0.dev6:

pygame 2.0.0.dev6 (SDL 2.0.10, python 3.8.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
desktops [(1280, 800), (1920, 1080)]
renderer: metal flags: 0b1110
accelerated
VSync
render to texture

pygame2.0.0.dev8:

pygame 2.0.0.dev8 (SDL 2.0.12, python 3.8.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
desktops [(1280, 800), (1920, 1080)]
renderer: opengl flags: 0b1010
accelerated
render to texture

The default renderer is still metal in the official build of SDL2.0.12:

renderer = SDL_CreateRenderer(window, -1, 0);
	if (renderer == NULL) {
		printf( "Renderer error: %s", SDL_GetError());
		SDL_Quit();
		return 1;
	}

	SDL_RendererInfo rinfo;
	SDL_GetRendererInfo(renderer, &rinfo);
	printf("RENDERER NAME: %s\n", rinfo.name);

makes a metal renderer by default
RENDERER NAME: metal
It's still possible to change it to opengl manually or using the SDL_HINTS.

pygame doesn't seem to specify any specific driver in display.c (I also can't find any SDL_HINTS)

if (flags & PGS_SCALED) {
                if (pg_renderer == NULL) {
                    SDL_RendererInfo info;

                    SDL_SetHintWithPriority(SDL_HINT_RENDER_SCALE_QUALITY,
                                            "nearest", SDL_HINT_DEFAULT);
                    if (soft_env != NULL) {
                        pg_renderer =
                            SDL_CreateRenderer(win, -1, SDL_RENDERER_SOFTWARE);
                    }
                    else if (vsync_env != NULL) {
                        pg_renderer = SDL_CreateRenderer(
                            win, -1, SDL_RENDERER_PRESENTVSYNC);
                    }
                    else {
                        pg_renderer = SDL_CreateRenderer(win, -1, 0);
                    }

This is, unfortunately, the most I can test with the knowledge I have.
But from what I see, nothing changed in SDL, and nothing changed in pygame either. Maybe something changed in the build system for mac that removed metal support? I can only guess at this point...

Thanks!

@robertpfeiffer
Copy link
Contributor

Can you set the default renderer back to metal with environment variables?
https://wiki.libsdl.org/SDL_HINT_RENDER_DRIVER

like
$ SDL_RENDER_DRIVER=metal python3 myscript.py

@illume
Copy link
Member

illume commented May 13, 2020

@galexandreg thanks for the report. I changed the way mac binaries are built, and missed that.

I'll fix it.

@ghost
Copy link
Author

ghost commented May 13, 2020

@galexandreg thanks for the report. I changed the way mac binaries are built, and missed that.

I'll fix it.

Thank you! 😃

@MyreMylar MyreMylar added the easy An easy challenge to solve label May 15, 2020
@illume
Copy link
Member

illume commented May 31, 2020

This has been fixed as part of #1864

@illume illume closed this as completed May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy An easy challenge to solve Platform: MacOS tooling
Projects
None yet
Development

No branches or pull requests

3 participants