mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-21 22:34:34 +00:00
Nuke const generics feature (#661)
* Nuke const generics feature * Remove spirv(image_type) attribute
This commit is contained in:
parent
e66e72b049
commit
e1a000d408
@ -760,38 +760,6 @@ fn trans_intrinsic_type<'tcx>(
|
|||||||
intrinsic_type_attr: IntrinsicType,
|
intrinsic_type_attr: IntrinsicType,
|
||||||
) -> Result<Word, ErrorReported> {
|
) -> Result<Word, ErrorReported> {
|
||||||
match intrinsic_type_attr {
|
match intrinsic_type_attr {
|
||||||
IntrinsicType::ImageType {
|
|
||||||
dim,
|
|
||||||
depth,
|
|
||||||
arrayed,
|
|
||||||
multisampled,
|
|
||||||
sampled,
|
|
||||||
image_format,
|
|
||||||
access_qualifier,
|
|
||||||
} => {
|
|
||||||
// see SpirvType::sizeof
|
|
||||||
if ty.size != Size::from_bytes(4) {
|
|
||||||
cx.tcx
|
|
||||||
.sess
|
|
||||||
.err("#[spirv(image_type)] type must have size 4");
|
|
||||||
return Err(ErrorReported);
|
|
||||||
}
|
|
||||||
// Hardcode to float for now
|
|
||||||
let sampled_type = SpirvType::Float(32).def(span, cx);
|
|
||||||
|
|
||||||
let ty = SpirvType::Image {
|
|
||||||
sampled_type,
|
|
||||||
dim,
|
|
||||||
depth,
|
|
||||||
arrayed,
|
|
||||||
multisampled,
|
|
||||||
sampled,
|
|
||||||
image_format,
|
|
||||||
access_qualifier,
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(ty.def(span, cx))
|
|
||||||
}
|
|
||||||
IntrinsicType::GenericImageType => {
|
IntrinsicType::GenericImageType => {
|
||||||
// see SpirvType::sizeof
|
// see SpirvType::sizeof
|
||||||
if ty.size != Size::from_bytes(4) {
|
if ty.size != Size::from_bytes(4) {
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
use crate::codegen_cx::CodegenCx;
|
use crate::codegen_cx::CodegenCx;
|
||||||
use crate::symbols::Symbols;
|
use crate::symbols::Symbols;
|
||||||
use rspirv::spirv::{
|
use rspirv::spirv::{BuiltIn, ExecutionMode, ExecutionModel, StorageClass};
|
||||||
AccessQualifier, BuiltIn, Dim, ExecutionMode, ExecutionModel, ImageFormat, StorageClass,
|
|
||||||
};
|
|
||||||
use rustc_ast::Attribute;
|
use rustc_ast::Attribute;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def_id::LocalDefId;
|
use rustc_hir::def_id::LocalDefId;
|
||||||
@ -62,15 +60,6 @@ impl From<ExecutionModel> for Entry {
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum IntrinsicType {
|
pub enum IntrinsicType {
|
||||||
GenericImageType,
|
GenericImageType,
|
||||||
ImageType {
|
|
||||||
dim: Dim,
|
|
||||||
depth: u32,
|
|
||||||
arrayed: u32,
|
|
||||||
multisampled: u32,
|
|
||||||
sampled: u32,
|
|
||||||
image_format: ImageFormat,
|
|
||||||
access_qualifier: Option<AccessQualifier>,
|
|
||||||
},
|
|
||||||
Sampler,
|
Sampler,
|
||||||
AccelerationStructureKhr,
|
AccelerationStructureKhr,
|
||||||
SampledImage,
|
SampledImage,
|
||||||
|
@ -24,14 +24,6 @@ pub struct Symbols {
|
|||||||
descriptor_set: Symbol,
|
descriptor_set: Symbol,
|
||||||
binding: Symbol,
|
binding: Symbol,
|
||||||
input_attachment_index: Symbol,
|
input_attachment_index: Symbol,
|
||||||
image_type: Symbol,
|
|
||||||
dim: Symbol,
|
|
||||||
depth: Symbol,
|
|
||||||
arrayed: Symbol,
|
|
||||||
multisampled: Symbol,
|
|
||||||
sampled: Symbol,
|
|
||||||
image_format: Symbol,
|
|
||||||
access_qualifier: Symbol,
|
|
||||||
pub bindless: Symbol,
|
pub bindless: Symbol,
|
||||||
attributes: FxHashMap<Symbol, SpirvAttribute>,
|
attributes: FxHashMap<Symbol, SpirvAttribute>,
|
||||||
execution_modes: FxHashMap<Symbol, (ExecutionMode, ExecutionModeExtraDim)>,
|
execution_modes: FxHashMap<Symbol, (ExecutionMode, ExecutionModeExtraDim)>,
|
||||||
@ -382,14 +374,6 @@ impl Symbols {
|
|||||||
descriptor_set: Symbol::intern("descriptor_set"),
|
descriptor_set: Symbol::intern("descriptor_set"),
|
||||||
binding: Symbol::intern("binding"),
|
binding: Symbol::intern("binding"),
|
||||||
input_attachment_index: Symbol::intern("input_attachment_index"),
|
input_attachment_index: Symbol::intern("input_attachment_index"),
|
||||||
image_type: Symbol::intern("image_type"),
|
|
||||||
dim: Symbol::intern("dim"),
|
|
||||||
depth: Symbol::intern("depth"),
|
|
||||||
arrayed: Symbol::intern("arrayed"),
|
|
||||||
multisampled: Symbol::intern("multisampled"),
|
|
||||||
sampled: Symbol::intern("sampled"),
|
|
||||||
image_format: Symbol::intern("image_format"),
|
|
||||||
access_qualifier: Symbol::intern("access_qualifier"),
|
|
||||||
bindless: Symbol::intern("bindless"),
|
bindless: Symbol::intern("bindless"),
|
||||||
attributes,
|
attributes,
|
||||||
execution_modes,
|
execution_modes,
|
||||||
@ -448,9 +432,7 @@ pub(crate) fn parse_attrs_for_checking<'a>(
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(args.into_iter().map(move |ref arg| {
|
.chain(args.into_iter().map(move |ref arg| {
|
||||||
let span = arg.span();
|
let span = arg.span();
|
||||||
let parsed_attr = if arg.has_name(sym.image_type) {
|
let parsed_attr = if arg.has_name(sym.descriptor_set) {
|
||||||
parse_image_type(sym, arg)?
|
|
||||||
} else if arg.has_name(sym.descriptor_set) {
|
|
||||||
SpirvAttribute::DescriptorSet(parse_attr_int_value(arg)?)
|
SpirvAttribute::DescriptorSet(parse_attr_int_value(arg)?)
|
||||||
} else if arg.has_name(sym.binding) {
|
} else if arg.has_name(sym.binding) {
|
||||||
SpirvAttribute::Binding(parse_attr_int_value(arg)?)
|
SpirvAttribute::Binding(parse_attr_int_value(arg)?)
|
||||||
@ -487,113 +469,6 @@ pub(crate) fn parse_attrs_for_checking<'a>(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_image_type(
|
|
||||||
sym: &Symbols,
|
|
||||||
attr: &NestedMetaItem,
|
|
||||||
) -> Result<SpirvAttribute, ParseAttrError> {
|
|
||||||
let args = match attr.meta_item_list() {
|
|
||||||
Some(args) => args,
|
|
||||||
None => {
|
|
||||||
return Err((
|
|
||||||
attr.span(),
|
|
||||||
"image_type attribute must have arguments".to_string(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if args.len() != 6 && args.len() != 7 {
|
|
||||||
return Err((
|
|
||||||
attr.span(),
|
|
||||||
"image_type attribute must have 6 or 7 arguments".to_string(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
let check = |idx: usize, sym: Symbol| -> Result<(), ParseAttrError> {
|
|
||||||
if args[idx].has_name(sym) {
|
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
Err((
|
|
||||||
args[idx].span(),
|
|
||||||
format!(
|
|
||||||
"image_type attribute argument {} must be {}=...",
|
|
||||||
idx + 1,
|
|
||||||
sym
|
|
||||||
),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
};
|
|
||||||
check(0, sym.dim)?;
|
|
||||||
check(1, sym.depth)?;
|
|
||||||
check(2, sym.arrayed)?;
|
|
||||||
check(3, sym.multisampled)?;
|
|
||||||
check(4, sym.sampled)?;
|
|
||||||
check(5, sym.image_format)?;
|
|
||||||
if args.len() == 7 {
|
|
||||||
check(6, sym.access_qualifier)?;
|
|
||||||
}
|
|
||||||
let arg_values = args
|
|
||||||
.iter()
|
|
||||||
.map(
|
|
||||||
|arg| match arg.meta_item().and_then(|arg| arg.name_value_literal()) {
|
|
||||||
Some(arg) => Ok(arg),
|
|
||||||
None => Err((
|
|
||||||
arg.span(),
|
|
||||||
"image_type attribute must be name=value".to_string(),
|
|
||||||
)),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
|
||||||
let dim = match arg_values[0].kind {
|
|
||||||
LitKind::Str(dim, _) => match dim.as_str().parse() {
|
|
||||||
Ok(dim) => dim,
|
|
||||||
Err(()) => return Err((args[0].span(), "invalid dim value".to_string())),
|
|
||||||
},
|
|
||||||
_ => return Err((args[0].span(), "dim value must be str".to_string())),
|
|
||||||
};
|
|
||||||
let parse_lit = |idx: usize, name: &str| -> Result<u32, ParseAttrError> {
|
|
||||||
match arg_values[idx].kind {
|
|
||||||
LitKind::Int(v, _) => Ok(v as u32),
|
|
||||||
_ => Err((args[idx].span(), format!("{} value must be int", name))),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let depth = parse_lit(1, "depth")?;
|
|
||||||
let arrayed = parse_lit(2, "arrayed")?;
|
|
||||||
let multisampled = parse_lit(3, "multisampled")?;
|
|
||||||
let sampled = parse_lit(4, "sampled")?;
|
|
||||||
let image_format = match arg_values[5].kind {
|
|
||||||
LitKind::Str(image_format, _) => match image_format.as_str().parse() {
|
|
||||||
Ok(image_format) => image_format,
|
|
||||||
Err(()) => return Err((args[5].span(), "invalid image_format value".to_string())),
|
|
||||||
},
|
|
||||||
_ => return Err((args[5].span(), "image_format value must be str".to_string())),
|
|
||||||
};
|
|
||||||
let access_qualifier = if args.len() == 7 {
|
|
||||||
Some(match arg_values[6].kind {
|
|
||||||
LitKind::Str(access_qualifier, _) => match access_qualifier.as_str().parse() {
|
|
||||||
Ok(access_qualifier) => access_qualifier,
|
|
||||||
Err(()) => {
|
|
||||||
return Err((args[6].span(), "invalid access_qualifier value".to_string()));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
return Err((
|
|
||||||
args[6].span(),
|
|
||||||
"access_qualifier value must be str".to_string(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
Ok(SpirvAttribute::IntrinsicType(IntrinsicType::ImageType {
|
|
||||||
dim,
|
|
||||||
depth,
|
|
||||||
arrayed,
|
|
||||||
multisampled,
|
|
||||||
sampled,
|
|
||||||
image_format,
|
|
||||||
access_qualifier,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_attr_int_value(arg: &NestedMetaItem) -> Result<u32, ParseAttrError> {
|
fn parse_attr_int_value(arg: &NestedMetaItem) -> Result<u32, ParseAttrError> {
|
||||||
let arg = match arg.meta_item() {
|
let arg = match arg.meta_item() {
|
||||||
Some(arg) => arg,
|
Some(arg) => arg,
|
||||||
|
@ -16,4 +16,3 @@ glam = { version = "0.15.2", default-features = false, features = ["libm"], opti
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
const-generics = []
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
use crate::{scalar::Scalar, vector::Vector};
|
use crate::{scalar::Scalar, vector::Vector};
|
||||||
|
|
||||||
mod arithmetic;
|
mod arithmetic;
|
||||||
#[cfg(feature = "const-generics")]
|
|
||||||
mod barrier;
|
mod barrier;
|
||||||
mod demote_to_helper_invocation_ext;
|
mod demote_to_helper_invocation_ext;
|
||||||
mod derivative;
|
mod derivative;
|
||||||
@ -14,7 +13,6 @@ mod primitive;
|
|||||||
mod ray_tracing;
|
mod ray_tracing;
|
||||||
|
|
||||||
pub use arithmetic::*;
|
pub use arithmetic::*;
|
||||||
#[cfg(feature = "const-generics")]
|
|
||||||
pub use barrier::*;
|
pub use barrier::*;
|
||||||
pub use demote_to_helper_invocation_ext::*;
|
pub use demote_to_helper_invocation_ext::*;
|
||||||
pub use derivative::*;
|
pub use derivative::*;
|
||||||
|
@ -11,11 +11,7 @@
|
|||||||
),
|
),
|
||||||
register_attr(spirv)
|
register_attr(spirv)
|
||||||
)]
|
)]
|
||||||
#![cfg_attr(
|
#![feature(const_generics)]
|
||||||
feature = "const-generics",
|
|
||||||
feature(const_generics),
|
|
||||||
allow(incomplete_features)
|
|
||||||
)]
|
|
||||||
// BEGIN - Embark standard lints v0.3
|
// BEGIN - Embark standard lints v0.3
|
||||||
// do not change or add/remove here, but one can add exceptions after this section
|
// 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>
|
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
|
||||||
@ -85,7 +81,6 @@ pub extern crate spirv_std_macros as macros;
|
|||||||
pub mod arch;
|
pub mod arch;
|
||||||
pub mod bindless;
|
pub mod bindless;
|
||||||
pub mod float;
|
pub mod float;
|
||||||
#[cfg(feature = "const-generics")]
|
|
||||||
pub mod image;
|
pub mod image;
|
||||||
pub mod integer;
|
pub mod integer;
|
||||||
pub mod memory;
|
pub mod memory;
|
||||||
@ -94,14 +89,12 @@ mod runtime_array;
|
|||||||
mod sampler;
|
mod sampler;
|
||||||
pub mod scalar;
|
pub mod scalar;
|
||||||
pub(crate) mod sealed;
|
pub(crate) mod sealed;
|
||||||
mod textures;
|
|
||||||
pub mod vector;
|
pub mod vector;
|
||||||
|
|
||||||
pub use self::sampler::Sampler;
|
pub use self::sampler::Sampler;
|
||||||
pub use crate::macros::Image;
|
pub use crate::macros::Image;
|
||||||
pub use num_traits;
|
pub use num_traits;
|
||||||
pub use runtime_array::*;
|
pub use runtime_array::*;
|
||||||
pub use textures::*;
|
|
||||||
|
|
||||||
#[cfg(feature = "glam")]
|
#[cfg(feature = "glam")]
|
||||||
pub use glam;
|
pub use glam;
|
||||||
|
@ -1,920 +0,0 @@
|
|||||||
use crate::{integer::Integer, vector::Vector};
|
|
||||||
|
|
||||||
pub use crate::sampler::Sampler;
|
|
||||||
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "const-generics",
|
|
||||||
deprecated = "Legacy image type. Use `spirv_std::image::Image2d` instead."
|
|
||||||
)]
|
|
||||||
#[spirv(image_type(
|
|
||||||
// sampled_type is hardcoded to f32 for now
|
|
||||||
dim = "Dim2D",
|
|
||||||
depth = 0,
|
|
||||||
arrayed = 0,
|
|
||||||
multisampled = 0,
|
|
||||||
sampled = 1,
|
|
||||||
image_format = "Unknown"
|
|
||||||
))]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct Image2d {
|
|
||||||
_x: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(deprecated)]
|
|
||||||
impl Image2d {
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleImplicitLod")]
|
|
||||||
pub fn sample<V: Vector<f32, 4>>(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 2>,
|
|
||||||
) -> V {
|
|
||||||
unsafe {
|
|
||||||
let mut result = Default::default();
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleImplicitLod _ %sampledImage %coordinate",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
);
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleExplicitLod")]
|
|
||||||
/// Sample the image at a coordinate by a lod
|
|
||||||
pub fn sample_by_lod<V: Vector<f32, 4>>(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 2>,
|
|
||||||
lod: f32,
|
|
||||||
) -> V {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%lod = OpLoad _ {lod}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleExplicitLod _ %sampledImage %coordinate Lod %lod",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
lod = in(reg) &lod
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleExplicitLod")]
|
|
||||||
/// Sample the image based on a gradient formed by (dx, dy). Specifically, ([du/dx, dv/dx], [du/dy, dv/dy])
|
|
||||||
pub fn sample_by_gradient<V: Vector<f32, 4>>(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 2>,
|
|
||||||
gradient_dx: impl Vector<f32, 2>,
|
|
||||||
gradient_dy: impl Vector<f32, 2>,
|
|
||||||
) -> V {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%gradient_dx = OpLoad _ {gradient_dx}",
|
|
||||||
"%gradient_dy = OpLoad _ {gradient_dy}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleExplicitLod _ %sampledImage %coordinate Grad %gradient_dx %gradient_dy",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
gradient_dx = in(reg) &gradient_dx,
|
|
||||||
gradient_dy = in(reg) &gradient_dy,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleProjImplicitLod")]
|
|
||||||
pub fn sample_with_project_coordinate<V: Vector<f32, 4>>(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
project_coordinate: impl Vector<f32, 3>,
|
|
||||||
) -> V {
|
|
||||||
unsafe {
|
|
||||||
let mut result = Default::default();
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%project_coordinate = OpLoad _ {project_coordinate}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleProjImplicitLod _ %sampledImage %project_coordinate",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
project_coordinate = in(reg) &project_coordinate,
|
|
||||||
);
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleProjExplicitLod")]
|
|
||||||
/// Sample the image with a project coordinate by a lod
|
|
||||||
pub fn sample_with_project_coordinate_by_lod<V: Vector<f32, 4>>(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
project_coordinate: impl Vector<f32, 3>,
|
|
||||||
lod: f32,
|
|
||||||
) -> V {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%project_coordinate = OpLoad _ {project_coordinate}",
|
|
||||||
"%lod = OpLoad _ {lod}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleProjExplicitLod _ %sampledImage %project_coordinate Lod %lod",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
project_coordinate = in(reg) &project_coordinate,
|
|
||||||
lod = in(reg) &lod
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleProjExplicitLod")]
|
|
||||||
/// Sample the image with a project coordinate based on a gradient formed by (dx, dy). Specifically, ([du/dx, dv/dx], [du/dy, dv/dy])
|
|
||||||
pub fn sample_with_project_coordinate_by_gradient<V: Vector<f32, 4>>(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
project_coordinate: impl Vector<f32, 3>,
|
|
||||||
gradient_dx: impl Vector<f32, 2>,
|
|
||||||
gradient_dy: impl Vector<f32, 2>,
|
|
||||||
) -> V {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%project_coordinate = OpLoad _ {project_coordinate}",
|
|
||||||
"%gradient_dx = OpLoad _ {gradient_dx}",
|
|
||||||
"%gradient_dy = OpLoad _ {gradient_dy}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleProjExplicitLod _ %sampledImage %project_coordinate Grad %gradient_dx %gradient_dy",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
project_coordinate = in(reg) &project_coordinate,
|
|
||||||
gradient_dx = in(reg) &gradient_dx,
|
|
||||||
gradient_dy = in(reg) &gradient_dy,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleDrefImplicitLod")]
|
|
||||||
/// Sample the image's depth reference
|
|
||||||
pub fn sample_depth_reference(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 2>,
|
|
||||||
depth_reference: f32,
|
|
||||||
) -> f32 {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%depth_reference = OpLoad _ {depth_reference}", // not required to do this way, but done for consistency
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleDrefImplicitLod _ %sampledImage %coordinate %depth_reference",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
depth_reference = in(reg) &depth_reference,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleDrefExplicitLod")]
|
|
||||||
/// Sample the image's depth reference based on an explicit lod
|
|
||||||
pub fn sample_depth_reference_by_lod(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 2>,
|
|
||||||
depth_reference: f32,
|
|
||||||
lod: f32,
|
|
||||||
) -> f32 {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%depth_reference = OpLoad _ {depth_reference}",
|
|
||||||
"%lod = OpLoad _ {lod}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleDrefExplicitLod _ %sampledImage %coordinate %depth_reference Lod %lod",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
depth_reference = in(reg) &depth_reference,
|
|
||||||
lod = in(reg) &lod,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleDrefExplicitLod")]
|
|
||||||
/// Sample the image's depth reference based on a gradient formed by (dx, dy).
|
|
||||||
/// Specifically, ([du/dx, dv/dx], [du/dy, dv/dy])
|
|
||||||
pub fn sample_depth_reference_by_gradient(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 2>,
|
|
||||||
depth_reference: f32,
|
|
||||||
gradient_dx: impl Vector<f32, 2>,
|
|
||||||
gradient_dy: impl Vector<f32, 2>,
|
|
||||||
) -> f32 {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%depth_reference = OpLoad _ {depth_reference}",
|
|
||||||
"%gradient_dx = OpLoad _ {gradient_dx}",
|
|
||||||
"%gradient_dy = OpLoad _ {gradient_dy}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleDrefExplicitLod _ %sampledImage %coordinate %depth_reference Grad %gradient_dx %gradient_dy",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
depth_reference = in(reg) &depth_reference,
|
|
||||||
gradient_dx = in(reg) &gradient_dx,
|
|
||||||
gradient_dy = in(reg) &gradient_dy,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleProjDrefImplicitLod")]
|
|
||||||
/// Sample the image's depth reference with the project coordinate
|
|
||||||
pub fn sample_depth_reference_with_project_coordinate(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
project_coordinate: impl Vector<f32, 3>,
|
|
||||||
depth_reference: f32,
|
|
||||||
) -> f32 {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%project_coordinate = OpLoad _ {project_coordinate}",
|
|
||||||
"%depth_reference = OpLoad _ {depth_reference}", // not required to do this way, but done for consistency
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleProjDrefImplicitLod _ %sampledImage %project_coordinate %depth_reference",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
project_coordinate = in(reg) &project_coordinate,
|
|
||||||
depth_reference = in(reg) &depth_reference,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleProjDrefExplicitLod")]
|
|
||||||
/// Sample the image's depth reference with the project coordinate based on an explicit lod
|
|
||||||
pub fn sample_depth_reference_with_project_coordinate_by_lod(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
depth_reference: f32,
|
|
||||||
lod: f32,
|
|
||||||
) -> f32 {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%depth_reference = OpLoad _ {depth_reference}",
|
|
||||||
"%lod = OpLoad _ {lod}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleProjDrefExplicitLod _ %sampledImage %coordinate %depth_reference Lod %lod",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
depth_reference = in(reg) &depth_reference,
|
|
||||||
lod = in(reg) &lod,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleProjDrefExplicitLod")]
|
|
||||||
/// Sample the image's depth reference with the project coordinate based on a gradient formed by (dx, dy).
|
|
||||||
/// Specifically, ([du/dx, dv/dx], [du/dy, dv/dy])
|
|
||||||
pub fn sample_depth_reference_with_project_coordinate_by_gradient(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
depth_reference: f32,
|
|
||||||
gradient_dx: impl Vector<f32, 2>,
|
|
||||||
gradient_dy: impl Vector<f32, 2>,
|
|
||||||
) -> f32 {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%depth_reference = OpLoad _ {depth_reference}",
|
|
||||||
"%gradient_dx = OpLoad _ {gradient_dx}",
|
|
||||||
"%gradient_dy = OpLoad _ {gradient_dy}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleProjDrefExplicitLod _ %sampledImage %coordinate %depth_reference Grad %gradient_dx %gradient_dy",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
depth_reference = in(reg) &depth_reference,
|
|
||||||
gradient_dx = in(reg) &gradient_dx,
|
|
||||||
gradient_dy = in(reg) &gradient_dy,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Fetch a single texel with a sampler set at compile time
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageFetch")]
|
|
||||||
pub fn fetch<V, I, const N: usize>(&self, coordinate: impl Vector<I, N>) -> V
|
|
||||||
where
|
|
||||||
V: Vector<f32, 4>,
|
|
||||||
I: Integer,
|
|
||||||
{
|
|
||||||
let mut result = V::default();
|
|
||||||
unsafe {
|
|
||||||
asm! {
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%result = OpImageFetch typeof*{result} %image %coordinate",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "const-generics",
|
|
||||||
deprecated = "Legacy image type. Use `spirv_std::image::StorageImage2d` instead."
|
|
||||||
)]
|
|
||||||
#[spirv(image_type(
|
|
||||||
// sampled_type is hardcoded to f32 for now
|
|
||||||
dim = "Dim2D",
|
|
||||||
depth = 0,
|
|
||||||
arrayed = 0,
|
|
||||||
multisampled = 0,
|
|
||||||
sampled = 2,
|
|
||||||
image_format = "Unknown"
|
|
||||||
))]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct StorageImage2d {
|
|
||||||
_x: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(deprecated)]
|
|
||||||
impl StorageImage2d {
|
|
||||||
/// Read a texel from an image without a sampler.
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageRead")]
|
|
||||||
pub fn read<I, V, const N: usize>(&self, coordinate: impl Vector<I, 2>) -> V
|
|
||||||
where
|
|
||||||
I: Integer,
|
|
||||||
V: Vector<f32, N>,
|
|
||||||
{
|
|
||||||
let mut result = V::default();
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
asm! {
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%result = OpImageRead typeof*{result} %image %coordinate",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
this = in(reg) self,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Write a texel to an image without a sampler.
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageWrite")]
|
|
||||||
pub unsafe fn write<I, const N: usize>(
|
|
||||||
&self,
|
|
||||||
coordinate: impl Vector<I, 2>,
|
|
||||||
texels: impl Vector<f32, N>,
|
|
||||||
) where
|
|
||||||
I: Integer,
|
|
||||||
{
|
|
||||||
asm! {
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%texels = OpLoad _ {texels}",
|
|
||||||
"OpImageWrite %image %coordinate %texels",
|
|
||||||
this = in(reg) self,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
texels = in(reg) &texels,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "const-generics",
|
|
||||||
deprecated = "Legacy image type. Use `spirv_std::image::Image2dArray` instead."
|
|
||||||
)]
|
|
||||||
#[spirv(image_type(
|
|
||||||
// sampled_type is hardcoded to f32 for now
|
|
||||||
dim = "Dim2D",
|
|
||||||
depth = 0,
|
|
||||||
arrayed = 1,
|
|
||||||
multisampled = 0,
|
|
||||||
sampled = 1,
|
|
||||||
image_format = "Unknown"
|
|
||||||
))]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct Image2dArray {
|
|
||||||
_x: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(deprecated)]
|
|
||||||
impl Image2dArray {
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleImplicitLod")]
|
|
||||||
pub fn sample<V: Vector<f32, 4>>(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
) -> V {
|
|
||||||
unsafe {
|
|
||||||
let mut result = V::default();
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleImplicitLod _ %sampledImage %coordinate",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
);
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleExplicitLod")]
|
|
||||||
/// Sample the image at a coordinate by a lod
|
|
||||||
pub fn sample_by_lod<V: Vector<f32, 4>>(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
lod: f32,
|
|
||||||
) -> V {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%lod = OpLoad _ {lod}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleExplicitLod _ %sampledImage %coordinate Lod %lod",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
lod = in(reg) &lod
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleExplicitLod")]
|
|
||||||
/// Sample the image based on a gradient formed by (dx, dy). Specifically, ([du/dx, dv/dx], [du/dy, dv/dy])
|
|
||||||
pub fn sample_by_gradient<V: Vector<f32, 4>>(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
gradient_dx: impl Vector<f32, 2>,
|
|
||||||
gradient_dy: impl Vector<f32, 2>,
|
|
||||||
) -> V {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%gradient_dx = OpLoad _ {gradient_dx}",
|
|
||||||
"%gradient_dy = OpLoad _ {gradient_dy}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleExplicitLod _ %sampledImage %coordinate Grad %gradient_dx %gradient_dy",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
gradient_dx = in(reg) &gradient_dx,
|
|
||||||
gradient_dy = in(reg) &gradient_dy,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleDrefImplicitLod")]
|
|
||||||
/// Sample the image's depth reference
|
|
||||||
pub fn sample_depth_reference(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
depth_reference: f32,
|
|
||||||
) -> f32 {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%depth_reference = OpLoad _ {depth_reference}", // not required to do this way, but done for consistency
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleDrefImplicitLod _ %sampledImage %coordinate %depth_reference",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
depth_reference = in(reg) &depth_reference,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleDrefExplicitLod")]
|
|
||||||
/// Sample the image's depth reference based on an explicit lod
|
|
||||||
pub fn sample_depth_reference_by_lod(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
depth_reference: f32,
|
|
||||||
lod: f32,
|
|
||||||
) -> f32 {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%depth_reference = OpLoad _ {depth_reference}",
|
|
||||||
"%lod = OpLoad _ {lod}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleDrefExplicitLod _ %sampledImage %coordinate %depth_reference Lod %lod",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
depth_reference = in(reg) &depth_reference,
|
|
||||||
lod = in(reg) &lod,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleDrefExplicitLod")]
|
|
||||||
/// Sample the image's depth reference based on a gradient formed by (dx, dy).
|
|
||||||
/// Specifically, ([du/dx, dv/dx], [du/dy, dv/dy])
|
|
||||||
pub fn sample_depth_reference_by_gradient(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
depth_reference: f32,
|
|
||||||
gradient_dx: impl Vector<f32, 2>,
|
|
||||||
gradient_dy: impl Vector<f32, 2>,
|
|
||||||
) -> f32 {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%depth_reference = OpLoad _ {depth_reference}",
|
|
||||||
"%gradient_dx = OpLoad _ {gradient_dx}",
|
|
||||||
"%gradient_dy = OpLoad _ {gradient_dy}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleDrefExplicitLod _ %sampledImage %coordinate %depth_reference Grad %gradient_dx %gradient_dy",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
depth_reference = in(reg) &depth_reference,
|
|
||||||
gradient_dx = in(reg) &gradient_dx,
|
|
||||||
gradient_dy = in(reg) &gradient_dy,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "const-generics",
|
|
||||||
deprecated = "Legacy image type. Use `spirv_std::image::Cubemap` instead."
|
|
||||||
)]
|
|
||||||
#[spirv(image_type(
|
|
||||||
// sampled_type is hardcoded to f32 for now
|
|
||||||
dim = "DimCube",
|
|
||||||
depth = 0,
|
|
||||||
arrayed = 0,
|
|
||||||
multisampled = 0,
|
|
||||||
sampled = 1,
|
|
||||||
image_format = "Unknown"
|
|
||||||
))]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct Cubemap {
|
|
||||||
_x: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(deprecated)]
|
|
||||||
impl Cubemap {
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpSampledImage")]
|
|
||||||
pub fn sample<V: Vector<f32, 4>>(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
) -> V {
|
|
||||||
unsafe {
|
|
||||||
let mut result = Default::default();
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleImplicitLod _ %sampledImage %coordinate",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
);
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleExplicitLod")]
|
|
||||||
/// Sample the image at a coordinate by a lod
|
|
||||||
pub fn sample_by_lod<V: Vector<f32, 4>>(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
lod: f32,
|
|
||||||
) -> V {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%lod = OpLoad _ {lod}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleExplicitLod _ %sampledImage %coordinate Lod %lod",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
lod = in(reg) &lod
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleExplicitLod")]
|
|
||||||
/// Sample the image based on a gradient formed by (dx, dy). Specifically, ([du/dx, dv/dx, dw/dx], [du/dy, dv/dy, dw/dy])
|
|
||||||
pub fn sample_by_gradient<V: Vector<f32, 4>>(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
gradient_dx: impl Vector<f32, 3>,
|
|
||||||
gradient_dy: impl Vector<f32, 3>,
|
|
||||||
) -> V {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%gradient_dx = OpLoad _ {gradient_dx}",
|
|
||||||
"%gradient_dy = OpLoad _ {gradient_dy}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleExplicitLod _ %sampledImage %coordinate Grad %gradient_dx %gradient_dy",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
gradient_dx = in(reg) &gradient_dx,
|
|
||||||
gradient_dy = in(reg) &gradient_dy,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleDrefImplicitLod")]
|
|
||||||
/// Sample the image's depth reference
|
|
||||||
pub fn sample_depth_reference(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
depth_reference: f32,
|
|
||||||
) -> f32 {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%depth_reference = OpLoad _ {depth_reference}", // not required to do this way, but done for consistency
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleDrefImplicitLod _ %sampledImage %coordinate %depth_reference",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
depth_reference = in(reg) &depth_reference,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleDrefExplicitLod")]
|
|
||||||
/// Sample the image's depth reference based on an explicit lod
|
|
||||||
pub fn sample_depth_reference_by_lod(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
depth_reference: f32,
|
|
||||||
lod: f32,
|
|
||||||
) -> f32 {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%depth_reference = OpLoad _ {depth_reference}",
|
|
||||||
"%lod = OpLoad _ {lod}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleDrefExplicitLod _ %sampledImage %coordinate %depth_reference Lod %lod",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
depth_reference = in(reg) &depth_reference,
|
|
||||||
lod = in(reg) &lod,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleDrefExplicitLod")]
|
|
||||||
/// Sample the image's depth reference based on a gradient formed by (dx, dy).
|
|
||||||
/// Specifically, ([du/dx, dv/dx, dw/dx], [du/dy, dv/dy, dw/dy])
|
|
||||||
pub fn sample_depth_reference_by_gradient(
|
|
||||||
&self,
|
|
||||||
sampler: Sampler,
|
|
||||||
coordinate: impl Vector<f32, 3>,
|
|
||||||
depth_reference: f32,
|
|
||||||
gradient_dx: impl Vector<f32, 3>,
|
|
||||||
gradient_dy: impl Vector<f32, 3>,
|
|
||||||
) -> f32 {
|
|
||||||
let mut result = Default::default();
|
|
||||||
unsafe {
|
|
||||||
asm!(
|
|
||||||
"%image = OpLoad _ {this}",
|
|
||||||
"%sampler = OpLoad _ {sampler}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%depth_reference = OpLoad _ {depth_reference}",
|
|
||||||
"%gradient_dx = OpLoad _ {gradient_dx}",
|
|
||||||
"%gradient_dy = OpLoad _ {gradient_dy}",
|
|
||||||
"%sampledImage = OpSampledImage _ %image %sampler",
|
|
||||||
"%result = OpImageSampleDrefExplicitLod _ %sampledImage %coordinate %depth_reference Grad %gradient_dx %gradient_dy",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
sampler = in(reg) &sampler,
|
|
||||||
coordinate = in(reg) &coordinate,
|
|
||||||
depth_reference = in(reg) &depth_reference,
|
|
||||||
gradient_dx = in(reg) &gradient_dx,
|
|
||||||
gradient_dy = in(reg) &gradient_dy,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg_attr(
|
|
||||||
feature = "const-generics",
|
|
||||||
deprecated = "Legacy image type. Use `spirv_std::image::SampledImage` instead."
|
|
||||||
)]
|
|
||||||
#[spirv(sampled_image)]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct SampledImage<I> {
|
|
||||||
_image: I,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(deprecated)]
|
|
||||||
impl SampledImage<Image2d> {
|
|
||||||
#[spirv_std_macros::gpu_only]
|
|
||||||
#[doc(alias = "OpImageSampleImplicitLod")]
|
|
||||||
pub fn sample<V: Vector<f32, 4>>(&self, coordinate: impl Vector<f32, 2>) -> V {
|
|
||||||
unsafe {
|
|
||||||
let mut result = Default::default();
|
|
||||||
asm!(
|
|
||||||
"%sampledImage = OpLoad _ {this}",
|
|
||||||
"%coordinate = OpLoad _ {coordinate}",
|
|
||||||
"%result = OpImageSampleImplicitLod _ %sampledImage %coordinate",
|
|
||||||
"OpStore {result} %result",
|
|
||||||
result = in(reg) &mut result,
|
|
||||||
this = in(reg) self,
|
|
||||||
coordinate = in(reg) &coordinate
|
|
||||||
);
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,11 +16,3 @@ and is likely what you want if you want a regular old sampled texture.
|
|||||||
```rust,no_run
|
```rust,no_run
|
||||||
type Image2d = Image!(2D, type=f32, sampled);
|
type Image2d = Image!(2D, type=f32, sampled);
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that the `const-generics` cargo feature in spirv-std must be enabled to use the `Image!` macro
|
|
||||||
at the moment. This will likely change in the near future.
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[dependencies]
|
|
||||||
spirv-std = { ..., features = ["const-generics"] }
|
|
||||||
```
|
|
||||||
|
@ -8,4 +8,4 @@ license = "MIT OR Apache-2.0"
|
|||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
spirv-std = { path = "../../crates/spirv-std", features = ["const-generics", "glam"] }
|
spirv-std = { path = "../../crates/spirv-std", features = ["glam"] }
|
||||||
|
@ -31,8 +31,7 @@
|
|||||||
// * 1 on `_closure`
|
// * 1 on `_closure`
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -42,8 +41,7 @@ macro_rules! _macro {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -51,8 +49,7 @@ macro_rules! _macro {
|
|||||||
extern crate spirv_std as _;
|
extern crate spirv_std as _;
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -60,8 +57,7 @@ extern crate spirv_std as _;
|
|||||||
use spirv_std as _;
|
use spirv_std as _;
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -69,16 +65,14 @@ use spirv_std as _;
|
|||||||
mod _mod {}
|
mod _mod {}
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
)]
|
)]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -86,8 +80,7 @@ extern "C" {
|
|||||||
type _ForeignTy;
|
type _ForeignTy;
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -95,8 +88,7 @@ extern "C" {
|
|||||||
static _FOREIGN_STATIC: ();
|
static _FOREIGN_STATIC: ();
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -105,8 +97,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -114,8 +105,7 @@ extern "C" {
|
|||||||
static _STATIC: () = ();
|
static _STATIC: () = ();
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -123,8 +113,7 @@ static _STATIC: () = ();
|
|||||||
const _CONST: () = ();
|
const _CONST: () = ();
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -132,8 +121,7 @@ const _CONST: () = ();
|
|||||||
type _TyAlias = ();
|
type _TyAlias = ();
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -145,24 +133,21 @@ fn _opaque_ty_definer() -> _OpaqueTy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
)]
|
)]
|
||||||
enum _Enum {
|
enum _Enum {
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
)]
|
)]
|
||||||
_Variant {
|
_Variant {
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -172,16 +157,14 @@ enum _Enum {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
)]
|
)]
|
||||||
union _Union {
|
union _Union {
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -196,8 +179,7 @@ union _Union {
|
|||||||
)]
|
)]
|
||||||
struct _Struct {
|
struct _Struct {
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -206,16 +188,14 @@ struct _Struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
)]
|
)]
|
||||||
impl _Struct {
|
impl _Struct {
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -223,16 +203,14 @@ impl _Struct {
|
|||||||
const _INHERENT_ASSOC_CONST: () = ();
|
const _INHERENT_ASSOC_CONST: () = ();
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
)]
|
)]
|
||||||
fn _inherent_method() {}
|
fn _inherent_method() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -240,16 +218,14 @@ impl _Struct {
|
|||||||
trait _TraitAlias = Copy;
|
trait _TraitAlias = Copy;
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
)]
|
)]
|
||||||
trait _Trait {
|
trait _Trait {
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -257,8 +233,7 @@ trait _Trait {
|
|||||||
type _AssocTy;
|
type _AssocTy;
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -266,8 +241,7 @@ trait _Trait {
|
|||||||
const _TRAIT_ASSOC_CONST: ();
|
const _TRAIT_ASSOC_CONST: ();
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -275,24 +249,21 @@ trait _Trait {
|
|||||||
fn _trait_method();
|
fn _trait_method();
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
)]
|
)]
|
||||||
fn _trait_method_with_default() {}
|
fn _trait_method_with_default() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
)]
|
)]
|
||||||
impl _Trait for () {
|
impl _Trait for () {
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -300,8 +271,7 @@ impl _Trait for () {
|
|||||||
type _AssocTy = ();
|
type _AssocTy = ();
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -309,30 +279,26 @@ impl _Trait for () {
|
|||||||
const _TRAIT_ASSOC_CONST: () = ();
|
const _TRAIT_ASSOC_CONST: () = ();
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
)]
|
)]
|
||||||
fn _trait_method() {}
|
fn _trait_method() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
)]
|
)]
|
||||||
fn _fn(
|
fn _fn(
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
)]
|
)]
|
||||||
_entry_param: (),
|
_entry_param: (),
|
||||||
) {
|
) {
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -340,8 +306,7 @@ fn _fn(
|
|||||||
let _statement = ();
|
let _statement = ();
|
||||||
|
|
||||||
let _closure = #[spirv(
|
let _closure = #[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
)]
|
)]
|
||||||
@ -349,8 +314,7 @@ fn _fn(
|
|||||||
|
|
||||||
(
|
(
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -360,8 +324,7 @@ fn _fn(
|
|||||||
|
|
||||||
match () {
|
match () {
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
@ -372,22 +335,19 @@ fn _fn(
|
|||||||
|
|
||||||
fn _fn_with_generics<
|
fn _fn_with_generics<
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
)] '_lifetime_param,
|
)] '_lifetime_param,
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
)] _TyParam,
|
)] _TyParam,
|
||||||
#[spirv(
|
#[spirv(
|
||||||
sampler, block, sampled_image, // struct-only (incl. `image_type`)
|
sampler, block, sampled_image, generic_image_type, // struct-only
|
||||||
image_type(dim = "Dim2D", depth = 0, arrayed = 0, multisampled = 0, sampled = 1, image_format = "Unknown"),
|
|
||||||
vertex, // fn-only
|
vertex, // fn-only
|
||||||
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
|
||||||
unroll_loops, // fn/closure-only
|
unroll_loops, // fn/closure-only
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -8,17 +8,7 @@ use spirv_std as _;
|
|||||||
#[spirv(sampler, sampler)]
|
#[spirv(sampler, sampler)]
|
||||||
struct _SameIntrinsicType {}
|
struct _SameIntrinsicType {}
|
||||||
|
|
||||||
#[spirv(
|
#[spirv(sampler, generic_image_type)]
|
||||||
sampler,
|
|
||||||
image_type(
|
|
||||||
dim = "Dim2D",
|
|
||||||
depth = 0,
|
|
||||||
arrayed = 0,
|
|
||||||
multisampled = 0,
|
|
||||||
sampled = 1,
|
|
||||||
image_format = "Unknown"
|
|
||||||
)
|
|
||||||
)]
|
|
||||||
struct _DiffIntrinsicType {}
|
struct _DiffIntrinsicType {}
|
||||||
|
|
||||||
#[spirv(block, block)]
|
#[spirv(block, block)]
|
||||||
|
@ -11,195 +11,189 @@ note: previous intrinsic type attribute
|
|||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: only one intrinsic type attribute is allowed on a struct
|
error: only one intrinsic type attribute is allowed on a struct
|
||||||
--> $DIR/multiple.rs:13:5
|
--> $DIR/multiple.rs:11:18
|
||||||
|
|
|
|
||||||
13 | / image_type(
|
11 | #[spirv(sampler, generic_image_type)]
|
||||||
14 | | dim = "Dim2D",
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
15 | | depth = 0,
|
|
||||||
16 | | arrayed = 0,
|
|
||||||
... |
|
|
||||||
19 | | image_format = "Unknown"
|
|
||||||
20 | | )
|
|
||||||
| |_____^
|
|
||||||
|
|
|
|
||||||
note: previous intrinsic type attribute
|
note: previous intrinsic type attribute
|
||||||
--> $DIR/multiple.rs:12:5
|
--> $DIR/multiple.rs:11:9
|
||||||
|
|
|
|
||||||
12 | sampler,
|
11 | #[spirv(sampler, generic_image_type)]
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: only one #[spirv(block)] attribute is allowed on a struct
|
error: only one #[spirv(block)] attribute is allowed on a struct
|
||||||
--> $DIR/multiple.rs:24:16
|
--> $DIR/multiple.rs:14:16
|
||||||
|
|
|
|
||||||
24 | #[spirv(block, block)]
|
14 | #[spirv(block, block)]
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
note: previous #[spirv(block)] attribute
|
note: previous #[spirv(block)] attribute
|
||||||
--> $DIR/multiple.rs:24:9
|
--> $DIR/multiple.rs:14:9
|
||||||
|
|
|
|
||||||
24 | #[spirv(block, block)]
|
14 | #[spirv(block, block)]
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
||||||
warning: #[spirv(block)] is no longer needed and should be removed
|
warning: #[spirv(block)] is no longer needed and should be removed
|
||||||
--> $DIR/multiple.rs:24:9
|
--> $DIR/multiple.rs:14:9
|
||||||
|
|
|
|
||||||
24 | #[spirv(block, block)]
|
14 | #[spirv(block, block)]
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
||||||
error: only one entry-point attribute is allowed on a function
|
error: only one entry-point attribute is allowed on a function
|
||||||
--> $DIR/multiple.rs:27:17
|
--> $DIR/multiple.rs:17:17
|
||||||
|
|
|
|
||||||
27 | #[spirv(vertex, vertex)]
|
17 | #[spirv(vertex, vertex)]
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
|
|
||||||
note: previous entry-point attribute
|
note: previous entry-point attribute
|
||||||
--> $DIR/multiple.rs:27:9
|
--> $DIR/multiple.rs:17:9
|
||||||
|
|
|
|
||||||
27 | #[spirv(vertex, vertex)]
|
17 | #[spirv(vertex, vertex)]
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error: only one entry-point attribute is allowed on a function
|
error: only one entry-point attribute is allowed on a function
|
||||||
--> $DIR/multiple.rs:30:17
|
--> $DIR/multiple.rs:20:17
|
||||||
|
|
|
|
||||||
30 | #[spirv(vertex, fragment)]
|
20 | #[spirv(vertex, fragment)]
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
|
|
||||||
note: previous entry-point attribute
|
note: previous entry-point attribute
|
||||||
--> $DIR/multiple.rs:30:9
|
--> $DIR/multiple.rs:20:9
|
||||||
|
|
|
|
||||||
30 | #[spirv(vertex, fragment)]
|
20 | #[spirv(vertex, fragment)]
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error: only one storage class attribute is allowed on a function param
|
error: only one storage class attribute is allowed on a function param
|
||||||
--> $DIR/multiple.rs:35:22
|
--> $DIR/multiple.rs:25:22
|
||||||
|
|
|
|
||||||
35 | #[spirv(uniform, uniform)] _same_storage_class: (),
|
25 | #[spirv(uniform, uniform)] _same_storage_class: (),
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
|
|
||||||
note: previous storage class attribute
|
note: previous storage class attribute
|
||||||
--> $DIR/multiple.rs:35:13
|
--> $DIR/multiple.rs:25:13
|
||||||
|
|
|
|
||||||
35 | #[spirv(uniform, uniform)] _same_storage_class: (),
|
25 | #[spirv(uniform, uniform)] _same_storage_class: (),
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: only one storage class attribute is allowed on a function param
|
error: only one storage class attribute is allowed on a function param
|
||||||
--> $DIR/multiple.rs:36:22
|
--> $DIR/multiple.rs:26:22
|
||||||
|
|
|
|
||||||
36 | #[spirv(uniform, push_constant)] _diff_storage_class: (),
|
26 | #[spirv(uniform, push_constant)] _diff_storage_class: (),
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: previous storage class attribute
|
note: previous storage class attribute
|
||||||
--> $DIR/multiple.rs:36:13
|
--> $DIR/multiple.rs:26:13
|
||||||
|
|
|
|
||||||
36 | #[spirv(uniform, push_constant)] _diff_storage_class: (),
|
26 | #[spirv(uniform, push_constant)] _diff_storage_class: (),
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: only one builtin attribute is allowed on a function param
|
error: only one builtin attribute is allowed on a function param
|
||||||
--> $DIR/multiple.rs:38:23
|
--> $DIR/multiple.rs:28:23
|
||||||
|
|
|
|
||||||
38 | #[spirv(position, position)] _same_builtin: (),
|
28 | #[spirv(position, position)] _same_builtin: (),
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
|
|
||||||
note: previous builtin attribute
|
note: previous builtin attribute
|
||||||
--> $DIR/multiple.rs:38:13
|
--> $DIR/multiple.rs:28:13
|
||||||
|
|
|
|
||||||
38 | #[spirv(position, position)] _same_builtin: (),
|
28 | #[spirv(position, position)] _same_builtin: (),
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error: only one builtin attribute is allowed on a function param
|
error: only one builtin attribute is allowed on a function param
|
||||||
--> $DIR/multiple.rs:39:23
|
--> $DIR/multiple.rs:29:23
|
||||||
|
|
|
|
||||||
39 | #[spirv(position, vertex_index)] _diff_builtin: (),
|
29 | #[spirv(position, vertex_index)] _diff_builtin: (),
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: previous builtin attribute
|
note: previous builtin attribute
|
||||||
--> $DIR/multiple.rs:39:13
|
--> $DIR/multiple.rs:29:13
|
||||||
|
|
|
|
||||||
39 | #[spirv(position, vertex_index)] _diff_builtin: (),
|
29 | #[spirv(position, vertex_index)] _diff_builtin: (),
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error: only one #[spirv(descriptor_set)] attribute is allowed on a function param
|
error: only one #[spirv(descriptor_set)] attribute is allowed on a function param
|
||||||
--> $DIR/multiple.rs:41:33
|
--> $DIR/multiple.rs:31:33
|
||||||
|
|
|
|
||||||
41 | #[spirv(descriptor_set = 0, descriptor_set = 0)] _same_descriptor_set: (),
|
31 | #[spirv(descriptor_set = 0, descriptor_set = 0)] _same_descriptor_set: (),
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: previous #[spirv(descriptor_set)] attribute
|
note: previous #[spirv(descriptor_set)] attribute
|
||||||
--> $DIR/multiple.rs:41:13
|
--> $DIR/multiple.rs:31:13
|
||||||
|
|
|
|
||||||
41 | #[spirv(descriptor_set = 0, descriptor_set = 0)] _same_descriptor_set: (),
|
31 | #[spirv(descriptor_set = 0, descriptor_set = 0)] _same_descriptor_set: (),
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: only one #[spirv(descriptor_set)] attribute is allowed on a function param
|
error: only one #[spirv(descriptor_set)] attribute is allowed on a function param
|
||||||
--> $DIR/multiple.rs:42:33
|
--> $DIR/multiple.rs:32:33
|
||||||
|
|
|
|
||||||
42 | #[spirv(descriptor_set = 0, descriptor_set = 1)] _diff_descriptor_set: (),
|
32 | #[spirv(descriptor_set = 0, descriptor_set = 1)] _diff_descriptor_set: (),
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: previous #[spirv(descriptor_set)] attribute
|
note: previous #[spirv(descriptor_set)] attribute
|
||||||
--> $DIR/multiple.rs:42:13
|
--> $DIR/multiple.rs:32:13
|
||||||
|
|
|
|
||||||
42 | #[spirv(descriptor_set = 0, descriptor_set = 1)] _diff_descriptor_set: (),
|
32 | #[spirv(descriptor_set = 0, descriptor_set = 1)] _diff_descriptor_set: (),
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: only one #[spirv(binding)] attribute is allowed on a function param
|
error: only one #[spirv(binding)] attribute is allowed on a function param
|
||||||
--> $DIR/multiple.rs:44:26
|
--> $DIR/multiple.rs:34:26
|
||||||
|
|
|
|
||||||
44 | #[spirv(binding = 0, binding = 0)] _same_binding: (),
|
34 | #[spirv(binding = 0, binding = 0)] _same_binding: (),
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: previous #[spirv(binding)] attribute
|
note: previous #[spirv(binding)] attribute
|
||||||
--> $DIR/multiple.rs:44:13
|
--> $DIR/multiple.rs:34:13
|
||||||
|
|
|
|
||||||
44 | #[spirv(binding = 0, binding = 0)] _same_binding: (),
|
34 | #[spirv(binding = 0, binding = 0)] _same_binding: (),
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error: only one #[spirv(binding)] attribute is allowed on a function param
|
error: only one #[spirv(binding)] attribute is allowed on a function param
|
||||||
--> $DIR/multiple.rs:45:26
|
--> $DIR/multiple.rs:35:26
|
||||||
|
|
|
|
||||||
45 | #[spirv(binding = 0, binding = 1)] _diff_binding: (),
|
35 | #[spirv(binding = 0, binding = 1)] _diff_binding: (),
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: previous #[spirv(binding)] attribute
|
note: previous #[spirv(binding)] attribute
|
||||||
--> $DIR/multiple.rs:45:13
|
--> $DIR/multiple.rs:35:13
|
||||||
|
|
|
|
||||||
45 | #[spirv(binding = 0, binding = 1)] _diff_binding: (),
|
35 | #[spirv(binding = 0, binding = 1)] _diff_binding: (),
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error: only one #[spirv(flat)] attribute is allowed on a function param
|
error: only one #[spirv(flat)] attribute is allowed on a function param
|
||||||
--> $DIR/multiple.rs:47:19
|
--> $DIR/multiple.rs:37:19
|
||||||
|
|
|
|
||||||
47 | #[spirv(flat, flat)] _flat: (),
|
37 | #[spirv(flat, flat)] _flat: (),
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
|
|
||||||
note: previous #[spirv(flat)] attribute
|
note: previous #[spirv(flat)] attribute
|
||||||
--> $DIR/multiple.rs:47:13
|
--> $DIR/multiple.rs:37:13
|
||||||
|
|
|
|
||||||
47 | #[spirv(flat, flat)] _flat: (),
|
37 | #[spirv(flat, flat)] _flat: (),
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
||||||
error: only one #[spirv(invariant)] attribute is allowed on a function param
|
error: only one #[spirv(invariant)] attribute is allowed on a function param
|
||||||
--> $DIR/multiple.rs:49:24
|
--> $DIR/multiple.rs:39:24
|
||||||
|
|
|
|
||||||
49 | #[spirv(invariant, invariant)] _invariant: (),
|
39 | #[spirv(invariant, invariant)] _invariant: (),
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: previous #[spirv(invariant)] attribute
|
note: previous #[spirv(invariant)] attribute
|
||||||
--> $DIR/multiple.rs:49:13
|
--> $DIR/multiple.rs:39:13
|
||||||
|
|
|
|
||||||
49 | #[spirv(invariant, invariant)] _invariant: (),
|
39 | #[spirv(invariant, invariant)] _invariant: (),
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: only one #[spirv(unroll_loops)] attribute is allowed on a function
|
error: only one #[spirv(unroll_loops)] attribute is allowed on a function
|
||||||
--> $DIR/multiple.rs:53:23
|
--> $DIR/multiple.rs:43:23
|
||||||
|
|
|
|
||||||
53 | #[spirv(unroll_loops, unroll_loops)]
|
43 | #[spirv(unroll_loops, unroll_loops)]
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: previous #[spirv(unroll_loops)] attribute
|
note: previous #[spirv(unroll_loops)] attribute
|
||||||
--> $DIR/multiple.rs:53:9
|
--> $DIR/multiple.rs:43:9
|
||||||
|
|
|
|
||||||
53 | #[spirv(unroll_loops, unroll_loops)]
|
43 | #[spirv(unroll_loops, unroll_loops)]
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 16 previous errors; 1 warning emitted
|
error: aborting due to 16 previous errors; 1 warning emitted
|
||||||
|
Loading…
Reference in New Issue
Block a user