Skip to content

Conversation

@squidbus
Copy link
Contributor

VK_KHR_maintenance5 requires that PointSize default to 1.0 when not written in a shader. In order to support this requirement, this PR adds an option for MSL to emit a default PointSize value when it was not written, as according to Metal documentation the point size must be specified within the vertex shader.

I considered using the existing enable_point_size_builtin flag for this but it currently defaults to true. Changing this could negatively impact users relying on the default conversion behavior respecting PointSize, and leaving it means every shader emits a default value unless explicitly disabled. Thus I added a new flag to control emitting the default, and a new float option to set what that default is.

Have also added tests with this option where the point size is provided by the shader, meaning it should not be defaulted, and where the point size is not provided by the shader, meaning it should be.

@squidbus squidbus changed the title Add option to provide a default point size. MSL: Add option to provide a default point size. Apr 27, 2025
@squidbus squidbus force-pushed the point-size-default branch 2 times, most recently from adc494c to ada5877 Compare April 27, 2025 11:53
return;

auto &type = this->get<SPIRType>(var.basetype);
if (need_point_size && has_decoration(type.self, DecorationBlock))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this handle case where point size is a standalone variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slipped my mind there could be multiple ways to define, I added the built-in check below as well which should handle this.

main.cpp Outdated
cbs.add("--msl-auto-disable-rasterization", [&args](CLIParser &) { args.msl_auto_disable_rasterization = true; });
cbs.add("--msl-default-point-size",
[&args](CLIParser &parser)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like applying the style nit in web viewer didn't work <_< I'll do it locally before merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I got what you wanted assuming it's like some of the other lines, fixed in commit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close enough (don't use static_cast for plain arithmetic types).

@squidbus squidbus force-pushed the point-size-default branch from bcf3764 to 8b91a44 Compare May 2, 2025 09:57
@HansKristian-Work HansKristian-Work merged commit e07cec7 into KhronosGroup:main May 2, 2025
10 checks passed
@squidbus squidbus deleted the point-size-default branch May 3, 2025 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants