Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename allow_point_size to allow_and_force_point_size #2280

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -2237,7 +2237,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 @@ -2277,7 +2277,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 @@ -3560,7 +3560,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 @@ -3581,7 +3581,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,
),
)