Allow for setting the array length in a shader using a specialization constant. (#2345)

This commit is contained in:
Alexander Rohde 2023-10-03 17:32:39 +02:00 committed by GitHub
parent d22104709f
commit ba4d11afa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -581,7 +581,7 @@ impl TypeArray {
let length = length_id let length = length_id
.map(|id| match shader.spirv.id(id).instruction() { .map(|id| match shader.spirv.id(id).instruction() {
Instruction::Constant { value, .. } => { Instruction::Constant { value, .. } | Instruction::SpecConstant { value, .. } => {
assert!(matches!(value.len(), 1 | 2)); assert!(matches!(value.len(), 1 | 2));
let len = value.iter().rev().fold(0u64, |a, &b| (a << 32) | b as u64); let len = value.iter().rev().fold(0u64, |a, &b| (a << 32) | b as u64);