Skip to content

Add limits for acceleration structures #7845

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

Merged
merged 5 commits into from
Jun 25, 2025

Conversation

Vecvec
Copy link
Collaborator

@Vecvec Vecvec commented Jun 24, 2025

Connections
Fixes #6803

Description
Adds acceleration structure limits which default to 0, as well as a function to add the minimum supported limits if acceleration structures are supported.

Testing
Adds tests, fixes tests broken by this.

Squash or Rebase?
Squash

Checklist

  • Run cargo fmt.
  • Run cargo clippy --tests.
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@Vecvec Vecvec requested a review from a team as a code owner June 24, 2025 05:01
@Vecvec Vecvec force-pushed the blas-tlas-limits branch from 6005b93 to 3d4efd6 Compare June 24, 2025 05:03
@@ -862,6 +894,32 @@ impl Limits {
}
}

/// The minimum guaranteed limits for acceleration structures if you enable [`Features::EXPERIMENTAL_RAY_TRACING_ACCELERATION_STRUCTURE`]
#[must_use]
pub const fn using_minimum_supported_acceleration_structure_values(self) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer this to be internal (for example just accessible to the tests). I think that we should encourage users to set these limits based on their needs rather than some large default.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree that users should be encouraged not to use the full limits, but I'm not sure that it would encourage users, I have used 500,000 as my limit for max_binding_array_elements_per_shader_stage because the docs say that it is guaranteed to be supported. I wouldn't be surprised many apps would just request it in development while requirements are changing, and then never change it.

Copy link
Contributor

@nical nical left a comment

Choose a reason for hiding this comment

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

Discussed this with Connor, we probably want a different way to provide something like using_minimum_supported_acceleration_structure_values with implications for other extensions to the API. This is probably going to need a bit of experimentation so let's not block this PR for that.

I'm fine with landing this PR as is although it is very likely that using_minimum_supported_acceleration_structure_values will be replaced with something else (hopefully soon but as always it depends on whether someone finds the time). If you'd prefer to avoid the public API churn you should restrc the visibility of the function.

@cwfitzgerald
Copy link
Member

I'm going to land this and then do the limits transform today.

@Vecvec
Copy link
Collaborator Author

Vecvec commented Jun 25, 2025

I'm fine with landing this PR as is although it is very likely that using_minimum_supported_acceleration_structure_values will be replaced with something else

Yeah, I'm happy if it gets replaced with something better.

If you'd prefer to avoid the public API churn you should restrc the visibility of the function.

I think that this function would be used once, so I'm not sure that it would be less inconvenient than new limits being added (which happens quite frequently).

Edit: if it gets replaced within the next release, it would just be normal trunk churn anyways.

@cwfitzgerald cwfitzgerald merged commit dc0d457 into gfx-rs:trunk Jun 25, 2025
40 checks passed
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.

Add acceleration structure limits
3 participants