mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2025-05-02 05:07:25 +00:00
Migration from register_attr to register_tool (#926)
* Accept `#[rust_gpu::spirv()]` attributes rather than `#[spirv()]` in backend * Implemented `#[spirv(..)]` proc macro attribute for all platforms that conditionally translates to `#[rust_gpu::spirv()]` based on platform * Changed `SpirvBuilder` to always apply `register_tool(rust_gpu)` attribute to shader crates * Updated docs * Added changelog
This commit is contained in:
parent
08117395b3
commit
c3a9b9fd3e
CHANGELOG.md
crates
rustc_codegen_spirv/src
spirv-builder/src
spirv-std
docs/src
examples/shaders
compute-shader/src
mouse-shader/src
reduce/src
simplest-shader/src
sky-shader/src
tests
src
ui
arch
all.rsall_memory_barrier.rsall_memory_barrier_with_group_sync.rsany.rsatomic_i_increment.rscontrol_barrier.rsconvert_u_to_acceleration_structure_khr.rsdebug_printf.rsdebug_printf_type_checking.rsdebug_printf_type_checking.stderrdemote_to_helper_invocation.rsdevice_memory_barrier.rsdevice_memory_barrier_with_group_sync.rsemit_stream_vertex.rsemit_vertex.rsend_primitive.rsend_stream_primitive.rsexecute_callable.rsignore_intersection_khr.rsindex_unchecked.rsinteger_min_and_max.rskill.rsmemory_barrier.rsray_query_confirm_intersection_khr.rsray_query_get_intersection_barycentrics_khr.rsray_query_get_intersection_candidate_aabb_opaque_khr.rsray_query_get_intersection_front_face_khr.rsray_query_get_intersection_geometry_index_khr.rsray_query_get_intersection_instance_custom_index_khr.rsray_query_get_intersection_instance_id_khr.rsray_query_get_intersection_object_ray_direction_khr.rsray_query_get_intersection_object_ray_origin_khr.rsray_query_get_intersection_object_to_world_khr.rsray_query_get_intersection_primitive_index_khr.rsray_query_get_intersection_shader_binding_table_record_offset_khr.rsray_query_get_intersection_t_khr.rsray_query_get_intersection_type_khr.rsray_query_get_ray_flags_khr.rsray_query_get_ray_t_min_khr.rsray_query_get_world_ray_direction_khr.rsray_query_get_world_ray_origin_khr.rsray_query_initialize_khr.rsray_query_terminate_khr.rsread_clock_khr.rsreport_intersection_khr.rsterminate_ray_khr.rstrace_ray_khr.rsvector_extract_dynamic.rsvector_insert_dynamic.rsworkgroup_memory_barrier.rsworkgroup_memory_barrier_with_group_sync.rs
byte_addressable_buffer
dis
add_two_ints.rsasm.rsasm_add_two_ints.rsasm_op_decorate.rscomplex_image_sample_inst.rscustom_entry_point.rsentry-pass-mode-cast-array.rsgeneric-fn-op-name.rsindex_user_dst.rsissue-373.rsissue-723-output.rsissue-731.rspass-mode-cast-struct.rsptr_copy.rsptr_read.rsptr_read_method.rsptr_write.rsptr_write_method.rsunroll_loops.rs
glam
hello_world.rsimage
22
CHANGELOG.md
Normal file
22
CHANGELOG.md
Normal file
@ -0,0 +1,22 @@
|
||||
# `rust-gpu` Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed 🛠️
|
||||
|
||||
- 🚨BREAKING🚨 Migrated from `register_attr` to `register_tool`. [More information](docs/src/migration-to-register-tool.md).
|
||||
|
||||
## [0.4.0-alpha.15]
|
||||
|
||||
### Added ⭐
|
||||
|
||||
- Build-time check for nightly toolchain version to provide user-friendly error messages.
|
||||
|
||||
### Changed 🛠️
|
||||
|
||||
- Updated rust toolchain to `nightly-2022-08-29`.
|
@ -1,7 +1,7 @@
|
||||
use crate::attr::{Entry, ExecutionModeExtra, IntrinsicType, SpirvAttribute};
|
||||
use crate::builder::libm_intrinsics;
|
||||
use rspirv::spirv::{BuiltIn, ExecutionMode, ExecutionModel, StorageClass};
|
||||
use rustc_ast::ast::{Attribute, Lit, LitIntType, LitKind, NestedMetaItem};
|
||||
use rustc_ast::ast::{AttrKind, Attribute, Lit, LitIntType, LitKind, NestedMetaItem};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
@ -16,6 +16,7 @@ pub struct Symbols {
|
||||
// Used by `is_blocklisted_fn`.
|
||||
pub fmt_decimal: Symbol,
|
||||
|
||||
pub rust_gpu: Symbol,
|
||||
pub spirv: Symbol,
|
||||
pub spirv_std: Symbol,
|
||||
pub libm: Symbol,
|
||||
@ -373,6 +374,7 @@ impl Symbols {
|
||||
Self {
|
||||
fmt_decimal: Symbol::intern("fmt_decimal"),
|
||||
|
||||
rust_gpu: Symbol::intern("rust_gpu"),
|
||||
spirv: Symbol::intern("spirv"),
|
||||
spirv_std: Symbol::intern("spirv_std"),
|
||||
libm: Symbol::intern("libm"),
|
||||
@ -411,20 +413,44 @@ pub(crate) fn parse_attrs_for_checking<'a>(
|
||||
attrs: &'a [Attribute],
|
||||
) -> impl Iterator<Item = Result<(Span, SpirvAttribute), ParseAttrError>> + 'a {
|
||||
attrs.iter().flat_map(move |attr| {
|
||||
let (whole_attr_error, args) = if !attr.has_name(sym.spirv) {
|
||||
// Use an empty vec here to return empty
|
||||
(None, Vec::new())
|
||||
} else if let Some(args) = attr.meta_item_list() {
|
||||
(None, args)
|
||||
} else {
|
||||
(
|
||||
Some(Err((
|
||||
attr.span,
|
||||
"#[spirv(..)] attribute must have at least one argument".to_string(),
|
||||
))),
|
||||
Vec::new(),
|
||||
)
|
||||
let (whole_attr_error, args) = match attr.kind {
|
||||
AttrKind::Normal(ref normal) => {
|
||||
// #[...]
|
||||
let s = &normal.item.path.segments;
|
||||
if s.len() > 1 && s[0].ident.name == sym.rust_gpu {
|
||||
// #[rust_gpu ...]
|
||||
if s.len() != 2 || s[1].ident.name != sym.spirv {
|
||||
// #[rust_gpu::...] but not #[rust_gpu::spirv]
|
||||
(
|
||||
Some(Err((
|
||||
attr.span,
|
||||
"unknown `rust_gpu` attribute, expected `rust_gpu::spirv`"
|
||||
.to_string(),
|
||||
))),
|
||||
Vec::new(),
|
||||
)
|
||||
} else if let Some(args) = attr.meta_item_list() {
|
||||
// #[rust_gpu::spirv(...)]
|
||||
(None, args)
|
||||
} else {
|
||||
// #[rust_gpu::spirv]
|
||||
(
|
||||
Some(Err((
|
||||
attr.span,
|
||||
"#[rust_gpu::spirv(..)] attribute must have at least one argument"
|
||||
.to_string(),
|
||||
))),
|
||||
Vec::new(),
|
||||
)
|
||||
}
|
||||
} else {
|
||||
// #[...] but not #[rust_gpu ...]
|
||||
(None, Vec::new())
|
||||
}
|
||||
}
|
||||
AttrKind::DocComment(..) => (None, Vec::new()), // doccomment
|
||||
};
|
||||
|
||||
whole_attr_error
|
||||
.into_iter()
|
||||
.chain(args.into_iter().map(move |ref arg| {
|
||||
|
@ -424,6 +424,8 @@ fn invoke_rustc(builder: &SpirvBuilder) -> Result<PathBuf, SpirvBuilderError> {
|
||||
// the default until https://github.com/rust-lang/rust/pull/93969).
|
||||
"-Zbinary-dep-depinfo".to_string(),
|
||||
"-Csymbol-mangling-version=v0".to_string(),
|
||||
"-Zcrate-attr=feature(register_tool)".to_string(),
|
||||
"-Zcrate-attr=register_tool(rust_gpu)".to_string(),
|
||||
];
|
||||
|
||||
let mut llvm_args = vec![];
|
||||
|
@ -77,7 +77,7 @@ use proc_macro2::{Delimiter, Group, Ident, Span, TokenTree};
|
||||
|
||||
use syn::{punctuated::Punctuated, spanned::Spanned, ItemFn, Token};
|
||||
|
||||
use quote::ToTokens;
|
||||
use quote::{quote, ToTokens};
|
||||
use std::fmt::Write;
|
||||
|
||||
/// A macro for creating SPIR-V `OpTypeImage` types. Always produces a
|
||||
@ -138,9 +138,16 @@ pub fn Image(item: TokenStream) -> TokenStream {
|
||||
output.into()
|
||||
}
|
||||
|
||||
/// Replaces all (nested) occurrences of the `#[spirv(..)]` attribute with
|
||||
/// `#[cfg_attr(target_arch="spirv", rust_gpu::spirv(..))]`.
|
||||
#[proc_macro_attribute]
|
||||
pub fn spirv(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
let mut tokens = Vec::new();
|
||||
pub fn spirv(attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
let mut tokens: Vec<TokenTree> = Vec::new();
|
||||
|
||||
// prepend with #[rust_gpu::spirv(..)]
|
||||
let attr: proc_macro2::TokenStream = attr.into();
|
||||
tokens.extend(quote! { #[cfg_attr(target_arch="spirv", rust_gpu::spirv(#attr))] });
|
||||
|
||||
let item: proc_macro2::TokenStream = item.into();
|
||||
for tt in item {
|
||||
match tt {
|
||||
@ -153,7 +160,11 @@ pub fn spirv(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
&& matches!(group.stream().into_iter().next(), Some(TokenTree::Ident(ident)) if ident == "spirv")
|
||||
&& matches!(sub_tokens.last(), Some(TokenTree::Punct(p)) if p.as_char() == '#') =>
|
||||
{
|
||||
sub_tokens.pop();
|
||||
// group matches [spirv ...]
|
||||
let inner = group.stream(); // group stream doesn't include the brackets
|
||||
sub_tokens.extend(
|
||||
quote! { [cfg_attr(target_arch="spirv", rust_gpu::#inner)] },
|
||||
);
|
||||
}
|
||||
_ => sub_tokens.push(tt),
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
//! Small shared crate, to share definitions between `spirv-std`
|
||||
//! and `spirv-std-macros`.
|
||||
|
||||
#![no_std]
|
||||
|
||||
pub mod image_params;
|
||||
|
@ -45,7 +45,7 @@ impl<'a> ByteAddressableBuffer<'a> {
|
||||
/// transmute)
|
||||
pub unsafe fn load<T>(&self, byte_index: u32) -> T {
|
||||
if byte_index + mem::size_of::<T>() as u32 > self.data.len() as u32 {
|
||||
panic!("Index out of range")
|
||||
panic!("Index out of range");
|
||||
}
|
||||
buffer_load_intrinsic(self.data, byte_index)
|
||||
}
|
||||
@ -71,7 +71,7 @@ impl<'a> ByteAddressableBuffer<'a> {
|
||||
/// transmute)
|
||||
pub unsafe fn store<T>(&mut self, byte_index: u32, value: T) {
|
||||
if byte_index + mem::size_of::<T>() as u32 > self.data.len() as u32 {
|
||||
panic!("Index out of range")
|
||||
panic!("Index out of range");
|
||||
}
|
||||
buffer_store_intrinsic(self.data, byte_index, value);
|
||||
}
|
||||
|
@ -6,10 +6,8 @@
|
||||
asm_experimental_arch,
|
||||
core_intrinsics,
|
||||
lang_items,
|
||||
register_attr,
|
||||
repr_simd,
|
||||
),
|
||||
register_attr(spirv)
|
||||
)
|
||||
)]
|
||||
// BEGIN - Embark standard lints v0.4
|
||||
// do not change or add/remove here, but one can add exceptions after this section
|
||||
@ -93,8 +91,9 @@
|
||||
//! Core functions, traits, and more that make up a "standard library" for SPIR-V for use in
|
||||
//! rust-gpu.
|
||||
|
||||
#[cfg_attr(not(target_arch = "spirv"), macro_use)]
|
||||
#[macro_use]
|
||||
pub extern crate spirv_std_macros as macros;
|
||||
pub use macros::spirv;
|
||||
|
||||
pub mod arch;
|
||||
pub mod byte_addressable_buffer;
|
||||
|
@ -2,6 +2,12 @@
|
||||
|
||||
rust-gpu introduces a number of SPIR-V related attributes to express behavior specific to SPIR-V not exposed in the base rust language.
|
||||
|
||||
Before you'll able to use these attributes, make sure you import the attribute from the `spirv-std` crate:
|
||||
|
||||
```rust
|
||||
use spirv_std::spirv;
|
||||
```
|
||||
|
||||
There are a few different categories of attributes:
|
||||
|
||||
## Entry points
|
||||
|
45
docs/src/migration-to-register-tool.md
Normal file
45
docs/src/migration-to-register-tool.md
Normal file
@ -0,0 +1,45 @@
|
||||
# Migration to `register_tool`
|
||||
|
||||
This document applies to [PR#926](https://github.com/EmbarkStudios/rust-gpu/pull/926)
|
||||
|
||||
## What happened
|
||||
|
||||
In a [recent nightly Rust update](https://github.com/rust-lang/rust/commit/76dd5c58a011bb734ad5b8e96fc560374893bc8f), the `register_attr` feature was removed in favor of `register_tool`. Unfortunately, rust-gpu made use of this feature to register the `spirv` attribute.
|
||||
|
||||
## What does this mean for you as a shader maintainer
|
||||
|
||||
You'll need to import the `spirv` proc macro attribute from `spirv-std` in order for the rust compiler:
|
||||
|
||||
```rust
|
||||
use spirv_std::spirv;
|
||||
```
|
||||
|
||||
If your shader code already contains this line but is conditionally only included for non-spirv builds, like so:
|
||||
|
||||
```rust
|
||||
#[cfg(not(target_arch = "spirv"))]
|
||||
use spirv_std::spirv;
|
||||
```
|
||||
|
||||
please remove the conditional attribute.
|
||||
|
||||
For this macro attribute to work correctly, it is important that `spirv` is visible in the global score and you use it like you used it before: `#[spirv(..)]`. An attempt to scope the attribute (such as `#[spirv_std::spirv(..)]`) will confuse the macro and likely fail.
|
||||
|
||||
You'll also need to remove the `feature(register_attr)` and `register_attr(spirv)` attributes from your shader crates. If you're building using `SpirvBuilder`, you don't need to do anything else; the new `register_tool` is applied automatically. If not, you'll need to include these attributes instead:
|
||||
|
||||
```rust
|
||||
#![feature(register_tool)]
|
||||
#![register_tool(rust_gpu)]
|
||||
```
|
||||
|
||||
That's it. Your shaders should now compile like before.
|
||||
|
||||
## Technical Background
|
||||
|
||||
Unfortunately, since the new Rust nightly toolchain in September 2022, `register_attr(spirv)` can no longer be used to register a global `spirv` attribute. Without this registration, the compiler would simply complain about `spirv` being an unknown attribute. However, the alternative, `register_tool`, requires us to scope the attribute in a namespace. For instance, as we've chosen the `rust_gpu` namespace, this would mean that you'd need to start writing `#[rust_gpu::spirv(..)]` instead, which would be quite tedious and would break a lot of code. And it's not possible to `use` a name from a tool namespace to bring it into scope.
|
||||
|
||||
Instead, we opted to implement a proc macro attribute called `spirv` instead[^1]. This macro attribute scans the item it is applied to, and translates any `#[spirv(..)]` it finds into `#[rust_gpu::spirv(..)]` which will be subsequently handled by the codegen backend. Because it is now a proc macro attribute exported from `spirv_std`, you need to do `use spirv_std::spirv` to make it globally visible in your crate. ***Note that we recommend using the `spirv` proc macro attribute itself rather than the `rust_gpu::spirv` attribute it translates to, as the latter is subject to change.***
|
||||
|
||||
We've also added the `feature(register_tool)` and `register_tool(rust_gpu)` crate attributes by default when compiling through `SpirvBuilder`. This will silence any error that you would otherwise get for applying a `rust_gpu` scoped attribute.
|
||||
|
||||
[^1]: This is not entirely true. In reality, the `spirv` proc macro attribute already existed, but only for non-spirv builds. It was used to turn the `#[spirv(..)]` attribute into a no-op. The proc macro is now used on all platforms, and it emits `#[cfg_attr(target_arch="spirv", rust_gpu::spirv(..))]` for each usage of `#[spirv(..)]`.
|
@ -1,16 +1,9 @@
|
||||
#![cfg_attr(
|
||||
target_arch = "spirv",
|
||||
feature(register_attr),
|
||||
register_attr(spirv),
|
||||
no_std
|
||||
)]
|
||||
#![cfg_attr(target_arch = "spirv", no_std)]
|
||||
// HACK(eddyb) can't easily see warnings otherwise from `spirv-builder` builds.
|
||||
#![deny(warnings)]
|
||||
|
||||
use glam::UVec3;
|
||||
use spirv_std::glam;
|
||||
#[cfg(not(target_arch = "spirv"))]
|
||||
use spirv_std::macros::spirv;
|
||||
use spirv_std::{glam, spirv};
|
||||
|
||||
// Adapted from the wgpu hello-compute example
|
||||
|
||||
|
@ -1,24 +1,17 @@
|
||||
#![cfg_attr(
|
||||
target_arch = "spirv",
|
||||
no_std,
|
||||
feature(register_attr),
|
||||
register_attr(spirv)
|
||||
)]
|
||||
#![cfg_attr(target_arch = "spirv", no_std)]
|
||||
// HACK(eddyb) can't easily see warnings otherwise from `spirv-builder` builds.
|
||||
#![deny(warnings)]
|
||||
|
||||
use core::f32::consts::PI;
|
||||
use glam::{const_vec4, vec2, vec3, Mat2, Vec2, Vec3, Vec4, Vec4Swizzles};
|
||||
use shared::*;
|
||||
use spirv_std::spirv;
|
||||
|
||||
// Note: This cfg is incorrect on its surface, it really should be "are we compiling with std", but
|
||||
// we tie #[no_std] above to the same condition, so it's fine.
|
||||
#[cfg(target_arch = "spirv")]
|
||||
use spirv_std::num_traits::Float;
|
||||
|
||||
#[cfg(not(target_arch = "spirv"))]
|
||||
use spirv_std::macros::spirv;
|
||||
|
||||
trait Shape: Copy {
|
||||
/// Distances indicate where the point is in relation to the shape:
|
||||
/// * negative distance: the point is "inside" the shape
|
||||
|
@ -1,17 +1,11 @@
|
||||
#![cfg_attr(
|
||||
target_arch = "spirv",
|
||||
no_std,
|
||||
feature(register_attr),
|
||||
register_attr(spirv)
|
||||
)]
|
||||
#![cfg_attr(target_arch = "spirv", no_std)]
|
||||
#![allow(clippy::too_many_arguments, clippy::missing_safety_doc)]
|
||||
// HACK(eddyb) can't easily see warnings otherwise from `spirv-builder` builds.
|
||||
#![deny(warnings)]
|
||||
use spirv_std::glam::UVec3;
|
||||
#[cfg(not(target_arch = "spirv"))]
|
||||
use spirv_std::macros::spirv;
|
||||
#[cfg(target_arch = "spirv")]
|
||||
use spirv_std::memory::Scope;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[doc(alias = "OpGroupNonUniformIAdd")]
|
||||
#[cfg(target_arch = "spirv")]
|
||||
|
@ -1,16 +1,9 @@
|
||||
#![cfg_attr(
|
||||
target_arch = "spirv",
|
||||
no_std,
|
||||
feature(register_attr),
|
||||
register_attr(spirv)
|
||||
)]
|
||||
#![cfg_attr(target_arch = "spirv", no_std)]
|
||||
// HACK(eddyb) can't easily see warnings otherwise from `spirv-builder` builds.
|
||||
#![deny(warnings)]
|
||||
|
||||
#[cfg(not(target_arch = "spirv"))]
|
||||
use spirv_std::macros::spirv;
|
||||
|
||||
use shared::glam::{vec4, Vec4};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main_fs(output: &mut Vec4) {
|
||||
|
@ -1,20 +1,13 @@
|
||||
//! Ported to Rust from <https://github.com/Tw1ddle/Sky-Shader/blob/master/src/shaders/glsl/sky.fragment>
|
||||
|
||||
#![cfg_attr(
|
||||
target_arch = "spirv",
|
||||
no_std,
|
||||
feature(register_attr, lang_items),
|
||||
register_attr(spirv)
|
||||
)]
|
||||
#![cfg_attr(target_arch = "spirv", no_std)]
|
||||
// HACK(eddyb) can't easily see warnings otherwise from `spirv-builder` builds.
|
||||
#![deny(warnings)]
|
||||
|
||||
#[cfg(not(target_arch = "spirv"))]
|
||||
use spirv_std::macros::spirv;
|
||||
|
||||
use core::f32::consts::PI;
|
||||
use glam::{const_vec3, vec2, vec3, Vec2, Vec3, Vec4};
|
||||
use shared::*;
|
||||
use spirv_std::spirv;
|
||||
|
||||
// Note: This cfg is incorrect on its surface, it really should be "are we compiling with std", but
|
||||
// we tie #[no_std] above to the same condition, so it's fine.
|
||||
|
@ -123,8 +123,7 @@ impl Runner {
|
||||
"--crate-type dylib",
|
||||
"-Zunstable-options",
|
||||
"-Zcrate-attr=no_std",
|
||||
"-Zcrate-attr=feature(register_attr,asm_const,asm_experimental_arch)",
|
||||
"-Zcrate-attr=register_attr(spirv)",
|
||||
"-Zcrate-attr=feature(asm_const,asm_experimental_arch)",
|
||||
]
|
||||
.join(" ")
|
||||
}
|
||||
@ -333,6 +332,8 @@ fn rust_flags(codegen_backend_path: &Path) -> String {
|
||||
"-Cembed-bitcode=no",
|
||||
&format!("-Ctarget-feature=+{}", target_features.join(",+")),
|
||||
"-Csymbol-mangling-version=v0",
|
||||
"-Zcrate-attr=feature(register_tool)",
|
||||
"-Zcrate-attr=register_tool(rust_gpu)",
|
||||
]
|
||||
.join(" ")
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
|
||||
#[spirv(fragment)]
|
||||
|
@ -2,7 +2,7 @@
|
||||
// compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=all_memory_barrier::all_memory_barrier
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
unsafe fn all_memory_barrier() {
|
||||
spirv_std::arch::all_memory_barrier();
|
||||
|
@ -2,7 +2,7 @@
|
||||
// compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=all_memory_barrier_with_group_sync::all_memory_barrier_with_group_sync
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
unsafe fn all_memory_barrier_with_group_sync() {
|
||||
spirv_std::arch::all_memory_barrier_with_group_sync();
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
|
||||
#[spirv(fragment)]
|
||||
|
@ -1,6 +1,7 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::arch::IndexUnchecked;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(compute(threads(64)))]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buffer: &mut [u32]) {
|
||||
|
@ -4,6 +4,7 @@
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
use spirv_std::memory::{Scope, Semantics};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main() {
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -Ctarget-feature=+RayTracingKHR,+ext:SPV_KHR_ray_tracing
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -Ctarget-feature=+ext:SPV_KHR_non_semantic_info
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::{
|
||||
glam::{IVec2, UVec2, Vec2, Vec3, Vec4},
|
||||
macros::{debug_printf, debug_printfln},
|
||||
|
@ -2,6 +2,7 @@
|
||||
// normalize-stderr-test "\S*/crates/spirv-std/src/" -> "$$SPIRV_STD_SRC/"
|
||||
// compile-flags: -Ctarget-feature=+ext:SPV_KHR_non_semantic_info
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::{glam::Vec2, macros::debug_printf};
|
||||
|
||||
#[spirv(fragment)]
|
||||
|
@ -1,105 +1,105 @@
|
||||
error: Unterminated format specifier: missing type after precision
|
||||
--> $DIR/debug_printf_type_checking.rs:10:23
|
||||
--> $DIR/debug_printf_type_checking.rs:11:23
|
||||
|
|
||||
10 | debug_printf!("%1");
|
||||
11 | debug_printf!("%1");
|
||||
| ^^^^
|
||||
|
||||
error: Unterminated format specifier: missing type after decimal point
|
||||
--> $DIR/debug_printf_type_checking.rs:11:23
|
||||
|
|
||||
11 | debug_printf!("%1.");
|
||||
| ^^^^^
|
||||
|
||||
error: Unrecognised format specifier: '.'
|
||||
--> $DIR/debug_printf_type_checking.rs:12:23
|
||||
|
|
||||
12 | debug_printf!("%.");
|
||||
| ^^^^
|
||||
12 | debug_printf!("%1.");
|
||||
| ^^^^^
|
||||
|
||||
error: Unrecognised format specifier: '.'
|
||||
--> $DIR/debug_printf_type_checking.rs:13:23
|
||||
|
|
||||
13 | debug_printf!("%.1");
|
||||
13 | debug_printf!("%.");
|
||||
| ^^^^
|
||||
|
||||
error: Unrecognised format specifier: '.'
|
||||
--> $DIR/debug_printf_type_checking.rs:14:23
|
||||
|
|
||||
14 | debug_printf!("%.1");
|
||||
| ^^^^^
|
||||
|
||||
error: Unterminated format specifier: missing type after fraction precision
|
||||
--> $DIR/debug_printf_type_checking.rs:14:23
|
||||
--> $DIR/debug_printf_type_checking.rs:15:23
|
||||
|
|
||||
14 | debug_printf!("%1.1");
|
||||
15 | debug_printf!("%1.1");
|
||||
| ^^^^^^
|
||||
|
||||
error: Missing vector dimensions specifier
|
||||
--> $DIR/debug_printf_type_checking.rs:15:23
|
||||
--> $DIR/debug_printf_type_checking.rs:16:23
|
||||
|
|
||||
15 | debug_printf!("%1.1v");
|
||||
16 | debug_printf!("%1.1v");
|
||||
| ^^^^^^^
|
||||
|
||||
error: Invalid width for vector: 5
|
||||
--> $DIR/debug_printf_type_checking.rs:16:23
|
||||
--> $DIR/debug_printf_type_checking.rs:17:23
|
||||
|
|
||||
16 | debug_printf!("%1.1v5");
|
||||
17 | debug_printf!("%1.1v5");
|
||||
| ^^^^^^^^
|
||||
|
||||
error: Missing vector type specifier
|
||||
--> $DIR/debug_printf_type_checking.rs:17:23
|
||||
--> $DIR/debug_printf_type_checking.rs:18:23
|
||||
|
|
||||
17 | debug_printf!("%1.1v2");
|
||||
18 | debug_printf!("%1.1v2");
|
||||
| ^^^^^^^^
|
||||
|
||||
error: Unrecognised vector type specifier: 'r'
|
||||
--> $DIR/debug_printf_type_checking.rs:18:23
|
||||
--> $DIR/debug_printf_type_checking.rs:19:23
|
||||
|
|
||||
18 | debug_printf!("%1.1v2r");
|
||||
19 | debug_printf!("%1.1v2r");
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: Unrecognised format specifier: 'r'
|
||||
--> $DIR/debug_printf_type_checking.rs:19:23
|
||||
--> $DIR/debug_printf_type_checking.rs:20:23
|
||||
|
|
||||
19 | debug_printf!("%r", 11_i32);
|
||||
20 | debug_printf!("%r", 11_i32);
|
||||
| ^^^^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/debug_printf_type_checking.rs:20:29
|
||||
--> $DIR/debug_printf_type_checking.rs:21:29
|
||||
|
|
||||
20 | debug_printf!("%f", 11_u32);
|
||||
21 | debug_printf!("%f", 11_u32);
|
||||
| --------------------^^^^^^-
|
||||
| | |
|
||||
| | expected `f32`, found `u32`
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
note: function defined here
|
||||
--> $SPIRV_STD_SRC/lib.rs:138:8
|
||||
--> $SPIRV_STD_SRC/lib.rs:137:8
|
||||
|
|
||||
138 | pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
|
||||
137 | pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: change the type of the numeric literal from `u32` to `f32`
|
||||
|
|
||||
20 | debug_printf!("%f", 11_f32);
|
||||
21 | debug_printf!("%f", 11_f32);
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/debug_printf_type_checking.rs:21:29
|
||||
--> $DIR/debug_printf_type_checking.rs:22:29
|
||||
|
|
||||
21 | debug_printf!("%u", 11.0_f32);
|
||||
22 | debug_printf!("%u", 11.0_f32);
|
||||
| --------------------^^^^^^^^-
|
||||
| | |
|
||||
| | expected `u32`, found `f32`
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
note: function defined here
|
||||
--> $SPIRV_STD_SRC/lib.rs:138:8
|
||||
--> $SPIRV_STD_SRC/lib.rs:137:8
|
||||
|
|
||||
138 | pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
|
||||
137 | pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: change the type of the numeric literal from `f32` to `u32`
|
||||
|
|
||||
21 | debug_printf!("%u", 11u32);
|
||||
22 | debug_printf!("%u", 11u32);
|
||||
| ~~~
|
||||
|
||||
error[E0277]: the trait bound `{float}: Vector<f32, 2>` is not satisfied
|
||||
--> $DIR/debug_printf_type_checking.rs:22:31
|
||||
--> $DIR/debug_printf_type_checking.rs:23:31
|
||||
|
|
||||
22 | debug_printf!("%v2f", 11.0);
|
||||
23 | debug_printf!("%v2f", 11.0);
|
||||
| ----------------------^^^^-
|
||||
| | |
|
||||
| | the trait `Vector<f32, 2>` is not implemented for `{float}`
|
||||
@ -116,24 +116,24 @@ error[E0277]: the trait bound `{float}: Vector<f32, 2>` is not satisfied
|
||||
<IVec3 as Vector<i32, 3>>
|
||||
and 8 others
|
||||
note: required by a bound in `debug_printf_assert_is_vector`
|
||||
--> $SPIRV_STD_SRC/lib.rs:145:8
|
||||
--> $SPIRV_STD_SRC/lib.rs:144:8
|
||||
|
|
||||
145 | V: crate::vector::Vector<TY, SIZE>,
|
||||
144 | V: crate::vector::Vector<TY, SIZE>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `debug_printf_assert_is_vector`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/debug_printf_type_checking.rs:23:29
|
||||
--> $DIR/debug_printf_type_checking.rs:24:29
|
||||
|
|
||||
23 | debug_printf!("%f", Vec2::splat(33.3));
|
||||
24 | debug_printf!("%f", Vec2::splat(33.3));
|
||||
| --------------------^^^^^^^^^^^^^^^^^-
|
||||
| | |
|
||||
| | expected `f32`, found struct `Vec2`
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
note: function defined here
|
||||
--> $SPIRV_STD_SRC/lib.rs:138:8
|
||||
--> $SPIRV_STD_SRC/lib.rs:137:8
|
||||
|
|
||||
138 | pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
|
||||
137 | pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
//
|
||||
// compile-flags: -C target-feature=+DemoteToHelperInvocationEXT,+ext:SPV_EXT_demote_to_helper_invocation
|
||||
|
@ -2,7 +2,7 @@
|
||||
// compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=device_memory_barrier::device_memory_barrier
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
unsafe fn device_memory_barrier() {
|
||||
spirv_std::arch::device_memory_barrier();
|
||||
|
@ -2,7 +2,7 @@
|
||||
// compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=device_memory_barrier_with_group_sync::device_memory_barrier_with_group_sync
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
unsafe fn device_memory_barrier_with_group_sync() {
|
||||
spirv_std::arch::device_memory_barrier_with_group_sync();
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C target-feature=+GeometryStreams
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -Ctarget-feature=+Geometry
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -Ctarget-feature=+Geometry
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C target-feature=+GeometryStreams
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -Ctarget-feature=+RayTracingKHR,+ext:SPV_KHR_ray_tracing
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -Ctarget-feature=+RayTracingKHR,+ext:SPV_KHR_ray_tracing
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::arch::IndexUnchecked;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(
|
||||
|
@ -1,6 +1,7 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::arch::{signed_max, signed_min, unsigned_max, unsigned_min};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main() {
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
|
||||
#[spirv(fragment)]
|
||||
|
@ -4,6 +4,7 @@
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
use spirv_std::memory::{Scope, Semantics};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main() {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
// Rustfmt eats long attributes <https://github.com/rust-lang/rustfmt/issues/4579>
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use glam::Vec3;
|
||||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery};
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStructure) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
// compile-flags: -Ctarget-feature=+Int64,+ShaderClockKHR,+ext:SPV_KHR_shader_clock
|
||||
|
||||
use glam::UVec2;
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::{
|
||||
arch::{read_clock_khr, read_clock_uvec2_khr},
|
||||
memory::Scope,
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -Ctarget-feature=+RayTracingKHR,+ext:SPV_KHR_ray_tracing
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -Ctarget-feature=+RayTracingKHR,+ext:SPV_KHR_ray_tracing
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -Ctarget-feature=+RayTracingKHR,+ext:SPV_KHR_ray_tracing
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::arch;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main() {
|
||||
|
@ -2,6 +2,7 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::arch;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=workgroup_memory_barrier::workgroup_memory_barrier
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
unsafe fn workgroup_memory_barrier() {
|
||||
spirv_std::arch::workgroup_memory_barrier();
|
||||
|
@ -1,7 +1,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=workgroup_memory_barrier_with_group_sync::workgroup_memory_barrier_with_group_sync
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
unsafe fn workgroup_memory_barrier_with_group_sync() {
|
||||
spirv_std::arch::workgroup_memory_barrier_with_group_sync();
|
||||
|
@ -1,5 +1,6 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::{glam::Vec4, ByteAddressableBuffer};
|
||||
|
||||
#[spirv(fragment)]
|
||||
|
@ -1,5 +1,6 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::ByteAddressableBuffer;
|
||||
|
||||
pub struct BigStruct {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::{glam::Vec2, ByteAddressableBuffer};
|
||||
|
||||
pub struct Complex {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::ByteAddressableBuffer;
|
||||
|
||||
pub struct EmptyStruct {}
|
||||
|
@ -1,5 +1,6 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::ByteAddressableBuffer;
|
||||
|
||||
#[spirv(fragment)]
|
||||
|
@ -1,5 +1,6 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::ByteAddressableBuffer;
|
||||
|
||||
pub struct SmallStruct {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::ByteAddressableBuffer;
|
||||
|
||||
#[spirv(fragment)]
|
||||
|
@ -1,5 +1,6 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::{glam::Vec4, ByteAddressableBuffer};
|
||||
|
||||
#[spirv(matrix)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=add_two_ints::add_two_ints
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn add_two_ints(x: u32, y: u32) -> u32 {
|
||||
x + y
|
||||
|
@ -2,7 +2,7 @@
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=asm::asm
|
||||
|
||||
use core::arch::asm;
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn asm() {
|
||||
unsafe {
|
||||
|
@ -2,7 +2,7 @@
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=asm_add_two_ints::add_two_ints
|
||||
|
||||
use core::arch::asm;
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn add_two_ints(x: u32, y: u32) -> u32 {
|
||||
let result;
|
||||
|
@ -11,7 +11,7 @@
|
||||
// ignore-vulkan1.2
|
||||
|
||||
use core::arch::asm;
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn add_decorate() {
|
||||
unsafe {
|
||||
|
@ -3,7 +3,7 @@
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=complex_image_sample_inst::sample_proj_lod
|
||||
|
||||
use core::arch::asm;
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn sample_proj_lod(
|
||||
coord: glam::Vec4,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// normalize-stderr-test "OpExtension .SPV_KHR_vulkan_memory_model.\n" -> ""
|
||||
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment(entry_point_name = "hello_world"))]
|
||||
pub fn main() {}
|
||||
|
@ -7,7 +7,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-entry=main
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(mut in_array: [f32; 2], out_array: &mut [f32; 2]) {
|
||||
|
@ -10,6 +10,7 @@
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
use spirv_std::image::Dimensionality;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn generic<T, const DIM: Dimensionality>() {}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-entry=main
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] slice: &mut [f32]) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-entry=main
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
|
@ -16,7 +16,7 @@
|
||||
// normalize-stderr-test "OpExtension .SPV_KHR_vulkan_memory_model.\n" -> ""
|
||||
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(/* unused Output */ _: &mut glam::Vec4) {}
|
||||
|
@ -5,7 +5,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-entry=main
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(mut in_array: [f32; 3], out_array: &mut [f32; 3]) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-entry=main
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
struct Foo {
|
||||
a: u32,
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#![cfg_attr(via_intrinsic, feature(intrinsics))]
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn copy_via_raw_ptr(src: &f32, dst: &mut f32) {
|
||||
#[cfg(via_intrinsic)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=ptr_read::copy_via_raw_ptr
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn copy_via_raw_ptr(src: &f32, dst: &mut f32) {
|
||||
unsafe { *dst = core::ptr::read(src) }
|
||||
|
@ -1,7 +1,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=ptr_read_method::copy_via_raw_ptr
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn copy_via_raw_ptr(src: &f32, dst: &mut f32) {
|
||||
unsafe { *dst = (src as *const f32).read() }
|
||||
|
@ -1,7 +1,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=ptr_write::copy_via_raw_ptr
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn copy_via_raw_ptr(src: &f32, dst: &mut f32) {
|
||||
unsafe { core::ptr::write(dst, *src) }
|
||||
|
@ -1,7 +1,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=ptr_write_method::copy_via_raw_ptr
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn copy_via_raw_ptr(src: &f32, dst: &mut f32) {
|
||||
unsafe { (dst as *mut f32).write(*src) }
|
||||
|
@ -1,7 +1,7 @@
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=unroll_loops::java_hash_ten_times
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(unroll_loops)]
|
||||
fn java_hash_ten_times(mut x: u32, y: u32) -> u32 {
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Tests multiplying a `Mat3` by a `Vec3`.
|
||||
// build-pass
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(input: glam::Mat3, output: &mut glam::Vec3) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Simple single entrypoint function test.
|
||||
// build-pass
|
||||
|
||||
use spirv_std as _;
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main() {}
|
||||
|
@ -1,5 +1,6 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::{arch, Image};
|
||||
|
||||
#[spirv(fragment)]
|
||||
|
@ -1,5 +1,6 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::{arch, Image};
|
||||
|
||||
#[spirv(fragment)]
|
||||
|
@ -2,6 +2,7 @@
|
||||
// build-pass
|
||||
|
||||
use core::arch::asm;
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::{arch, Image, Sampler};
|
||||
|
||||
#[spirv(fragment)]
|
||||
|
@ -2,7 +2,7 @@
|
||||
// normalize-stderr-test "\S*/crates/spirv-std/src/" -> "$$SPIRV_STD_SRC/"
|
||||
// compile-flags: -Ctarget-feature=+Sampled1D
|
||||
|
||||
use spirv_std::{arch, Image, Sampler};
|
||||
use spirv_std::{arch, spirv, Image, Sampler};
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(
|
||||
|
@ -1,5 +1,6 @@
|
||||
// build-fail
|
||||
|
||||
use spirv_std::spirv;
|
||||
use spirv_std::{arch, Image, Sampler};
|
||||
|
||||
fn deeper_stack(image2d: &Image!(2D, type=f32, sampled), sampler: &Sampler) -> glam::Vec4 {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user