gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.49k stars 914 forks source link

OSX: wgpu error when building bevy with camera3d::default() #4529

Open Lykdraft opened 2 years ago

Lykdraft commented 2 years ago

OSX 10.14. --> Here it is:

2022-09-16T21:12:09.766888Z ERROR wgpu::backend::direct: Shader translation error for stage FRAGMENT: Metal: Compilation failed: 

program_source:687:32: error: no matching function for call to 'dot'
    float NdotV_3 = metal::max(metal::dot(in_1.N, in_1.V), 0.00009999999747378752);
                               ^~~~~~~~~~
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/3902/Libraries/lib/clang/902.3/include/metal/metal_geometric:171:30: note: candidate template ignored: requirement '_geometric_binary_func_enable<float __attribute__((ext_vector_type(3))), float __attribute__((packed_vector_type(3)))>::value' was not satisfied [with T = float __attribute__((ext_vector_type(3))), U = float __attribute__((packed_vector_type(3)))]
METAL_FUNC make_scalar_t<_O> dot(T x, U y)
                             ^
program_source:693:25: error: no matching function for call to 'reflect'
    metal::float3 R_3 = metal::reflect(-in_1.V, in_1.N);
                        ^~~~~~~~~~~~~~
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/3902/Libraries/lib/clang/902.3/include/metal/metal_geometric:354:15: note: candidate template ignored: requirement '_geometric_binary_func_enable<float __attribute__((packed_vector_type(3))), float __attribute__((ext_vector_type(3)))>::value' was not satisfied [with T = float __attribute__((packed_vector_type(3))), U = float __attribute__((ext_vector_type(3)))]
METAL_FUNC _O reflect(T i, U n)
              ^

2022-09-16T21:12:09.767008Z ERROR wgpu::backend::direct: Please report it to https://github.com/gfx-rs/naga    
2022-09-16T21:12:09.767057Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default    
thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
      note: label = `pbr_opaque_mesh_pipeline`
    Internal error in FRAGMENT shader: Metal: Compilation failed: 

program_source:687:32: error: no matching function for call to 'dot'
    float NdotV_3 = metal::max(metal::dot(in_1.N, in_1.V), 0.00009999999747378752);
                               ^~~~~~~~~~
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/3902/Libraries/lib/clang/902.3/include/metal/metal_geometric:171:30: note: candidate template ignored: requirement '_geometric_binary_func_enable<float __attribute__((ext_vector_type(3))), float __attribute__((packed_vector_type(3)))>::value' was not satisfied [with T = float __attribute__((ext_vector_type(3))), U = float __attribute__((packed_vector_type(3)))]
METAL_FUNC make_scalar_t<_O> dot(T x, U y)
                             ^
program_source:693:25: error: no matching function for call to 'reflect'
    metal::float3 R_3 = metal::reflect(-in_1.V, in_1.N);
                        ^~~~~~~~~~~~~~
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/3902/Libraries/lib/clang/902.3/include/metal/metal_geometric:354:15: note: candidate template ignored: requirement '_geometric_binary_func_enable<float __attribute__((packed_vector_type(3))), float __attribute__((ext_vector_type(3)))>::value' was not satisfied [with T = float __attribute__((packed_vector_type(3))), U = float __attribute__((ext_vector_type(3)))]
METAL_FUNC _O reflect(T i, U n)

Cheers, tL.

teoxoy commented 2 years ago

Hmm, it seems dot and reflect don't have overloads for packed vectors.

Which version of Metal do you have on your system?

Lykdraft commented 2 years ago

I can't find a version number. This is from 'About this mac / System Report / Display' (from the ATI Radeon RX580 GPU): OSX 10.14.6 --> Metal: Supported, feature set macOS GPUFamily2 v1 (MacPro 2013)

I need to see if I can find a command line...

Lykdraft commented 2 years ago

Lol, yeah, that didn't work...

LZK-Studio-160:luetze$ xcrun --show-sdk-platform-version
xcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" cannot be located.
xcrun: error: unable to lookup item 'PlatformVersion' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
LZK-Studio-160:luetze$ xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Lykdraft commented 2 years ago

xcrun -sdk macosx metal -v:

Apple LLVM version 902.14 (metalfe-902.14.12)
Target: air64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Volumes/HDD2/Luetze/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/bin