1
0
Fork 0
firefox/third_party/rust/metal/examples/mesh-shader/shaders.metal
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

30 lines
No EOL
619 B
Metal

#include <metal_stdlib>
using namespace metal;
struct VertexOut {
float4 position [[position]];
};
using mesh_t = mesh<VertexOut, void, 3, 1, topology::triangle>;
[[mesh]] void mesh_function(mesh_t m) {
VertexOut v;
v.position = float4(-1.0, -1.0, 0.0, 1.0);
m.set_primitive_count(1);
m.set_vertex(0, v);
v.position = float4(0.0, 1.0, 0.0, 1.0);
m.set_vertex(1, v);
v.position = float4(1.0, -1.0, 0.0, 1.0);
m.set_vertex(2, v);
m.set_index(0, 0);
m.set_index(1, 1);
m.set_index(2, 2);
}
fragment half4 fragment_function() {
return half4(0.1, 1.0, 0.1, 1.0);
}