Move vertex position function into own file
This commit is contained in:
parent
bcc55e6036
commit
e197abe0aa
4 changed files with 13 additions and 8 deletions
|
|
@ -83,6 +83,8 @@ impl Pipeline {
|
|||
concat!(
|
||||
include_str!("../shader/quad.wgsl"),
|
||||
"\n",
|
||||
include_str!("../shader/vertex.wgsl"),
|
||||
"\n",
|
||||
include_str!("../shader/quad/gradient.wgsl"),
|
||||
"\n",
|
||||
include_str!("../shader/color/oklab.wgsl")
|
||||
|
|
@ -91,6 +93,8 @@ impl Pipeline {
|
|||
concat!(
|
||||
include_str!("../shader/quad.wgsl"),
|
||||
"\n",
|
||||
include_str!("../shader/vertex.wgsl"),
|
||||
"\n",
|
||||
include_str!("../shader/quad/gradient.wgsl"),
|
||||
"\n",
|
||||
include_str!("../shader/color/linear_rgb.wgsl")
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ impl Pipeline {
|
|||
concat!(
|
||||
include_str!("../shader/quad.wgsl"),
|
||||
"\n",
|
||||
include_str!("../shader/vertex.wgsl"),
|
||||
"\n",
|
||||
include_str!("../shader/quad/solid.wgsl"),
|
||||
),
|
||||
)),
|
||||
|
|
|
|||
|
|
@ -37,11 +37,3 @@ fn select_border_radius(radi: vec4<f32>, position: vec2<f32>, center: vec2<f32>)
|
|||
rx = select(rx, ry, position.y > center.y);
|
||||
return rx;
|
||||
}
|
||||
|
||||
// Compute the normalized quad coordinates based on the vertex index.
|
||||
fn vertex_position(vertex_index: u32) -> vec2<f32> {
|
||||
// #: 0 1 2 3 4 5
|
||||
// x: 1 1 0 0 0 1
|
||||
// y: 1 0 0 0 1 1
|
||||
return vec2<f32>((vec2(1u, 2u) + vertex_index) % 6u < 3u);
|
||||
}
|
||||
|
|
|
|||
7
wgpu/src/shader/vertex.wgsl
Normal file
7
wgpu/src/shader/vertex.wgsl
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
// Compute the normalized quad coordinates based on the vertex index.
|
||||
fn vertex_position(vertex_index: u32) -> vec2<f32> {
|
||||
// #: 0 1 2 3 4 5
|
||||
// x: 1 1 0 0 0 1
|
||||
// y: 1 0 0 0 1 1
|
||||
return vec2<f32>((vec2(1u, 2u) + vertex_index) % 6u < 3u);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue