@@ -6,7 +6,10 @@ use crate::{
66 PassErrorScope , QueryResetMap , QueryUseError , RenderCommand , RenderCommandError ,
77 StateChange ,
88 } ,
9- device:: { AttachmentData , RenderPassCompatibilityError , RenderPassContext } ,
9+ device:: {
10+ AttachmentData , MissingDownlevelFlags , MissingFeatures , RenderPassCompatibilityError ,
11+ RenderPassContext ,
12+ } ,
1013 hub:: { Global , GlobalIdentityHandlerFactory , HalApi , Storage , Token } ,
1114 id,
1215 memory_init_tracker:: { MemoryInitKind , MemoryInitTrackerAction } ,
@@ -419,8 +422,10 @@ pub enum RenderPassErrorInner {
419422 SampleCountMismatch { actual : u32 , expected : u32 } ,
420423 #[ error( "setting `values_offset` to be `None` is only for internal use in render bundles" ) ]
421424 InvalidValuesOffset ,
422- #[ error( "required device features not enabled: {0:?}" ) ]
423- MissingDeviceFeatures ( wgt:: Features ) ,
425+ #[ error( transparent) ]
426+ MissingFeatures ( #[ from] MissingFeatures ) ,
427+ #[ error( transparent) ]
428+ MissingDownlevelFlags ( #[ from] MissingDownlevelFlags ) ,
424429 #[ error( "indirect draw uses bytes {offset}..{end_offset} {} which overruns indirect buffer of size {buffer_size}" , count. map_or_else( String :: new, |v| format!( "(using count {})" , v) ) ) ]
425430 IndirectBufferOverrun {
426431 count : Option < NonZeroU32 > ,
@@ -483,17 +488,6 @@ where
483488 }
484489}
485490
486- fn check_device_features (
487- actual : wgt:: Features ,
488- expected : wgt:: Features ,
489- ) -> Result < ( ) , RenderPassErrorInner > {
490- if !actual. contains ( expected) {
491- Err ( RenderPassErrorInner :: MissingDeviceFeatures ( expected) )
492- } else {
493- Ok ( ( ) )
494- }
495- }
496-
497491struct RenderAttachment < ' a > {
498492 texture_id : & ' a Stored < id:: TextureId > ,
499493 selector : & ' a TextureSelector ,
@@ -745,6 +739,8 @@ impl<'a, A: HalApi> RenderPassInfo<'a, A> {
745739
746740 let hal_desc = hal:: RenderPassDescriptor {
747741 label,
742+ extent,
743+ sample_count,
748744 color_attachments : & colors,
749745 depth_stencil_attachment : depth_stencil,
750746 } ;
@@ -1175,6 +1171,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
11751171 . inputs
11761172 . extend ( iter:: repeat ( VertexBufferState :: EMPTY ) . take ( empty_slots) ) ;
11771173 let vertex_state = & mut state. vertex . inputs [ slot as usize ] ;
1174+ //TODO: where are we checking that the offset is in bound?
11781175 vertex_state. total_size = match size {
11791176 Some ( s) => s. get ( ) ,
11801177 None => buffer. size - offset,
@@ -1400,12 +1397,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
14001397 } ;
14011398
14021399 if count. is_some ( ) {
1403- check_device_features (
1404- device. features ,
1405- wgt:: Features :: MULTI_DRAW_INDIRECT ,
1406- )
1407- . map_pass_err ( scope) ?;
1400+ device
1401+ . require_features ( wgt:: Features :: MULTI_DRAW_INDIRECT )
1402+ . map_pass_err ( scope) ?;
14081403 }
1404+ device
1405+ . require_downlevel_flags ( wgt:: DownlevelFlags :: INDIRECT_EXECUTION )
1406+ . map_pass_err ( scope) ?;
14091407
14101408 let indirect_buffer = info
14111409 . trackers
@@ -1474,11 +1472,12 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
14741472 true => mem:: size_of :: < wgt:: DrawIndexedIndirectArgs > ( ) ,
14751473 } as u64 ;
14761474
1477- check_device_features (
1478- device. features ,
1479- wgt:: Features :: MULTI_DRAW_INDIRECT_COUNT ,
1480- )
1481- . map_pass_err ( scope) ?;
1475+ device
1476+ . require_features ( wgt:: Features :: MULTI_DRAW_INDIRECT_COUNT )
1477+ . map_pass_err ( scope) ?;
1478+ device
1479+ . require_downlevel_flags ( wgt:: DownlevelFlags :: INDIRECT_EXECUTION )
1480+ . map_pass_err ( scope) ?;
14821481
14831482 let indirect_buffer = info
14841483 . trackers
0 commit comments