Skip to content

Commit

Permalink
Merge #2072
Browse files Browse the repository at this point in the history
2072: [WIP] A third gfx example r=kvark a=ZeGentzy

Depends on #2071 and #2052 
PR checklist:
- [ ] `make` succeeds (on *nix)
- [ ] `make reftests` succeeds
- [ ] tested examples with the following backends:


Co-authored-by: Hal Gentz <[email protected]>
  • Loading branch information
bors[bot] and goddessfreya committed Jul 21, 2018
2 parents 57ff16d + d5d38e6 commit 308dd39
Show file tree
Hide file tree
Showing 5 changed files with 1,661 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ dx12 = ["gfx-backend-dx12"]
vulkan = ["gfx-backend-vulkan"]
unstable = []

[[bin]]
name = "colour-uniform"
path = "colour-uniform/main.rs"

[[bin]]
name = "quad"
path = "quad/main.rs"
Expand All @@ -27,6 +31,7 @@ log = "0.4"
winit = "0.16"
glsl-to-spirv = "0.1.4"
gfx-hal = { path = "../src/hal", version = "0.1" }
gfx-backend-empty = { path = "../src/backend/empty", version = "0.1" }

[dependencies.gfx-backend-gl]
path = "../src/backend/gl"
Expand Down
Binary file added examples/colour-uniform/data/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions examples/colour-uniform/data/quad.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable

layout(location = 0) in vec2 v_uv;
layout(location = 0) out vec4 target0;

layout(set = 0, binding = 0) uniform texture2D u_texture;
layout(set = 0, binding = 1) uniform sampler u_sampler;

layout(set = 1, binding = 0) uniform UBOCol {
vec4 color;
} color_dat;

void main() {
target0 = texture(sampler2D(u_texture, u_sampler), v_uv) * color_dat.color;
}
17 changes: 17 additions & 0 deletions examples/colour-uniform/data/quad.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable

layout(constant_id = 0) const float scale = 1.2f;

layout(location = 0) in vec2 a_pos;
layout(location = 1) in vec2 a_uv;
layout(location = 0) out vec2 v_uv;

out gl_PerVertex {
vec4 gl_Position;
};

void main() {
v_uv = a_uv;
gl_Position = vec4(scale * a_pos, 0.0, 1.0);
}
Loading

0 comments on commit 308dd39

Please sign in to comment.