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

Add sample_bias and gather functions #704

Merged
merged 6 commits into from
Aug 6, 2021
Merged

Add sample_bias and gather functions #704

merged 6 commits into from
Aug 6, 2021

Conversation

khyperia
Copy link
Contributor

@khyperia khyperia commented Aug 4, 2021

Fixes #703

Fixes #706

@khyperia khyperia requested a review from eddyb as a code owner August 4, 2021 11:47
@khyperia khyperia changed the title Add sample_bias function Add sample_bias and gather functions Aug 5, 2021
CI was failing on "Capability SampledRect is not allowed by Vulkan 1.1
specification (or requires extension)", except locally it was fine, and
I have more up to date spirv-tools than CI, so try bumping the CI
version to see if it's just an out-of-date spirv-val
@@ -136,6 +136,42 @@ impl<
ACCESS_QUALIFIER,
>
{
// Note: #[inline] is needed because in vulkan, the component must be a constant expression.
Copy link
Contributor

Choose a reason for hiding this comment

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

You could plausibly add a const COMPONENT: u32 generic parameter, #[rustc_legacy_const_generics(3)], and remove component: u32 from the normal parameter list. AFAICT, this would result in the same call syntax working, but it gets automatically converted to the const generic.

(this is what core::arch uses for constant arguments - not sure how appropriate it is here, but as it stands, the argument isn't even required to be constant)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's a bit of a bizarre case - when compiling for Vulkan, it's required to be constant, but when not, it's free to be a variable. I feel like there's just no good solution here.

Comment on lines +1541 to +1558
impl<
SampledType: SampleType<FORMAT>,
const DEPTH: ImageDepth,
const FORMAT: ImageFormat,
const ARRAYED: Arrayed,
const SAMPLED: Sampled,
const ACCESS_QUALIFIER: Option<AccessQualifier>,
> HasQuerySizeLod
for Image<
SampledType,
{ Dimensionality::Cube },
DEPTH,
ARRAYED,
{ Multisampled::False },
SAMPLED,
FORMAT,
ACCESS_QUALIFIER,
>
Copy link
Contributor

Choose a reason for hiding this comment

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

I really wish we could use _ as a shorthand for generic impls, i.e.:

impl HasQuerySizeLod for Image<_, { Dimensionality::Cube }, _, _, { Multisampled::False }, _, _, _> {}

@khyperia khyperia merged commit a93d6e0 into main Aug 6, 2021
@khyperia khyperia deleted the sample-bias branch August 6, 2021 13:26
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.

Image texture_gather (yet another sampling mode) Image seems to be missing sample_bias()
2 participants