summaryrefslogtreecommitdiffstats
path: root/wgpu/src/shader/quad.wgsl
diff options
context:
space:
mode:
authorLibravatar Cupnfish <cupnfish@icloud.com>2022-07-02 15:39:42 +0800
committerLibravatar Cupnfish <cupnfish@icloud.com>2022-07-02 15:39:42 +0800
commitc148557cabf1fb9127b00b248479de2eb1d1d477 (patch)
tree1f3fe0a654effa351997e5462fae2536e118f517 /wgpu/src/shader/quad.wgsl
parente6e3eff8762e9e8350f00b340348dc2261dd0053 (diff)
downloadiced-c148557cabf1fb9127b00b248479de2eb1d1d477.tar.gz
iced-c148557cabf1fb9127b00b248479de2eb1d1d477.tar.bz2
iced-c148557cabf1fb9127b00b248479de2eb1d1d477.zip
update `wgpu` to `0.13`
Diffstat (limited to 'wgpu/src/shader/quad.wgsl')
-rw-r--r--wgpu/src/shader/quad.wgsl44
1 files changed, 22 insertions, 22 deletions
diff --git a/wgpu/src/shader/quad.wgsl b/wgpu/src/shader/quad.wgsl
index 73f5d597..2e31cde3 100644
--- a/wgpu/src/shader/quad.wgsl
+++ b/wgpu/src/shader/quad.wgsl
@@ -1,31 +1,31 @@
struct Globals {
- transform: mat4x4<f32>;
- scale: f32;
+ transform: mat4x4<f32>,
+ scale: f32,
};
-[[group(0), binding(0)]] var<uniform> globals: Globals;
+@group(0) @binding(0) var<uniform> globals: Globals;
struct VertexInput {
- [[location(0)]] v_pos: vec2<f32>;
- [[location(1)]] pos: vec2<f32>;
- [[location(2)]] scale: vec2<f32>;
- [[location(3)]] color: vec4<f32>;
- [[location(4)]] border_color: vec4<f32>;
- [[location(5)]] border_radius: f32;
- [[location(6)]] border_width: f32;
+ @location(0) v_pos: vec2<f32>,
+ @location(1) pos: vec2<f32>,
+ @location(2) scale: vec2<f32>,
+ @location(3) color: vec4<f32>,
+ @location(4) border_color: vec4<f32>,
+ @location(5) border_radius: f32,
+ @location(6) border_width: f32,
};
struct VertexOutput {
- [[builtin(position)]] position: vec4<f32>;
- [[location(0)]] color: vec4<f32>;
- [[location(1)]] border_color: vec4<f32>;
- [[location(2)]] pos: vec2<f32>;
- [[location(3)]] scale: vec2<f32>;
- [[location(4)]] border_radius: f32;
- [[location(5)]] border_width: f32;
+ @builtin(position) position: vec4<f32>,
+ @location(0) color: vec4<f32>,
+ @location(1) border_color: vec4<f32>,
+ @location(2) pos: vec2<f32>,
+ @location(3) scale: vec2<f32>,
+ @location(4) border_radius: f32,
+ @location(5) border_width: f32,
};
-[[stage(vertex)]]
+@vertex
fn vs_main(input: VertexInput) -> VertexOutput {
var out: VertexOutput;
@@ -77,10 +77,10 @@ fn distance_alg(
}
-[[stage(fragment)]]
+@fragment
fn fs_main(
input: VertexOutput
-) -> [[location(0)]] vec4<f32> {
+) -> @location(0) vec4<f32> {
var mixed_color: vec4<f32> = input.color;
if (input.border_width > 0.0) {
@@ -96,7 +96,7 @@ fn fs_main(
internal_border
);
- var border_mix: f32 = smoothStep(
+ var border_mix: f32 = smoothstep(
max(internal_border - 0.5, 0.0),
internal_border + 0.5,
internal_distance
@@ -112,7 +112,7 @@ fn fs_main(
input.border_radius
);
- var radius_alpha: f32 = 1.0 - smoothStep(
+ var radius_alpha: f32 = 1.0 - smoothstep(
max(input.border_radius - 0.5, 0.0),
input.border_radius + 0.5,
dist);