Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ByteAddressableBuffer PassMode::Pair (#837)
- Loading branch information
Showing
11 changed files
with
181 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
#![cfg_attr( | ||
target_arch = "spirv", | ||
feature( | ||
abi_unadjusted, | ||
asm, | ||
asm_const, | ||
asm_experimental_arch, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Compiletests | ||
|
||
This folder contains tests known as "compiletests". Each file in the `ui` folder corresponds to a | ||
single compiletest. The way they work is a tool iterates over every file, and tries to compile it. | ||
At the start of the file, there's some meta-comments about the expected result of the compile: | ||
whether it should succeed compilation, or fail. If it is expected to fail, there's a corresponding | ||
.stderr file next to the file that contains the expected compiler error message. | ||
|
||
The `src` folder here is the tool that iterates over every file in the `ui` folder. It uses the | ||
`compiletests` library, taken from rustc's own compiletest framework. | ||
|
||
You can run compiletests via `cargo compiletests`. This is an alias set up in `.cargo/config` for | ||
`cargo run --release -p compiletests --`. You can filter to run specific tests by passing the | ||
(partial) filenames to `cargo compiletests some_file_name`, and update the `.stderr` files to | ||
contain new output via the `--bless` flag (with `--bless`, make sure you're actually supposed to be | ||
changing the .stderr files due to an intentional change, and hand-validate the output is correct | ||
afterwards). | ||
|
||
Keep in mind that tests here here are not executed, merely checked for errors (including validating | ||
the resulting binary with spirv-val). Because of this, there might be some strange code in here - | ||
the point isn't to make a fully functional shader every time (that would take an annoying amount of | ||
effort), but rather validate that specific parts of the compiler are doing their job correctly | ||
(either succeeding as they should, or erroring as they should). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// build-pass | ||
|
||
use spirv_std::ByteAddressableBuffer; | ||
|
||
pub struct EmptyStruct {} | ||
|
||
#[spirv(fragment)] | ||
pub fn load( | ||
#[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buf: &mut [u32], | ||
#[spirv(flat)] out: &mut EmptyStruct, | ||
) { | ||
unsafe { | ||
let buf = ByteAddressableBuffer::new(buf); | ||
*out = buf.load(5); | ||
} | ||
} | ||
|
||
#[spirv(fragment)] | ||
pub fn store(#[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buf: &mut [u32]) { | ||
let val = EmptyStruct {}; | ||
unsafe { | ||
let mut buf = ByteAddressableBuffer::new(buf); | ||
buf.store(5, val); | ||
} | ||
} |
Oops, something went wrong.