Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and document storage classes #280

Merged
merged 2 commits into from
Nov 27, 2020
Merged

Refactor and document storage classes #280

merged 2 commits into from
Nov 27, 2020

Conversation

XAMPPRocky
Copy link
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 changed the title Refactor and documentation storage classes Refactor and document storage classes Nov 27, 2020
@XAMPPRocky
Copy link
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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants