@@ -894,24 +894,23 @@ impl RenderContext {
894894 . to_string ( ) ,
895895 ) ) ;
896896 }
897+ }
897898
898- #[ cfg( any(
899- debug_assertions,
900- feature = "render-instancing-validation" ,
901- ) ) ]
902- {
903- let pipeline_index = current_pipeline. expect (
904- "current_pipeline must be set when validation is active" ,
905- ) ;
906- let pipeline_ref = & self . render_pipelines [ pipeline_index] ;
907-
908- validation:: validate_instance_bindings (
909- pipeline_ref. pipeline ( ) . label ( ) . unwrap_or ( "unnamed" ) ,
910- pipeline_ref. per_instance_slots ( ) ,
911- & bound_vertex_slots,
912- )
913- . map_err ( RenderError :: Configuration ) ?;
914- }
899+ #[ cfg( any(
900+ debug_assertions,
901+ feature = "render-instancing-validation" ,
902+ ) ) ]
903+ {
904+ let pipeline_index = current_pipeline
905+ . expect ( "current_pipeline must be set when validation is active" ) ;
906+ let pipeline_ref = & self . render_pipelines [ pipeline_index] ;
907+
908+ validation:: validate_instance_bindings (
909+ pipeline_ref. pipeline ( ) . label ( ) . unwrap_or ( "unnamed" ) ,
910+ pipeline_ref. per_instance_slots ( ) ,
911+ & bound_vertex_slots,
912+ )
913+ . map_err ( RenderError :: Configuration ) ?;
915914
916915 if let Err ( msg) =
917916 validation:: validate_instance_range ( "Draw" , & instances)
@@ -981,23 +980,29 @@ impl RenderContext {
981980 feature = "render-instancing-validation" ,
982981 ) ) ]
983982 {
984- #[ cfg( any(
985- debug_assertions,
986- feature = "render-instancing-validation" ,
987- ) ) ]
988- {
989- let pipeline_index = current_pipeline. expect (
990- "current_pipeline must be set when validation is active" ,
991- ) ;
992- let pipeline_ref = & self . render_pipelines [ pipeline_index] ;
993-
994- validation:: validate_instance_bindings (
995- pipeline_ref. pipeline ( ) . label ( ) . unwrap_or ( "unnamed" ) ,
996- pipeline_ref. per_instance_slots ( ) ,
997- & bound_vertex_slots,
998- )
999- . map_err ( RenderError :: Configuration ) ?;
983+ if current_pipeline. is_none ( ) {
984+ return Err ( RenderError :: Configuration (
985+ "DrawIndexed command encountered before any pipeline was set in this render pass"
986+ . to_string ( ) ,
987+ ) ) ;
1000988 }
989+ }
990+
991+ #[ cfg( any(
992+ debug_assertions,
993+ feature = "render-instancing-validation" ,
994+ ) ) ]
995+ {
996+ let pipeline_index = current_pipeline
997+ . expect ( "current_pipeline must be set when validation is active" ) ;
998+ let pipeline_ref = & self . render_pipelines [ pipeline_index] ;
999+
1000+ validation:: validate_instance_bindings (
1001+ pipeline_ref. pipeline ( ) . label ( ) . unwrap_or ( "unnamed" ) ,
1002+ pipeline_ref. per_instance_slots ( ) ,
1003+ & bound_vertex_slots,
1004+ )
1005+ . map_err ( RenderError :: Configuration ) ?;
10011006
10021007 if let Err ( msg) =
10031008 validation:: validate_instance_range ( "DrawIndexed" , & instances)
0 commit comments