Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,11 @@ jobs:
run: cargo fmt --check --all --manifest-path tests/difftests/tests/Cargo.toml
- name: Check docs are valid
run: RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps
- name: Check docs for `spirv-std` and `spirv-builder` on stable (for docs.rs)
run: |
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-std
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-builder --no-default-features
# TODO: Stable is not supported due to use of nightly features
# - name: Check docs for `spirv-std` and `spirv-builder` on stable (for docs.rs)
# run: |
# RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-std
# RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-builder --no-default-features
- name: cargo clippy
run: cargo clippy --all-targets -- -D warnings
- name: custom lints
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ 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 🛠

- [PR#635](https://github.com/Rust-GPU/rust-gpu/pull/635) started using `Scope`- and `Semantics`-typed const generics (`control_barrier`, `memory_barrier`, atomic intrinsics, `read_clock_khr`/`read_clock_uvec2_khr`) now take `spirv_std::memory::Scope`/`Semantics` directly (e.g. `{ Scope::Workgroup }`, `{ Semantics::WORKGROUP_MEMORY.union(Semantics::ACQUIRE_RELEASE) }`) instead of raw `u32` bit patterns, using `adt_const_params`. Composing `Semantics` flags now compiles with an assertion that at most one memory-ordering flag (`ACQUIRE`/`RELEASE`/`ACQUIRE_RELEASE`/`SEQUENTIALLY_CONST`) is set, per the SPIR-V spec.

## [0.10.0-alpha.1](https://github.com/Rust-GPU/rust-gpu/compare/v0.9.0...v0.10.0-alpha.1) - 2026-04-13

Toolchain: `nightly-2026-04-11` (rustc 1.96.0)
Expand Down
9 changes: 5 additions & 4 deletions crates/spirv-std/src/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#[cfg(target_arch = "spirv")]
use crate::Integer;
use crate::glam::UVec2;
use crate::memory::Scope;
use crate::{Scalar, SignedInteger, UnsignedInteger, Vector};
#[cfg(target_arch = "spirv")]
use core::arch::asm;
Expand Down Expand Up @@ -150,7 +151,7 @@ pub fn kill() -> ! {
/// <https://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/master/extensions/KHR/SPV_KHR_shader_clock.html>
#[spirv_std_macros::gpu_only]
#[doc(alias = "OpReadClockKHR")]
pub fn read_clock_khr<const SCOPE: u32>() -> u64 {
pub fn read_clock_khr<const SCOPE: Scope>() -> u64 {
unsafe {
let mut result: u64;

Expand All @@ -159,7 +160,7 @@ pub fn read_clock_khr<const SCOPE: u32>() -> u64 {
"%scope = OpConstant %uint {scope}",
"{result} = OpReadClockKHR typeof*{result} %scope",
result = out(reg) result,
scope = const SCOPE,
scope = const { SCOPE as u32 },
};

result
Expand All @@ -172,7 +173,7 @@ pub fn read_clock_khr<const SCOPE: u32>() -> u64 {
/// bits and the second component containing the 32 most significant bits.'
#[spirv_std_macros::gpu_only]
#[doc(alias = "OpReadClockKHR")]
pub fn read_clock_uvec2_khr<const SCOPE: u32>() -> UVec2 {
pub fn read_clock_uvec2_khr<const SCOPE: Scope>() -> UVec2 {
unsafe {
let mut result = UVec2::default();

Expand All @@ -182,7 +183,7 @@ pub fn read_clock_uvec2_khr<const SCOPE: u32>() -> UVec2 {
"%result = OpReadClockKHR typeof*{result} %scope",
"OpStore {result} %result",
result = in(reg) &mut result,
scope = const SCOPE,
scope = const { SCOPE as u32 },
};

result
Expand Down
Loading
Loading