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

Add support for running on OpenGL 4.1 with a core profile on macOS #5331

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

bes
Copy link
Contributor

@bes bes commented Mar 2, 2024

Description

When running wgpu with an OpenGL context on macOS that is created with a core profile and with the forward-compatibility bit set, the MAX_VARYING_COMPONENTS constant returns 0 when queried. The default value is 60, so we return the default value if the query returns 0.

We also need to use #version 140 on macOS since #version 130 isn't accepted. Since #version 140 should be available from OpenGL 3.1, we use that everywhere. That way we don't need any specific macOS flags or features.

Testing

  • Manually tested on macOS with an OpenGL 4.1 Context with a core profile that I got from GStreamer.
  • Automatic tests (cargo xtask test)

Checklist

  • Run cargo fmt.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@bes bes requested a review from a team as a code owner March 2, 2024 20:22
@bes bes force-pushed the macos-gl-support branch from e4d1523 to d2ea6de Compare March 3, 2024 07:56
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me! Can you please add a note in the changelog?

@bes bes force-pushed the macos-gl-support branch from d2ea6de to e6f8494 Compare March 3, 2024 18:31
@bes
Copy link
Contributor Author

bes commented Mar 3, 2024

Thanks! Added a line in the changelog!

@bes bes force-pushed the macos-gl-support branch from e6f8494 to 888935b Compare March 3, 2024 18:32
When running wgpu with an OpenGL context on macOS that is created with a core
profile and with the forward-compatibility bit set, the MAX_VARYING_COMPONENTS
constant returns 0 when queried. The default value is 60, so we return the
default value if the query returns 0.

We also need to use `#version 140` on macOS since `#version 130` isn't accepted.
Since `#version 140` should be available from OpenGL 3.1, we use that everywhere.
That way we don't need any specific macOS flags or features.
@bes bes force-pushed the macos-gl-support branch from 888935b to 30c7e73 Compare March 3, 2024 18:52
@Wumpf Wumpf merged commit f0ed4cf into gfx-rs:trunk Mar 3, 2024
27 checks passed
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.

2 participants