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

[hal/vulkan] Don't advertise features without prerequisites present. #5460

Conversation

jimblandy
Copy link
Member

Don't advertise features like STORAGE_RESOURCE_BINDING_ARRAY unless at least one of the features it extends, like BUFFER_BINDING_ARRAY or TEXTURE_BINDING_ARRAY, is actually present.

See the comments on PhysicalDevicefeatures::prequisites_satisfied for more details.

@jimblandy jimblandy requested a review from a team as a code owner March 30, 2024 23:54
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

I feel like it would be easier to just inline the requirements.

features.set(F::STORAGE_RESOURCE_BINDING_ARRAY,
    (features.contains(F::BUFFER_BINDING_ARRAY) && self.core.shader_storage_buffer_array_dynamic_indexing != 0) ||
    (features.contains(F::TEXTURE_BINDING_ARRAY) && self.core.shader_storage_image_array_dynamic_indexing != 0)
);
features.set(F::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING,
    (features.contains(F::TEXTURE_BINDING_ARRAY) && descriptor_indexing.shader_sampled_image_array_non_uniform_indexing != 0) &&
    (features.contains(F::BUFFER_BINDING_ARRAY | F::STORAGE_RESOURCE_BINDING_ARRAY) && descriptor_indexing.shader_storage_buffer_array_non_uniform_indexing != 0)
);
features.set(F::UNIFORM_BUFFER_AND_STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING,
    (features.contains(F::BUFFER_BINDING_ARRAY) && descriptor_indexing.shader_uniform_buffer_array_non_uniform_indexing != 0) &&
    (features.contains(F::TEXTURE_BINDING_ARRAY | F::STORAGE_RESOURCE_BINDING_ARRAY) && descriptor_indexing.shader_storage_image_array_non_uniform_indexing != 0)
);

wgpu-hal/src/vulkan/adapter.rs Outdated Show resolved Hide resolved
@jimblandy
Copy link
Member Author

I feel like it would be easier to just inline the requirements.

And remove the helper function altogether? ... I strongly agree.

@teoxoy
Copy link
Member

teoxoy commented Apr 18, 2024

Yeah, I think it's more straightforward. Especially here because STORAGE_RESOURCE_BINDING_ARRAY needs different logic compared to the other 2 (OR vs AND).

@alphastrata
Copy link

any movement on this one?

@cwfitzgerald cwfitzgerald assigned jimblandy and teoxoy and unassigned jimblandy Dec 11, 2024
@jimblandy jimblandy force-pushed the hal-vulkan-actually-require-some-prerequisite branch 2 times, most recently from 71c2c33 to f7cb8fd Compare December 22, 2024 21:29
@jimblandy jimblandy requested a review from teoxoy December 22, 2024 21:31
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

Nice!

@teoxoy
Copy link
Member

teoxoy commented Jan 6, 2025

@jimblandy looks like CI is failing.

@cwfitzgerald cwfitzgerald assigned jimblandy and unassigned teoxoy Jan 8, 2025
Don't advertise features like `STORAGE_RESOURCE_BINDING_ARRAY` unless
at least one of the features it extends, like `BUFFER_BINDING_ARRAY`
or `TEXTURE_BINDING_ARRAY`, is actually present.

Replace the calls to `all_features_supported` with the equivalent
inline code, and delete the function.
@jimblandy jimblandy force-pushed the hal-vulkan-actually-require-some-prerequisite branch from f7cb8fd to 261ab09 Compare January 8, 2025 16:23
@jimblandy jimblandy enabled auto-merge (rebase) January 8, 2025 16:24
@jimblandy jimblandy merged commit 0d69482 into gfx-rs:trunk Jan 8, 2025
26 checks passed
@jimblandy jimblandy deleted the hal-vulkan-actually-require-some-prerequisite branch January 8, 2025 16:54
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