Skip to content

Commit

Permalink
rename allow_point_size to allow_and_force_point_size (#2280)
Browse files Browse the repository at this point in the history
  • Loading branch information
teoxoy authored Jun 22, 2023
1 parent f915d39 commit ffe2308
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/back/msl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions src/back/msl/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,7 @@ impl<W: Write> Writer<W> {
member.binding
{
has_point_size = true;
if !context.pipeline_options.allow_point_size {
if !context.pipeline_options.allow_and_force_point_size {
continue;
}
}
Expand Down Expand Up @@ -2358,7 +2358,7 @@ impl<W: Write> Writer<W> {

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
{
Expand Down Expand Up @@ -3769,7 +3769,7 @@ impl<W: Write> Writer<W> {

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;
}
}
Expand All @@ -3790,7 +3790,7 @@ impl<W: Write> Writer<W> {
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/in/interface.param.ron
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
zero_initialize_workgroup_memory: true,
),
msl_pipeline: (
allow_point_size: true,
allow_and_force_point_size: true,
),
)

0 comments on commit ffe2308

Please sign in to comment.