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

Prevent compilation warning about redefining SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE #606

Closed
wants to merge 1 commit into from

Conversation

Lundis
Copy link
Contributor

@Lundis Lundis commented Jul 27, 2024

I'm compiling with dynamic SDL 2.28.3, on Ubuntu 23.10. Every time I compile my game, I get ~6 sets of warnings about SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE already being defined:

In file included from system.c:1:
hints.go:11: warning: "SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE" redefined
   11 | #define SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE ""
      | 
In file included from /usr/include/SDL2/SDL.h:47,
                 from /home/lundis/go/pkg/mod/github.com/veandco/go-sdl2@v0.5.0-alpha.6/sdl/sdl_wrapper.h:5,
                 from events.go:4:
/usr/include/SDL2/SDL_hints.h:1486: note: this is the location of the previous definition
 1486 | #define SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE "SDL_RENDER_METAL_PREFER_LOW_POWER_DEVICE"

So to avoid this spam, this PR undefines it first if it's defined already. The other new constants do not suffer from the same problem (on my setup, at least).

@Lundis
Copy link
Contributor Author

Lundis commented Jul 27, 2024

Nevermind, the problem is actually that the function was added in 2.28, not 2.30. I'll close this and suggest the correct fix instead.

@Lundis Lundis closed this Jul 27, 2024
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

Successfully merging this pull request may close these issues.

1 participant