examples: import mach-examples@20ceb359231ff284cf343dddba8cf25112ffe717
Helps hexops/mach#1165 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
f25f435275
commit
0a8e22bb49
19 changed files with 3147 additions and 0 deletions
22
examples/custom-renderer/shader.wgsl
Normal file
22
examples/custom-renderer/shader.wgsl
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
struct Uniform {
|
||||
pos: vec3<f32>,
|
||||
scale: f32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<uniform> in : Uniform;
|
||||
|
||||
@vertex fn vertex_main(
|
||||
@builtin(vertex_index) VertexIndex : u32
|
||||
) -> @builtin(position) vec4<f32> {
|
||||
var positions = array<vec2<f32>, 3>(
|
||||
vec2<f32>( 0.0, 0.1),
|
||||
vec2<f32>(-0.1, -0.1),
|
||||
vec2<f32>( 0.1, -0.1)
|
||||
);
|
||||
var pos = positions[VertexIndex];
|
||||
return vec4<f32>((pos*in.scale)+in.pos.xy, 0.0, 1.0);
|
||||
}
|
||||
|
||||
@fragment fn frag_main() -> @location(0) vec4<f32> {
|
||||
return vec4<f32>(1.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue