stable spirv-std (#335)

* should compile on stable now

* moved allow into cfg_attr

* more allow

* merged cfg_attr's
This commit is contained in:
Viktor Zoutman 2020-12-11 11:31:17 +01:00 committed by GitHub
parent ebf3dbee8d
commit 06de5ba6ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 19 deletions

View File

@ -1,7 +1,9 @@
#![no_std]
#![feature(register_attr, repr_simd, core_intrinsics, lang_items)]
#![cfg_attr(target_arch = "spirv", feature(asm))]
#![register_attr(spirv)]
#![cfg_attr(
target_arch = "spirv",
feature(asm, register_attr, repr_simd, core_intrinsics, lang_items),
register_attr(spirv)
)]
// Our standard Clippy lints that we use in Embark projects, we opt out of a few that are not appropriate for the specific crate (yet)
#![warn(
clippy::all,

View File

@ -9,8 +9,7 @@
macro_rules! storage_class {
($(#[$($meta:meta)+])* storage_class $name:ident ; $($tt:tt)*) => {
$(#[$($meta)+])*
#[allow(unused_attributes)]
$(#[cfg_attr(target_arch = "spirv", allow(unused_attributes), $($meta)+)])*
pub struct $name<'value, T> {
value: &'value mut T,
}
@ -18,8 +17,7 @@ macro_rules! storage_class {
impl<T: Copy> $name<'_, T> {
/// Load the value into memory.
#[inline]
#[allow(unused_attributes)]
#[spirv(really_unsafe_ignore_bitcasts)]
#[cfg_attr(target_arch = "spirv", allow(unused_attributes), spirv(really_unsafe_ignore_bitcasts))]
pub fn load(&self) -> T {
*self.value
}
@ -35,8 +33,7 @@ macro_rules! storage_class {
impl <T: Copy> $name<'_, T> {
/// Store the value in storage.
#[inline]
#[allow(unused_attributes)]
#[spirv(really_unsafe_ignore_bitcasts)]
#[cfg_attr(target_arch = "spirv", allow(unused_attributes), spirv(really_unsafe_ignore_bitcasts))]
pub fn store(&mut self, v: T) {
*self.value = v
}

View File

@ -1,14 +1,12 @@
use glam::{Vec2, Vec3A, Vec4};
#[allow(unused_attributes)]
#[spirv(sampler)]
#[cfg_attr(target_arch = "spirv", allow(unused_attributes), spirv(sampler))]
#[derive(Copy, Clone)]
pub struct Sampler {
_x: u32,
}
#[allow(unused_attributes)]
#[spirv(image(
#[cfg_attr(target_arch = "spirv", allow(unused_attributes), spirv(image(
// sampled_type is hardcoded to f32 for now
dim = "Dim2D",
depth = 0,
@ -16,7 +14,7 @@ pub struct Sampler {
multisampled = 0,
sampled = 1,
image_format = "Unknown"
))]
)))]
#[derive(Copy, Clone)]
pub struct Image2d {
_x: u32,
@ -51,8 +49,7 @@ impl Image2d {
}
}
#[allow(unused_attributes)]
#[spirv(image(
#[cfg_attr(target_arch = "spirv", allow(unused_attributes), spirv(image(
// sampled_type is hardcoded to f32 for now
dim = "Dim2D",
depth = 0,
@ -60,7 +57,7 @@ impl Image2d {
multisampled = 0,
sampled = 1,
image_format = "Unknown"
))]
)))]
#[derive(Copy, Clone)]
pub struct Image2dArray {
_x: u32,
@ -95,8 +92,7 @@ impl Image2dArray {
}
}
#[allow(unused_attributes)]
#[spirv(sampled_image)]
#[cfg_attr(target_arch = "spirv", allow(unused_attributes), spirv(sampled_image))]
#[derive(Copy, Clone)]
pub struct SampledImage<I> {
_image: I,