-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
195 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
struct VertexOutput { | ||
@builtin(position) position: vec4<f32>, | ||
@location(0) tex_coords: vec2<f32>, | ||
}; | ||
|
||
// meant to be called with 3 vertex indices: 0, 1, 2 | ||
// draws one large triangle over the clip space like this: | ||
// (the asterisks represent the clip space bounds) | ||
//-1,1 1,1 | ||
// --------------------------------- | ||
// | * . | ||
// | * . | ||
// | * . | ||
// | * . | ||
// | * . | ||
// | * . | ||
// |*************** | ||
// | . 1,-1 | ||
// | . | ||
// | . | ||
// | . | ||
// | . | ||
// |. | ||
@vertex | ||
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput { | ||
var result: VertexOutput; | ||
let x = i32(vertex_index) / 2; | ||
let y = i32(vertex_index) & 1; | ||
let tc = vec2<f32>( | ||
f32(x) * 2.0, | ||
f32(y) * 2.0 | ||
); | ||
result.position = vec4<f32>( | ||
tc.x * 2.0 - 1.0, | ||
1.0 - tc.y * 2.0, | ||
0.0, 1.0 | ||
); | ||
result.tex_coords = tc; | ||
return result; | ||
} | ||
|
||
@group(0) | ||
@binding(0) | ||
var r_color: texture_2d<f32>; | ||
@group(0) | ||
@binding(1) | ||
var r_sampler: sampler; | ||
|
||
@fragment | ||
fn fs_main(vertex: VertexOutput) -> @location(0) vec4<f32> { | ||
return textureSample(r_color, r_sampler, vertex.tex_coords); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters