@@ -652,7 +652,10 @@ impl Device {
652
652
}
653
653
654
654
pub fn create_shader_library_from_source < S > (
655
- & self , source : S , version : LanguageVersion ,
655
+ & self ,
656
+ source : S ,
657
+ version : LanguageVersion ,
658
+ rasterization_enabled : bool ,
656
659
) -> Result < n:: ShaderModule , ShaderError > where S : AsRef < str > {
657
660
let options = metal:: CompileOptions :: new ( ) ;
658
661
let msl_version = match version {
@@ -673,6 +676,7 @@ impl Device {
673
676
. map ( |library| n:: ShaderModule :: Compiled ( n:: ModuleInfo {
674
677
library,
675
678
entry_point_map : n:: EntryPointMap :: default ( ) ,
679
+ rasterization_enabled,
676
680
} ) )
677
681
. map_err ( |e| ShaderError :: CompilationFailed ( e. into ( ) ) )
678
682
}
@@ -737,6 +741,9 @@ impl Device {
737
741
} ) ;
738
742
}
739
743
744
+ let rasterization_enabled = ast. is_rasterization_enabled ( )
745
+ . map_err ( |_| ShaderError :: CompilationFailed ( "Unknown compile error" . into ( ) ) ) ?;
746
+
740
747
// done
741
748
debug ! ( "SPIRV-Cross generated shader:\n {}" , shader_code) ;
742
749
@@ -751,6 +758,7 @@ impl Device {
751
758
Ok ( n:: ModuleInfo {
752
759
library,
753
760
entry_point_map,
761
+ rasterization_enabled,
754
762
} )
755
763
}
756
764
@@ -760,7 +768,7 @@ impl Device {
760
768
layout : & n:: PipelineLayout ,
761
769
primitive_class : MTLPrimitiveTopologyClass ,
762
770
pipeline_cache : Option < & n:: PipelineCache > ,
763
- ) -> Result < ( metal:: Library , metal:: Function , metal:: MTLSize ) , pso:: CreationError > {
771
+ ) -> Result < ( metal:: Library , metal:: Function , metal:: MTLSize , bool ) , pso:: CreationError > {
764
772
let device = & self . shared . device ;
765
773
let msl_version = self . private_caps . msl_version ;
766
774
let module_map;
@@ -812,7 +820,7 @@ impl Device {
812
820
pso:: CreationError :: Other
813
821
} ) ?;
814
822
815
- Ok ( ( lib, mtl_function, wg_size) )
823
+ Ok ( ( lib, mtl_function, wg_size, info . rasterization_enabled ) )
816
824
}
817
825
818
826
fn describe_argument (
@@ -1209,7 +1217,7 @@ impl hal::Device<Backend> for Device {
1209
1217
pipeline. set_input_primitive_topology ( primitive_class) ;
1210
1218
1211
1219
// Vertex shader
1212
- let ( vs_lib, vs_function, _) = self . load_shader (
1220
+ let ( vs_lib, vs_function, _, enable_rasterization ) = self . load_shader (
1213
1221
& pipeline_desc. shaders . vertex ,
1214
1222
pipeline_layout,
1215
1223
primitive_class,
@@ -1221,7 +1229,7 @@ impl hal::Device<Backend> for Device {
1221
1229
let fs_function;
1222
1230
let fs_lib = match pipeline_desc. shaders . fragment {
1223
1231
Some ( ref ep) => {
1224
- let ( lib, fun, _) = self . load_shader ( ep, pipeline_layout, primitive_class, cache) ?;
1232
+ let ( lib, fun, _, _ ) = self . load_shader ( ep, pipeline_layout, primitive_class, cache) ?;
1225
1233
fs_function = fun;
1226
1234
pipeline. set_fragment_function ( Some ( & fs_function) ) ;
1227
1235
Some ( lib)
@@ -1247,6 +1255,8 @@ impl hal::Device<Backend> for Device {
1247
1255
return Err ( pso:: CreationError :: Shader ( ShaderError :: UnsupportedStage ( pso:: Stage :: Geometry ) ) ) ;
1248
1256
}
1249
1257
1258
+ pipeline. set_rasterization_enabled ( enable_rasterization) ;
1259
+
1250
1260
// Assign target formats
1251
1261
let blend_targets = pipeline_desc. blender . targets
1252
1262
. iter ( )
@@ -1428,7 +1438,7 @@ impl hal::Device<Backend> for Device {
1428
1438
debug ! ( "create_compute_pipeline {:?}" , pipeline_desc) ;
1429
1439
let pipeline = metal:: ComputePipelineDescriptor :: new ( ) ;
1430
1440
1431
- let ( cs_lib, cs_function, work_group_size) = self . load_shader (
1441
+ let ( cs_lib, cs_function, work_group_size, _ ) = self . load_shader (
1432
1442
& pipeline_desc. shader ,
1433
1443
& pipeline_desc. layout ,
1434
1444
MTLPrimitiveTopologyClass :: Unspecified ,
0 commit comments