mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 23:04:07 +00:00
61 lines
2.3 KiB
Plaintext
61 lines
2.3 KiB
Plaintext
// language: metal1.0
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using metal::uint;
|
|
|
|
struct FragmentInput {
|
|
metal::float4 position;
|
|
uint _flat;
|
|
float _linear;
|
|
metal::float2 linear_centroid;
|
|
metal::float3 linear_sample;
|
|
metal::float4 perspective;
|
|
float perspective_centroid;
|
|
float perspective_sample;
|
|
};
|
|
|
|
struct vert_mainOutput {
|
|
metal::float4 position [[position]];
|
|
uint _flat [[user(loc0), flat]];
|
|
float _linear [[user(loc1), center_no_perspective]];
|
|
metal::float2 linear_centroid [[user(loc2), centroid_no_perspective]];
|
|
metal::float3 linear_sample [[user(loc3), sample_no_perspective]];
|
|
metal::float4 perspective [[user(loc4), center_perspective]];
|
|
float perspective_centroid [[user(loc5), centroid_perspective]];
|
|
float perspective_sample [[user(loc6), sample_perspective]];
|
|
};
|
|
vertex vert_mainOutput vert_main(
|
|
) {
|
|
FragmentInput out = {};
|
|
out.position = metal::float4(2.0, 4.0, 5.0, 6.0);
|
|
out._flat = 8u;
|
|
out._linear = 27.0;
|
|
out.linear_centroid = metal::float2(64.0, 125.0);
|
|
out.linear_sample = metal::float3(216.0, 343.0, 512.0);
|
|
out.perspective = metal::float4(729.0, 1000.0, 1331.0, 1728.0);
|
|
out.perspective_centroid = 2197.0;
|
|
out.perspective_sample = 2744.0;
|
|
FragmentInput _e30 = out;
|
|
const auto _tmp = _e30;
|
|
return vert_mainOutput { _tmp.position, _tmp._flat, _tmp._linear, _tmp.linear_centroid, _tmp.linear_sample, _tmp.perspective, _tmp.perspective_centroid, _tmp.perspective_sample };
|
|
}
|
|
|
|
|
|
struct frag_mainInput {
|
|
uint _flat [[user(loc0), flat]];
|
|
float _linear [[user(loc1), center_no_perspective]];
|
|
metal::float2 linear_centroid [[user(loc2), centroid_no_perspective]];
|
|
metal::float3 linear_sample [[user(loc3), sample_no_perspective]];
|
|
metal::float4 perspective [[user(loc4), center_perspective]];
|
|
float perspective_centroid [[user(loc5), centroid_perspective]];
|
|
float perspective_sample [[user(loc6), sample_perspective]];
|
|
};
|
|
fragment void frag_main(
|
|
frag_mainInput varyings_1 [[stage_in]]
|
|
, metal::float4 position [[position]]
|
|
) {
|
|
const FragmentInput val = { position, varyings_1._flat, varyings_1._linear, varyings_1.linear_centroid, varyings_1.linear_sample, varyings_1.perspective, varyings_1.perspective_centroid, varyings_1.perspective_sample };
|
|
return;
|
|
}
|