mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-21 22:34:43 +00:00
Fix descriptor set TypeStruct readonly detection (#1513)
This commit is contained in:
parent
c38f484baa
commit
b18bb01430
@ -26,6 +26,9 @@
|
||||
- Implemented synchronization for `SyncCommandBufferBuilder::execute_commands`.
|
||||
- `AutoCommandBufferBuilder::execute_commands` is now fully safe to use.
|
||||
- `SyncCommandBufferBuilder` now becomes poisoned when it returns an error, to prevent using the builder in an inconsistent state.
|
||||
- Fixed missing barriers in dispatch calls
|
||||
- **Breaking** `shader!` no longer marks descriptor sets as readonly as a fallback when it doesn't know
|
||||
- **Breaking** The keyword `readonly` might need to be added in front of the `buffer` keyword in GLSL files to get them working again
|
||||
|
||||
# Version 0.21.0 (2021-03-05)
|
||||
|
||||
|
@ -57,11 +57,11 @@ fn main() {
|
||||
|
||||
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(set = 0, binding = 0) buffer Data {
|
||||
layout(set = 0, binding = 0) restrict buffer Data {
|
||||
uint data[];
|
||||
} data;
|
||||
|
||||
layout(set = 0, binding = 1) buffer ImmutableData {
|
||||
layout(set = 0, binding = 1) readonly restrict buffer ImmutableData {
|
||||
uint data;
|
||||
} immutable_data;
|
||||
|
||||
|
@ -378,7 +378,7 @@ fn descriptor_infos(
|
||||
.iter()
|
||||
.filter_map(|i| {
|
||||
match i {
|
||||
&Instruction::TypeStruct { result_id, .. } if result_id == pointed_ty => {
|
||||
Instruction::TypeStruct { result_id, member_types } if *result_id == pointed_ty => {
|
||||
let decoration_block = doc
|
||||
.get_decoration_params(pointed_ty, Decoration::DecorationBlock)
|
||||
.is_some();
|
||||
@ -392,7 +392,18 @@ fn descriptor_infos(
|
||||
let is_ssbo = pointer_storage == StorageClass::StorageClassStorageBuffer;
|
||||
|
||||
// Determine whether there's a NonWritable decoration.
|
||||
//let non_writable = false; // TODO: tricky because the decoration is on struct members
|
||||
let readonly = {
|
||||
let mut readonly = vec![false; member_types.len()];
|
||||
for i in doc.instructions.iter() {
|
||||
if let Instruction::MemberDecorate { target_id, member, decoration, .. } = i {
|
||||
if *target_id == *result_id && *decoration == Decoration::DecorationNonWritable {
|
||||
assert!(!readonly[*member as usize]);
|
||||
readonly[*member as usize] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
readonly.iter().all(|x| *x)
|
||||
};
|
||||
|
||||
let desc = quote! {
|
||||
DescriptorDescTy::Buffer(DescriptorBufferDesc {
|
||||
@ -401,7 +412,7 @@ fn descriptor_infos(
|
||||
})
|
||||
};
|
||||
|
||||
Some((desc, true, 1))
|
||||
Some((desc, readonly, 1))
|
||||
}
|
||||
&Instruction::TypeImage {
|
||||
result_id,
|
||||
|
Loading…
Reference in New Issue
Block a user