forked from gfx-rs/wgpu
-
Notifications
You must be signed in to change notification settings - Fork 1
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
7 changed files
with
475 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,6 @@ Cargo.lock | |
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# Other | ||
.DS_Store |
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,10 @@ | ||
#version 450 | ||
|
||
layout(location = 0) in vec2 v_TexCoord; | ||
layout(location = 0) out vec4 o_Target; | ||
layout(set = 0, binding = 0) uniform texture2D t_Color; | ||
layout(set = 0, binding = 1) uniform sampler s_Color; | ||
|
||
void main() { | ||
o_Target = textureLod(sampler2D(t_Color, s_Color), v_TexCoord, 0.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#version 450 | ||
|
||
layout(location = 0) out vec2 v_TexCoord; | ||
|
||
void main() { | ||
vec2 tc = vec2(0.0); | ||
switch(gl_VertexIndex) { | ||
case 0: tc = vec2(1.0, 0.0); break; | ||
case 1: tc = vec2(1.0, 1.0); break; | ||
case 2: tc = vec2(0.0, 0.0); break; | ||
case 3: tc = vec2(0.0, 1.0); break; | ||
} | ||
v_TexCoord = tc; | ||
gl_Position = vec4(tc * 2.0 - 1.0, 0.5, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#version 450 | ||
|
||
layout(location = 0) in vec2 v_TexCoord; | ||
layout(location = 0) out vec4 o_Target; | ||
layout(set = 0, binding = 1) uniform texture2D t_Color; | ||
layout(set = 0, binding = 2) uniform sampler s_Color; | ||
|
||
void main() { | ||
vec4 tex = texture(sampler2D(t_Color, s_Color), v_TexCoord); | ||
float mag = length(v_TexCoord-vec2(0.5)); | ||
o_Target = mix(tex, vec4(0.0), mag*mag); | ||
} |
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,15 @@ | ||
#version 450 | ||
|
||
layout(location = 0) in vec4 a_Pos; | ||
layout(location = 0) out vec2 v_TexCoord; | ||
|
||
layout(set = 0, binding = 0) uniform Locals { | ||
mat4 u_Transform; | ||
}; | ||
|
||
void main() { | ||
v_TexCoord = a_Pos.xy / 10.0; | ||
gl_Position = u_Transform * a_Pos; | ||
// convert from -1,1 Z to 0,1 | ||
gl_Position.z = 0.5 * (gl_Position.z + gl_Position.w); | ||
} |
Oops, something went wrong.