mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-10-30 05:52:44 +00:00
Anonymous specialization constants support (#1338)
This commit is contained in:
parent
c74ac31f27
commit
f211a3af2a
@ -1,5 +1,8 @@
|
||||
# Unreleased
|
||||
|
||||
- Fixed Vulkano Shaders bug when compute shader local group layout values bound to specialization constants.
|
||||
Now it is possible to define the layout in form of `layout(local_size_x_id = 12, local_size_y_id = 13, local_size_z = 1) in;`
|
||||
and then set the values as `SpecializationConstants {constant_12: 8, constant_13: 4, ...}`.
|
||||
- Allow applications to access the instance and device pointers
|
||||
|
||||
# Version 0.18.0 (2020-03-11)
|
||||
|
@ -72,17 +72,26 @@ pub fn write_specialization_constants(doc: &Spirv) -> TokenStream {
|
||||
let (rust_ty, rust_size, rust_alignment) = spec_const_type_from_id(doc, type_id);
|
||||
let rust_size = rust_size.expect("Found runtime-sized specialization constant");
|
||||
|
||||
let constant_id = doc.get_decoration_params(result_id, Decoration::DecorationSpecId)
|
||||
.unwrap()[0];
|
||||
let constant_id = doc.get_decoration_params(result_id, Decoration::DecorationSpecId);
|
||||
|
||||
spec_consts.push(SpecConst {
|
||||
name: spirv_search::name_from_id(doc, result_id),
|
||||
constant_id,
|
||||
rust_ty,
|
||||
rust_size,
|
||||
rust_alignment: rust_alignment as u32,
|
||||
default_value,
|
||||
});
|
||||
if let Some(constant_id) = constant_id {
|
||||
let constant_id = constant_id[0];
|
||||
|
||||
let mut name = spirv_search::name_from_id(doc, result_id);
|
||||
|
||||
if name == "__unnamed".to_owned() {
|
||||
name = String::from(format!("constant_{}", constant_id));
|
||||
}
|
||||
|
||||
spec_consts.push(SpecConst {
|
||||
name,
|
||||
constant_id,
|
||||
rust_ty,
|
||||
rust_size,
|
||||
rust_alignment: rust_alignment as u32,
|
||||
default_value,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let map_entries = {
|
||||
|
Loading…
Reference in New Issue
Block a user