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

Use shaderc for aarch64-apple-darwin. #1027

Merged
merged 1 commit into from
Dec 9, 2020
Merged

Use shaderc for aarch64-apple-darwin. #1027

merged 1 commit into from
Dec 9, 2020

Conversation

frewsxcv
Copy link
Contributor

@frewsxcv frewsxcv commented Dec 8, 2020

As suggested by @cart and @mockersf in #928, this pull request switches Apple Silicon devices to use shaderc instead of bevy-glsl-to-spirv. This change, along with the latest unreleased version of winit (rust-windowing/winit#1789), gets Bevy working on Apple Silicon!

Screen Shot 2020-12-07 at 6 29 38 PM

pub fn glsl_to_spirv(
glsl_source: &str,
stage: ShaderStage,
shader_defs: Option<&[String]>,
) -> Result<Vec<u32>, ShaderError> {
let mut compiler = shaderc::Compiler::new()?;
let mut options = shaderc::CompileOptions::new()?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These lines were not compiling prior to my pull request. Both of these lines return Option, whereas the function signature returns Result.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for fixing it ❤️

@frewsxcv frewsxcv mentioned this pull request Dec 8, 2020
@Moxinilian Moxinilian added C-Enhancement A new feature O-MacOS Specific to the MacOS (Apple) desktop operating system A-Rendering Drawing game state to the screen labels Dec 9, 2020
@cart
Copy link
Member

cart commented Dec 9, 2020

Looks good to me. Thanks!

@cart
Copy link
Member

cart commented Dec 9, 2020

I'd love to make shaderc an optional feature, then selectively enable it for specific platforms. This would clean the code/config significantly and enable people to opt in to shaderc on any platform. But cargo won't let us do that afaik: rust-lang/cargo#1197

@cart cart merged commit 66f972c into bevyengine:master Dec 9, 2020
@frewsxcv frewsxcv deleted the frewsxcv-shader branch December 9, 2020 21:19
@frewsxcv frewsxcv mentioned this pull request Dec 9, 2020
@fopsdev fopsdev mentioned this pull request Jan 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Enhancement A new feature O-MacOS Specific to the MacOS (Apple) desktop operating system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants