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

Support Slice Literals #378

Closed
XAMPPRocky opened this issue Jan 15, 2021 · 2 comments
Closed

Support Slice Literals #378

XAMPPRocky opened this issue Jan 15, 2021 · 2 comments
Labels
a: rust-lang Issues specific to rust-lang/rust. t: enhancement A new feature or improvement to an existing one.

Comments

@XAMPPRocky
Copy link
Member

Currently you cannot have a static slice literal in your code such as &[] or &[1,2 3, 4].

Error

      --> /Users/cargo/git/checkouts/rspirv-50a5048e4e24b3a2/7111e6c/spirv/autogen_spirv.rs:2887:48
       |
  2887 |             GroupOperation::ClusteredReduce => &[Capability::GroupNonUniformClustered],
       |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: from: *{Function} [u32; 1]
       = note: to: *{Function} [u32]
@XAMPPRocky XAMPPRocky added t: enhancement A new feature or improvement to an existing one. a: rust-lang Issues specific to rust-lang/rust. labels Jan 15, 2021
@XAMPPRocky XAMPPRocky mentioned this issue Jan 15, 2021
18 tasks
@khyperia
Copy link
Contributor

Statically sized slice literals work fine, this passes:

#[test]
fn slice_constant() {
    val(r#"
#[allow(unused_attributes)]
#[spirv(fragment)]
pub fn main() {
    let x: &[u32; 4] = &[1, 2, 3, 4];
}
"#);
}

Unsized slice literals will never be supported, SPIR-V does not support creating OpTypeRuntimeArray values.

(Please let me know how you were compiling rspirv with rust-gpu if it was not intentional, because that's really strange)

@XAMPPRocky
Copy link
Member Author

(Please let me know how you were compiling rspirv with rust-gpu if it was not intentional, because that's really strange)

It was intentional. I was trying to see if we could have spirv_headers work in spirv-std to save having to redefine stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: rust-lang Issues specific to rust-lang/rust. t: enhancement A new feature or improvement to an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants