@@ -40,11 +40,27 @@ impl RenderPipeline {
4040 }
4141}
4242
43- pub struct RenderPipelineBuilder { }
43+ pub use lambda_platform:: gfx:: pipeline:: PipelineStage ;
44+ use lambda_platform:: gfx:: pipeline:: PushConstantUpload ;
45+
46+ pub struct RenderPipelineBuilder {
47+ push_constants : Vec < PushConstantUpload > ,
48+ }
4449
4550impl RenderPipelineBuilder {
4651 pub fn new ( ) -> Self {
47- return Self { } ;
52+ return Self {
53+ push_constants : Vec :: new ( ) ,
54+ } ;
55+ }
56+
57+ pub fn with_push_constant (
58+ mut self ,
59+ stage : PipelineStage ,
60+ bytes : u32 ,
61+ ) -> Self {
62+ self . push_constants . push ( ( stage, 0 ..bytes) ) ;
63+ return self ;
4864 }
4965
5066 /// Builds a render pipeline based on your builder configuration.
@@ -68,12 +84,14 @@ impl RenderPipelineBuilder {
6884 ) ;
6985
7086 let render_pipeline =
71- lambda_platform:: gfx:: pipeline:: RenderPipelineBuilder :: new ( ) . build (
72- gpu_from_context ( render_context) ,
73- & platform_render_pass_from_render_pass ( render_pass) ,
74- & vertex_shader_module,
75- & fragment_shader_module,
76- ) ;
87+ lambda_platform:: gfx:: pipeline:: RenderPipelineBuilder :: new ( )
88+ . with_push_constants ( self . push_constants )
89+ . build (
90+ gpu_from_context ( render_context) ,
91+ & platform_render_pass_from_render_pass ( render_pass) ,
92+ & vertex_shader_module,
93+ & fragment_shader_module,
94+ ) ;
7795
7896 vertex_shader_module. destroy ( mut_gpu_from_context ( render_context) ) ;
7997 fragment_shader_module. destroy ( mut_gpu_from_context ( render_context) ) ;
0 commit comments