mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-23 15:23:33 +00:00
57 lines
2.2 KiB
Plaintext
57 lines
2.2 KiB
Plaintext
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
struct FragmentInput {
|
|
metal::float4 position;
|
|
metal::uint flat;
|
|
float linear;
|
|
metal::float2 linear_centroid;
|
|
metal::float3 linear_sample;
|
|
metal::float4 perspective;
|
|
float perspective_centroid;
|
|
float perspective_sample;
|
|
};
|
|
|
|
struct main1Output {
|
|
metal::float4 position [[position]];
|
|
metal::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 main1Output main1(
|
|
) {
|
|
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;
|
|
const auto _tmp = out;
|
|
return main1Output { _tmp.position, _tmp.flat, _tmp.linear, _tmp.linear_centroid, _tmp.linear_sample, _tmp.perspective, _tmp.perspective_centroid, _tmp.perspective_sample };
|
|
}
|
|
|
|
|
|
struct main2Input {
|
|
metal::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 main2(
|
|
main2Input varyings1 [[stage_in]]
|
|
, metal::float4 position [[position]]
|
|
) {
|
|
const FragmentInput val = { position, varyings1.flat, varyings1.linear, varyings1.linear_centroid, varyings1.linear_sample, varyings1.perspective, varyings1.perspective_centroid, varyings1.perspective_sample };
|
|
return;
|
|
}
|