Skip to content

Commit

Permalink
Changed example to use a combined image sampler so it works with the GL
Browse files Browse the repository at this point in the history
backend

Signed-off-by: Hal Gentz <[email protected]>
  • Loading branch information
goddessfreya committed May 30, 2018
1 parent 9e92025 commit 83f0ee6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
Binary file modified examples/hal/quad/data/frag.spv
Binary file not shown.
24 changes: 3 additions & 21 deletions examples/hal/quad/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,7 @@ fn main() {
let set_layout = device.create_descriptor_set_layout(&[
pso::DescriptorSetLayoutBinding {
binding: 0,
ty: pso::DescriptorType::SampledImage,
count: 1,
stage_flags: ShaderStageFlags::FRAGMENT,
},
pso::DescriptorSetLayoutBinding {
binding: 1,
ty: pso::DescriptorType::Sampler,
ty: pso::DescriptorType::CombinedImageSampler,
count: 1,
stage_flags: ShaderStageFlags::FRAGMENT,
},
Expand Down Expand Up @@ -312,11 +306,7 @@ fn main() {
1, // sets
&[
pso::DescriptorRangeDesc {
ty: pso::DescriptorType::SampledImage,
count: 1,
},
pso::DescriptorRangeDesc {
ty: pso::DescriptorType::Sampler,
ty: pso::DescriptorType::CombinedImageSampler,
count: 1,
},
],
Expand Down Expand Up @@ -445,15 +435,7 @@ fn main() {
binding: 0,
array_offset: 0,
descriptors: Some(
pso::Descriptor::Image(&image_srv, i::Layout::Undefined)
),
},
pso::DescriptorSetWrite {
set: &desc_set,
binding: 1,
array_offset: 0,
descriptors: Some(
pso::Descriptor::Sampler(&sampler)
pso::Descriptor::CombinedImageSampler(&image_srv, i::Layout::ShaderReadOnlyOptimal, &sampler)
),
},
]);
Expand Down
5 changes: 2 additions & 3 deletions examples/hal/quad/shader/quad.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
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 = 0, binding = 0) uniform sampler2D u_Texture;

void main() {
Target0 = texture(sampler2D(u_Texture, u_Sampler), v_Uv);
Target0 = texture(u_Texture, v_Uv);
}

0 comments on commit 83f0ee6

Please sign in to comment.