@@ -108,6 +108,10 @@ pub enum Command {
108
108
CopySurfaceToBuffer ( n:: Surface , n:: RawBuffer , command:: BufferImageCopy ) ,
109
109
CopyImageToTexture ( n:: ImageKind , n:: Texture , command:: ImageCopy ) ,
110
110
CopyImageToSurface ( n:: ImageKind , n:: Surface , command:: ImageCopy ) ,
111
+
112
+ BindBufferRange ( gl:: types:: GLenum , gl:: types:: GLuint , n:: RawBuffer , gl:: types:: GLintptr , gl:: types:: GLsizeiptr ) ,
113
+ BindTexture ( gl:: types:: GLenum , n:: Texture ) ,
114
+ BindSampler ( gl:: types:: GLuint , n:: Texture ) ,
111
115
}
112
116
113
117
pub type FrameBufferTarget = gl:: types:: GLenum ;
@@ -862,17 +866,56 @@ impl command::RawCommandBuffer<Backend> for RawCommandBuffer {
862
866
863
867
fn bind_graphics_descriptor_sets < I , J > (
864
868
& mut self ,
865
- _layout : & n:: PipelineLayout ,
866
- _first_set : usize ,
867
- _sets : I ,
868
- _offsets : J ,
869
+ layout : & n:: PipelineLayout ,
870
+ first_set : usize ,
871
+ sets : I ,
872
+ offsets : J ,
869
873
) where
870
874
I : IntoIterator ,
871
875
I :: Item : Borrow < n:: DescriptorSet > ,
872
876
J : IntoIterator ,
873
877
J :: Item : Borrow < command:: DescriptorSetOffset > ,
874
878
{
875
- // TODO
879
+ assert ! ( offsets. into_iter( ) . next( ) . is_none( ) ) ; // TODO: offsets unsupported
880
+
881
+ let mut set = first_set as _ ;
882
+ let drd = & * layout. desc_remap_data . read ( ) . unwrap ( ) ;
883
+
884
+ for desc_set in sets {
885
+ let desc_set = desc_set. borrow ( ) ;
886
+ for new_binding in & * desc_set. bindings . lock ( ) . unwrap ( ) {
887
+ match new_binding {
888
+ n:: DescSetBindings :: Buffer { ty : btype, binding, buffer, offset, size} => {
889
+ for binding in drd. get_binding ( n:: BindingTypes :: UniformBuffers , set, * binding) . unwrap ( ) {
890
+ self . push_cmd ( Command :: BindBufferRange (
891
+ gl:: UNIFORM_BUFFER ,
892
+ * binding,
893
+ * buffer,
894
+ * offset,
895
+ * size,
896
+ ) )
897
+ }
898
+ }
899
+ n:: DescSetBindings :: Texture ( binding, texture) => {
900
+ for binding in drd. get_binding ( n:: BindingTypes :: Images , set, * binding) . unwrap ( ) {
901
+ self . push_cmd ( Command :: BindTexture (
902
+ * binding,
903
+ * texture,
904
+ ) )
905
+ }
906
+ }
907
+ n:: DescSetBindings :: Sampler ( binding, sampler) => {
908
+ for binding in drd. get_binding ( n:: BindingTypes :: Images , set, * binding) . unwrap ( ) {
909
+ self . push_cmd ( Command :: BindSampler (
910
+ * binding,
911
+ * sampler,
912
+ ) )
913
+ }
914
+ }
915
+ }
916
+ }
917
+ set += 1 ;
918
+ }
876
919
}
877
920
878
921
fn bind_compute_pipeline ( & mut self , pipeline : & n:: ComputePipeline ) {
0 commit comments