ba66a91402
Adjust SPIRV-Cross unit test reference shaders to accommodate these changes.
33 lines
831 B
Plaintext
33 lines
831 B
Plaintext
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
|
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct SSBO0
|
|
{
|
|
float scalar;
|
|
float2 vec2_val;
|
|
float3 vec3_val;
|
|
float4 vec4_val;
|
|
};
|
|
|
|
template <typename F> struct SpvHalfTypeSelector;
|
|
template <> struct SpvHalfTypeSelector<float> { public: using H = half; };
|
|
template<uint N> struct SpvHalfTypeSelector<vec<float, N>> { using H = vec<half, N>; };
|
|
template<typename F, typename H = typename SpvHalfTypeSelector<F>::H>
|
|
[[clang::optnone]] F spvQuantizeToF16(F val)
|
|
{
|
|
return F(H(val));
|
|
}
|
|
|
|
kernel void main0(device SSBO0& _4 [[buffer(0)]])
|
|
{
|
|
_4.scalar = spvQuantizeToF16(_4.scalar);
|
|
_4.vec2_val = spvQuantizeToF16(_4.vec2_val);
|
|
_4.vec3_val = spvQuantizeToF16(_4.vec3_val);
|
|
_4.vec4_val = spvQuantizeToF16(_4.vec4_val);
|
|
}
|
|
|