@@ -763,7 +763,7 @@ impl<A: HalApi> RenderBundle<A> {
763763 let mut offsets = self . base . dynamic_offsets . as_slice ( ) ;
764764 let mut pipeline_layout_id = None :: < id:: Valid < id:: PipelineLayoutId > > ;
765765 if let Some ( ref label) = self . base . label {
766- raw. begin_debug_marker ( label) ;
766+ unsafe { raw. begin_debug_marker ( label) } ;
767767 }
768768
769769 for command in self . base . commands . iter ( ) {
@@ -774,17 +774,19 @@ impl<A: HalApi> RenderBundle<A> {
774774 bind_group_id,
775775 } => {
776776 let bind_group = bind_group_guard. get ( bind_group_id) . unwrap ( ) ;
777- raw. set_bind_group (
778- & pipeline_layout_guard[ pipeline_layout_id. unwrap ( ) ] . raw ,
779- index as u32 ,
780- & bind_group. raw ,
781- & offsets[ ..num_dynamic_offsets as usize ] ,
782- ) ;
777+ unsafe {
778+ raw. set_bind_group (
779+ & pipeline_layout_guard[ pipeline_layout_id. unwrap ( ) ] . raw ,
780+ index as u32 ,
781+ & bind_group. raw ,
782+ & offsets[ ..num_dynamic_offsets as usize ] ,
783+ )
784+ } ;
783785 offsets = & offsets[ num_dynamic_offsets as usize ..] ;
784786 }
785787 RenderCommand :: SetPipeline ( pipeline_id) => {
786788 let pipeline = pipeline_guard. get ( pipeline_id) . unwrap ( ) ;
787- raw. set_render_pipeline ( & pipeline. raw ) ;
789+ unsafe { raw. set_render_pipeline ( & pipeline. raw ) } ;
788790
789791 pipeline_layout_id = Some ( pipeline. layout_id . value ) ;
790792 }
@@ -805,7 +807,7 @@ impl<A: HalApi> RenderBundle<A> {
805807 offset,
806808 size,
807809 } ;
808- raw. set_index_buffer ( bb, index_format) ;
810+ unsafe { raw. set_index_buffer ( bb, index_format) } ;
809811 }
810812 RenderCommand :: SetVertexBuffer {
811813 slot,
@@ -824,7 +826,7 @@ impl<A: HalApi> RenderBundle<A> {
824826 offset,
825827 size,
826828 } ;
827- raw. set_vertex_buffer ( slot, bb) ;
829+ unsafe { raw. set_vertex_buffer ( slot, bb) } ;
828830 }
829831 RenderCommand :: SetPushConstant {
830832 stages,
@@ -841,18 +843,22 @@ impl<A: HalApi> RenderBundle<A> {
841843 let data_slice = & self . base . push_constant_data
842844 [ ( values_offset as usize ) ..values_end_offset] ;
843845
844- raw. set_push_constants ( & pipeline_layout. raw , stages, offset, data_slice)
846+ unsafe {
847+ raw. set_push_constants ( & pipeline_layout. raw , stages, offset, data_slice)
848+ }
845849 } else {
846850 super :: push_constant_clear (
847851 offset,
848852 size_bytes,
849853 |clear_offset, clear_data| {
850- raw. set_push_constants (
851- & pipeline_layout. raw ,
852- stages,
853- clear_offset,
854- clear_data,
855- ) ;
854+ unsafe {
855+ raw. set_push_constants (
856+ & pipeline_layout. raw ,
857+ stages,
858+ clear_offset,
859+ clear_data,
860+ )
861+ } ;
856862 } ,
857863 ) ;
858864 }
@@ -863,7 +869,7 @@ impl<A: HalApi> RenderBundle<A> {
863869 first_vertex,
864870 first_instance,
865871 } => {
866- raw. draw ( first_vertex, vertex_count, first_instance, instance_count) ;
872+ unsafe { raw. draw ( first_vertex, vertex_count, first_instance, instance_count) } ;
867873 }
868874 RenderCommand :: DrawIndexed {
869875 index_count,
@@ -872,13 +878,15 @@ impl<A: HalApi> RenderBundle<A> {
872878 base_vertex,
873879 first_instance,
874880 } => {
875- raw. draw_indexed (
876- first_index,
877- index_count,
878- base_vertex,
879- first_instance,
880- instance_count,
881- ) ;
881+ unsafe {
882+ raw. draw_indexed (
883+ first_index,
884+ index_count,
885+ base_vertex,
886+ first_instance,
887+ instance_count,
888+ )
889+ } ;
882890 }
883891 RenderCommand :: MultiDrawIndirect {
884892 buffer_id,
@@ -892,7 +900,7 @@ impl<A: HalApi> RenderBundle<A> {
892900 . raw
893901 . as_ref ( )
894902 . ok_or ( ExecutionError :: DestroyedBuffer ( buffer_id) ) ?;
895- raw. draw_indirect ( buffer, offset, 1 ) ;
903+ unsafe { raw. draw_indirect ( buffer, offset, 1 ) } ;
896904 }
897905 RenderCommand :: MultiDrawIndirect {
898906 buffer_id,
@@ -906,7 +914,7 @@ impl<A: HalApi> RenderBundle<A> {
906914 . raw
907915 . as_ref ( )
908916 . ok_or ( ExecutionError :: DestroyedBuffer ( buffer_id) ) ?;
909- raw. draw_indexed_indirect ( buffer, offset, 1 ) ;
917+ unsafe { raw. draw_indexed_indirect ( buffer, offset, 1 ) } ;
910918 }
911919 RenderCommand :: MultiDrawIndirect { .. }
912920 | RenderCommand :: MultiDrawIndirectCount { .. } => {
@@ -931,7 +939,7 @@ impl<A: HalApi> RenderBundle<A> {
931939 }
932940
933941 if let Some ( _) = self . base . label {
934- raw. end_debug_marker ( ) ;
942+ unsafe { raw. end_debug_marker ( ) } ;
935943 }
936944
937945 Ok ( ( ) )
@@ -1439,13 +1447,15 @@ pub mod bundle_ffi {
14391447 offsets : * const DynamicOffset ,
14401448 offset_length : usize ,
14411449 ) {
1442- let redundant = bundle. current_bind_groups . set_and_check_redundant (
1443- bind_group_id,
1444- index,
1445- & mut bundle. base . dynamic_offsets ,
1446- offsets,
1447- offset_length,
1448- ) ;
1450+ let redundant = unsafe {
1451+ bundle. current_bind_groups . set_and_check_redundant (
1452+ bind_group_id,
1453+ index,
1454+ & mut bundle. base . dynamic_offsets ,
1455+ offsets,
1456+ offset_length,
1457+ )
1458+ } ;
14491459
14501460 if redundant {
14511461 return ;
@@ -1522,7 +1532,7 @@ pub mod bundle_ffi {
15221532 0 ,
15231533 "Push constant size must be aligned to 4 bytes."
15241534 ) ;
1525- let data_slice = slice:: from_raw_parts ( data, size_bytes as usize ) ;
1535+ let data_slice = unsafe { slice:: from_raw_parts ( data, size_bytes as usize ) } ;
15261536 let value_offset = pass. base . push_constant_data . len ( ) . try_into ( ) . expect (
15271537 "Ran out of push constant space. Don't set 4gb of push constants per RenderBundle." ,
15281538 ) ;
0 commit comments