@@ -63,12 +63,12 @@ pub(crate) async fn request_device_and_queue(
63
63
) -> ( DeviceId , QueueId ) {
64
64
let device_promise = match desc {
65
65
Some ( d) => {
66
- let mut mapped_descriptor = web_sys:: GpuDeviceDescriptor :: new ( ) ;
67
- // TODO: Extensions
66
+ let mut mapped_desc = web_sys:: GpuDeviceDescriptor :: new ( ) ;
67
+ // TODO: label, extensions
68
68
let mut mapped_limits = web_sys:: GpuLimits :: new ( ) ;
69
69
mapped_limits. max_bind_groups ( d. limits . max_bind_groups ) ;
70
- mapped_descriptor . limits ( & mapped_limits) ;
71
- adapter. request_device_with_descriptor ( & mapped_descriptor )
70
+ mapped_desc . limits ( & mapped_limits) ;
71
+ adapter. request_device_with_descriptor ( & mapped_desc )
72
72
}
73
73
None => adapter. request_device ( ) ,
74
74
} ;
@@ -82,6 +82,7 @@ pub(crate) async fn request_device_and_queue(
82
82
83
83
pub ( crate ) fn create_shader_module ( device : & DeviceId , spv : & [ u32 ] ) -> ShaderModuleId {
84
84
let desc = web_sys:: GpuShaderModuleDescriptor :: new ( & js_sys:: Uint32Array :: from ( spv) ) ;
85
+ // TODO: label
85
86
device. create_shader_module ( & desc)
86
87
}
87
88
@@ -150,7 +151,10 @@ pub(crate) fn create_bind_group_layout(
150
151
} )
151
152
. collect :: < js_sys:: Array > ( ) ;
152
153
153
- let mapped_desc = web_sys:: GpuBindGroupLayoutDescriptor :: new ( & mapped_bindings) ;
154
+ let mut mapped_desc = web_sys:: GpuBindGroupLayoutDescriptor :: new ( & mapped_bindings) ;
155
+ if let Some ( label) = desc. label {
156
+ mapped_desc. label ( label) ;
157
+ }
154
158
device. create_bind_group_layout ( & mapped_desc)
155
159
}
156
160
@@ -179,7 +183,10 @@ pub(crate) fn create_bind_group(device: &DeviceId, desc: &BindGroupDescriptor) -
179
183
} )
180
184
. collect :: < js_sys:: Array > ( ) ;
181
185
182
- let mapped_desc = web_sys:: GpuBindGroupDescriptor :: new ( & mapped_entries, & desc. layout . id ) ;
186
+ let mut mapped_desc = web_sys:: GpuBindGroupDescriptor :: new ( & mapped_entries, & desc. layout . id ) ;
187
+ if let Some ( label) = desc. label {
188
+ mapped_desc. label ( label) ;
189
+ }
183
190
device. create_bind_group ( & mapped_desc)
184
191
}
185
192
@@ -193,6 +200,7 @@ pub(crate) fn create_pipeline_layout(
193
200
. map ( |bgl| bgl. id . clone ( ) )
194
201
. collect :: < js_sys:: Array > ( ) ;
195
202
let mapped_desc = web_sys:: GpuPipelineLayoutDescriptor :: new ( & temp_layouts) ;
203
+ // TODO: label
196
204
device. create_pipeline_layout ( & mapped_desc)
197
205
}
198
206
@@ -591,6 +599,8 @@ pub(crate) fn create_render_pipeline(
591
599
& mapped_vertex_stage,
592
600
) ;
593
601
602
+ // TODO: label
603
+
594
604
if let Some ( ref frag) = desc. fragment_stage {
595
605
mapped_desc. fragment_stage ( & map_stage_descriptor ( frag) ) ;
596
606
}
@@ -618,7 +628,7 @@ pub(crate) fn create_compute_pipeline(
618
628
let mapped_compute_stage = map_stage_descriptor ( & desc. compute_stage ) ;
619
629
let mapped_desc =
620
630
web_sys:: GpuComputePipelineDescriptor :: new ( & desc. layout . id , & mapped_compute_stage) ;
621
-
631
+ // TODO: label
622
632
device. create_compute_pipeline ( & mapped_desc)
623
633
}
624
634
@@ -633,7 +643,10 @@ pub(crate) fn device_create_buffer_mapped<'a>(
633
643
device : & DeviceId ,
634
644
desc : & BufferDescriptor ,
635
645
) -> crate :: CreateBufferMapped < ' a > {
636
- let mapped_desc = web_sys:: GpuBufferDescriptor :: new ( desc. size as f64 , desc. usage . bits ( ) ) ;
646
+ let mut mapped_desc = web_sys:: GpuBufferDescriptor :: new ( desc. size as f64 , desc. usage . bits ( ) ) ;
647
+ if let Some ( label) = desc. label {
648
+ mapped_desc. label ( label) ;
649
+ }
637
650
unsafe {
638
651
let pair = device. create_buffer_mapped ( & mapped_desc) ;
639
652
let id = pair. get ( 0 ) . into ( ) ;
@@ -690,7 +703,10 @@ pub(crate) fn buffer_drop(_buffer: &BufferId) {
690
703
}
691
704
692
705
pub ( crate ) fn device_create_buffer ( device : & DeviceId , desc : & BufferDescriptor ) -> crate :: Buffer {
693
- let mapped_desc = web_sys:: GpuBufferDescriptor :: new ( desc. size as f64 , desc. usage . bits ( ) ) ;
706
+ let mut mapped_desc = web_sys:: GpuBufferDescriptor :: new ( desc. size as f64 , desc. usage . bits ( ) ) ;
707
+ if let Some ( label) = desc. label {
708
+ mapped_desc. label ( label) ;
709
+ }
694
710
crate :: Buffer {
695
711
id : device. create_buffer ( & mapped_desc) ,
696
712
detail : ( ) ,
@@ -703,6 +719,9 @@ pub(crate) fn device_create_texture(device: &DeviceId, desc: &TextureDescriptor)
703
719
& map_extent_3d ( desc. size ) ,
704
720
desc. usage . bits ( ) ,
705
721
) ;
722
+ if let Some ( label) = desc. label {
723
+ mapped_desc. label ( label) ;
724
+ }
706
725
mapped_desc. dimension ( map_texture_dimension ( desc. dimension ) ) ;
707
726
mapped_desc. mip_level_count ( desc. mip_level_count ) ;
708
727
mapped_desc. sample_count ( desc. sample_count ) ;
@@ -711,6 +730,7 @@ pub(crate) fn device_create_texture(device: &DeviceId, desc: &TextureDescriptor)
711
730
712
731
pub ( crate ) fn device_create_sampler ( device : & DeviceId , desc : & SamplerDescriptor ) -> SamplerId {
713
732
let mut mapped_desc = web_sys:: GpuSamplerDescriptor :: new ( ) ;
733
+ // TODO: label
714
734
mapped_desc. address_mode_u ( map_address_mode ( desc. address_mode_u ) ) ;
715
735
mapped_desc. address_mode_v ( map_address_mode ( desc. address_mode_v ) ) ;
716
736
mapped_desc. address_mode_w ( map_address_mode ( desc. address_mode_w ) ) ;
@@ -727,9 +747,12 @@ pub(crate) fn device_create_sampler(device: &DeviceId, desc: &SamplerDescriptor)
727
747
728
748
pub ( crate ) fn create_command_encoder (
729
749
device : & DeviceId ,
730
- _desc : & CommandEncoderDescriptor ,
750
+ desc : & CommandEncoderDescriptor ,
731
751
) -> CommandEncoderId {
732
- let mapped_desc = web_sys:: GpuCommandEncoderDescriptor :: new ( ) ;
752
+ let mut mapped_desc = web_sys:: GpuCommandEncoderDescriptor :: new ( ) ;
753
+ if let Some ( label) = desc. label {
754
+ mapped_desc. label ( label) ;
755
+ }
733
756
device. create_command_encoder_with_descriptor ( & mapped_desc)
734
757
}
735
758
@@ -790,7 +813,10 @@ pub(crate) fn command_encoder_copy_texture_to_texture(
790
813
}
791
814
792
815
pub ( crate ) fn begin_compute_pass ( command_encoder : & CommandEncoderId ) -> ComputePassId {
793
- let mapped_desc = web_sys:: GpuComputePassDescriptor :: new ( ) ;
816
+ let mut mapped_desc = web_sys:: GpuComputePassDescriptor :: new ( ) ;
817
+ if let Some ( ref label) = command_encoder. label ( ) {
818
+ mapped_desc. label ( label) ;
819
+ }
794
820
command_encoder. begin_compute_pass_with_descriptor ( & mapped_desc)
795
821
}
796
822
@@ -833,7 +859,10 @@ pub(crate) fn compute_pass_end_pass(compute_pass: &ComputePassId) {
833
859
}
834
860
835
861
pub ( crate ) fn command_encoder_finish ( command_encoder : & CommandEncoderId ) -> CommandBufferId {
836
- let mapped_desc = web_sys:: GpuCommandBufferDescriptor :: new ( ) ;
862
+ let mut mapped_desc = web_sys:: GpuCommandBufferDescriptor :: new ( ) ;
863
+ if let Some ( ref label) = command_encoder. label ( ) {
864
+ mapped_desc. label ( label) ;
865
+ }
837
866
command_encoder. finish_with_descriptor ( & mapped_desc)
838
867
}
839
868
@@ -996,7 +1025,9 @@ pub(crate) fn command_encoder_begin_render_pass<'a>(
996
1025
} )
997
1026
. collect :: < js_sys:: Array > ( ) ;
998
1027
999
- let mut mapped = web_sys:: GpuRenderPassDescriptor :: new ( & mapped_color_attachments) ;
1028
+ let mut mapped_desc = web_sys:: GpuRenderPassDescriptor :: new ( & mapped_color_attachments) ;
1029
+
1030
+ // TODO: label
1000
1031
1001
1032
if let Some ( dsa) = & desc. depth_stencil_attachment {
1002
1033
let mapped_depth_stencil_attachment =
@@ -1014,10 +1045,10 @@ pub(crate) fn command_encoder_begin_render_pass<'a>(
1014
1045
map_store_op ( dsa. stencil_store_op ) ,
1015
1046
) ;
1016
1047
1017
- mapped . depth_stencil_attachment ( & mapped_depth_stencil_attachment) ;
1048
+ mapped_desc . depth_stencil_attachment ( & mapped_depth_stencil_attachment) ;
1018
1049
}
1019
1050
1020
- command_encoder. begin_render_pass ( & mapped )
1051
+ command_encoder. begin_render_pass ( & mapped_desc )
1021
1052
}
1022
1053
1023
1054
pub ( crate ) fn render_pass_set_pipeline (
@@ -1154,6 +1185,7 @@ pub(crate) fn texture_create_view(
1154
1185
mapped_desc. dimension ( map_texture_view_dimension ( d. dimension ) ) ;
1155
1186
mapped_desc. format ( map_texture_format ( d. format ) ) ;
1156
1187
mapped_desc. mip_level_count ( d. level_count ) ;
1188
+ // TODO: label
1157
1189
texture. create_view_with_descriptor ( & mapped_desc)
1158
1190
}
1159
1191
None => texture. create_view ( ) ,
0 commit comments