-
Notifications
You must be signed in to change notification settings - Fork 958
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
24 changed files
with
187 additions
and
159 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[[stage(compute), workgroup_size(1)]] | ||
@stage(compute) | ||
@workgroup_size(1) | ||
fn main() { | ||
} |
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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
struct InOutBuffer { | ||
data: [[stride(4)]] array<u32>; | ||
data: @stride(4) array<u32>; | ||
}; | ||
|
||
[[group(0), binding(0)]] | ||
@group(0) | ||
@binding(0) | ||
var<storage, read_write> buffer: InOutBuffer; | ||
|
||
[[stage(compute), workgroup_size(1)]] | ||
fn main([[builtin(global_invocation_id)]] global_id: vec3<u32>) { | ||
@stage(compute) | ||
@workgroup_size(1) | ||
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) { | ||
buffer.data[global_id.x] = buffer.data[global_id.x] + global_id.x; | ||
} |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[[group(0), binding(0)]] var tex: texture_2d<f32>; | ||
[[group(0), binding(1)]] var tex_storage: texture_storage_2d<rgba8uint, write>; | ||
@group(0) @binding(0) var tex: texture_2d<f32>; | ||
@group(0) @binding(1) var tex_storage: texture_storage_2d<rgba8uint, write>; | ||
|
||
[[stage(compute), workgroup_size(1)]] | ||
fn main([[builtin(global_invocation_id)]] global_id: vec3<u32>) { | ||
@stage(compute) | ||
@workgroup_size(1) | ||
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) { | ||
} |
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 |
---|---|---|
@@ -1,22 +1,22 @@ | ||
[[stage(vertex)]] | ||
fn vs_main([[builtin(vertex_index)]] vertex_index: u32) -> [[builtin(position)]] vec4<f32> { | ||
@stage(vertex) | ||
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4<f32> { | ||
let i: i32 = i32(vertex_index % 3u); | ||
let x: f32 = f32(i - 1) * 0.75; | ||
let y: f32 = f32((i & 1) * 2 - 1) * 0.75 + x * 0.2 + 0.1; | ||
return vec4<f32>(x, y, 0.0, 1.0); | ||
} | ||
|
||
[[stage(fragment)]] | ||
fn fs_main_red() -> [[location(0)]] vec4<f32> { | ||
@stage(fragment) | ||
fn fs_main_red() -> @location(0) vec4<f32> { | ||
return vec4<f32>(1.0, 0.0, 0.0, 1.0); | ||
} | ||
|
||
[[stage(fragment)]] | ||
fn fs_main_blue() -> [[location(0)]] vec4<f32> { | ||
@stage(fragment) | ||
fn fs_main_blue() -> @location(0) vec4<f32> { | ||
return vec4<f32>(0.13, 0.31, 0.85, 1.0); // cornflower blue in linear space | ||
} | ||
|
||
[[stage(fragment)]] | ||
fn fs_main_white() -> [[location(0)]] vec4<f32> { | ||
@stage(fragment) | ||
fn fs_main_white() -> @location(0) vec4<f32> { | ||
return vec4<f32>(1.0, 1.0, 1.0, 1.0); | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
[[stage(vertex)]] | ||
fn vs_main([[builtin(vertex_index)]] in_vertex_index: u32) -> [[builtin(position)]] vec4<f32> { | ||
@stage(vertex) | ||
fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4<f32> { | ||
let x = f32(i32(in_vertex_index) - 1); | ||
let y = f32(i32(in_vertex_index & 1u) * 2 - 1); | ||
return vec4<f32>(x, y, 0.0, 1.0); | ||
} | ||
|
||
[[stage(fragment)]] | ||
fn fs_main() -> [[location(0)]] vec4<f32> { | ||
@stage(fragment) | ||
fn fs_main() -> @location(0) vec4<f32> { | ||
return vec4<f32>(1.0, 0.0, 0.0, 1.0); | ||
} |
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
Oops, something went wrong.