Last active
July 17, 2020 14:59
-
-
Save hasenbanck/4bf7e5b34c1f5a397d88cb96dd20e54b to your computer and use it in GitHub Desktop.
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
layout(push_constant) uniform VertexConstants { | |
mat4 mvp; | |
} pc; |
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
layout(push_constant) uniform FragmentConstants { | |
vec4 sun_color; | |
} pc; |
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
// Init | |
let render_pipeline_layout = | |
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { | |
bind_group_layouts: &[&bind_group_layout], | |
push_constant_ranges: &[ | |
wgpu::PushConstantRange { | |
stages: wgpu::ShaderStage::VERTEX, | |
range: 0..64, | |
}, | |
wgpu::PushConstantRange { | |
stages: wgpu::ShaderStage::FRAGMENT, | |
range: 64..80, | |
}, | |
], | |
}); | |
// Draw | |
pass.set_push_constants(wgpu::ShaderStage::VERTEX, 0, vertex_push_constant); | |
pass.set_push_constants(wgpu::ShaderStage::FRAGMENT, 64, fragment_push_constant); | |
pass.draw(0..7, 0..1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment