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

MSL: Fix regression error in argument buffer runtime arrays. #2222

Conversation

billhollings
Copy link
Contributor

@billhollings billhollings commented Nov 3, 2023

Argument buffers can contain multiple runtime arrays if they have fixed lengths as specified by the binding API. Regression error had assumed each runtime array is in separate argument buffer with undefined array length.

  • Add CompilerMSL::is_var_runtime_size_array() to include test for setting of array length via CompilerMSL::add_msl_resource_binding().

  • Fixed unrelated test case MSL compile syntax failure when acceleration structure is the first entry point function argument (unrelated).

This has been tested in MoltenVK, but I couldn't think of a way of defining a SPRIV-Cross unit test for this, as it would involve calling add_msl_resource_binding() with some complex input.

Argument buffers can contain multiple runtime arrays if they have fixed
lengths as specified by the binding API. Regression error had assumed each
runtime array is in separate argument buffer with undefined array length.

- Add CompilerMSL::is_var_runtime_size_array() to include test for
  setting of array length via CompilerMSL::add_msl_resource_binding().

- Fixed unrelated test case MSL compile syntax failure when acceleration
  structure is the first entry point function argument (unrelated).
Copy link
Contributor

@cdavis5e cdavis5e left a comment

Choose a reason for hiding this comment

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

LGTM

fragment void main0(, raytracing::acceleration_structure<raytracing::instancing> topLevelAS [[buffer(0)]])
fragment void main0(raytracing::acceleration_structure<raytracing::instancing> topLevelAS [[buffer(0)]])
Copy link
Contributor

Choose a reason for hiding this comment

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

...How did this even pass before??

Copy link
Contributor

Choose a reason for hiding this comment

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

Very strange.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It don't think it ever did pass Metal compile. The shaders were new when added in da9c861, so no regression check, and I assume it was committed without an actual unit test run on macOS. Unit tests on other OS's bypass the Metal compile step, of course.

SPIRV-Cross Github CI doesn't build and test on macOS. Perhaps we should add a CI test sequence for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

SPIRV-Cross Github CI definitely runs on macOS. Did that break?

Copy link
Contributor

Choose a reason for hiding this comment

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

@HansKristian-Work HansKristian-Work merged commit 4818f7e into KhronosGroup:main Nov 3, 2023
6 checks passed
@billhollings billhollings deleted the fix-runtime-array-regression branch November 3, 2023 13:58
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.

3 participants