Convert Image<> parameters from enums to integers to make spirv-std build on stable (#761)

* Convert Image<> parameters from enums to integers to make spirv-std build on stable

* Remove access_qualifier from Image type

It's kernel-mode-only, and we won't ever support kernel mode.
This commit is contained in:
Ashley Hauck 2021-10-07 13:28:33 +02:00 committed by GitHub
parent 2540106965
commit b692ab5afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 410 additions and 562 deletions

View File

@ -25,7 +25,6 @@ use std::collections::hash_map::Entry;
use std::fmt;
use num_traits::cast::FromPrimitive;
use rspirv::spirv;
/// If a struct contains a pointer to itself, even indirectly, then doing a naiive recursive walk
/// of the fields will result in an infinite loop. Because pointers are the only thing that are
@ -715,17 +714,17 @@ fn trans_intrinsic_type<'tcx>(
return Err(ErrorReported);
}
fn type_from_variant_discriminant<'tcx, P: FromPrimitive>(
cx: &CodegenCx<'tcx>,
const_: &'tcx Const<'tcx>,
) -> P {
let adt_def = const_.ty.ty_adt_def().unwrap();
assert!(adt_def.is_enum());
let destructured = cx.tcx.destructure_const(ParamEnv::reveal_all().and(const_));
let idx = destructured.variant.unwrap();
let value = const_.ty.discriminant_for_variant(cx.tcx, idx).unwrap().val as u64;
<_>::from_u64(value).unwrap()
}
// fn type_from_variant_discriminant<'tcx, P: FromPrimitive>(
// cx: &CodegenCx<'tcx>,
// const_: &'tcx Const<'tcx>,
// ) -> P {
// let adt_def = const_.ty.ty_adt_def().unwrap();
// assert!(adt_def.is_enum());
// let destructured = cx.tcx.destructure_const(ParamEnv::reveal_all().and(const_));
// let idx = destructured.variant.unwrap();
// let value = const_.ty.discriminant_for_variant(cx.tcx, idx).unwrap().val as u64;
// <_>::from_u64(value).unwrap()
// }
let sampled_type = match substs.type_at(0).kind() {
TyKind::Int(int) => match int {
@ -760,25 +759,37 @@ fn trans_intrinsic_type<'tcx>(
}
};
let dim: spirv::Dim = type_from_variant_discriminant(cx, substs.const_at(1));
let depth: u32 = type_from_variant_discriminant(cx, substs.const_at(2));
let arrayed: u32 = type_from_variant_discriminant(cx, substs.const_at(3));
let multisampled: u32 = type_from_variant_discriminant(cx, substs.const_at(4));
let sampled: u32 = type_from_variant_discriminant(cx, substs.const_at(5));
let image_format: spirv::ImageFormat =
type_from_variant_discriminant(cx, substs.const_at(6));
// let dim: spirv::Dim = type_from_variant_discriminant(cx, substs.const_at(1));
// let depth: u32 = type_from_variant_discriminant(cx, substs.const_at(2));
// let arrayed: u32 = type_from_variant_discriminant(cx, substs.const_at(3));
// let multisampled: u32 = type_from_variant_discriminant(cx, substs.const_at(4));
// let sampled: u32 = type_from_variant_discriminant(cx, substs.const_at(5));
// let image_format: spirv::ImageFormat =
// type_from_variant_discriminant(cx, substs.const_at(6));
let access_qualifier = {
let option = cx
.tcx
.destructure_const(ParamEnv::reveal_all().and(substs.const_at(7)));
match option.variant.map(|i| i.as_u32()).unwrap_or(0) {
0 => None,
1 => Some(type_from_variant_discriminant(cx, option.fields[0])),
_ => unreachable!(),
fn const_int_value<'tcx, P: FromPrimitive>(
cx: &CodegenCx<'tcx>,
const_: &'tcx Const<'tcx>,
) -> Result<P, ErrorReported> {
assert!(const_.ty.is_integral());
let value = const_.eval_bits(cx.tcx, ParamEnv::reveal_all(), const_.ty);
match P::from_u128(value) {
Some(v) => Ok(v),
None => {
cx.tcx
.sess
.err(&format!("Invalid value for Image const generic: {}", value));
Err(ErrorReported)
}
}
};
}
let dim = const_int_value(cx, substs.const_at(1))?;
let depth = const_int_value(cx, substs.const_at(2))?;
let arrayed = const_int_value(cx, substs.const_at(3))?;
let multisampled = const_int_value(cx, substs.const_at(4))?;
let sampled = const_int_value(cx, substs.const_at(5))?;
let image_format = const_int_value(cx, substs.const_at(6))?;
let ty = SpirvType::Image {
sampled_type,
@ -788,7 +799,6 @@ fn trans_intrinsic_type<'tcx>(
multisampled,
sampled,
image_format,
access_qualifier,
};
Ok(ty.def(span, cx))
}

View File

@ -343,7 +343,6 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
multisampled: inst.operands[4].unwrap_literal_int32(),
sampled: inst.operands[5].unwrap_literal_int32(),
image_format: inst.operands[6].unwrap_image_format(),
access_qualifier: None,
}
.def(self.span(), self),
Op::TypeSampledImage => SpirvType::SampledImage {

View File

@ -4,9 +4,7 @@ use crate::codegen_cx::CodegenCx;
use bimap::BiHashMap;
use indexmap::IndexSet;
use rspirv::dr::Operand;
use rspirv::spirv::{
AccessQualifier, Capability, Decoration, Dim, ImageFormat, StorageClass, Word,
};
use rspirv::spirv::{Capability, Decoration, Dim, ImageFormat, StorageClass, Word};
use rustc_data_structures::fx::FxHashMap;
use rustc_span::def_id::DefId;
use rustc_span::Span;
@ -75,7 +73,6 @@ pub enum SpirvType {
multisampled: u32,
sampled: u32,
image_format: ImageFormat,
access_qualifier: Option<AccessQualifier>,
},
Sampler,
SampledImage {
@ -243,7 +240,6 @@ impl SpirvType {
multisampled,
sampled,
image_format,
access_qualifier,
} => cx.emit_global().type_image_id(
id,
sampled_type,
@ -253,7 +249,7 @@ impl SpirvType {
multisampled,
sampled,
image_format,
access_qualifier,
None,
),
Self::Sampler => cx.emit_global().type_sampler_id(id),
Self::AccelerationStructureKhr => {
@ -513,7 +509,6 @@ impl fmt::Debug for SpirvTypePrinter<'_, '_> {
multisampled,
sampled,
image_format,
access_qualifier,
} => f
.debug_struct("Image")
.field("id", &self.id)
@ -524,7 +519,6 @@ impl fmt::Debug for SpirvTypePrinter<'_, '_> {
.field("multisampled", &multisampled)
.field("sampled", &sampled)
.field("image_format", &image_format)
.field("access_qualifier", &access_qualifier)
.finish(),
SpirvType::Sampler => f.debug_struct("Sampler").field("id", &self.id).finish(),
SpirvType::SampledImage { image_type } => f
@ -670,7 +664,6 @@ impl SpirvTypePrinter<'_, '_> {
multisampled,
sampled,
image_format,
access_qualifier,
} => f
.debug_struct("Image")
.field("sampled_type", &self.cx.debug_type(sampled_type))
@ -680,7 +673,6 @@ impl SpirvTypePrinter<'_, '_> {
.field("multisampled", &multisampled)
.field("sampled", &sampled)
.field("image_format", &image_format)
.field("access_qualifier", &access_qualifier)
.finish(),
SpirvType::Sampler => f.write_str("Sampler"),
SpirvType::SampledImage { image_type } => f

View File

@ -25,7 +25,6 @@ type, or use `format` to set the image to a specific image format.";
/// Creates an `Image` type using the following syntax.
pub struct ImageType {
access_qualifier: Option<AccessQualifier>,
arrayed: Arrayed,
crate_root: Option<syn::Path>,
depth: ImageDepth,
@ -38,7 +37,6 @@ pub struct ImageType {
impl Parse for ImageType {
fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
let mut access_qualifier = None;
let mut sampled_type = None;
let mut dimensionality = None;
let mut arrayed = None;
@ -86,20 +84,7 @@ impl Parse for ImageType {
} else if input.peek(syn::Ident) {
let ident = input.parse::<Ident>().unwrap();
if ident == "access" {
let value = peek_and_eat_value!(syn::Ident)
.as_ref()
.map(|i| params::access_qualifier_from_str(&i.to_string()));
if value.is_none() {
return Err(syn::Error::new(
ident.span(),
"Expected argument for `access`.",
));
}
access_qualifier = value.unwrap().ok();
} else if ident == "buffer" {
if ident == "buffer" {
set_unique!(dimensionality = Dimensionality::Buffer);
} else if ident == "cube" {
set_unique!(dimensionality = Dimensionality::Cube);
@ -302,7 +287,6 @@ impl Parse for ImageType {
let sampled = sampled.unwrap_or(Sampled::Unknown);
Ok(Self {
access_qualifier,
arrayed,
crate_root,
depth,
@ -326,13 +310,6 @@ impl quote::ToTokens for ImageType {
punct
},
});
let access_qualifier = match self.access_qualifier {
Some(aq) => {
let aq = params::access_qualifier_to_tokens(&aq);
quote!(Some(#crate_root::image::#aq))
}
None => quote!(None),
};
let dimensionality = params::dimensionality_to_tokens(&self.dimensionality);
let arrayed = params::arrayed_to_tokens(&self.arrayed);
let depth = params::image_depth_to_tokens(&self.depth);
@ -344,13 +321,12 @@ impl quote::ToTokens for ImageType {
tokens.append_all(quote::quote! {
#crate_root::image::Image<
#crate_root::image::__private::#sampled_type,
{ #crate_root::image::#dimensionality },
{ #crate_root::image::#depth },
{ #crate_root::image::#arrayed },
{ #crate_root::image::#multisampled },
{ #crate_root::image::#sampled },
{ #crate_root::image::#format },
{ #access_qualifier },
{ #crate_root::image::#dimensionality as u32 },
{ #crate_root::image::#depth as u32 },
{ #crate_root::image::#arrayed as u32 },
{ #crate_root::image::#multisampled as u32 },
{ #crate_root::image::#sampled as u32 },
{ #crate_root::image::#format as u32 },
>
});
}
@ -360,15 +336,6 @@ mod params {
use super::*;
use proc_macro2::TokenStream;
pub fn access_qualifier_from_str(s: &str) -> Result<AccessQualifier, &'static str> {
match s {
"read" => Ok(AccessQualifier::ReadOnly),
"write" => Ok(AccessQualifier::WriteOnly),
"read_write" => Ok(AccessQualifier::ReadWrite),
_ => Err("Invalid access qualifier."),
}
}
pub fn image_format_from_str(s: &str) -> Result<ImageFormat, &'static str> {
Ok(match s {
"rgba32f" => ImageFormat::Rgba32f,
@ -449,14 +416,6 @@ mod params {
}
}
pub fn access_qualifier_to_tokens(aq: &AccessQualifier) -> TokenStream {
match aq {
AccessQualifier::ReadOnly => quote!(AccessQualifier::ReadOnly),
AccessQualifier::WriteOnly => quote!(AccessQualifier::WriteOnly),
AccessQualifier::ReadWrite => quote!(AccessQualifier::ReadWrite),
}
}
pub fn image_depth_to_tokens(id: &ImageDepth) -> TokenStream {
match id {
ImageDepth::True => quote!(ImageDepth::True),

File diff suppressed because it is too large Load Diff

View File

@ -1,79 +1,109 @@
use super::{Arrayed, Dimensionality, ImageFormat};
use crate::{scalar::Scalar, vector::Vector, integer::Integer};
use crate::{integer::Integer, scalar::Scalar, vector::Vector};
/// Marker trait for arguments that accept single scalar values or vectors
/// of scalars.
pub trait SampleType<const FORMAT: ImageFormat>: Scalar {}
pub trait SampleType<const FORMAT: u32>: Scalar {}
impl SampleType<{ ImageFormat::Unknown }> for i8 {}
impl SampleType<{ ImageFormat::Unknown }> for i16 {}
impl SampleType<{ ImageFormat::Unknown }> for i32 {}
impl SampleType<{ ImageFormat::Unknown }> for i64 {}
impl SampleType<{ ImageFormat::Unknown }> for u8 {}
impl SampleType<{ ImageFormat::Unknown }> for u16 {}
impl SampleType<{ ImageFormat::Unknown }> for u32 {}
impl SampleType<{ ImageFormat::Unknown }> for u64 {}
impl SampleType<{ ImageFormat::Unknown }> for f32 {}
impl SampleType<{ ImageFormat::Unknown }> for f64 {}
impl SampleType<{ ImageFormat::Rgba32f }> for f32 {}
impl SampleType<{ ImageFormat::Rgba16f }> for f32 {}
impl SampleType<{ ImageFormat::R32f }> for f32 {}
impl SampleType<{ ImageFormat::Rgba8 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba8Snorm }> for f32 {}
impl SampleType<{ ImageFormat::Rg32f }> for f32 {}
impl SampleType<{ ImageFormat::Rg16f }> for f32 {}
impl SampleType<{ ImageFormat::R11fG11fB10f }> for f32 {}
impl SampleType<{ ImageFormat::R16f }> for f32 {}
impl SampleType<{ ImageFormat::Rgba16 }> for f32 {}
impl SampleType<{ ImageFormat::Rgb10A2 }> for f32 {}
impl SampleType<{ ImageFormat::Rg16 }> for f32 {}
impl SampleType<{ ImageFormat::Rg8 }> for f32 {}
impl SampleType<{ ImageFormat::R16 }> for f32 {}
impl SampleType<{ ImageFormat::R8 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba16Snorm }> for f32 {}
impl SampleType<{ ImageFormat::Rg16Snorm }> for f32 {}
impl SampleType<{ ImageFormat::Rg8Snorm }> for f32 {}
impl SampleType<{ ImageFormat::R16Snorm }> for f32 {}
impl SampleType<{ ImageFormat::R8Snorm }> for f32 {}
impl SampleType<{ ImageFormat::Rgba32i }> for i32 {}
impl SampleType<{ ImageFormat::Rgba16i }> for i32 {}
impl SampleType<{ ImageFormat::Rgba8i }> for i32 {}
impl SampleType<{ ImageFormat::R32i }> for i32 {}
impl SampleType<{ ImageFormat::Rg32i }> for i32 {}
impl SampleType<{ ImageFormat::Rg16i }> for i32 {}
impl SampleType<{ ImageFormat::Rg8i }> for i32 {}
impl SampleType<{ ImageFormat::R16i }> for i32 {}
impl SampleType<{ ImageFormat::R8i }> for i32 {}
impl SampleType<{ ImageFormat::Rgba32ui }> for u32 {}
impl SampleType<{ ImageFormat::Rgba16ui }> for u32 {}
impl SampleType<{ ImageFormat::Rgba8ui }> for u32 {}
impl SampleType<{ ImageFormat::R32ui }> for u32 {}
impl SampleType<{ ImageFormat::Rgb10A2ui }> for u32 {}
impl SampleType<{ ImageFormat::Rg32ui }> for u32 {}
impl SampleType<{ ImageFormat::Rg16ui }> for u32 {}
impl SampleType<{ ImageFormat::Rg8ui }> for u32 {}
impl SampleType<{ ImageFormat::R16ui }> for u32 {}
impl SampleType<{ ImageFormat::R8ui }> for u32 {}
impl SampleType<{ ImageFormat::R64ui }> for u64 {}
impl SampleType<{ ImageFormat::R64i }> for i64 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for i8 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for i16 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for i64 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for u8 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for u16 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for u64 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for f64 {}
impl SampleType<{ ImageFormat::Rgba32f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba16f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R32f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba8 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba8Snorm as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rg32f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rg16f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R11fG11fB10f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R16f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba16 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgb10A2 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rg16 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rg8 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R16 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R8 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba16Snorm as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rg16Snorm as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rg8Snorm as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R16Snorm as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R8Snorm as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba32i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Rgba16i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Rgba8i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::R32i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Rg32i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Rg16i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Rg8i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::R16i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::R8i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Rgba32ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Rgba16ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Rgba8ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::R32ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Rgb10A2ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Rg32ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Rg16ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Rg8ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::R16ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::R8ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::R64ui as u32 }> for u64 {}
impl SampleType<{ ImageFormat::R64i as u32 }> for i64 {}
/// Marker trait for arguments that accept a coordinate for an [`crate::Image`].
pub trait ImageCoordinate<T, const DIM: Dimensionality, const ARRAYED: Arrayed> {}
pub trait ImageCoordinate<T, const DIM: u32, const ARRAYED: u32> {}
impl<S: Scalar> ImageCoordinate<S, { Dimensionality::OneD }, { Arrayed::False }> for S {}
impl<S: Scalar> ImageCoordinate<S, { Dimensionality::Buffer }, { Arrayed::False }> for S {}
impl<S: Scalar> ImageCoordinate<S, { Dimensionality::OneD as u32 }, { Arrayed::False as u32 }>
for S
{
}
impl<S: Scalar> ImageCoordinate<S, { Dimensionality::Buffer as u32 }, { Arrayed::False as u32 }>
for S
{
}
impl<V: Vector<S, 2>, S: Scalar> ImageCoordinate<S, { Dimensionality::TwoD }, { Arrayed::False }> for V {}
impl<V: Vector<S, 2>, S: Scalar> ImageCoordinate<S, { Dimensionality::Rect }, { Arrayed::False }> for V {}
impl<V: Vector<S, 3>, S: Scalar> ImageCoordinate<S, { Dimensionality::Cube }, { Arrayed::False }> for V {}
impl<V: Vector<S, 3>, S: Scalar> ImageCoordinate<S, { Dimensionality::ThreeD }, { Arrayed::False }> for V {}
impl<V: Vector<S, 2>, S: Scalar>
ImageCoordinate<S, { Dimensionality::TwoD as u32 }, { Arrayed::False as u32 }> for V
{
}
impl<V: Vector<S, 2>, S: Scalar>
ImageCoordinate<S, { Dimensionality::Rect as u32 }, { Arrayed::False as u32 }> for V
{
}
impl<V: Vector<S, 3>, S: Scalar>
ImageCoordinate<S, { Dimensionality::Cube as u32 }, { Arrayed::False as u32 }> for V
{
}
impl<V: Vector<S, 3>, S: Scalar>
ImageCoordinate<S, { Dimensionality::ThreeD as u32 }, { Arrayed::False as u32 }> for V
{
}
impl<V: Vector<S, 3>, S: Scalar> ImageCoordinate<S, { Dimensionality::TwoD }, { Arrayed::True }> for V {}
impl<V: Vector<S, 3>, S: Scalar> ImageCoordinate<S, { Dimensionality::Rect }, { Arrayed::True }> for V {}
impl<V: Vector<S, 4>, S: Scalar> ImageCoordinate<S, { Dimensionality::Cube }, { Arrayed::True }> for V {}
impl<V: Vector<S, 4>, S: Scalar> ImageCoordinate<S, { Dimensionality::ThreeD }, { Arrayed::True }> for V {}
impl<V: Vector<S, 3>, S: Scalar>
ImageCoordinate<S, { Dimensionality::TwoD as u32 }, { Arrayed::True as u32 }> for V
{
}
impl<V: Vector<S, 3>, S: Scalar>
ImageCoordinate<S, { Dimensionality::Rect as u32 }, { Arrayed::True as u32 }> for V
{
}
impl<V: Vector<S, 4>, S: Scalar>
ImageCoordinate<S, { Dimensionality::Cube as u32 }, { Arrayed::True as u32 }> for V
{
}
impl<V: Vector<S, 4>, S: Scalar>
ImageCoordinate<S, { Dimensionality::ThreeD as u32 }, { Arrayed::True as u32 }> for V
{
}
/// Marker trait for arguments that are valid for a [`crate::image::Dimensionality::SubpassData`] image query.
pub trait ImageCoordinateSubpassData<T, const ARRAYED: Arrayed> {}
impl<V: Vector<I, 2>, I: Integer> ImageCoordinateSubpassData<I, { Arrayed::False }> for V {}
impl<V: Vector<I, 3>, I: Integer> ImageCoordinateSubpassData<I, { Arrayed::True }> for V {}
pub trait ImageCoordinateSubpassData<T, const ARRAYED: u32> {}
impl<V: Vector<I, 2>, I: Integer> ImageCoordinateSubpassData<I, { Arrayed::False as u32 }> for V {}
impl<V: Vector<I, 3>, I: Integer> ImageCoordinateSubpassData<I, { Arrayed::True as u32 }> for V {}

View File

@ -11,7 +11,6 @@
),
register_attr(spirv)
)]
#![feature(adt_const_params)]
// BEGIN - Embark standard lints v0.4
// do not change or add/remove here, but one can add exceptions after this section
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>

View File

@ -1,24 +1,24 @@
error[E0277]: the trait bound `Image<f32, OneD, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, Yes, spirv_std::image::ImageFormat::Unknown, Option::<AccessQualifier>::None>: HasGather` is not satisfied
error[E0277]: the trait bound `Image<f32, 0_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>: HasGather` is not satisfied
--> $DIR/gather_err.rs:15:34
|
15 | let r1: glam::Vec4 = image1d.gather(*sampler, 0.0, 0);
| ^^^^^^ the trait `HasGather` is not implemented for `Image<f32, OneD, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, Yes, spirv_std::image::ImageFormat::Unknown, Option::<AccessQualifier>::None>`
| ^^^^^^ the trait `HasGather` is not implemented for `Image<f32, 0_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>`
|
= help: the following implementations were found:
<Image<SampledType, Cube, DEPTH, ARRAYED, spirv_std::image::Multisampled::False, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasGather>
<Image<SampledType, Rect, DEPTH, ARRAYED, spirv_std::image::Multisampled::False, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasGather>
<Image<SampledType, TwoD, DEPTH, ARRAYED, spirv_std::image::Multisampled::False, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasGather>
<Image<SampledType, 1_u32, DEPTH, ARRAYED, 0_u32, SAMPLED, FORMAT> as HasGather>
<Image<SampledType, 3_u32, DEPTH, ARRAYED, 0_u32, SAMPLED, FORMAT> as HasGather>
<Image<SampledType, 4_u32, DEPTH, ARRAYED, 0_u32, SAMPLED, FORMAT> as HasGather>
error[E0277]: the trait bound `Image<f32, ThreeD, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, Yes, spirv_std::image::ImageFormat::Unknown, Option::<AccessQualifier>::None>: HasGather` is not satisfied
error[E0277]: the trait bound `Image<f32, 2_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>: HasGather` is not satisfied
--> $DIR/gather_err.rs:16:34
|
16 | let r2: glam::Vec4 = image3d.gather(*sampler, v3, 0);
| ^^^^^^ the trait `HasGather` is not implemented for `Image<f32, ThreeD, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, Yes, spirv_std::image::ImageFormat::Unknown, Option::<AccessQualifier>::None>`
| ^^^^^^ the trait `HasGather` is not implemented for `Image<f32, 2_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>`
|
= help: the following implementations were found:
<Image<SampledType, Cube, DEPTH, ARRAYED, spirv_std::image::Multisampled::False, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasGather>
<Image<SampledType, Rect, DEPTH, ARRAYED, spirv_std::image::Multisampled::False, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasGather>
<Image<SampledType, TwoD, DEPTH, ARRAYED, spirv_std::image::Multisampled::False, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasGather>
<Image<SampledType, 1_u32, DEPTH, ARRAYED, 0_u32, SAMPLED, FORMAT> as HasGather>
<Image<SampledType, 3_u32, DEPTH, ARRAYED, 0_u32, SAMPLED, FORMAT> as HasGather>
<Image<SampledType, 4_u32, DEPTH, ARRAYED, 0_u32, SAMPLED, FORMAT> as HasGather>
error: aborting due to 2 previous errors

View File

@ -1,14 +1,14 @@
error[E0277]: the trait bound `Image<f32, Rect, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, Yes, spirv_std::image::ImageFormat::Unknown, Option::<AccessQualifier>::None>: HasQueryLevels` is not satisfied
error[E0277]: the trait bound `Image<f32, 4_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>: HasQueryLevels` is not satisfied
--> $DIR/query_levels_err.rs:12:21
|
12 | *output = image.query_levels();
| ^^^^^^^^^^^^ the trait `HasQueryLevels` is not implemented for `Image<f32, Rect, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, Yes, spirv_std::image::ImageFormat::Unknown, Option::<AccessQualifier>::None>`
| ^^^^^^^^^^^^ the trait `HasQueryLevels` is not implemented for `Image<f32, 4_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>`
|
= help: the following implementations were found:
<Image<SampledType, Cube, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQueryLevels>
<Image<SampledType, OneD, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQueryLevels>
<Image<SampledType, ThreeD, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQueryLevels>
<Image<SampledType, TwoD, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQueryLevels>
<Image<SampledType, 0_u32, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT> as HasQueryLevels>
<Image<SampledType, 1_u32, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT> as HasQueryLevels>
<Image<SampledType, 2_u32, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT> as HasQueryLevels>
<Image<SampledType, 3_u32, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT> as HasQueryLevels>
error: aborting due to previous error

View File

@ -1,14 +1,14 @@
error[E0277]: the trait bound `Image<f32, Rect, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, Yes, spirv_std::image::ImageFormat::Unknown, Option::<AccessQualifier>::None>: HasQueryLevels` is not satisfied
error[E0277]: the trait bound `Image<f32, 4_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>: HasQueryLevels` is not satisfied
--> $DIR/query_lod_err.rs:13:21
|
13 | *output = image.query_lod(*sampler, glam::Vec2::new(0.0, 1.0));
| ^^^^^^^^^ the trait `HasQueryLevels` is not implemented for `Image<f32, Rect, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, Yes, spirv_std::image::ImageFormat::Unknown, Option::<AccessQualifier>::None>`
| ^^^^^^^^^ the trait `HasQueryLevels` is not implemented for `Image<f32, 4_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>`
|
= help: the following implementations were found:
<Image<SampledType, Cube, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQueryLevels>
<Image<SampledType, OneD, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQueryLevels>
<Image<SampledType, ThreeD, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQueryLevels>
<Image<SampledType, TwoD, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQueryLevels>
<Image<SampledType, 0_u32, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT> as HasQueryLevels>
<Image<SampledType, 1_u32, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT> as HasQueryLevels>
<Image<SampledType, 2_u32, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT> as HasQueryLevels>
<Image<SampledType, 3_u32, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT> as HasQueryLevels>
error: aborting due to previous error

View File

@ -1,14 +1,14 @@
error[E0277]: the trait bound `Image<f32, TwoD, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, Yes, spirv_std::image::ImageFormat::Unknown, Option::<AccessQualifier>::None>: HasQuerySize` is not satisfied
error[E0277]: the trait bound `Image<f32, 1_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>: HasQuerySize` is not satisfied
--> $DIR/query_size_err.rs:12:21
|
12 | *output = image.query_size();
| ^^^^^^^^^^ the trait `HasQuerySize` is not implemented for `Image<f32, TwoD, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, Yes, spirv_std::image::ImageFormat::Unknown, Option::<AccessQualifier>::None>`
| ^^^^^^^^^^ the trait `HasQuerySize` is not implemented for `Image<f32, 1_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>`
|
= help: the following implementations were found:
<Image<SampledType, Buffer, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQuerySize>
<Image<SampledType, Cube, DEPTH, ARRAYED, spirv_std::image::Multisampled::False, No, FORMAT, ACCESS_QUALIFIER> as HasQuerySize>
<Image<SampledType, Cube, DEPTH, ARRAYED, spirv_std::image::Multisampled::False, spirv_std::image::Sampled::Unknown, FORMAT, ACCESS_QUALIFIER> as HasQuerySize>
<Image<SampledType, Cube, DEPTH, ARRAYED, spirv_std::image::Multisampled::True, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQuerySize>
<Image<SampledType, 0_u32, DEPTH, ARRAYED, 0_u32, 0_u32, FORMAT> as HasQuerySize>
<Image<SampledType, 0_u32, DEPTH, ARRAYED, 0_u32, 2_u32, FORMAT> as HasQuerySize>
<Image<SampledType, 0_u32, DEPTH, ARRAYED, 1_u32, SAMPLED, FORMAT> as HasQuerySize>
<Image<SampledType, 1_u32, DEPTH, ARRAYED, 0_u32, 0_u32, FORMAT> as HasQuerySize>
and 10 others
error: aborting due to previous error

View File

@ -1,14 +1,14 @@
error[E0277]: the trait bound `Image<f32, Rect, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, Yes, spirv_std::image::ImageFormat::Unknown, Option::<AccessQualifier>::None>: HasQuerySizeLod` is not satisfied
error[E0277]: the trait bound `Image<f32, 4_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>: HasQuerySizeLod` is not satisfied
--> $DIR/query_size_lod_err.rs:12:21
|
12 | *output = image.query_size_lod(0);
| ^^^^^^^^^^^^^^ the trait `HasQuerySizeLod` is not implemented for `Image<f32, Rect, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, Yes, spirv_std::image::ImageFormat::Unknown, Option::<AccessQualifier>::None>`
| ^^^^^^^^^^^^^^ the trait `HasQuerySizeLod` is not implemented for `Image<f32, 4_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>`
|
= help: the following implementations were found:
<Image<SampledType, Cube, DEPTH, ARRAYED, spirv_std::image::Multisampled::False, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQuerySizeLod>
<Image<SampledType, OneD, DEPTH, ARRAYED, spirv_std::image::Multisampled::False, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQuerySizeLod>
<Image<SampledType, ThreeD, DEPTH, ARRAYED, spirv_std::image::Multisampled::False, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQuerySizeLod>
<Image<SampledType, TwoD, DEPTH, ARRAYED, spirv_std::image::Multisampled::False, SAMPLED, FORMAT, ACCESS_QUALIFIER> as HasQuerySizeLod>
<Image<SampledType, 0_u32, DEPTH, ARRAYED, 0_u32, SAMPLED, FORMAT> as HasQuerySizeLod>
<Image<SampledType, 1_u32, DEPTH, ARRAYED, 0_u32, SAMPLED, FORMAT> as HasQuerySizeLod>
<Image<SampledType, 2_u32, DEPTH, ARRAYED, 0_u32, SAMPLED, FORMAT> as HasQuerySizeLod>
<Image<SampledType, 3_u32, DEPTH, ARRAYED, 0_u32, SAMPLED, FORMAT> as HasQuerySizeLod>
error: aborting due to previous error

View File

@ -19,7 +19,7 @@ warning: redundant storage class specifier, storage class is inferred from type
9 | #[spirv(uniform_constant)] warning: &Image!(2D, type=f32),
| ^^^^^^^^^^^^^^^^
error: entry parameter type must be by-reference: `&spirv_std::image::Image<f32, spirv_std::image::Dimensionality::TwoD, spirv_std::image::ImageDepth::Unknown, spirv_std::image::Arrayed::False, spirv_std::image::Multisampled::False, spirv_std::image::Sampled::Unknown, spirv_std::image::ImageFormat::Unknown, core::option::Option::<spirv_std::image::AccessQualifier>::None>`
error: entry parameter type must be by-reference: `&spirv_std::image::Image<f32, 1_u32, 2_u32, 0_u32, 0_u32, 0_u32, 0_u32>`
--> $DIR/bad-infer-storage-class.rs:15:27
|
15 | pub fn issue_585(invalid: Image!(2D, type=f32)) {}