Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Refactor and document storage classes#280

Merged
mergify[bot] merged 2 commits into
mainfrom
refactor-storage-class
Nov 27, 2020
Merged

Refactor and document storage classes#280
mergify[bot] merged 2 commits into
mainfrom
refactor-storage-class

Conversation

@XAMPPRocky

Copy link
Copy Markdown
Member

This PR changes how storage classes where defined to their own module, refactors the macro to allow you to define multiple storage classes in a single macro invocation and more importantly allows you to add documentation to the storage classes. With the refactor I also changed the DSL you use to define storage so that's a more descriptive, and hopefully more intuitive, for example here is now what the definition of the Input and Output storage classes look like.

storage_class! {
    /// Input from pipeline.
    ///
    /// Visible across all functions in the current invocation. Variables
    /// declared with this storage class are read-only, and must not
    /// have initializers.
    #[spirv(input)] storage_class Input;

    /// Output to pipeline.
    ///
    /// Visible across all functions in the current invocation.
    #[spirv(output)] writeable storage_class Output;
}
@XAMPPRocky XAMPPRocky requested a review from khyperia November 27, 2020 13:03
@XAMPPRocky XAMPPRocky changed the title Refactor and documentation storage classes Nov 27, 2020
Comment thread crates/spirv-std/src/storage_class.rs Outdated
@XAMPPRocky XAMPPRocky force-pushed the refactor-storage-class branch from 6f69751 to eba862f Compare November 27, 2020 14:39
@XAMPPRocky XAMPPRocky requested a review from khyperia November 27, 2020 14:42
Comment thread crates/spirv-std/src/storage_class.rs Outdated
@XAMPPRocky XAMPPRocky force-pushed the refactor-storage-class branch from 3cc3fdb to 15aca53 Compare November 27, 2020 14:54
@XAMPPRocky

Copy link
Copy Markdown
Member Author

I've also now also added a conivence function for "load and store" operations. For example multiplying and storing the result.

// Before
input.store(input.load() * 5);
// Now
input.then(|i| i * 5);
@mergify mergify Bot merged commit 16c380a into main Nov 27, 2020
@mergify mergify Bot deleted the refactor-storage-class branch November 27, 2020 15:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants