Unbreak CI (fix control_barrier and memory_barrier tests).

This commit is contained in:
Eduard-Mihai Burtescu 2021-04-05 15:03:37 +03:00 committed by Eduard-Mihai Burtescu
parent dd60da0be6
commit 2b15e20f2f
4 changed files with 8 additions and 6 deletions

View File

@ -65,13 +65,14 @@ pub unsafe fn control_barrier<
#[spirv_std_macros::gpu_only]
#[doc(alias = "OpMemoryBarrier")]
#[inline]
pub unsafe fn memory_barrier<const MEMORY: Scope, const SEMANTICS: Semantics>() {
// FIXME(eddyb) use a `bitflags!` `Semantics` for `SEMANTICS`.
pub unsafe fn memory_barrier<const MEMORY: Scope, const SEMANTICS: u32>() {
asm! {
"%u32 = OpTypeInt 32 0",
"%memory = OpConstant %u32 {memory}",
"%semantics = OpConstant %u32 {semantics}",
"OpMemoryBarrier %memory %semantics",
memory = const MEMORY as u8,
semantics = const SEMANTICS as u8,
semantics = const SEMANTICS,
}
}

View File

@ -21,6 +21,7 @@ pub enum Scope {
QueueFamily = 5,
}
// FIXME(eddyb) use `bitflags!` for this.
#[derive(Debug, PartialEq, Eq)]
pub enum Semantics {
/// No memory semantics.

View File

@ -9,8 +9,8 @@ use spirv_std::memory::{Scope, Semantics};
pub fn main() {
unsafe {
spirv_std::arch::control_barrier::<
{ Scope::Workgroup },
{ Scope::Workgroup },
{ Scope::Subgroup },
{ Scope::Subgroup },
{ Semantics::None },
>();
}

View File

@ -9,8 +9,8 @@ use spirv_std::memory::{Scope, Semantics};
pub fn main() {
unsafe {
spirv_std::arch::memory_barrier::<
{ Scope::Workgroup },
{ Semantics::None },
{ Scope::Subgroup },
{ (Semantics::AcquireRelease as u32) | (Semantics::UniformMemory as u32) },
>();
}
}