diff --git a/src/back/msl/mod.rs b/src/back/msl/mod.rs index 3174d4b756..78bcc2123b 100644 --- a/src/back/msl/mod.rs +++ b/src/back/msl/mod.rs @@ -210,10 +210,13 @@ impl Default for Options { #[cfg_attr(feature = "serialize", derive(serde::Serialize))] #[cfg_attr(feature = "deserialize", derive(serde::Deserialize))] pub struct PipelineOptions { - /// Allow `BuiltIn::PointSize` in the vertex shader. + /// Allow `BuiltIn::PointSize` and inject it if doesn't exist. /// - /// Metal doesn't like this for non-point primitive topologies. - pub allow_point_size: bool, + /// Metal doesn't like this for non-point primitive topologies and requires it for + /// point primitive topologies. + /// + /// Enable this for vertex shaders with point primitive topologies. + pub allow_and_force_point_size: bool, } impl Options { diff --git a/src/back/msl/writer.rs b/src/back/msl/writer.rs index 22a5f56b72..a9551dc715 100644 --- a/src/back/msl/writer.rs +++ b/src/back/msl/writer.rs @@ -2321,7 +2321,7 @@ impl Writer { member.binding { has_point_size = true; - if !context.pipeline_options.allow_point_size { + if !context.pipeline_options.allow_and_force_point_size { continue; } } @@ -2358,7 +2358,7 @@ impl Writer { if let FunctionOrigin::EntryPoint(ep_index) = context.origin { let stage = context.module.entry_points[ep_index as usize].stage; - if context.pipeline_options.allow_point_size + if context.pipeline_options.allow_and_force_point_size && stage == crate::ShaderStage::Vertex && !has_point_size { @@ -3769,7 +3769,7 @@ impl Writer { if let crate::Binding::BuiltIn(crate::BuiltIn::PointSize) = *binding { has_point_size = true; - if !pipeline_options.allow_point_size { + if !pipeline_options.allow_and_force_point_size { continue; } } @@ -3790,7 +3790,7 @@ impl Writer { writeln!(self.out, ";")?; } - if pipeline_options.allow_point_size + if pipeline_options.allow_and_force_point_size && ep.stage == crate::ShaderStage::Vertex && !has_point_size { diff --git a/tests/in/interface.param.ron b/tests/in/interface.param.ron index 1c910d2b86..4d85661767 100644 --- a/tests/in/interface.param.ron +++ b/tests/in/interface.param.ron @@ -26,6 +26,6 @@ zero_initialize_workgroup_memory: true, ), msl_pipeline: ( - allow_point_size: true, + allow_and_force_point_size: true, ), )