-
Notifications
You must be signed in to change notification settings - Fork 248
Closed
Labels
a: rust-langIssues specific to rust-lang/rust.Issues specific to rust-lang/rust.t: enhancementA new feature or improvement to an existing one.A new feature or improvement to an existing one.
Description
Currently if you try to use an atomic you get the following error.
Code
#![no_std]
#![feature(register_attr)]
#![register_attr(spirv)]
use core::sync::atomic::AtomicI32;
#[allow(unused_attributes)]
#[spirv(vertex)]
pub fn main_vs() {
let atomic = AtomicI32::from(65);
atomic.fetch_add(35, core::sync::atomic::Ordering::AcqRel);
assert!(atomic.load(core::sync::atomic::Ordering::AcqRel) == 100);
}
Error
error: Cannot use AtomicOrdering=SequentiallyConsistent on Vulkan memory model. Check if AcquireRelease fits your needs.
error: Cannot use AtomicOrdering=SequentiallyConsistent on Vulkan memory model. Check if AcquireRelease fits your needs.
error: Cannot cast between pointer types
|
= note: from: *{Function} struct core::sync::atomic::AtomicI32 { v: i32 }
= note: to: *{Function} u32
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: Cannot cast between pointer types
--> D:\local\Temp\2b65e857-11aa-4ed1-a4a1-8dfa7f30591a\lib.rs:12:18
|
12 | let atomic = AtomicI32::new(65);
| ^^^^^^^^^^^^^^^^^^
|
= note: from: *{Function} struct core::sync::atomic::AtomicI32 { v: i32 }
= note: to: *{Function} u32
Metadata
Metadata
Assignees
Labels
a: rust-langIssues specific to rust-lang/rust.Issues specific to rust-lang/rust.t: enhancementA new feature or improvement to an existing one.A new feature or improvement to an existing one.