Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] A third gfx example #2072

Merged
merged 2 commits into from
Jul 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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