Treat atomic writes in shaders as write accesses (#1989)

This commit is contained in:
Rua 2022-09-18 09:45:55 +02:00 committed by GitHub
parent 8f99ceab32
commit 0bab019d10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 4 deletions

View File

@ -442,7 +442,7 @@ mod linux {
};
let surface = WindowBuilder::new()
.build_vk_surface(&event_loop, instance.clone())
.build_vk_surface(event_loop, instance.clone())
.unwrap();
let device_extensions = DeviceExtensions {

View File

@ -293,8 +293,23 @@ fn inspect_entry_point(
}
} else {
match instruction {
&Instruction::AtomicLoad { pointer, .. }
| &Instruction::AtomicStore { pointer, .. }
&Instruction::AtomicLoad { pointer, .. } => {
// Storage buffer
instruction_chain(result, global, spirv, [], pointer);
// Storage image
if let Some((variable, Some(index))) = instruction_chain(
result,
global,
spirv,
[inst_image_texel_pointer],
pointer,
) {
variable.reqs.storage_image_atomic.insert(index);
}
}
&Instruction::AtomicStore { pointer, .. }
| &Instruction::AtomicExchange { pointer, .. }
| &Instruction::AtomicCompareExchange { pointer, .. }
| &Instruction::AtomicCompareExchangeWeak { pointer, .. }
@ -315,7 +330,11 @@ fn inspect_entry_point(
| &Instruction::AtomicFMaxEXT { pointer, .. }
| &Instruction::AtomicFAddEXT { pointer, .. } => {
// Storage buffer
instruction_chain(result, global, spirv, [], pointer);
if let Some((variable, Some(index))) =
instruction_chain(result, global, spirv, [], pointer)
{
variable.reqs.storage_write.insert(index);
}
// Storage image
if let Some((variable, Some(index))) = instruction_chain(
@ -325,6 +344,7 @@ fn inspect_entry_point(
[inst_image_texel_pointer],
pointer,
) {
variable.reqs.storage_write.insert(index);
variable.reqs.storage_image_atomic.insert(index);
}
}