Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HansKristian-Work/dxil-spirv.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dxil_converter.cpp38
-rw-r--r--opcodes/converter_impl.hpp2
-rw-r--r--opcodes/dxil/dxil_compute.cpp12
-rw-r--r--opcodes/opcodes_dxil_builtins.cpp26
-rw-r--r--reference/shaders/dxil-builtin/barrier.comp53
-rw-r--r--reference/shaders/memory-model/uav-coherent-promotion.bindless.ssbo.comp332
-rw-r--r--reference/shaders/memory-model/uav-coherent-promotion.root-descriptor.ssbo.comp287
-rw-r--r--reference/shaders/memory-model/uav-coherent-promotion.sm66.bindless.ssbo.comp286
-rw-r--r--reference/shaders/memory-model/uav-coherent-promotion.sm66.ssbo.comp238
-rw-r--r--reference/shaders/memory-model/uav-coherent-promotion.ssbo.comp262
-rw-r--r--reference/shaders/memory-model/uav-coherent.root-descriptor.ssbo.comp288
-rw-r--r--reference/shaders/memory-model/uav-coherent.sm66.ssbo.comp239
-rw-r--r--reference/shaders/memory-model/uav-coherent.ssbo.comp263
-rw-r--r--reference/shaders/resources/sm66/buffer-64bit-double.ssbo.sm66.comp6
-rw-r--r--reference/shaders/resources/sm66/buffer-64bit.ssbo.sm66.comp6
-rw-r--r--reference/shaders/resources/sm66/buffer-64bit.ssbo.ssbo-align.sm66.comp6
-rw-r--r--reference/shaders/resources/sm66/raw-buffer-heap.sm66.frag1
-rw-r--r--reference/shaders/resources/sm66/raw-buffer-heap.ssbo.sm66.frag3
-rw-r--r--reference/shaders/resources/sm66/raw-buffer-heap.typed-buffer-offset.sm66.frag1
-rw-r--r--reference/shaders/resources/sm66/structured-16bit-heap.ssbo.sm66.frag6
-rw-r--r--reference/shaders/resources/sm66/structured-16bit-heap.ssbo.ssbo-align.sm66.frag6
-rw-r--r--reference/shaders/resources/sm66/structured-buffer-heap.sm66.frag689
-rw-r--r--reference/shaders/resources/sm66/structured-buffer-heap.ssbo.sm66.frag18
-rw-r--r--reference/shaders/resources/sm66/structured-buffer-heap.ssbo.ssbo-align.sm66.frag861
-rw-r--r--reference/shaders/resources/sm66/structured-buffer-heap.typed-buffer-offset.sm66.frag951
-rw-r--r--shaders/memory-model/uav-coherent-promotion.bindless.ssbo.comp27
-rw-r--r--shaders/memory-model/uav-coherent-promotion.root-descriptor.ssbo.comp27
-rw-r--r--shaders/memory-model/uav-coherent-promotion.sm66.bindless.ssbo.comp27
-rw-r--r--shaders/memory-model/uav-coherent-promotion.sm66.ssbo.comp27
-rw-r--r--shaders/memory-model/uav-coherent-promotion.ssbo.comp27
-rw-r--r--shaders/memory-model/uav-coherent.root-descriptor.ssbo.comp27
-rw-r--r--shaders/memory-model/uav-coherent.sm66.ssbo.comp27
-rw-r--r--shaders/memory-model/uav-coherent.ssbo.comp27
33 files changed, 3751 insertions, 1345 deletions
diff --git a/dxil_converter.cpp b/dxil_converter.cpp
index 29288da..fbf11ae 100644
--- a/dxil_converter.cpp
+++ b/dxil_converter.cpp
@@ -1411,6 +1411,24 @@ bool Converter::Impl::emit_uavs(const llvm::MDNode *uavs, const llvm::MDNode *re
auto effective_component_type = actual_component_type;
auto &access_meta = uav_access_tracking[index];
+ if (globally_coherent)
+ execution_mode_meta.declares_globallycoherent_uav = true;
+
+ // If the shader has device-memory memory barriers, we need to support this.
+ // GLSL450 memory model does not do this for us by default.
+ // coherent: memory variable where reads and writes are coherent with reads and
+ // writes from other shader invocations
+ // We have two options:
+ // - slap Coherent on it.
+ // - Use Vulkan memory model and make use of MakeVisibleKHR/MakeAvailableKHR flags in a OpMemoryBarrier.
+ // This would flush and invalidate any incoherent caches as necessary.
+ // For now, slapping coherent on all UAVs is good enough.
+ // When we move to full Vulkan memory model we can do a slightly better job.
+ // If no UAV actually needs globallycoherent we can demote any barriers to workgroup barriers,
+ // which is hopefully more optimal if the compiler understands the intent ...
+ // Only promote resources which actually need some kind of coherence.
+ if (shader_analysis.require_uav_thread_group_coherence && access_meta.has_written && access_meta.has_read)
+ globally_coherent = true;
if (tags && get_constant_metadata(tags, 0) == 0)
{
@@ -2655,6 +2673,26 @@ bool Converter::Impl::emit_global_heaps()
if (info.type == DXIL::ResourceType::UAV)
{
+ // See emit_uavs() for details around coherent and memory model shenanigans ...
+ if (annotation->coherent)
+ execution_mode_meta.declares_globallycoherent_uav = true;
+
+ // Do not attempt to track read and write here to figure out if this resource in particular needs to be coherent.
+ // It's plausible that the write and read can happen across
+ // two different accesses to ResourceDescriptorHeap[]. Don't take any chances here ...
+ if (shader_analysis.require_uav_thread_group_coherence)
+ annotation->coherent = true;
+
+ if (annotation->resource_kind == DXIL::ResourceKind::StructuredBuffer ||
+ annotation->resource_kind == DXIL::ResourceKind::RawBuffer)
+ {
+ // In case there is aliasing through different declarations,
+ // we cannot emit NonWritable or NonReadable safely. Assume full read-write.
+ // Be a bit careful with typed resources since it's not always supported with read-write + typed.
+ annotation->tracking.has_read = true;
+ annotation->tracking.has_written = true;
+ }
+
info.uav_coherent = annotation->coherent;
info.uav_read = annotation->tracking.has_read;
info.uav_written = annotation->tracking.has_written;
diff --git a/opcodes/converter_impl.hpp b/opcodes/converter_impl.hpp
index 1d29f9f..e4f85cc 100644
--- a/opcodes/converter_impl.hpp
+++ b/opcodes/converter_impl.hpp
@@ -262,6 +262,7 @@ struct Converter::Impl
bool native_16bit_operations = false;
bool synthesize_2d_quad_dispatch = false;
unsigned required_wave_size = 0;
+ bool declares_globallycoherent_uav = false;
} execution_mode_meta;
static ShaderStage get_remapping_stage(spv::ExecutionModel model);
@@ -609,6 +610,7 @@ struct Converter::Impl
bool can_require_primitive_culling = false;
bool require_compute_shader_derivatives = false;
bool precise_f16_to_f32_observed = false;
+ bool require_uav_thread_group_coherence = false;
} shader_analysis;
// For descriptor QA, we need to rewrite how resource handles are emitted.
diff --git a/opcodes/dxil/dxil_compute.cpp b/opcodes/dxil/dxil_compute.cpp
index 420c3c0..73efd2c 100644
--- a/opcodes/dxil/dxil_compute.cpp
+++ b/opcodes/dxil/dxil_compute.cpp
@@ -39,12 +39,16 @@ bool emit_barrier_instruction(Converter::Impl &impl, const llvm::CallInst *instr
// Match DXC SPIR-V output here.
Operation *op = nullptr;
+ // We might only need to ensure coherency within the workgroup, in which case we can narrow the scope.
+ spv::Scope uav_memory_scope = impl.execution_mode_meta.declares_globallycoherent_uav ?
+ spv::ScopeDevice : spv::ScopeWorkgroup;
+
switch (static_cast<DXIL::BarrierMode>(operation))
{
case DXIL::BarrierMode::DeviceMemoryBarrierWithGroupSync:
op = impl.allocate(spv::OpControlBarrier);
op->add_id(builder.makeUintConstant(spv::ScopeWorkgroup));
- op->add_id(builder.makeUintConstant(spv::ScopeDevice));
+ op->add_id(builder.makeUintConstant(uav_memory_scope));
op->add_id(
builder.makeUintConstant(spv::MemorySemanticsImageMemoryMask | spv::MemorySemanticsUniformMemoryMask |
spv::MemorySemanticsAcquireReleaseMask));
@@ -61,7 +65,7 @@ bool emit_barrier_instruction(Converter::Impl &impl, const llvm::CallInst *instr
case DXIL::BarrierMode::AllMemoryBarrierWithGroupSync:
op = impl.allocate(spv::OpControlBarrier);
op->add_id(builder.makeUintConstant(spv::ScopeWorkgroup));
- op->add_id(builder.makeUintConstant(spv::ScopeDevice));
+ op->add_id(builder.makeUintConstant(uav_memory_scope));
op->add_id(
builder.makeUintConstant(spv::MemorySemanticsWorkgroupMemoryMask | spv::MemorySemanticsImageMemoryMask |
spv::MemorySemanticsUniformMemoryMask | spv::MemorySemanticsAcquireReleaseMask));
@@ -69,7 +73,7 @@ bool emit_barrier_instruction(Converter::Impl &impl, const llvm::CallInst *instr
case DXIL::BarrierMode::DeviceMemoryBarrier:
op = impl.allocate(spv::OpMemoryBarrier);
- op->add_id(builder.makeUintConstant(spv::ScopeDevice));
+ op->add_id(builder.makeUintConstant(uav_memory_scope));
op->add_id(
builder.makeUintConstant(spv::MemorySemanticsImageMemoryMask | spv::MemorySemanticsUniformMemoryMask |
spv::MemorySemanticsAcquireReleaseMask));
@@ -84,7 +88,7 @@ bool emit_barrier_instruction(Converter::Impl &impl, const llvm::CallInst *instr
case DXIL::BarrierMode::AllMemoryBarrier:
op = impl.allocate(spv::OpMemoryBarrier);
- op->add_id(builder.makeUintConstant(spv::ScopeDevice));
+ op->add_id(builder.makeUintConstant(uav_memory_scope));
op->add_id(
builder.makeUintConstant(spv::MemorySemanticsWorkgroupMemoryMask | spv::MemorySemanticsImageMemoryMask |
spv::MemorySemanticsUniformMemoryMask | spv::MemorySemanticsAcquireReleaseMask));
diff --git a/opcodes/opcodes_dxil_builtins.cpp b/opcodes/opcodes_dxil_builtins.cpp
index c180775..21c1575 100644
--- a/opcodes/opcodes_dxil_builtins.cpp
+++ b/opcodes/opcodes_dxil_builtins.cpp
@@ -976,6 +976,32 @@ bool analyze_dxil_resource_instruction(Converter::Impl &impl, const llvm::CallIn
impl.handle_to_storage_class[instruction->getOperand(4)] = spv::StorageClassTaskPayloadWorkgroupEXT;
break;
+ case DXIL::Op::Barrier:
+ {
+ uint32_t operation;
+ if (!get_constant_operand(instruction, 1, &operation))
+ return false;
+
+ // See D3D11 functional spec: 7.14.4 Global vs Group/Local Coherency on Non-Atomic UAV Reads.
+ // In the GLSL memory model, we need coherent between invocations in general.
+ // There is no guarantee for intra-workgroup coherence sadly :(
+ auto barrier_op = static_cast<DXIL::BarrierMode>(operation);
+ switch (barrier_op)
+ {
+ case DXIL::BarrierMode::DeviceMemoryBarrier:
+ case DXIL::BarrierMode::DeviceMemoryBarrierWithGroupSync:
+ case DXIL::BarrierMode::AllMemoryBarrier:
+ case DXIL::BarrierMode::AllMemoryBarrierWithGroupSync:
+ impl.shader_analysis.require_uav_thread_group_coherence = true;
+ break;
+
+ default:
+ break;
+ }
+
+ break;
+ }
+
default:
break;
}
diff --git a/reference/shaders/dxil-builtin/barrier.comp b/reference/shaders/dxil-builtin/barrier.comp
index 2e3d9b0..e6cd3d3 100644
--- a/reference/shaders/dxil-builtin/barrier.comp
+++ b/reference/shaders/dxil-builtin/barrier.comp
@@ -8,18 +8,16 @@ void main()
imageStore(_8, int(0u), uvec4(5u));
memoryBarrierShared();
imageStore(_8, int(0u), uvec4(10u));
- memoryBarrier();
+ groupMemoryBarrier();
imageStore(_8, int(0u), uvec4(15u));
barrier();
imageStore(_8, int(0u), uvec4(20u));
- memoryBarrier();
+ groupMemoryBarrier();
barrier();
imageStore(_8, int(0u), uvec4(30u));
- memoryBarrierBuffer();
- memoryBarrierImage();
+ groupMemoryBarrier();
imageStore(_8, int(0u), uvec4(40u));
- memoryBarrierBuffer();
- memoryBarrierImage();
+ groupMemoryBarrier();
barrier();
}
@@ -29,7 +27,7 @@ void main()
; SPIR-V
; Version: 1.3
; Generator: Unknown(30017); 21022
-; Bound: 31
+; Bound: 30
; Schema: 0
OpCapability Shader
OpCapability ImageBuffer
@@ -52,36 +50,35 @@ OpDecorate %8 NonReadable
%14 = OpConstant %5 2
%15 = OpConstant %5 264
%16 = OpConstant %5 10
-%18 = OpConstant %5 1
-%19 = OpConstant %5 2376
-%20 = OpConstant %5 15
-%22 = OpConstant %5 20
-%24 = OpConstant %5 30
-%26 = OpConstant %5 2120
-%27 = OpConstant %5 40
+%18 = OpConstant %5 2376
+%19 = OpConstant %5 15
+%21 = OpConstant %5 20
+%23 = OpConstant %5 30
+%25 = OpConstant %5 2120
+%26 = OpConstant %5 40
%3 = OpFunction %1 None %2
%4 = OpLabel
-OpBranch %29
-%29 = OpLabel
+OpBranch %28
+%28 = OpLabel
%9 = OpLoad %6 %8
%13 = OpCompositeConstruct %12 %11 %11 %11 %11
OpImageWrite %9 %10 %13
OpMemoryBarrier %14 %15
%17 = OpCompositeConstruct %12 %16 %16 %16 %16
OpImageWrite %9 %10 %17
-OpMemoryBarrier %18 %19
-%21 = OpCompositeConstruct %12 %20 %20 %20 %20
-OpImageWrite %9 %10 %21
+OpMemoryBarrier %14 %18
+%20 = OpCompositeConstruct %12 %19 %19 %19 %19
+OpImageWrite %9 %10 %20
OpControlBarrier %14 %14 %15
-%23 = OpCompositeConstruct %12 %22 %22 %22 %22
-OpImageWrite %9 %10 %23
-OpControlBarrier %14 %18 %19
-%25 = OpCompositeConstruct %12 %24 %24 %24 %24
-OpImageWrite %9 %10 %25
-OpMemoryBarrier %18 %26
-%28 = OpCompositeConstruct %12 %27 %27 %27 %27
-OpImageWrite %9 %10 %28
-OpControlBarrier %14 %18 %26
+%22 = OpCompositeConstruct %12 %21 %21 %21 %21
+OpImageWrite %9 %10 %22
+OpControlBarrier %14 %14 %18
+%24 = OpCompositeConstruct %12 %23 %23 %23 %23
+OpImageWrite %9 %10 %24
+OpMemoryBarrier %14 %25
+%27 = OpCompositeConstruct %12 %26 %26 %26 %26
+OpImageWrite %9 %10 %27
+OpControlBarrier %14 %14 %25
OpReturn
OpFunctionEnd
#endif
diff --git a/reference/shaders/memory-model/uav-coherent-promotion.bindless.ssbo.comp b/reference/shaders/memory-model/uav-coherent-promotion.bindless.ssbo.comp
new file mode 100644
index 0000000..9ce5b43
--- /dev/null
+++ b/reference/shaders/memory-model/uav-coherent-promotion.bindless.ssbo.comp
@@ -0,0 +1,332 @@
+#version 460
+#extension GL_EXT_buffer_reference : require
+#extension GL_EXT_nonuniform_qualifier : require
+layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
+
+layout(set = 1, binding = 0, std430) restrict readonly buffer SSBO
+{
+ uint _m0[];
+} _13[];
+
+layout(set = 1, binding = 0, std430) restrict readonly buffer _16_19
+{
+ uvec4 _m0[];
+} _19[];
+
+layout(set = 4, binding = 0, std430) coherent buffer _21_24
+{
+ uvec4 _m0[];
+} _24[];
+
+layout(set = 4, binding = 0, std430) readonly buffer _26_29
+{
+ uvec4 _m0[];
+} _29[];
+
+layout(set = 4, binding = 0, std430) writeonly buffer _31_34
+{
+ uvec4 _m0[];
+} _34[];
+
+layout(set = 5, binding = 0, std140) uniform BindlessCBV
+{
+ vec4 _m0[4096];
+} _42[];
+
+layout(push_constant, std430) uniform RootConstants
+{
+ uint _m0;
+ uint _m1;
+ uint _m2;
+ uint _m3;
+ uint _m4;
+ uint _m5;
+ uint _m6;
+ uint _m7;
+} registers;
+
+void main()
+{
+ uint _65 = registers._m1 + 1u;
+ _24[registers._m4]._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(0.0), floatBitsToUint(0.0), floatBitsToUint(0.0), floatBitsToUint(0.0));
+ if (!(floatBitsToUint(_42[registers._m5]._m0[0u]).x == 0u))
+ {
+ uint _107 = 0u;
+ uint _111;
+ uint _114;
+ bool _116;
+ for (;;)
+ {
+ _111 = (_107 << 8u) + gl_LocalInvocationIndex;
+ _114 = _13[registers._m1]._m0[_111];
+ groupMemoryBarrier();
+ barrier();
+ _116 = _114 < 256u;
+ if (_116)
+ {
+ vec4 _120 = uintBitsToFloat(_19[_65]._m0[_111]);
+ vec4 _127 = uintBitsToFloat(_24[registers._m4]._m0[_114]);
+ _24[registers._m4]._m0[_114] = uvec4(floatBitsToUint(_127.x + _120.x), floatBitsToUint(_127.y + _120.y), floatBitsToUint(_127.z + _120.z), floatBitsToUint(_127.w + _120.w));
+ }
+ uint _108 = _107 + 1u;
+ if (_108 < floatBitsToUint(_42[registers._m5]._m0[0u]).x)
+ {
+ _107 = _108;
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ vec4 _96 = uintBitsToFloat(_29[registers._m4 + 1u]._m0[gl_LocalInvocationIndex]);
+ _34[registers._m4 + 2u]._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(_96.x), floatBitsToUint(_96.y), floatBitsToUint(_96.z), floatBitsToUint(_96.w));
+}
+
+
+#if 0
+// SPIR-V disassembly
+; SPIR-V
+; Version: 1.3
+; Generator: Unknown(30017); 21022
+; Bound: 157
+; Schema: 0
+OpCapability Shader
+OpCapability RuntimeDescriptorArray
+OpCapability PhysicalStorageBufferAddresses
+OpExtension "SPV_EXT_descriptor_indexing"
+OpExtension "SPV_KHR_physical_storage_buffer"
+OpMemoryModel PhysicalStorageBuffer64 GLSL450
+OpEntryPoint GLCompute %3 "main" %76
+OpExecutionMode %3 LocalSize 256 1 1
+OpName %3 "main"
+OpName %6 "RootConstants"
+OpName %8 "registers"
+OpName %10 "SSBO"
+OpName %16 "SSBO"
+OpName %21 "SSBO"
+OpName %26 "SSBO"
+OpName %31 "SSBO"
+OpName %39 "BindlessCBV"
+OpDecorate %6 Block
+OpMemberDecorate %6 0 Offset 0
+OpMemberDecorate %6 1 Offset 4
+OpMemberDecorate %6 2 Offset 8
+OpMemberDecorate %6 3 Offset 12
+OpMemberDecorate %6 4 Offset 16
+OpMemberDecorate %6 5 Offset 20
+OpMemberDecorate %6 6 Offset 24
+OpMemberDecorate %6 7 Offset 28
+OpDecorate %9 ArrayStride 4
+OpMemberDecorate %10 0 Offset 0
+OpDecorate %10 Block
+OpDecorate %13 DescriptorSet 1
+OpDecorate %13 Binding 0
+OpDecorate %13 NonWritable
+OpDecorate %13 Restrict
+OpDecorate %15 ArrayStride 16
+OpMemberDecorate %16 0 Offset 0
+OpDecorate %16 Block
+OpDecorate %19 DescriptorSet 1
+OpDecorate %19 Binding 0
+OpDecorate %19 NonWritable
+OpDecorate %19 Restrict
+OpDecorate %20 ArrayStride 16
+OpMemberDecorate %21 0 Offset 0
+OpDecorate %21 Block
+OpDecorate %24 DescriptorSet 4
+OpDecorate %24 Binding 0
+OpDecorate %24 Coherent
+OpDecorate %25 ArrayStride 16
+OpMemberDecorate %26 0 Offset 0
+OpDecorate %26 Block
+OpDecorate %29 DescriptorSet 4
+OpDecorate %29 Binding 0
+OpDecorate %29 NonWritable
+OpDecorate %30 ArrayStride 16
+OpMemberDecorate %31 0 Offset 0
+OpDecorate %31 Block
+OpDecorate %34 DescriptorSet 4
+OpDecorate %34 Binding 0
+OpDecorate %34 NonReadable
+OpDecorate %38 ArrayStride 16
+OpDecorate %39 Block
+OpMemberDecorate %39 0 Offset 0
+OpDecorate %42 DescriptorSet 5
+OpDecorate %42 Binding 0
+OpDecorate %76 BuiltIn LocalInvocationIndex
+%1 = OpTypeVoid
+%2 = OpTypeFunction %1
+%5 = OpTypeInt 32 0
+%6 = OpTypeStruct %5 %5 %5 %5 %5 %5 %5 %5
+%7 = OpTypePointer PushConstant %6
+%8 = OpVariable %7 PushConstant
+%9 = OpTypeRuntimeArray %5
+%10 = OpTypeStruct %9
+%11 = OpTypeRuntimeArray %10
+%12 = OpTypePointer StorageBuffer %11
+%13 = OpVariable %12 StorageBuffer
+%14 = OpTypeVector %5 4
+%15 = OpTypeRuntimeArray %14
+%16 = OpTypeStruct %15
+%17 = OpTypeRuntimeArray %16
+%18 = OpTypePointer StorageBuffer %17
+%19 = OpVariable %18 StorageBuffer
+%20 = OpTypeRuntimeArray %14
+%21 = OpTypeStruct %20
+%22 = OpTypeRuntimeArray %21
+%23 = OpTypePointer StorageBuffer %22
+%24 = OpVariable %23 StorageBuffer
+%25 = OpTypeRuntimeArray %14
+%26 = OpTypeStruct %25
+%27 = OpTypeRuntimeArray %26
+%28 = OpTypePointer StorageBuffer %27
+%29 = OpVariable %28 StorageBuffer
+%30 = OpTypeRuntimeArray %14
+%31 = OpTypeStruct %30
+%32 = OpTypeRuntimeArray %31
+%33 = OpTypePointer StorageBuffer %32
+%34 = OpVariable %33 StorageBuffer
+%35 = OpTypeFloat 32
+%36 = OpTypeVector %35 4
+%37 = OpConstant %5 4096
+%38 = OpTypeArray %36 %37
+%39 = OpTypeStruct %38
+%40 = OpTypeRuntimeArray %39
+%41 = OpTypePointer Uniform %40
+%42 = OpVariable %41 Uniform
+%43 = OpTypePointer StorageBuffer %31
+%45 = OpTypePointer PushConstant %5
+%47 = OpConstant %5 4
+%50 = OpConstant %5 2
+%51 = OpTypePointer StorageBuffer %26
+%56 = OpConstant %5 1
+%57 = OpTypePointer StorageBuffer %21
+%61 = OpTypePointer StorageBuffer %16
+%66 = OpTypePointer StorageBuffer %10
+%70 = OpTypePointer Uniform %39
+%73 = OpConstant %5 5
+%75 = OpTypePointer Input %5
+%76 = OpVariable %75 Input
+%78 = OpConstant %35 0
+%84 = OpTypePointer StorageBuffer %14
+%86 = OpConstant %5 0
+%87 = OpTypePointer Uniform %36
+%92 = OpTypeBool
+%110 = OpConstant %5 8
+%112 = OpTypePointer StorageBuffer %5
+%115 = OpConstant %5 2120
+%117 = OpConstant %5 256
+%3 = OpFunction %1 None %2
+%4 = OpLabel
+OpBranch %147
+%147 = OpLabel
+%46 = OpAccessChain %45 %8 %47
+%48 = OpLoad %5 %46
+%49 = OpIAdd %5 %48 %50
+%44 = OpAccessChain %43 %34 %49
+%53 = OpAccessChain %45 %8 %47
+%54 = OpLoad %5 %53
+%55 = OpIAdd %5 %54 %56
+%52 = OpAccessChain %51 %29 %55
+%59 = OpAccessChain %45 %8 %47
+%60 = OpLoad %5 %59
+%58 = OpAccessChain %57 %24 %60
+%63 = OpAccessChain %45 %8 %56
+%64 = OpLoad %5 %63
+%65 = OpIAdd %5 %64 %56
+%62 = OpAccessChain %61 %19 %65
+%68 = OpAccessChain %45 %8 %56
+%69 = OpLoad %5 %68
+%67 = OpAccessChain %66 %13 %69
+%72 = OpAccessChain %45 %8 %73
+%74 = OpLoad %5 %72
+%71 = OpAccessChain %70 %42 %74
+%77 = OpLoad %5 %76
+%79 = OpBitcast %5 %78
+%80 = OpBitcast %5 %78
+%81 = OpBitcast %5 %78
+%82 = OpBitcast %5 %78
+%83 = OpCompositeConstruct %14 %79 %80 %81 %82
+%85 = OpAccessChain %84 %58 %86 %77
+OpStore %85 %83
+%88 = OpAccessChain %87 %71 %86 %86
+%89 = OpLoad %36 %88
+%90 = OpBitcast %14 %89
+%91 = OpCompositeExtract %5 %90 0
+%93 = OpIEqual %92 %91 %86
+OpSelectionMerge %155 None
+OpBranchConditional %93 %155 %148
+%148 = OpLabel
+OpBranch %149
+%149 = OpLabel
+%107 = OpPhi %5 %86 %148 %108 %153
+%109 = OpShiftLeftLogical %5 %107 %110
+%111 = OpIAdd %5 %109 %77
+%113 = OpAccessChain %112 %67 %86 %111
+%114 = OpLoad %5 %113
+OpControlBarrier %50 %50 %115
+%116 = OpULessThan %92 %114 %117
+OpLoopMerge %154 %153 None
+OpBranch %150
+%150 = OpLabel
+OpSelectionMerge %152 None
+OpBranchConditional %116 %151 %152
+%151 = OpLabel
+%118 = OpAccessChain %84 %62 %86 %111
+%119 = OpLoad %14 %118
+%120 = OpBitcast %36 %119
+%121 = OpCompositeExtract %35 %120 0
+%122 = OpCompositeExtract %35 %120 1
+%123 = OpCompositeExtract %35 %120 2
+%124 = OpCompositeExtract %35 %120 3
+%125 = OpAccessChain %84 %58 %86 %114
+%126 = OpLoad %14 %125
+%127 = OpBitcast %36 %126
+%128 = OpCompositeExtract %35 %127 0
+%129 = OpCompositeExtract %35 %127 1
+%130 = OpCompositeExtract %35 %127 2
+%131 = OpCompositeExtract %35 %127 3
+%132 = OpFAdd %35 %128 %121
+%133 = OpFAdd %35 %129 %122
+%134 = OpFAdd %35 %130 %123
+%135 = OpFAdd %35 %131 %124
+%136 = OpBitcast %5 %132
+%137 = OpBitcast %5 %133
+%138 = OpBitcast %5 %134
+%139 = OpBitcast %5 %135
+%140 = OpCompositeConstruct %14 %136 %137 %138 %139
+%141 = OpAccessChain %84 %58 %86 %114
+OpStore %141 %140
+OpBranch %152
+%152 = OpLabel
+OpBranch %153
+%153 = OpLabel
+%108 = OpIAdd %5 %107 %56
+%142 = OpAccessChain %87 %71 %86 %86
+%143 = OpLoad %36 %142
+%144 = OpBitcast %14 %143
+%145 = OpCompositeExtract %5 %144 0
+%146 = OpULessThan %92 %108 %145
+OpBranchConditional %146 %149 %154
+%154 = OpLabel
+OpBranch %155
+%155 = OpLabel
+%94 = OpAccessChain %84 %52 %86 %77
+%95 = OpLoad %14 %94
+%96 = OpBitcast %36 %95
+%97 = OpCompositeExtract %35 %96 0
+%98 = OpCompositeExtract %35 %96 1
+%99 = OpCompositeExtract %35 %96 2
+%100 = OpCompositeExtract %35 %96 3
+%101 = OpBitcast %5 %97
+%102 = OpBitcast %5 %98
+%103 = OpBitcast %5 %99
+%104 = OpBitcast %5 %100
+%105 = OpCompositeConstruct %14 %101 %102 %103 %104
+%106 = OpAccessChain %84 %44 %86 %77
+OpStore %106 %105
+OpReturn
+OpFunctionEnd
+#endif
diff --git a/reference/shaders/memory-model/uav-coherent-promotion.root-descriptor.ssbo.comp b/reference/shaders/memory-model/uav-coherent-promotion.root-descriptor.ssbo.comp
new file mode 100644
index 0000000..8d4e9a4
--- /dev/null
+++ b/reference/shaders/memory-model/uav-coherent-promotion.root-descriptor.ssbo.comp
@@ -0,0 +1,287 @@
+#version 460
+#extension GL_EXT_buffer_reference : require
+#extension GL_EXT_buffer_reference_uvec2 : require
+layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
+
+layout(buffer_reference) buffer PhysicalPointerFloat4CoherentArray;
+layout(buffer_reference) buffer PhysicalPointerUint4NonWriteCBVArray;
+layout(buffer_reference) buffer PhysicalPointerFloat4Array;
+layout(buffer_reference) buffer PhysicalPointerUintNonWriteArray;
+layout(buffer_reference, buffer_reference_align = 4, std430) coherent buffer PhysicalPointerFloat4CoherentArray
+{
+ vec4 value[];
+};
+
+layout(buffer_reference, buffer_reference_align = 16, std430) readonly buffer PhysicalPointerUint4NonWriteCBVArray
+{
+ uvec4 value[4096];
+};
+
+layout(buffer_reference, buffer_reference_align = 4, std430) buffer PhysicalPointerFloat4Array
+{
+ vec4 value[];
+};
+
+layout(buffer_reference, buffer_reference_align = 4, std430) readonly buffer PhysicalPointerUintNonWriteArray
+{
+ uint value[];
+};
+
+layout(set = 0, binding = 1, std430) restrict readonly buffer SSBO
+{
+ uvec4 _m0[];
+} _14;
+
+layout(set = 0, binding = 2, std430) writeonly buffer _16_18
+{
+ uvec4 _m0[];
+} _18;
+
+layout(push_constant, std430) uniform RootConstants
+{
+ uvec2 _m0;
+ uvec2 _m1;
+ uvec2 _m2;
+ uvec2 _m3;
+} registers;
+
+void main()
+{
+ PhysicalPointerFloat4CoherentArray(registers._m2).value[gl_LocalInvocationIndex] = vec4(0.0);
+ if (!(PhysicalPointerUint4NonWriteCBVArray(registers._m0).value[0u].x == 0u))
+ {
+ uint _73 = 0u;
+ uint _77;
+ uint _84;
+ bool _86;
+ for (;;)
+ {
+ _77 = (_73 << 8u) + gl_LocalInvocationIndex;
+ _84 = PhysicalPointerUintNonWriteArray(registers._m1).value[_77];
+ groupMemoryBarrier();
+ barrier();
+ _86 = _84 < 256u;
+ if (_86)
+ {
+ vec4 _90 = uintBitsToFloat(_14._m0[_77]);
+ PhysicalPointerFloat4CoherentArray _95 = PhysicalPointerFloat4CoherentArray(registers._m2);
+ PhysicalPointerFloat4CoherentArray(registers._m2).value[_84] = vec4(_95.value[_84].x + _90.x, _95.value[_84].y + _90.y, _95.value[_84].z + _90.z, _95.value[_84].w + _90.w);
+ }
+ uint _74 = _73 + 1u;
+ if (_74 < PhysicalPointerUint4NonWriteCBVArray(registers._m0).value[0u].x)
+ {
+ _73 = _74;
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ PhysicalPointerFloat4Array _59 = PhysicalPointerFloat4Array(registers._m3);
+ _18._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(_59.value[gl_LocalInvocationIndex].x), floatBitsToUint(_59.value[gl_LocalInvocationIndex].y), floatBitsToUint(_59.value[gl_LocalInvocationIndex].z), floatBitsToUint(_59.value[gl_LocalInvocationIndex].w));
+}
+
+
+#if 0
+// SPIR-V disassembly
+; SPIR-V
+; Version: 1.3
+; Generator: Unknown(30017); 21022
+; Bound: 124
+; Schema: 0
+OpCapability Shader
+OpCapability PhysicalStorageBufferAddresses
+OpExtension "SPV_KHR_physical_storage_buffer"
+OpMemoryModel PhysicalStorageBuffer64 GLSL450
+OpEntryPoint GLCompute %3 "main" %33
+OpExecutionMode %3 LocalSize 256 1 1
+OpName %3 "main"
+OpName %7 "RootConstants"
+OpName %9 "registers"
+OpName %12 "SSBO"
+OpName %16 "SSBO"
+OpName %38 "PhysicalPointerFloat4CoherentArray"
+OpMemberName %38 0 "value"
+OpName %47 "PhysicalPointerUint4NonWriteCBVArray"
+OpMemberName %47 0 "value"
+OpName %57 "PhysicalPointerFloat4Array"
+OpMemberName %57 0 "value"
+OpName %79 "PhysicalPointerUintNonWriteArray"
+OpMemberName %79 0 "value"
+OpDecorate %7 Block
+OpMemberDecorate %7 0 Offset 0
+OpMemberDecorate %7 1 Offset 8
+OpMemberDecorate %7 2 Offset 16
+OpMemberDecorate %7 3 Offset 24
+OpDecorate %11 ArrayStride 16
+OpMemberDecorate %12 0 Offset 0
+OpDecorate %12 Block
+OpDecorate %14 DescriptorSet 0
+OpDecorate %14 Binding 1
+OpDecorate %14 NonWritable
+OpDecorate %14 Restrict
+OpDecorate %15 ArrayStride 16
+OpMemberDecorate %16 0 Offset 0
+OpDecorate %16 Block
+OpDecorate %18 DescriptorSet 0
+OpDecorate %18 Binding 2
+OpDecorate %18 NonReadable
+OpDecorate %33 BuiltIn LocalInvocationIndex
+OpDecorate %37 ArrayStride 16
+OpMemberDecorate %38 0 Offset 0
+OpDecorate %38 Block
+OpMemberDecorate %38 0 Coherent
+OpDecorate %46 ArrayStride 16
+OpMemberDecorate %47 0 Offset 0
+OpDecorate %47 Block
+OpMemberDecorate %47 0 NonWritable
+OpDecorate %56 ArrayStride 16
+OpMemberDecorate %57 0 Offset 0
+OpDecorate %57 Block
+OpDecorate %78 ArrayStride 4
+OpMemberDecorate %79 0 Offset 0
+OpDecorate %79 Block
+OpMemberDecorate %79 0 NonWritable
+%1 = OpTypeVoid
+%2 = OpTypeFunction %1
+%5 = OpTypeInt 32 0
+%6 = OpTypeVector %5 2
+%7 = OpTypeStruct %6 %6 %6 %6
+%8 = OpTypePointer PushConstant %7
+%9 = OpVariable %8 PushConstant
+%10 = OpTypeVector %5 4
+%11 = OpTypeRuntimeArray %10
+%12 = OpTypeStruct %11
+%13 = OpTypePointer StorageBuffer %12
+%14 = OpVariable %13 StorageBuffer
+%15 = OpTypeRuntimeArray %10
+%16 = OpTypeStruct %15
+%17 = OpTypePointer StorageBuffer %16
+%18 = OpVariable %17 StorageBuffer
+%19 = OpTypePointer PushConstant %6
+%21 = OpConstant %5 3
+%24 = OpConstant %5 2
+%27 = OpConstant %5 1
+%30 = OpConstant %5 0
+%32 = OpTypePointer Input %5
+%33 = OpVariable %32 Input
+%35 = OpTypeFloat 32
+%36 = OpTypeVector %35 4
+%37 = OpTypeRuntimeArray %36
+%38 = OpTypeStruct %37
+%39 = OpTypePointer PhysicalStorageBuffer %38
+%41 = OpTypePointer PhysicalStorageBuffer %36
+%43 = OpConstant %35 0
+%45 = OpConstant %5 4096
+%46 = OpTypeArray %10 %45
+%47 = OpTypeStruct %46
+%48 = OpTypePointer PhysicalStorageBuffer %47
+%50 = OpTypePointer PhysicalStorageBuffer %10
+%54 = OpTypeBool
+%56 = OpTypeRuntimeArray %36
+%57 = OpTypeStruct %56
+%58 = OpTypePointer PhysicalStorageBuffer %57
+%71 = OpTypePointer StorageBuffer %10
+%76 = OpConstant %5 8
+%78 = OpTypeRuntimeArray %5
+%79 = OpTypeStruct %78
+%80 = OpTypePointer PhysicalStorageBuffer %79
+%82 = OpTypePointer PhysicalStorageBuffer %5
+%85 = OpConstant %5 2120
+%87 = OpConstant %5 256
+%3 = OpFunction %1 None %2
+%4 = OpLabel
+OpBranch %114
+%114 = OpLabel
+%20 = OpAccessChain %19 %9 %21
+%22 = OpLoad %6 %20
+%23 = OpAccessChain %19 %9 %24
+%25 = OpLoad %6 %23
+%26 = OpAccessChain %19 %9 %27
+%28 = OpLoad %6 %26
+%29 = OpAccessChain %19 %9 %30
+%31 = OpLoad %6 %29
+%34 = OpLoad %5 %33
+%40 = OpBitcast %39 %25
+%42 = OpInBoundsAccessChain %41 %40 %30 %34
+%44 = OpCompositeConstruct %36 %43 %43 %43 %43
+OpStore %42 %44 Aligned 4
+%49 = OpBitcast %48 %31
+%51 = OpInBoundsAccessChain %50 %49 %30 %30
+%52 = OpLoad %10 %51 Aligned 16
+%53 = OpCompositeExtract %5 %52 0
+%55 = OpIEqual %54 %53 %30
+OpSelectionMerge %122 None
+OpBranchConditional %55 %122 %115
+%115 = OpLabel
+OpBranch %116
+%116 = OpLabel
+%73 = OpPhi %5 %30 %115 %74 %120
+%75 = OpShiftLeftLogical %5 %73 %76
+%77 = OpIAdd %5 %75 %34
+%81 = OpBitcast %80 %28
+%83 = OpInBoundsAccessChain %82 %81 %30 %77
+%84 = OpLoad %5 %83 Aligned 4
+OpControlBarrier %24 %24 %85
+%86 = OpULessThan %54 %84 %87
+OpLoopMerge %121 %120 None
+OpBranch %117
+%117 = OpLabel
+OpSelectionMerge %119 None
+OpBranchConditional %86 %118 %119
+%118 = OpLabel
+%88 = OpAccessChain %71 %14 %30 %77
+%89 = OpLoad %10 %88
+%90 = OpBitcast %36 %89
+%91 = OpCompositeExtract %35 %90 0
+%92 = OpCompositeExtract %35 %90 1
+%93 = OpCompositeExtract %35 %90 2
+%94 = OpCompositeExtract %35 %90 3
+%95 = OpBitcast %39 %25
+%96 = OpInBoundsAccessChain %41 %95 %30 %84
+%97 = OpLoad %36 %96 Aligned 4
+%98 = OpCompositeExtract %35 %97 0
+%99 = OpCompositeExtract %35 %97 1
+%100 = OpCompositeExtract %35 %97 2
+%101 = OpCompositeExtract %35 %97 3
+%102 = OpFAdd %35 %98 %91
+%103 = OpFAdd %35 %99 %92
+%104 = OpFAdd %35 %100 %93
+%105 = OpFAdd %35 %101 %94
+%106 = OpBitcast %39 %25
+%107 = OpInBoundsAccessChain %41 %106 %30 %84
+%108 = OpCompositeConstruct %36 %102 %103 %104 %105
+OpStore %107 %108 Aligned 4
+OpBranch %119
+%119 = OpLabel
+OpBranch %120
+%120 = OpLabel
+%74 = OpIAdd %5 %73 %27
+%109 = OpBitcast %48 %31
+%110 = OpInBoundsAccessChain %50 %109 %30 %30
+%111 = OpLoad %10 %110 Aligned 16
+%112 = OpCompositeExtract %5 %111 0
+%113 = OpULessThan %54 %74 %112
+OpBranchConditional %113 %116 %121
+%121 = OpLabel
+OpBranch %122
+%122 = OpLabel
+%59 = OpBitcast %58 %22
+%60 = OpInBoundsAccessChain %41 %59 %30 %34
+%61 = OpLoad %36 %60 Aligned 4
+%62 = OpCompositeExtract %35 %61 0
+%63 = OpCompositeExtract %35 %61 1
+%64 = OpCompositeExtract %35 %61 2
+%65 = OpCompositeExtract %35 %61 3
+%66 = OpBitcast %5 %62
+%67 = OpBitcast %5 %63
+%68 = OpBitcast %5 %64
+%69 = OpBitcast %5 %65
+%70 = OpCompositeConstruct %10 %66 %67 %68 %69
+%72 = OpAccessChain %71 %18 %30 %34
+OpStore %72 %70
+OpReturn
+OpFunctionEnd
+#endif
diff --git a/reference/shaders/memory-model/uav-coherent-promotion.sm66.bindless.ssbo.comp b/reference/shaders/memory-model/uav-coherent-promotion.sm66.bindless.ssbo.comp
new file mode 100644
index 0000000..f8cf96e
--- /dev/null
+++ b/reference/shaders/memory-model/uav-coherent-promotion.sm66.bindless.ssbo.comp
@@ -0,0 +1,286 @@
+#version 460
+#extension GL_EXT_buffer_reference : require
+#extension GL_EXT_nonuniform_qualifier : require
+layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
+
+layout(set = 0, binding = 0, std430) coherent buffer SSBO
+{
+ uvec4 _m0[];
+} _14[];
+
+layout(set = 1, binding = 0, std430) restrict readonly buffer _16_19
+{
+ uint _m0[];
+} _19[];
+
+layout(set = 1, binding = 0, std430) restrict readonly buffer _21_24
+{
+ uvec4 _m0[];
+} _24[];
+
+layout(set = 5, binding = 0, std140) uniform BindlessCBV
+{
+ vec4 _m0[4096];
+} _32[];
+
+layout(push_constant, std430) uniform RootConstants
+{
+ uint _m0;
+ uint _m1;
+ uint _m2;
+ uint _m3;
+ uint _m4;
+ uint _m5;
+ uint _m6;
+ uint _m7;
+} registers;
+
+void main()
+{
+ _14[0u]._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(0.0), floatBitsToUint(0.0), floatBitsToUint(0.0), floatBitsToUint(0.0));
+ if (!(floatBitsToUint(_32[registers._m5]._m0[0u]).x == 0u))
+ {
+ uint _77 = 0u;
+ uint _81;
+ uint _88;
+ bool _90;
+ for (;;)
+ {
+ _81 = (_77 << 8u) + gl_LocalInvocationIndex;
+ _88 = _19[registers._m1]._m0[_81];
+ groupMemoryBarrier();
+ barrier();
+ _90 = _88 < 256u;
+ if (_90)
+ {
+ vec4 _99 = uintBitsToFloat(_24[registers._m1 + 1u]._m0[_81]);
+ vec4 _106 = uintBitsToFloat(_14[0u]._m0[_88]);
+ _14[0u]._m0[_88] = uvec4(floatBitsToUint(_106.x + _99.x), floatBitsToUint(_106.y + _99.y), floatBitsToUint(_106.z + _99.z), floatBitsToUint(_106.w + _99.w));
+ }
+ uint _78 = _77 + 1u;
+ if (_78 < floatBitsToUint(_32[registers._m5]._m0[0u]).x)
+ {
+ _77 = _78;
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ vec4 _66 = uintBitsToFloat(_14[1u]._m0[gl_LocalInvocationIndex]);
+ _14[2u]._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(_66.x), floatBitsToUint(_66.y), floatBitsToUint(_66.z), floatBitsToUint(_66.w));
+}
+
+
+#if 0
+// SPIR-V disassembly
+; SPIR-V
+; Version: 1.3
+; Generator: Unknown(30017); 21022
+; Bound: 136
+; Schema: 0
+OpCapability Shader
+OpCapability RuntimeDescriptorArray
+OpCapability PhysicalStorageBufferAddresses
+OpExtension "SPV_EXT_descriptor_indexing"
+OpExtension "SPV_KHR_physical_storage_buffer"
+OpMemoryModel PhysicalStorageBuffer64 GLSL450
+OpEntryPoint GLCompute %3 "main" %40
+OpExecutionMode %3 LocalSize 256 1 1
+OpName %3 "main"
+OpName %6 "RootConstants"
+OpName %8 "registers"
+OpName %11 "SSBO"
+OpName %16 "SSBO"
+OpName %21 "SSBO"
+OpName %29 "BindlessCBV"
+OpDecorate %6 Block
+OpMemberDecorate %6 0 Offset 0
+OpMemberDecorate %6 1 Offset 4
+OpMemberDecorate %6 2 Offset 8
+OpMemberDecorate %6 3 Offset 12
+OpMemberDecorate %6 4 Offset 16
+OpMemberDecorate %6 5 Offset 20
+OpMemberDecorate %6 6 Offset 24
+OpMemberDecorate %6 7 Offset 28
+OpDecorate %10 ArrayStride 16
+OpMemberDecorate %11 0 Offset 0
+OpDecorate %11 Block
+OpDecorate %14 DescriptorSet 0
+OpDecorate %14 Binding 0
+OpDecorate %14 Coherent
+OpDecorate %15 ArrayStride 4
+OpMemberDecorate %16 0 Offset 0
+OpDecorate %16 Block
+OpDecorate %19 DescriptorSet 1
+OpDecorate %19 Binding 0
+OpDecorate %19 NonWritable
+OpDecorate %19 Restrict
+OpDecorate %20 ArrayStride 16
+OpMemberDecorate %21 0 Offset 0
+OpDecorate %21 Block
+OpDecorate %24 DescriptorSet 1
+OpDecorate %24 Binding 0
+OpDecorate %24 NonWritable
+OpDecorate %24 Restrict
+OpDecorate %28 ArrayStride 16
+OpDecorate %29 Block
+OpMemberDecorate %29 0 Offset 0
+OpDecorate %32 DescriptorSet 5
+OpDecorate %32 Binding 0
+OpDecorate %40 BuiltIn LocalInvocationIndex
+%1 = OpTypeVoid
+%2 = OpTypeFunction %1
+%5 = OpTypeInt 32 0
+%6 = OpTypeStruct %5 %5 %5 %5 %5 %5 %5 %5
+%7 = OpTypePointer PushConstant %6
+%8 = OpVariable %7 PushConstant
+%9 = OpTypeVector %5 4
+%10 = OpTypeRuntimeArray %9
+%11 = OpTypeStruct %10
+%12 = OpTypeRuntimeArray %11
+%13 = OpTypePointer StorageBuffer %12
+%14 = OpVariable %13 StorageBuffer
+%15 = OpTypeRuntimeArray %5
+%16 = OpTypeStruct %15
+%17 = OpTypeRuntimeArray %16
+%18 = OpTypePointer StorageBuffer %17
+%19 = OpVariable %18 StorageBuffer
+%20 = OpTypeRuntimeArray %9
+%21 = OpTypeStruct %20
+%22 = OpTypeRuntimeArray %21
+%23 = OpTypePointer StorageBuffer %22
+%24 = OpVariable %23 StorageBuffer
+%25 = OpTypeFloat 32
+%26 = OpTypeVector %25 4
+%27 = OpConstant %5 4096
+%28 = OpTypeArray %26 %27
+%29 = OpTypeStruct %28
+%30 = OpTypeRuntimeArray %29
+%31 = OpTypePointer Uniform %30
+%32 = OpVariable %31 Uniform
+%33 = OpTypePointer Uniform %29
+%35 = OpTypePointer PushConstant %5
+%37 = OpConstant %5 5
+%39 = OpTypePointer Input %5
+%40 = OpVariable %39 Input
+%42 = OpTypePointer StorageBuffer %11
+%44 = OpConstant %5 0
+%46 = OpConstant %5 1
+%48 = OpConstant %5 2
+%49 = OpConstant %25 0
+%55 = OpTypePointer StorageBuffer %9
+%57 = OpTypePointer Uniform %26
+%62 = OpTypeBool
+%80 = OpConstant %5 8
+%82 = OpTypePointer StorageBuffer %16
+%86 = OpTypePointer StorageBuffer %5
+%89 = OpConstant %5 2120
+%91 = OpConstant %5 256
+%92 = OpTypePointer StorageBuffer %21
+%3 = OpFunction %1 None %2
+%4 = OpLabel
+OpBranch %126
+%126 = OpLabel
+%36 = OpAccessChain %35 %8 %37
+%38 = OpLoad %5 %36
+%34 = OpAccessChain %33 %32 %38
+%41 = OpLoad %5 %40
+%43 = OpAccessChain %42 %14 %44
+%45 = OpAccessChain %42 %14 %46
+%47 = OpAccessChain %42 %14 %48
+%50 = OpBitcast %5 %49
+%51 = OpBitcast %5 %49
+%52 = OpBitcast %5 %49
+%53 = OpBitcast %5 %49
+%54 = OpCompositeConstruct %9 %50 %51 %52 %53
+%56 = OpAccessChain %55 %43 %44 %41
+OpStore %56 %54
+%58 = OpAccessChain %57 %34 %44 %44
+%59 = OpLoad %26 %58
+%60 = OpBitcast %9 %59
+%61 = OpCompositeExtract %5 %60 0
+%63 = OpIEqual %62 %61 %44
+OpSelectionMerge %134 None
+OpBranchConditional %63 %134 %127
+%127 = OpLabel
+OpBranch %128
+%128 = OpLabel
+%77 = OpPhi %5 %44 %127 %78 %132
+%79 = OpShiftLeftLogical %5 %77 %80
+%81 = OpIAdd %5 %79 %41
+%84 = OpAccessChain %35 %8 %46
+%85 = OpLoad %5 %84
+%83 = OpAccessChain %82 %19 %85
+%87 = OpAccessChain %86 %83 %44 %81
+%88 = OpLoad %5 %87
+OpControlBarrier %48 %48 %89
+%90 = OpULessThan %62 %88 %91
+OpLoopMerge %133 %132 None
+OpBranch %129
+%129 = OpLabel
+OpSelectionMerge %131 None
+OpBranchConditional %90 %130 %131
+%130 = OpLabel
+%94 = OpAccessChain %35 %8 %46
+%95 = OpLoad %5 %94
+%96 = OpIAdd %5 %95 %46
+%93 = OpAccessChain %92 %24 %96
+%97 = OpAccessChain %55 %93 %44 %81
+%98 = OpLoad %9 %97
+%99 = OpBitcast %26 %98
+%100 = OpCompositeExtract %25 %99 0
+%101 = OpCompositeExtract %25 %99 1
+%102 = OpCompositeExtract %25 %99 2
+%103 = OpCompositeExtract %25 %99 3
+%104 = OpAccessChain %55 %43 %44 %88
+%105 = OpLoad %9 %104
+%106 = OpBitcast %26 %105
+%107 = OpCompositeExtract %25 %106 0
+%108 = OpCompositeExtract %25 %106 1
+%109 = OpCompositeExtract %25 %106 2
+%110 = OpCompositeExtract %25 %106 3
+%111 = OpFAdd %25 %107 %100
+%112 = OpFAdd %25 %108 %101
+%113 = OpFAdd %25 %109 %102
+%114 = OpFAdd %25 %110 %103
+%115 = OpBitcast %5 %111
+%116 = OpBitcast %5 %112
+%117 = OpBitcast %5 %113
+%118 = OpBitcast %5 %114
+%119 = OpCompositeConstruct %9 %115 %116 %117 %118
+%120 = OpAccessChain %55 %43 %44 %88
+OpStore %120 %119
+OpBranch %131
+%131 = OpLabel
+OpBranch %132
+%132 = OpLabel
+%78 = OpIAdd %5 %77 %46
+%121 = OpAccessChain %57 %34 %44 %44
+%122 = OpLoad %26 %121
+%123 = OpBitcast %9 %122
+%124 = OpCompositeExtract %5 %123 0
+%125 = OpULessThan %62 %78 %124
+OpBranchConditional %125 %128 %133
+%133 = OpLabel
+OpBranch %134
+%134 = OpLabel
+%64 = OpAccessChain %55 %45 %44 %41
+%65 = OpLoad %9 %64
+%66 = OpBitcast %26 %65
+%67 = OpCompositeExtract %25 %66 0
+%68 = OpCompositeExtract %25 %66 1
+%69 = OpCompositeExtract %25 %66 2
+%70 = OpCompositeExtract %25 %66 3
+%71 = OpBitcast %5 %67
+%72 = OpBitcast %5 %68
+%73 = OpBitcast %5 %69
+%74 = OpBitcast %5 %70
+%75 = OpCompositeConstruct %9 %71 %72 %73 %74
+%76 = OpAccessChain %55 %47 %44 %41
+OpStore %76 %75
+OpReturn
+OpFunctionEnd
+#endif
diff --git a/reference/shaders/memory-model/uav-coherent-promotion.sm66.ssbo.comp b/reference/shaders/memory-model/uav-coherent-promotion.sm66.ssbo.comp
new file mode 100644
index 0000000..8645dff
--- /dev/null
+++ b/reference/shaders/memory-model/uav-coherent-promotion.sm66.ssbo.comp
@@ -0,0 +1,238 @@
+#version 460
+#extension GL_EXT_nonuniform_qualifier : require
+layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
+
+layout(set = 0, binding = 0, std430) coherent buffer SSBO
+{
+ uvec4 _m0[];
+} _11[];
+
+layout(set = 0, binding = 0, std430) restrict readonly buffer _13_15
+{
+ uint _m0[];
+} _15;
+
+layout(set = 0, binding = 1, std430) restrict readonly buffer _17_19
+{
+ uvec4 _m0[];
+} _19;
+
+layout(set = 0, binding = 0, std140) uniform _24_26
+{
+ vec4 _m0[1];
+} _26;
+
+void main()
+{
+ _11[0u]._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(0.0), floatBitsToUint(0.0), floatBitsToUint(0.0), floatBitsToUint(0.0));
+ if (!(floatBitsToUint(_26._m0[0u]).x == 0u))
+ {
+ uint _64 = 0u;
+ uint _68;
+ uint _71;
+ bool _73;
+ for (;;)
+ {
+ _68 = (_64 << 8u) + gl_LocalInvocationIndex;
+ _71 = _15._m0[_68];
+ groupMemoryBarrier();
+ barrier();
+ _73 = _71 < 256u;
+ if (_73)
+ {
+ vec4 _77 = uintBitsToFloat(_19._m0[_68]);
+ vec4 _84 = uintBitsToFloat(_11[0u]._m0[_71]);
+ _11[0u]._m0[_71] = uvec4(floatBitsToUint(_84.x + _77.x), floatBitsToUint(_84.y + _77.y), floatBitsToUint(_84.z + _77.z), floatBitsToUint(_84.w + _77.w));
+ }
+ uint _65 = _64 + 1u;
+ if (_65 < floatBitsToUint(_26._m0[0u]).x)
+ {
+ _64 = _65;
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ vec4 _53 = uintBitsToFloat(_11[1u]._m0[gl_LocalInvocationIndex]);
+ _11[2u]._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(_53.x), floatBitsToUint(_53.y), floatBitsToUint(_53.z), floatBitsToUint(_53.w));
+}
+
+
+#if 0
+// SPIR-V disassembly
+; SPIR-V
+; Version: 1.3
+; Generator: Unknown(30017); 21022
+; Bound: 114
+; Schema: 0
+OpCapability Shader
+OpCapability RuntimeDescriptorArray
+OpExtension "SPV_EXT_descriptor_indexing"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %3 "main" %28
+OpExecutionMode %3 LocalSize 256 1 1
+OpName %3 "main"
+OpName %8 "SSBO"
+OpName %13 "SSBO"
+OpName %17 "SSBO"
+OpName %24 ""
+OpDecorate %7 ArrayStride 16
+OpMemberDecorate %8 0 Offset 0
+OpDecorate %8 Block
+OpDecorate %11 DescriptorSet 0
+OpDecorate %11 Binding 0
+OpDecorate %11 Coherent
+OpDecorate %12 ArrayStride 4
+OpMemberDecorate %13 0 Offset 0
+OpDecorate %13 Block
+OpDecorate %15 DescriptorSet 0
+OpDecorate %15 Binding 0
+OpDecorate %15 NonWritable
+OpDecorate %15 Restrict
+OpDecorate %16 ArrayStride 16
+OpMemberDecorate %17 0 Offset 0
+OpDecorate %17 Block
+OpDecorate %19 DescriptorSet 0
+OpDecorate %19 Binding 1
+OpDecorate %19 NonWritable
+OpDecorate %19 Restrict
+OpDecorate %23 ArrayStride 16
+OpMemberDecorate %24 0 Offset 0
+OpDecorate %24 Block
+OpDecorate %26 DescriptorSet 0
+OpDecorate %26 Binding 0
+OpDecorate %28 BuiltIn LocalInvocationIndex
+%1 = OpTypeVoid
+%2 = OpTypeFunction %1
+%5 = OpTypeInt 32 0
+%6 = OpTypeVector %5 4
+%7 = OpTypeRuntimeArray %6
+%8 = OpTypeStruct %7
+%9 = OpTypeRuntimeArray %8
+%10 = OpTypePointer StorageBuffer %9
+%11 = OpVariable %10 StorageBuffer
+%12 = OpTypeRuntimeArray %5
+%13 = OpTypeStruct %12
+%14 = OpTypePointer StorageBuffer %13
+%15 = OpVariable %14 StorageBuffer
+%16 = OpTypeRuntimeArray %6
+%17 = OpTypeStruct %16
+%18 = OpTypePointer StorageBuffer %17
+%19 = OpVariable %18 StorageBuffer
+%20 = OpConstant %5 1
+%21 = OpTypeFloat 32
+%22 = OpTypeVector %21 4
+%23 = OpTypeArray %22 %20
+%24 = OpTypeStruct %23
+%25 = OpTypePointer Uniform %24
+%26 = OpVariable %25 Uniform
+%27 = OpTypePointer Input %5
+%28 = OpVariable %27 Input
+%30 = OpTypePointer StorageBuffer %8
+%32 = OpConstant %5 0
+%35 = OpConstant %5 2
+%36 = OpConstant %21 0
+%42 = OpTypePointer StorageBuffer %6
+%44 = OpTypePointer Uniform %22
+%49 = OpTypeBool
+%67 = OpConstant %5 8
+%69 = OpTypePointer StorageBuffer %5
+%72 = OpConstant %5 2120
+%74 = OpConstant %5 256
+%3 = OpFunction %1 None %2
+%4 = OpLabel
+OpBranch %104
+%104 = OpLabel
+%29 = OpLoad %5 %28
+%31 = OpAccessChain %30 %11 %32
+%33 = OpAccessChain %30 %11 %20
+%34 = OpAccessChain %30 %11 %35
+%37 = OpBitcast %5 %36
+%38 = OpBitcast %5 %36
+%39 = OpBitcast %5 %36
+%40 = OpBitcast %5 %36
+%41 = OpCompositeConstruct %6 %37 %38 %39 %40
+%43 = OpAccessChain %42 %31 %32 %29
+OpStore %43 %41
+%45 = OpAccessChain %44 %26 %32 %32
+%46 = OpLoad %22 %45
+%47 = OpBitcast %6 %46
+%48 = OpCompositeExtract %5 %47 0
+%50 = OpIEqual %49 %48 %32
+OpSelectionMerge %112 None
+OpBranchConditional %50 %112 %105
+%105 = OpLabel
+OpBranch %106
+%106 = OpLabel
+%64 = OpPhi %5 %32 %105 %65 %110
+%66 = OpShiftLeftLogical %5 %64 %67
+%68 = OpIAdd %5 %66 %29
+%70 = OpAccessChain %69 %15 %32 %68
+%71 = OpLoad %5 %70
+OpControlBarrier %35 %35 %72
+%73 = OpULessThan %49 %71 %74
+OpLoopMerge %111 %110 None
+OpBranch %107
+%107 = OpLabel
+OpSelectionMerge %109 None
+OpBranchConditional %73 %108 %109
+%108 = OpLabel
+%75 = OpAccessChain %42 %19 %32 %68
+%76 = OpLoad %6 %75
+%77 = OpBitcast %22 %76
+%78 = OpCompositeExtract %21 %77 0
+%79 = OpCompositeExtract %21 %77 1
+%80 = OpCompositeExtract %21 %77 2
+%81 = OpCompositeExtract %21 %77 3
+%82 = OpAccessChain %42 %31 %32 %71
+%83 = OpLoad %6 %82
+%84 = OpBitcast %22 %83
+%85 = OpCompositeExtract %21 %84 0
+%86 = OpCompositeExtract %21 %84 1
+%87 = OpCompositeExtract %21 %84 2
+%88 = OpCompositeExtract %21 %84 3
+%89 = OpFAdd %21 %85 %78
+%90 = OpFAdd %21 %86 %79
+%91 = OpFAdd %21 %87 %80
+%92 = OpFAdd %21 %88 %81
+%93 = OpBitcast %5 %89
+%94 = OpBitcast %5 %90
+%95 = OpBitcast %5 %91
+%96 = OpBitcast %5 %92
+%97 = OpCompositeConstruct %6 %93 %94 %95 %96
+%98 = OpAccessChain %42 %31 %32 %71
+OpStore %98 %97
+OpBranch %109
+%109 = OpLabel
+OpBranch %110
+%110 = OpLabel
+%65 = OpIAdd %5 %64 %20
+%99 = OpAccessChain %44 %26 %32 %32
+%100 = OpLoad %22 %99
+%101 = OpBitcast %6 %100
+%102 = OpCompositeExtract %5 %101 0
+%103 = OpULessThan %49 %65 %102
+OpBranchConditional %103 %106 %111
+%111 = OpLabel
+OpBranch %112
+%112 = OpLabel
+%51 = OpAccessChain %42 %33 %32 %29
+%52 = OpLoad %6 %51
+%53 = OpBitcast %22 %52
+%54 = OpCompositeExtract %21 %53 0
+%55 = OpCompositeExtract %21 %53 1
+%56 = OpCompositeExtract %21 %53 2
+%57 = OpCompositeExtract %21 %53 3
+%58 = OpBitcast %5 %54
+%59 = OpBitcast %5 %55
+%60 = OpBitcast %5 %56
+%61 = OpBitcast %5 %57
+%62 = OpCompositeConstruct %6 %58 %59 %60 %61
+%63 = OpAccessChain %42 %34 %32 %29
+OpStore %63 %62
+OpReturn
+OpFunctionEnd
+#endif
diff --git a/reference/shaders/memory-model/uav-coherent-promotion.ssbo.comp b/reference/shaders/memory-model/uav-coherent-promotion.ssbo.comp
new file mode 100644
index 0000000..a7c8794
--- /dev/null
+++ b/reference/shaders/memory-model/uav-coherent-promotion.ssbo.comp
@@ -0,0 +1,262 @@
+#version 460
+layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
+
+layout(set = 0, binding = 0, std430) restrict readonly buffer SSBO
+{
+ uint _m0[];
+} _9;
+
+layout(set = 0, binding = 1, std430) restrict readonly buffer _12_14
+{
+ uvec4 _m0[];
+} _14;
+
+layout(set = 0, binding = 0, std430) coherent buffer _16_18
+{
+ uvec4 _m0[];
+} _18;
+
+layout(set = 0, binding = 1, std430) readonly buffer _20_22
+{
+ uvec4 _m0[];
+} _22;
+
+layout(set = 0, binding = 2, std430) writeonly buffer _24_26
+{
+ uvec4 _m0[];
+} _26;
+
+layout(set = 0, binding = 0, std140) uniform _31_33
+{
+ vec4 _m0[1];
+} _33;
+
+void main()
+{
+ _18._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(0.0), floatBitsToUint(0.0), floatBitsToUint(0.0), floatBitsToUint(0.0));
+ if (!(floatBitsToUint(_33._m0[0u]).x == 0u))
+ {
+ uint _66 = 0u;
+ uint _70;
+ uint _73;
+ bool _76;
+ for (;;)
+ {
+ _70 = (_66 << 8u) + gl_LocalInvocationIndex;
+ _73 = _9._m0[_70];
+ groupMemoryBarrier();
+ barrier();
+ _76 = _73 < 256u;
+ if (_76)
+ {
+ vec4 _80 = uintBitsToFloat(_14._m0[_70]);
+ vec4 _87 = uintBitsToFloat(_18._m0[_73]);
+ _18._m0[_73] = uvec4(floatBitsToUint(_87.x + _80.x), floatBitsToUint(_87.y + _80.y), floatBitsToUint(_87.z + _80.z), floatBitsToUint(_87.w + _80.w));
+ }
+ uint _67 = _66 + 1u;
+ if (_67 < floatBitsToUint(_33._m0[0u]).x)
+ {
+ _66 = _67;
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ vec4 _55 = uintBitsToFloat(_22._m0[gl_LocalInvocationIndex]);
+ _26._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(_55.x), floatBitsToUint(_55.y), floatBitsToUint(_55.z), floatBitsToUint(_55.w));
+}
+
+
+#if 0
+// SPIR-V disassembly
+; SPIR-V
+; Version: 1.3
+; Generator: Unknown(30017); 21022
+; Bound: 117
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %3 "main" %35
+OpExecutionMode %3 LocalSize 256 1 1
+OpName %3 "main"
+OpName %7 "SSBO"
+OpName %12 "SSBO"
+OpName %16 "SSBO"
+OpName %20 "SSBO"
+OpName %24 "SSBO"
+OpName %31 ""
+OpDecorate %6 ArrayStride 4
+OpMemberDecorate %7 0 Offset 0
+OpDecorate %7 Block
+OpDecorate %9 DescriptorSet 0
+OpDecorate %9 Binding 0
+OpDecorate %9 NonWritable
+OpDecorate %9 Restrict
+OpDecorate %11 ArrayStride 16
+OpMemberDecorate %12 0 Offset 0
+OpDecorate %12 Block
+OpDecorate %14 DescriptorSet 0
+OpDecorate %14 Binding 1
+OpDecorate %14 NonWritable
+OpDecorate %14 Restrict
+OpDecorate %15 ArrayStride 16
+OpMemberDecorate %16 0 Offset 0
+OpDecorate %16 Block
+OpDecorate %18 DescriptorSet 0
+OpDecorate %18 Binding 0
+OpDecorate %18 Coherent
+OpDecorate %19 ArrayStride 16
+OpMemberDecorate %20 0 Offset 0
+OpDecorate %20 Block
+OpDecorate %22 DescriptorSet 0
+OpDecorate %22 Binding 1
+OpDecorate %22 NonWritable
+OpDecorate %23 ArrayStride 16
+OpMemberDecorate %24 0 Offset 0
+OpDecorate %24 Block
+OpDecorate %26 DescriptorSet 0
+OpDecorate %26 Binding 2
+OpDecorate %26 NonReadable
+OpDecorate %30 ArrayStride 16
+OpMemberDecorate %31 0 Offset 0
+OpDecorate %31 Block
+OpDecorate %33 DescriptorSet 0
+OpDecorate %33 Binding 0
+OpDecorate %35 BuiltIn LocalInvocationIndex
+%1 = OpTypeVoid
+%2 = OpTypeFunction %1
+%5 = OpTypeInt 32 0
+%6 = OpTypeRuntimeArray %5
+%7 = OpTypeStruct %6
+%8 = OpTypePointer StorageBuffer %7
+%9 = OpVariable %8 StorageBuffer
+%10 = OpTypeVector %5 4
+%11 = OpTypeRuntimeArray %10
+%12 = OpTypeStruct %11
+%13 = OpTypePointer StorageBuffer %12
+%14 = OpVariable %13 StorageBuffer
+%15 = OpTypeRuntimeArray %10
+%16 = OpTypeStruct %15
+%17 = OpTypePointer StorageBuffer %16
+%18 = OpVariable %17 StorageBuffer
+%19 = OpTypeRuntimeArray %10
+%20 = OpTypeStruct %19
+%21 = OpTypePointer StorageBuffer %20
+%22 = OpVariable %21 StorageBuffer
+%23 = OpTypeRuntimeArray %10
+%24 = OpTypeStruct %23
+%25 = OpTypePointer StorageBuffer %24
+%26 = OpVariable %25 StorageBuffer
+%27 = OpConstant %5 1
+%28 = OpTypeFloat 32
+%29 = OpTypeVector %28 4
+%30 = OpTypeArray %29 %27
+%31 = OpTypeStruct %30
+%32 = OpTypePointer Uniform %31
+%33 = OpVariable %32 Uniform
+%34 = OpTypePointer Input %5
+%35 = OpVariable %34 Input
+%37 = OpConstant %28 0
+%43 = OpTypePointer StorageBuffer %10
+%45 = OpConstant %5 0
+%46 = OpTypePointer Uniform %29
+%51 = OpTypeBool
+%69 = OpConstant %5 8
+%71 = OpTypePointer StorageBuffer %5
+%74 = OpConstant %5 2
+%75 = OpConstant %5 2120
+%77 = OpConstant %5 256
+%3 = OpFunction %1 None %2
+%4 = OpLabel
+OpBranch %107
+%107 = OpLabel
+%36 = OpLoad %5 %35
+%38 = OpBitcast %5 %37
+%39 = OpBitcast %5 %37
+%40 = OpBitcast %5 %37
+%41 = OpBitcast %5 %37
+%42 = OpCompositeConstruct %10 %38 %39 %40 %41
+%44 = OpAccessChain %43 %18 %45 %36
+OpStore %44 %42
+%47 = OpAccessChain %46 %33 %45 %45
+%48 = OpLoad %29 %47
+%49 = OpBitcast %10 %48
+%50 = OpCompositeExtract %5 %49 0
+%52 = OpIEqual %51 %50 %45
+OpSelectionMerge %115 None
+OpBranchConditional %52 %115 %108
+%108 = OpLabel
+OpBranch %109
+%109 = OpLabel
+%66 = OpPhi %5 %45 %108 %67 %113
+%68 = OpShiftLeftLogical %5 %66 %69
+%70 = OpIAdd %5 %68 %36
+%72 = OpAccessChain %71 %9 %45 %70
+%73 = OpLoad %5 %72
+OpControlBarrier %74 %74 %75
+%76 = OpULessThan %51 %73 %77
+OpLoopMerge %114 %113 None
+OpBranch %110
+%110 = OpLabel
+OpSelectionMerge %112 None
+OpBranchConditional %76 %111 %112
+%111 = OpLabel
+%78 = OpAccessChain %43 %14 %45 %70
+%79 = OpLoad %10 %78
+%80 = OpBitcast %29 %79
+%81 = OpCompositeExtract %28 %80 0
+%82 = OpCompositeExtract %28 %80 1
+%83 = OpCompositeExtract %28 %80 2
+%84 = OpCompositeExtract %28 %80 3
+%85 = OpAccessChain %43 %18 %45 %73
+%86 = OpLoad %10 %85
+%87 = OpBitcast %29 %86
+%88 = OpCompositeExtract %28 %87 0
+%89 = OpCompositeExtract %28 %87 1
+%90 = OpCompositeExtract %28 %87 2
+%91 = OpCompositeExtract %28 %87 3
+%92 = OpFAdd %28 %88 %81
+%93 = OpFAdd %28 %89 %82
+%94 = OpFAdd %28 %90 %83
+%95 = OpFAdd %28 %91 %84
+%96 = OpBitcast %5 %92
+%97 = OpBitcast %5 %93
+%98 = OpBitcast %5 %94
+%99 = OpBitcast %5 %95
+%100 = OpCompositeConstruct %10 %96 %97 %98 %99
+%101 = OpAccessChain %43 %18 %45 %73
+OpStore %101 %100
+OpBranch %112
+%112 = OpLabel
+OpBranch %113
+%113 = OpLabel
+%67 = OpIAdd %5 %66 %27
+%102 = OpAccessChain %46 %33 %45 %45
+%103 = OpLoad %29 %102
+%104 = OpBitcast %10 %103
+%105 = OpCompositeExtract %5 %104 0
+%106 = OpULessThan %51 %67 %105
+OpBranchConditional %106 %109 %114
+%114 = OpLabel
+OpBranch %115
+%115 = OpLabel
+%53 = OpAccessChain %43 %22 %45 %36
+%54 = OpLoad %10 %53
+%55 = OpBitcast %29 %54
+%56 = OpCompositeExtract %28 %55 0
+%57 = OpCompositeExtract %28 %55 1
+%58 = OpCompositeExtract %28 %55 2
+%59 = OpCompositeExtract %28 %55 3
+%60 = OpBitcast %5 %56
+%61 = OpBitcast %5 %57
+%62 = OpBitcast %5 %58
+%63 = OpBitcast %5 %59
+%64 = OpCompositeConstruct %10 %60 %61 %62 %63
+%65 = OpAccessChain %43 %26 %45 %36
+OpStore %65 %64
+OpReturn
+OpFunctionEnd
+#endif
diff --git a/reference/shaders/memory-model/uav-coherent.root-descriptor.ssbo.comp b/reference/shaders/memory-model/uav-coherent.root-descriptor.ssbo.comp
new file mode 100644
index 0000000..29d1346
--- /dev/null
+++ b/reference/shaders/memory-model/uav-coherent.root-descriptor.ssbo.comp
@@ -0,0 +1,288 @@
+#version 460
+#extension GL_EXT_buffer_reference : require
+#extension GL_EXT_buffer_reference_uvec2 : require
+layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
+
+layout(buffer_reference) buffer PhysicalPointerFloat4CoherentArray;
+layout(buffer_reference) buffer PhysicalPointerUint4NonWriteCBVArray;
+layout(buffer_reference) buffer PhysicalPointerFloat4Array;
+layout(buffer_reference) buffer PhysicalPointerUintNonWriteArray;
+layout(buffer_reference, buffer_reference_align = 4, std430) coherent buffer PhysicalPointerFloat4CoherentArray
+{
+ vec4 value[];
+};
+
+layout(buffer_reference, buffer_reference_align = 16, std430) readonly buffer PhysicalPointerUint4NonWriteCBVArray
+{
+ uvec4 value[4096];
+};
+
+layout(buffer_reference, buffer_reference_align = 4, std430) buffer PhysicalPointerFloat4Array
+{
+ vec4 value[];
+};
+
+layout(buffer_reference, buffer_reference_align = 4, std430) readonly buffer PhysicalPointerUintNonWriteArray
+{
+ uint value[];
+};
+
+layout(set = 0, binding = 1, std430) restrict readonly buffer SSBO
+{
+ uvec4 _m0[];
+} _14;
+
+layout(set = 0, binding = 2, std430) writeonly buffer _16_18
+{
+ uvec4 _m0[];
+} _18;
+
+layout(push_constant, std430) uniform RootConstants
+{
+ uvec2 _m0;
+ uvec2 _m1;
+ uvec2 _m2;
+ uvec2 _m3;
+} registers;
+
+void main()
+{
+ PhysicalPointerFloat4CoherentArray(registers._m2).value[gl_LocalInvocationIndex] = vec4(0.0);
+ if (!(PhysicalPointerUint4NonWriteCBVArray(registers._m0).value[0u].x == 0u))
+ {
+ uint _73 = 0u;
+ uint _77;
+ uint _84;
+ bool _86;
+ for (;;)
+ {
+ _77 = (_73 << 8u) + gl_LocalInvocationIndex;
+ _84 = PhysicalPointerUintNonWriteArray(registers._m1).value[_77];
+ memoryBarrierBuffer();
+ memoryBarrierImage();
+ barrier();
+ _86 = _84 < 256u;
+ if (_86)
+ {
+ vec4 _90 = uintBitsToFloat(_14._m0[_77]);
+ PhysicalPointerFloat4CoherentArray _95 = PhysicalPointerFloat4CoherentArray(registers._m2);
+ PhysicalPointerFloat4CoherentArray(registers._m2).value[_84] = vec4(_95.value[_84].x + _90.x, _95.value[_84].y + _90.y, _95.value[_84].z + _90.z, _95.value[_84].w + _90.w);
+ }
+ uint _74 = _73 + 1u;
+ if (_74 < PhysicalPointerUint4NonWriteCBVArray(registers._m0).value[0u].x)
+ {
+ _73 = _74;
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ PhysicalPointerFloat4Array _59 = PhysicalPointerFloat4Array(registers._m3);
+ _18._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(_59.value[gl_LocalInvocationIndex].x), floatBitsToUint(_59.value[gl_LocalInvocationIndex].y), floatBitsToUint(_59.value[gl_LocalInvocationIndex].z), floatBitsToUint(_59.value[gl_LocalInvocationIndex].w));
+}
+
+
+#if 0
+// SPIR-V disassembly
+; SPIR-V
+; Version: 1.3
+; Generator: Unknown(30017); 21022
+; Bound: 124
+; Schema: 0
+OpCapability Shader
+OpCapability PhysicalStorageBufferAddresses
+OpExtension "SPV_KHR_physical_storage_buffer"
+OpMemoryModel PhysicalStorageBuffer64 GLSL450
+OpEntryPoint GLCompute %3 "main" %33
+OpExecutionMode %3 LocalSize 256 1 1
+OpName %3 "main"
+OpName %7 "RootConstants"
+OpName %9 "registers"
+OpName %12 "SSBO"
+OpName %16 "SSBO"
+OpName %38 "PhysicalPointerFloat4CoherentArray"
+OpMemberName %38 0 "value"
+OpName %47 "PhysicalPointerUint4NonWriteCBVArray"
+OpMemberName %47 0 "value"
+OpName %57 "PhysicalPointerFloat4Array"
+OpMemberName %57 0 "value"
+OpName %79 "PhysicalPointerUintNonWriteArray"
+OpMemberName %79 0 "value"
+OpDecorate %7 Block
+OpMemberDecorate %7 0 Offset 0
+OpMemberDecorate %7 1 Offset 8
+OpMemberDecorate %7 2 Offset 16
+OpMemberDecorate %7 3 Offset 24
+OpDecorate %11 ArrayStride 16
+OpMemberDecorate %12 0 Offset 0
+OpDecorate %12 Block
+OpDecorate %14 DescriptorSet 0
+OpDecorate %14 Binding 1
+OpDecorate %14 NonWritable
+OpDecorate %14 Restrict
+OpDecorate %15 ArrayStride 16
+OpMemberDecorate %16 0 Offset 0
+OpDecorate %16 Block
+OpDecorate %18 DescriptorSet 0
+OpDecorate %18 Binding 2
+OpDecorate %18 NonReadable
+OpDecorate %33 BuiltIn LocalInvocationIndex
+OpDecorate %37 ArrayStride 16
+OpMemberDecorate %38 0 Offset 0
+OpDecorate %38 Block
+OpMemberDecorate %38 0 Coherent
+OpDecorate %46 ArrayStride 16
+OpMemberDecorate %47 0 Offset 0
+OpDecorate %47 Block
+OpMemberDecorate %47 0 NonWritable
+OpDecorate %56 ArrayStride 16
+OpMemberDecorate %57 0 Offset 0
+OpDecorate %57 Block
+OpDecorate %78 ArrayStride 4
+OpMemberDecorate %79 0 Offset 0
+OpDecorate %79 Block
+OpMemberDecorate %79 0 NonWritable
+%1 = OpTypeVoid
+%2 = OpTypeFunction %1
+%5 = OpTypeInt 32 0
+%6 = OpTypeVector %5 2
+%7 = OpTypeStruct %6 %6 %6 %6
+%8 = OpTypePointer PushConstant %7
+%9 = OpVariable %8 PushConstant
+%10 = OpTypeVector %5 4
+%11 = OpTypeRuntimeArray %10
+%12 = OpTypeStruct %11
+%13 = OpTypePointer StorageBuffer %12
+%14 = OpVariable %13 StorageBuffer
+%15 = OpTypeRuntimeArray %10
+%16 = OpTypeStruct %15
+%17 = OpTypePointer StorageBuffer %16
+%18 = OpVariable %17 StorageBuffer
+%19 = OpTypePointer PushConstant %6
+%21 = OpConstant %5 3
+%24 = OpConstant %5 2
+%27 = OpConstant %5 1
+%30 = OpConstant %5 0
+%32 = OpTypePointer Input %5
+%33 = OpVariable %32 Input
+%35 = OpTypeFloat 32
+%36 = OpTypeVector %35 4
+%37 = OpTypeRuntimeArray %36
+%38 = OpTypeStruct %37
+%39 = OpTypePointer PhysicalStorageBuffer %38
+%41 = OpTypePointer PhysicalStorageBuffer %36
+%43 = OpConstant %35 0
+%45 = OpConstant %5 4096
+%46 = OpTypeArray %10 %45
+%47 = OpTypeStruct %46
+%48 = OpTypePointer PhysicalStorageBuffer %47
+%50 = OpTypePointer PhysicalStorageBuffer %10
+%54 = OpTypeBool
+%56 = OpTypeRuntimeArray %36
+%57 = OpTypeStruct %56
+%58 = OpTypePointer PhysicalStorageBuffer %57
+%71 = OpTypePointer StorageBuffer %10
+%76 = OpConstant %5 8
+%78 = OpTypeRuntimeArray %5
+%79 = OpTypeStruct %78
+%80 = OpTypePointer PhysicalStorageBuffer %79
+%82 = OpTypePointer PhysicalStorageBuffer %5
+%85 = OpConstant %5 2120
+%87 = OpConstant %5 256
+%3 = OpFunction %1 None %2
+%4 = OpLabel
+OpBranch %114
+%114 = OpLabel
+%20 = OpAccessChain %19 %9 %21
+%22 = OpLoad %6 %20
+%23 = OpAccessChain %19 %9 %24
+%25 = OpLoad %6 %23
+%26 = OpAccessChain %19 %9 %27
+%28 = OpLoad %6 %26
+%29 = OpAccessChain %19 %9 %30
+%31 = OpLoad %6 %29
+%34 = OpLoad %5 %33
+%40 = OpBitcast %39 %25
+%42 = OpInBoundsAccessChain %41 %40 %30 %34
+%44 = OpCompositeConstruct %36 %43 %43 %43 %43
+OpStore %42 %44 Aligned 4
+%49 = OpBitcast %48 %31
+%51 = OpInBoundsAccessChain %50 %49 %30 %30
+%52 = OpLoad %10 %51 Aligned 16
+%53 = OpCompositeExtract %5 %52 0
+%55 = OpIEqual %54 %53 %30
+OpSelectionMerge %122 None
+OpBranchConditional %55 %122 %115
+%115 = OpLabel
+OpBranch %116
+%116 = OpLabel
+%73 = OpPhi %5 %30 %115 %74 %120
+%75 = OpShiftLeftLogical %5 %73 %76
+%77 = OpIAdd %5 %75 %34
+%81 = OpBitcast %80 %28
+%83 = OpInBoundsAccessChain %82 %81 %30 %77
+%84 = OpLoad %5 %83 Aligned 4
+OpControlBarrier %24 %27 %85
+%86 = OpULessThan %54 %84 %87
+OpLoopMerge %121 %120 None
+OpBranch %117
+%117 = OpLabel
+OpSelectionMerge %119 None
+OpBranchConditional %86 %118 %119
+%118 = OpLabel
+%88 = OpAccessChain %71 %14 %30 %77
+%89 = OpLoad %10 %88
+%90 = OpBitcast %36 %89
+%91 = OpCompositeExtract %35 %90 0
+%92 = OpCompositeExtract %35 %90 1
+%93 = OpCompositeExtract %35 %90 2
+%94 = OpCompositeExtract %35 %90 3
+%95 = OpBitcast %39 %25
+%96 = OpInBoundsAccessChain %41 %95 %30 %84
+%97 = OpLoad %36 %96 Aligned 4
+%98 = OpCompositeExtract %35 %97 0
+%99 = OpCompositeExtract %35 %97 1
+%100 = OpCompositeExtract %35 %97 2
+%101 = OpCompositeExtract %35 %97 3
+%102 = OpFAdd %35 %98 %91
+%103 = OpFAdd %35 %99 %92
+%104 = OpFAdd %35 %100 %93
+%105 = OpFAdd %35 %101 %94
+%106 = OpBitcast %39 %25
+%107 = OpInBoundsAccessChain %41 %106 %30 %84
+%108 = OpCompositeConstruct %36 %102 %103 %104 %105
+OpStore %107 %108 Aligned 4
+OpBranch %119
+%119 = OpLabel
+OpBranch %120
+%120 = OpLabel
+%74 = OpIAdd %5 %73 %27
+%109 = OpBitcast %48 %31
+%110 = OpInBoundsAccessChain %50 %109 %30 %30
+%111 = OpLoad %10 %110 Aligned 16
+%112 = OpCompositeExtract %5 %111 0
+%113 = OpULessThan %54 %74 %112
+OpBranchConditional %113 %116 %121
+%121 = OpLabel
+OpBranch %122
+%122 = OpLabel
+%59 = OpBitcast %58 %22
+%60 = OpInBoundsAccessChain %41 %59 %30 %34
+%61 = OpLoad %36 %60 Aligned 4
+%62 = OpCompositeExtract %35 %61 0
+%63 = OpCompositeExtract %35 %61 1
+%64 = OpCompositeExtract %35 %61 2
+%65 = OpCompositeExtract %35 %61 3
+%66 = OpBitcast %5 %62
+%67 = OpBitcast %5 %63
+%68 = OpBitcast %5 %64
+%69 = OpBitcast %5 %65
+%70 = OpCompositeConstruct %10 %66 %67 %68 %69
+%72 = OpAccessChain %71 %18 %30 %34
+OpStore %72 %70
+OpReturn
+OpFunctionEnd
+#endif
diff --git a/reference/shaders/memory-model/uav-coherent.sm66.ssbo.comp b/reference/shaders/memory-model/uav-coherent.sm66.ssbo.comp
new file mode 100644
index 0000000..1162e80
--- /dev/null
+++ b/reference/shaders/memory-model/uav-coherent.sm66.ssbo.comp
@@ -0,0 +1,239 @@
+#version 460
+#extension GL_EXT_nonuniform_qualifier : require
+layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
+
+layout(set = 0, binding = 0, std430) coherent buffer SSBO
+{
+ uvec4 _m0[];
+} _11[];
+
+layout(set = 0, binding = 0, std430) restrict readonly buffer _13_15
+{
+ uint _m0[];
+} _15;
+
+layout(set = 0, binding = 1, std430) restrict readonly buffer _17_19
+{
+ uvec4 _m0[];
+} _19;
+
+layout(set = 0, binding = 0, std140) uniform _24_26
+{
+ vec4 _m0[1];
+} _26;
+
+void main()
+{
+ _11[0u]._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(0.0), floatBitsToUint(0.0), floatBitsToUint(0.0), floatBitsToUint(0.0));
+ if (!(floatBitsToUint(_26._m0[0u]).x == 0u))
+ {
+ uint _64 = 0u;
+ uint _68;
+ uint _71;
+ bool _73;
+ for (;;)
+ {
+ _68 = (_64 << 8u) + gl_LocalInvocationIndex;
+ _71 = _15._m0[_68];
+ memoryBarrierBuffer();
+ memoryBarrierImage();
+ barrier();
+ _73 = _71 < 256u;
+ if (_73)
+ {
+ vec4 _77 = uintBitsToFloat(_19._m0[_68]);
+ vec4 _84 = uintBitsToFloat(_11[0u]._m0[_71]);
+ _11[0u]._m0[_71] = uvec4(floatBitsToUint(_84.x + _77.x), floatBitsToUint(_84.y + _77.y), floatBitsToUint(_84.z + _77.z), floatBitsToUint(_84.w + _77.w));
+ }
+ uint _65 = _64 + 1u;
+ if (_65 < floatBitsToUint(_26._m0[0u]).x)
+ {
+ _64 = _65;
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ vec4 _53 = uintBitsToFloat(_11[1u]._m0[gl_LocalInvocationIndex]);
+ _11[2u]._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(_53.x), floatBitsToUint(_53.y), floatBitsToUint(_53.z), floatBitsToUint(_53.w));
+}
+
+
+#if 0
+// SPIR-V disassembly
+; SPIR-V
+; Version: 1.3
+; Generator: Unknown(30017); 21022
+; Bound: 114
+; Schema: 0
+OpCapability Shader
+OpCapability RuntimeDescriptorArray
+OpExtension "SPV_EXT_descriptor_indexing"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %3 "main" %28
+OpExecutionMode %3 LocalSize 256 1 1
+OpName %3 "main"
+OpName %8 "SSBO"
+OpName %13 "SSBO"
+OpName %17 "SSBO"
+OpName %24 ""
+OpDecorate %7 ArrayStride 16
+OpMemberDecorate %8 0 Offset 0
+OpDecorate %8 Block
+OpDecorate %11 DescriptorSet 0
+OpDecorate %11 Binding 0
+OpDecorate %11 Coherent
+OpDecorate %12 ArrayStride 4
+OpMemberDecorate %13 0 Offset 0
+OpDecorate %13 Block
+OpDecorate %15 DescriptorSet 0
+OpDecorate %15 Binding 0
+OpDecorate %15 NonWritable
+OpDecorate %15 Restrict
+OpDecorate %16 ArrayStride 16
+OpMemberDecorate %17 0 Offset 0
+OpDecorate %17 Block
+OpDecorate %19 DescriptorSet 0
+OpDecorate %19 Binding 1
+OpDecorate %19 NonWritable
+OpDecorate %19 Restrict
+OpDecorate %23 ArrayStride 16
+OpMemberDecorate %24 0 Offset 0
+OpDecorate %24 Block
+OpDecorate %26 DescriptorSet 0
+OpDecorate %26 Binding 0
+OpDecorate %28 BuiltIn LocalInvocationIndex
+%1 = OpTypeVoid
+%2 = OpTypeFunction %1
+%5 = OpTypeInt 32 0
+%6 = OpTypeVector %5 4
+%7 = OpTypeRuntimeArray %6
+%8 = OpTypeStruct %7
+%9 = OpTypeRuntimeArray %8
+%10 = OpTypePointer StorageBuffer %9
+%11 = OpVariable %10 StorageBuffer
+%12 = OpTypeRuntimeArray %5
+%13 = OpTypeStruct %12
+%14 = OpTypePointer StorageBuffer %13
+%15 = OpVariable %14 StorageBuffer
+%16 = OpTypeRuntimeArray %6
+%17 = OpTypeStruct %16
+%18 = OpTypePointer StorageBuffer %17
+%19 = OpVariable %18 StorageBuffer
+%20 = OpConstant %5 1
+%21 = OpTypeFloat 32
+%22 = OpTypeVector %21 4
+%23 = OpTypeArray %22 %20
+%24 = OpTypeStruct %23
+%25 = OpTypePointer Uniform %24
+%26 = OpVariable %25 Uniform
+%27 = OpTypePointer Input %5
+%28 = OpVariable %27 Input
+%30 = OpTypePointer StorageBuffer %8
+%32 = OpConstant %5 0
+%35 = OpConstant %5 2
+%36 = OpConstant %21 0
+%42 = OpTypePointer StorageBuffer %6
+%44 = OpTypePointer Uniform %22
+%49 = OpTypeBool
+%67 = OpConstant %5 8
+%69 = OpTypePointer StorageBuffer %5
+%72 = OpConstant %5 2120
+%74 = OpConstant %5 256
+%3 = OpFunction %1 None %2
+%4 = OpLabel
+OpBranch %104
+%104 = OpLabel
+%29 = OpLoad %5 %28
+%31 = OpAccessChain %30 %11 %32
+%33 = OpAccessChain %30 %11 %20
+%34 = OpAccessChain %30 %11 %35
+%37 = OpBitcast %5 %36
+%38 = OpBitcast %5 %36
+%39 = OpBitcast %5 %36
+%40 = OpBitcast %5 %36
+%41 = OpCompositeConstruct %6 %37 %38 %39 %40
+%43 = OpAccessChain %42 %31 %32 %29
+OpStore %43 %41
+%45 = OpAccessChain %44 %26 %32 %32
+%46 = OpLoad %22 %45
+%47 = OpBitcast %6 %46
+%48 = OpCompositeExtract %5 %47 0
+%50 = OpIEqual %49 %48 %32
+OpSelectionMerge %112 None
+OpBranchConditional %50 %112 %105
+%105 = OpLabel
+OpBranch %106
+%106 = OpLabel
+%64 = OpPhi %5 %32 %105 %65 %110
+%66 = OpShiftLeftLogical %5 %64 %67
+%68 = OpIAdd %5 %66 %29
+%70 = OpAccessChain %69 %15 %32 %68
+%71 = OpLoad %5 %70
+OpControlBarrier %35 %20 %72
+%73 = OpULessThan %49 %71 %74
+OpLoopMerge %111 %110 None
+OpBranch %107
+%107 = OpLabel
+OpSelectionMerge %109 None
+OpBranchConditional %73 %108 %109
+%108 = OpLabel
+%75 = OpAccessChain %42 %19 %32 %68
+%76 = OpLoad %6 %75
+%77 = OpBitcast %22 %76
+%78 = OpCompositeExtract %21 %77 0
+%79 = OpCompositeExtract %21 %77 1
+%80 = OpCompositeExtract %21 %77 2
+%81 = OpCompositeExtract %21 %77 3
+%82 = OpAccessChain %42 %31 %32 %71
+%83 = OpLoad %6 %82
+%84 = OpBitcast %22 %83
+%85 = OpCompositeExtract %21 %84 0
+%86 = OpCompositeExtract %21 %84 1
+%87 = OpCompositeExtract %21 %84 2
+%88 = OpCompositeExtract %21 %84 3
+%89 = OpFAdd %21 %85 %78
+%90 = OpFAdd %21 %86 %79
+%91 = OpFAdd %21 %87 %80
+%92 = OpFAdd %21 %88 %81
+%93 = OpBitcast %5 %89
+%94 = OpBitcast %5 %90
+%95 = OpBitcast %5 %91
+%96 = OpBitcast %5 %92
+%97 = OpCompositeConstruct %6 %93 %94 %95 %96
+%98 = OpAccessChain %42 %31 %32 %71
+OpStore %98 %97
+OpBranch %109
+%109 = OpLabel
+OpBranch %110
+%110 = OpLabel
+%65 = OpIAdd %5 %64 %20
+%99 = OpAccessChain %44 %26 %32 %32
+%100 = OpLoad %22 %99
+%101 = OpBitcast %6 %100
+%102 = OpCompositeExtract %5 %101 0
+%103 = OpULessThan %49 %65 %102
+OpBranchConditional %103 %106 %111
+%111 = OpLabel
+OpBranch %112
+%112 = OpLabel
+%51 = OpAccessChain %42 %33 %32 %29
+%52 = OpLoad %6 %51
+%53 = OpBitcast %22 %52
+%54 = OpCompositeExtract %21 %53 0
+%55 = OpCompositeExtract %21 %53 1
+%56 = OpCompositeExtract %21 %53 2
+%57 = OpCompositeExtract %21 %53 3
+%58 = OpBitcast %5 %54
+%59 = OpBitcast %5 %55
+%60 = OpBitcast %5 %56
+%61 = OpBitcast %5 %57
+%62 = OpCompositeConstruct %6 %58 %59 %60 %61
+%63 = OpAccessChain %42 %34 %32 %29
+OpStore %63 %62
+OpReturn
+OpFunctionEnd
+#endif
diff --git a/reference/shaders/memory-model/uav-coherent.ssbo.comp b/reference/shaders/memory-model/uav-coherent.ssbo.comp
new file mode 100644
index 0000000..e1e752c
--- /dev/null
+++ b/reference/shaders/memory-model/uav-coherent.ssbo.comp
@@ -0,0 +1,263 @@
+#version 460
+layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
+
+layout(set = 0, binding = 0, std430) restrict readonly buffer SSBO
+{
+ uint _m0[];
+} _9;
+
+layout(set = 0, binding = 1, std430) restrict readonly buffer _12_14
+{
+ uvec4 _m0[];
+} _14;
+
+layout(set = 0, binding = 0, std430) coherent buffer _16_18
+{
+ uvec4 _m0[];
+} _18;
+
+layout(set = 0, binding = 1, std430) readonly buffer _20_22
+{
+ uvec4 _m0[];
+} _22;
+
+layout(set = 0, binding = 2, std430) writeonly buffer _24_26
+{
+ uvec4 _m0[];
+} _26;
+
+layout(set = 0, binding = 0, std140) uniform _31_33
+{
+ vec4 _m0[1];
+} _33;
+
+void main()
+{
+ _18._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(0.0), floatBitsToUint(0.0), floatBitsToUint(0.0), floatBitsToUint(0.0));
+ if (!(floatBitsToUint(_33._m0[0u]).x == 0u))
+ {
+ uint _66 = 0u;
+ uint _70;
+ uint _73;
+ bool _76;
+ for (;;)
+ {
+ _70 = (_66 << 8u) + gl_LocalInvocationIndex;
+ _73 = _9._m0[_70];
+ memoryBarrierBuffer();
+ memoryBarrierImage();
+ barrier();
+ _76 = _73 < 256u;
+ if (_76)
+ {
+ vec4 _80 = uintBitsToFloat(_14._m0[_70]);
+ vec4 _87 = uintBitsToFloat(_18._m0[_73]);
+ _18._m0[_73] = uvec4(floatBitsToUint(_87.x + _80.x), floatBitsToUint(_87.y + _80.y), floatBitsToUint(_87.z + _80.z), floatBitsToUint(_87.w + _80.w));
+ }
+ uint _67 = _66 + 1u;
+ if (_67 < floatBitsToUint(_33._m0[0u]).x)
+ {
+ _66 = _67;
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ vec4 _55 = uintBitsToFloat(_22._m0[gl_LocalInvocationIndex]);
+ _26._m0[gl_LocalInvocationIndex] = uvec4(floatBitsToUint(_55.x), floatBitsToUint(_55.y), floatBitsToUint(_55.z), floatBitsToUint(_55.w));
+}
+
+
+#if 0
+// SPIR-V disassembly
+; SPIR-V
+; Version: 1.3
+; Generator: Unknown(30017); 21022
+; Bound: 117
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %3 "main" %35
+OpExecutionMode %3 LocalSize 256 1 1
+OpName %3 "main"
+OpName %7 "SSBO"
+OpName %12 "SSBO"
+OpName %16 "SSBO"
+OpName %20 "SSBO"
+OpName %24 "SSBO"
+OpName %31 ""
+OpDecorate %6 ArrayStride 4
+OpMemberDecorate %7 0 Offset 0
+OpDecorate %7 Block
+OpDecorate %9 DescriptorSet 0
+OpDecorate %9 Binding 0
+OpDecorate %9 NonWritable
+OpDecorate %9 Restrict
+OpDecorate %11 ArrayStride 16
+OpMemberDecorate %12 0 Offset 0
+OpDecorate %12 Block
+OpDecorate %14 DescriptorSet 0
+OpDecorate %14 Binding 1
+OpDecorate %14 NonWritable
+OpDecorate %14 Restrict
+OpDecorate %15 ArrayStride 16
+OpMemberDecorate %16 0 Offset 0
+OpDecorate %16 Block
+OpDecorate %18 DescriptorSet 0
+OpDecorate %18 Binding 0
+OpDecorate %18 Coherent
+OpDecorate %19 ArrayStride 16
+OpMemberDecorate %20 0 Offset 0
+OpDecorate %20 Block
+OpDecorate %22 DescriptorSet 0
+OpDecorate %22 Binding 1
+OpDecorate %22 NonWritable
+OpDecorate %23 ArrayStride 16
+OpMemberDecorate %24 0 Offset 0
+OpDecorate %24 Block
+OpDecorate %26 DescriptorSet 0
+OpDecorate %26 Binding 2
+OpDecorate %26 NonReadable
+OpDecorate %30 ArrayStride 16
+OpMemberDecorate %31 0 Offset 0
+OpDecorate %31 Block
+OpDecorate %33 DescriptorSet 0
+OpDecorate %33 Binding 0
+OpDecorate %35 BuiltIn LocalInvocationIndex
+%1 = OpTypeVoid
+%2 = OpTypeFunction %1
+%5 = OpTypeInt 32 0
+%6 = OpTypeRuntimeArray %5
+%7 = OpTypeStruct %6
+%8 = OpTypePointer StorageBuffer %7
+%9 = OpVariable %8 StorageBuffer
+%10 = OpTypeVector %5 4
+%11 = OpTypeRuntimeArray %10
+%12 = OpTypeStruct %11
+%13 = OpTypePointer StorageBuffer %12
+%14 = OpVariable %13 StorageBuffer
+%15 = OpTypeRuntimeArray %10
+%16 = OpTypeStruct %15
+%17 = OpTypePointer StorageBuffer %16
+%18 = OpVariable %17 StorageBuffer
+%19 = OpTypeRuntimeArray %10
+%20 = OpTypeStruct %19
+%21 = OpTypePointer StorageBuffer %20
+%22 = OpVariable %21 StorageBuffer
+%23 = OpTypeRuntimeArray %10
+%24 = OpTypeStruct %23
+%25 = OpTypePointer StorageBuffer %24
+%26 = OpVariable %25 StorageBuffer
+%27 = OpConstant %5 1
+%28 = OpTypeFloat 32
+%29 = OpTypeVector %28 4
+%30 = OpTypeArray %29 %27
+%31 = OpTypeStruct %30
+%32 = OpTypePointer Uniform %31
+%33 = OpVariable %32 Uniform
+%34 = OpTypePointer Input %5
+%35 = OpVariable %34 Input
+%37 = OpConstant %28 0
+%43 = OpTypePointer StorageBuffer %10
+%45 = OpConstant %5 0
+%46 = OpTypePointer Uniform %29
+%51 = OpTypeBool
+%69 = OpConstant %5 8
+%71 = OpTypePointer StorageBuffer %5
+%74 = OpConstant %5 2
+%75 = OpConstant %5 2120
+%77 = OpConstant %5 256
+%3 = OpFunction %1 None %2
+%4 = OpLabel
+OpBranch %107
+%107 = OpLabel
+%36 = OpLoad %5 %35
+%38 = OpBitcast %5 %37
+%39 = OpBitcast %5 %37
+%40 = OpBitcast %5 %37
+%41 = OpBitcast %5 %37
+%42 = OpCompositeConstruct %10 %38 %39 %40 %41
+%44 = OpAccessChain %43 %18 %45 %36
+OpStore %44 %42
+%47 = OpAccessChain %46 %33 %45 %45
+%48 = OpLoad %29 %47
+%49 = OpBitcast %10 %48
+%50 = OpCompositeExtract %5 %49 0
+%52 = OpIEqual %51 %50 %45
+OpSelectionMerge %115 None
+OpBranchConditional %52 %115 %108
+%108 = OpLabel
+OpBranch %109
+%109 = OpLabel
+%66 = OpPhi %5 %45 %108 %67 %113
+%68 = OpShiftLeftLogical %5 %66 %69
+%70 = OpIAdd %5 %68 %36
+%72 = OpAccessChain %71 %9 %45 %70
+%73 = OpLoad %5 %72
+OpControlBarrier %74 %27 %75
+%76 = OpULessThan %51 %73 %77
+OpLoopMerge %114 %113 None
+OpBranch %110
+%110 = OpLabel
+OpSelectionMerge %112 None
+OpBranchConditional %76 %111 %112
+%111 = OpLabel
+%78 = OpAccessChain %43 %14 %45 %70
+%79 = OpLoad %10 %78
+%80 = OpBitcast %29 %79
+%81 = OpCompositeExtract %28 %80 0
+%82 = OpCompositeExtract %28 %80 1
+%83 = OpCompositeExtract %28 %80 2
+%84 = OpCompositeExtract %28 %80 3
+%85 = OpAccessChain %43 %18 %45 %73
+%86 = OpLoad %10 %85
+%87 = OpBitcast %29 %86
+%88 = OpCompositeExtract %28 %87 0
+%89 = OpCompositeExtract %28 %87 1
+%90 = OpCompositeExtract %28 %87 2
+%91 = OpCompositeExtract %28 %87 3
+%92 = OpFAdd %28 %88 %81
+%93 = OpFAdd %28 %89 %82
+%94 = OpFAdd %28 %90 %83
+%95 = OpFAdd %28 %91 %84
+%96 = OpBitcast %5 %92
+%97 = OpBitcast %5 %93
+%98 = OpBitcast %5 %94
+%99 = OpBitcast %5 %95
+%100 = OpCompositeConstruct %10 %96 %97 %98 %99
+%101 = OpAccessChain %43 %18 %45 %73
+OpStore %101 %100
+OpBranch %112
+%112 = OpLabel
+OpBranch %113
+%113 = OpLabel
+%67 = OpIAdd %5 %66 %27
+%102 = OpAccessChain %46 %33 %45 %45
+%103 = OpLoad %29 %102
+%104 = OpBitcast %10 %103
+%105 = OpCompositeExtract %5 %104 0
+%106 = OpULessThan %51 %67 %105
+OpBranchConditional %106 %109 %114
+%114 = OpLabel
+OpBranch %115
+%115 = OpLabel
+%53 = OpAccessChain %43 %22 %45 %36
+%54 = OpLoad %10 %53
+%55 = OpBitcast %29 %54
+%56 = OpCompositeExtract %28 %55 0
+%57 = OpCompositeExtract %28 %55 1
+%58 = OpCompositeExtract %28 %55 2
+%59 = OpCompositeExtract %28 %55 3
+%60 = OpBitcast %5 %56
+%61 = OpBitcast %5 %57
+%62 = OpBitcast %5 %58
+%63 = OpBitcast %5 %59
+%64 = OpCompositeConstruct %10 %60 %61 %62 %63
+%65 = OpAccessChain %43 %26 %45 %36
+OpStore %65 %64
+OpReturn
+OpFunctionEnd
+#endif
diff --git a/reference/shaders/resources/sm66/buffer-64bit-double.ssbo.sm66.comp b/reference/shaders/resources/sm66/buffer-64bit-double.ssbo.sm66.comp
index f92e47c..a313eee 100644
--- a/reference/shaders/resources/sm66/buffer-64bit-double.ssbo.sm66.comp
+++ b/reference/shaders/resources/sm66/buffer-64bit-double.ssbo.sm66.comp
@@ -8,7 +8,7 @@
#extension GL_EXT_scalar_block_layout : require
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
-layout(set = 0, binding = 0, scalar) writeonly buffer SSBO
+layout(set = 0, binding = 0, scalar) buffer SSBO
{
u64vec3 _m0[];
} _11[];
@@ -18,7 +18,7 @@ layout(set = 0, binding = 0, scalar) restrict readonly buffer _13_16
u64vec3 _m0[];
} _16[];
-layout(set = 0, binding = 0, std430) writeonly buffer _18_21
+layout(set = 0, binding = 0, std430) buffer _18_21
{
uint64_t _m0[];
} _21[];
@@ -76,7 +76,6 @@ OpMemberDecorate %8 0 Offset 0
OpDecorate %8 Block
OpDecorate %11 DescriptorSet 0
OpDecorate %11 Binding 0
-OpDecorate %11 NonReadable
OpDecorate %12 ArrayStride 24
OpMemberDecorate %13 0 Offset 0
OpDecorate %13 Block
@@ -89,7 +88,6 @@ OpMemberDecorate %18 0 Offset 0
OpDecorate %18 Block
OpDecorate %21 DescriptorSet 0
OpDecorate %21 Binding 0
-OpDecorate %21 NonReadable
OpDecorate %22 ArrayStride 8
OpMemberDecorate %23 0 Offset 0
OpDecorate %23 Block
diff --git a/reference/shaders/resources/sm66/buffer-64bit.ssbo.sm66.comp b/reference/shaders/resources/sm66/buffer-64bit.ssbo.sm66.comp
index b412a16..2aa5e63 100644
--- a/reference/shaders/resources/sm66/buffer-64bit.ssbo.sm66.comp
+++ b/reference/shaders/resources/sm66/buffer-64bit.ssbo.sm66.comp
@@ -8,7 +8,7 @@
#extension GL_EXT_scalar_block_layout : require
layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in;
-layout(set = 0, binding = 0, scalar) writeonly buffer SSBO
+layout(set = 0, binding = 0, scalar) buffer SSBO
{
u64vec3 _m0[];
} _11[];
@@ -18,7 +18,7 @@ layout(set = 0, binding = 0, scalar) restrict readonly buffer _13_16
u64vec3 _m0[];
} _16[];
-layout(set = 0, binding = 0, std430) writeonly buffer _18_21
+layout(set = 0, binding = 0, std430) buffer _18_21
{
uint64_t _m0[];
} _21[];
@@ -76,7 +76,6 @@ OpMemberDecorate %8 0 Offset 0
OpDecorate %8 Block
OpDecorate %11 DescriptorSet 0
OpDecorate %11 Binding 0
-OpDecorate %11 NonReadable
OpDecorate %12 ArrayStride 24
OpMemberDecorate %13 0 Offset 0
OpDecorate %13 Block
@@ -89,7 +88,6 @@ OpMemberDecorate %18 0 Offset 0
OpDecorate %18 Block
OpDecorate %21 DescriptorSet 0
OpDecorate %21 Binding 0
-OpDecorate %21 NonReadable
OpDecorate %22 ArrayStride 8
OpMemberDecorate %23 0 Offset 0
OpDecorate %23 Block
diff --git a/reference/shaders/resources/sm66/buffer-64bit.ssbo.ssbo-align.sm66.comp b/reference/shaders/resources/sm66/buffer-64bit.ssbo.ssbo-align.sm66.comp
index d090803..96d41c2 100644
--- a/reference/shaders/resources/sm66/buffer-64bit.ssbo.ssbo-align.sm66.comp
+++ b/reference/shaders/resources/sm66/buffer-64bit.ssbo.ssbo-align.sm66.comp
@@ -13,7 +13,7 @@ layout(set = 15, binding = 0, std430) restrict readonly buffer SSBO_Offsets
uvec2 _m0[];
} _10;
-layout(set = 0, binding = 0, std430) writeonly buffer SSBO
+layout(set = 0, binding = 0, std430) buffer SSBO
{
uint64_t _m0[];
} _16[];
@@ -23,7 +23,7 @@ layout(set = 0, binding = 0, std430) restrict readonly buffer _18_21
uint64_t _m0[];
} _21[];
-layout(set = 0, binding = 0, std430) writeonly buffer _23_26
+layout(set = 0, binding = 0, std430) buffer _23_26
{
uint64_t _m0[];
} _26[];
@@ -138,7 +138,6 @@ OpMemberDecorate %13 0 Offset 0
OpDecorate %13 Block
OpDecorate %16 DescriptorSet 0
OpDecorate %16 Binding 0
-OpDecorate %16 NonReadable
OpDecorate %17 ArrayStride 8
OpMemberDecorate %18 0 Offset 0
OpDecorate %18 Block
@@ -151,7 +150,6 @@ OpMemberDecorate %23 0 Offset 0
OpDecorate %23 Block
OpDecorate %26 DescriptorSet 0
OpDecorate %26 Binding 0
-OpDecorate %26 NonReadable
OpDecorate %27 ArrayStride 8
OpMemberDecorate %28 0 Offset 0
OpDecorate %28 Block
diff --git a/reference/shaders/resources/sm66/raw-buffer-heap.sm66.frag b/reference/shaders/resources/sm66/raw-buffer-heap.sm66.frag
index d838339..267c736 100644
--- a/reference/shaders/resources/sm66/raw-buffer-heap.sm66.frag
+++ b/reference/shaders/resources/sm66/raw-buffer-heap.sm66.frag
@@ -49,7 +49,6 @@ OpDecorate %9 DescriptorSet 0
OpDecorate %9 Binding 0
OpDecorate %13 DescriptorSet 0
OpDecorate %13 Binding 0
-OpDecorate %13 NonReadable
OpDecorate %13 Coherent
OpDecorate %15 Flat
OpDecorate %15 Location 0
diff --git a/reference/shaders/resources/sm66/raw-buffer-heap.ssbo.sm66.frag b/reference/shaders/resources/sm66/raw-buffer-heap.ssbo.sm66.frag
index 0d9b637..0bc2c27 100644
--- a/reference/shaders/resources/sm66/raw-buffer-heap.ssbo.sm66.frag
+++ b/reference/shaders/resources/sm66/raw-buffer-heap.ssbo.sm66.frag
@@ -6,7 +6,7 @@ layout(set = 0, binding = 0, std430) restrict readonly buffer SSBO
uint _m0[];
} _10[];
-layout(set = 0, binding = 0, std430) coherent writeonly buffer _12_15
+layout(set = 0, binding = 0, std430) coherent buffer _12_15
{
uint _m0[];
} _15[];
@@ -64,7 +64,6 @@ OpMemberDecorate %12 0 Offset 0
OpDecorate %12 Block
OpDecorate %15 DescriptorSet 0
OpDecorate %15 Binding 0
-OpDecorate %15 NonReadable
OpDecorate %15 Coherent
OpDecorate %17 Flat
OpDecorate %17 Location 0
diff --git a/reference/shaders/resources/sm66/raw-buffer-heap.typed-buffer-offset.sm66.frag b/reference/shaders/resources/sm66/raw-buffer-heap.typed-buffer-offset.sm66.frag
index 0ef0d1f..26213b0 100644
--- a/reference/shaders/resources/sm66/raw-buffer-heap.typed-buffer-offset.sm66.frag
+++ b/reference/shaders/resources/sm66/raw-buffer-heap.typed-buffer-offset.sm66.frag
@@ -94,7 +94,6 @@ OpDecorate %17 DescriptorSet 0
OpDecorate %17 Binding 0
OpDecorate %21 DescriptorSet 0
OpDecorate %21 Binding 0
-OpDecorate %21 NonReadable
OpDecorate %21 Coherent
OpDecorate %23 Flat
OpDecorate %23 Location 0
diff --git a/reference/shaders/resources/sm66/structured-16bit-heap.ssbo.sm66.frag b/reference/shaders/resources/sm66/structured-16bit-heap.ssbo.sm66.frag
index 6bc6537..f5a773d 100644
--- a/reference/shaders/resources/sm66/structured-16bit-heap.ssbo.sm66.frag
+++ b/reference/shaders/resources/sm66/structured-16bit-heap.ssbo.sm66.frag
@@ -20,12 +20,12 @@ layout(set = 0, binding = 0, std430) restrict readonly buffer _14_17
u16vec2 _m0[];
} _17[];
-layout(set = 0, binding = 0, std430) readonly buffer _19_22
+layout(set = 0, binding = 0, std430) buffer _19_22
{
uint _m0[];
} _22[];
-layout(set = 0, binding = 0, std430) readonly buffer _24_27
+layout(set = 0, binding = 0, std430) buffer _24_27
{
u16vec2 _m0[];
} _27[];
@@ -125,13 +125,11 @@ OpMemberDecorate %19 0 Offset 0
OpDecorate %19 Block
OpDecorate %22 DescriptorSet 0
OpDecorate %22 Binding 0
-OpDecorate %22 NonWritable
OpDecorate %23 ArrayStride 4
OpMemberDecorate %24 0 Offset 0
OpDecorate %24 Block
OpDecorate %27 DescriptorSet 0
OpDecorate %27 Binding 0
-OpDecorate %27 NonWritable
OpDecorate %29 ArrayStride 8
OpMemberDecorate %30 0 Offset 0
OpDecorate %30 Block
diff --git a/reference/shaders/resources/sm66/structured-16bit-heap.ssbo.ssbo-align.sm66.frag b/reference/shaders/resources/sm66/structured-16bit-heap.ssbo.ssbo-align.sm66.frag
index 8c122b8..7eee978 100644
--- a/reference/shaders/resources/sm66/structured-16bit-heap.ssbo.ssbo-align.sm66.frag
+++ b/reference/shaders/resources/sm66/structured-16bit-heap.ssbo.ssbo-align.sm66.frag
@@ -26,12 +26,12 @@ layout(set = 0, binding = 0, std430) restrict readonly buffer _19_22
u16vec2 _m0[];
} _22[];
-layout(set = 0, binding = 0, std430) readonly buffer _24_27
+layout(set = 0, binding = 0, std430) buffer _24_27
{
uint _m0[];
} _27[];
-layout(set = 0, binding = 0, std430) readonly buffer _29_32
+layout(set = 0, binding = 0, std430) buffer _29_32
{
u16vec2 _m0[];
} _32[];
@@ -157,13 +157,11 @@ OpMemberDecorate %24 0 Offset 0
OpDecorate %24 Block
OpDecorate %27 DescriptorSet 0
OpDecorate %27 Binding 0
-OpDecorate %27 NonWritable
OpDecorate %28 ArrayStride 4
OpMemberDecorate %29 0 Offset 0
OpDecorate %29 Block
OpDecorate %32 DescriptorSet 0
OpDecorate %32 Binding 0
-OpDecorate %32 NonWritable
OpDecorate %34 ArrayStride 8
OpMemberDecorate %35 0 Offset 0
OpDecorate %35 Block
diff --git a/reference/shaders/resources/sm66/structured-buffer-heap.sm66.frag b/reference/shaders/resources/sm66/structured-buffer-heap.sm66.frag
index 550183a..fa9a5d2 100644
--- a/reference/shaders/resources/sm66/structured-buffer-heap.sm66.frag
+++ b/reference/shaders/resources/sm66/structured-buffer-heap.sm66.frag
@@ -2,10 +2,8 @@
#extension GL_EXT_nonuniform_qualifier : require
layout(set = 0, binding = 0) uniform usamplerBuffer _9[];
-layout(set = 0, binding = 0, r32ui) uniform readonly uimageBuffer _13[];
-layout(set = 0, binding = 0, r32ui) uniform uimageBuffer _16[];
-layout(set = 0, binding = 0, r32ui) uniform coherent readonly uimageBuffer _19[];
-layout(set = 0, binding = 0, r32ui) uniform coherent uimageBuffer _22[];
+layout(set = 0, binding = 0, r32ui) uniform uimageBuffer _13[];
+layout(set = 0, binding = 0, r32ui) uniform coherent uimageBuffer _16[];
layout(location = 0) flat in uint INDEX;
layout(location = 1) flat in ivec4 UV;
@@ -13,63 +11,63 @@ layout(location = 0) out vec4 SV_Target;
void main()
{
- uint _37 = uint(UV.x);
- uint _41 = uint(UV.y);
- uint _45 = uint(UV.z);
- uint _49 = uint(UV.w);
- uint _54 = INDEX + 1u;
- uint _57 = INDEX + 2u;
- uint _60 = INDEX + 3u;
- uint _68 = INDEX + 5u;
- uint _72 = INDEX + 6u;
- uint _76 = INDEX + 7u;
- uint _84 = INDEX + 9u;
- uint _88 = INDEX + 10u;
- uint _92 = INDEX + 11u;
- uint _100 = _41 * 2u;
- vec2 _109 = uintBitsToFloat(uvec2(texelFetch(_9[_54], int(_100)).x, texelFetch(_9[_54], int(_100 + 1u)).x));
- uint _113 = _45 * 3u;
- vec3 _125 = uintBitsToFloat(uvec3(texelFetch(_9[_57], int(_113)).x, texelFetch(_9[_57], int(_113 + 1u)).x, texelFetch(_9[_57], int(_113 + 2u)).x));
- uint _131 = _49 * 4u;
- vec4 _144 = uintBitsToFloat(uvec4(texelFetch(_9[_60], int(_131)).x, texelFetch(_9[_60], int(_131 + 1u)).x, texelFetch(_9[_60], int(_131 + 2u)).x, texelFetch(_9[_60], int(_131 + 3u)).x));
- uvec4 _152 = imageLoad(_13[INDEX + 4u], int(_37));
- uint _156 = _41 * 2u;
- vec2 _163 = uintBitsToFloat(uvec2(imageLoad(_16[_68], int(_156)).x, imageLoad(_16[_68], int(_156 + 1u)).x));
- uint _168 = _45 * 3u;
- vec3 _178 = uintBitsToFloat(uvec3(imageLoad(_13[_72], int(_168)).x, imageLoad(_13[_72], int(_168 + 1u)).x, imageLoad(_13[_72], int(_168 + 2u)).x));
- uint _185 = _49 * 4u;
- uvec4 _186 = imageLoad(_13[_76], int(_185));
- uvec4 _188 = imageLoad(_13[_76], int(_185 + 1u));
- uvec4 _191 = imageLoad(_13[_76], int(_185 + 2u));
- uvec4 _194 = imageLoad(_13[_76], int(_185 + 3u));
- vec4 _198 = uintBitsToFloat(uvec4(_186.x, _188.x, _191.x, _194.x));
- uvec4 _207 = imageLoad(_19[INDEX + 8u], int(_37));
- uint _211 = _41 * 2u;
- uvec4 _212 = imageLoad(_19[_84], int(_211));
- uvec4 _214 = imageLoad(_19[_84], int(_211 + 1u));
- vec2 _218 = uintBitsToFloat(uvec2(_212.x, _214.x));
- uint _223 = _45 * 3u;
- uvec4 _224 = imageLoad(_22[_88], int(_223));
- uvec4 _226 = imageLoad(_22[_88], int(_223 + 1u));
- uvec4 _229 = imageLoad(_22[_88], int(_223 + 2u));
- vec3 _233 = uintBitsToFloat(uvec3(_224.x, _226.x, _229.x));
- uint _240 = _49 * 4u;
- uvec4 _241 = imageLoad(_19[_92], int(_240));
- uvec4 _243 = imageLoad(_19[_92], int(_240 + 1u));
- uvec4 _246 = imageLoad(_19[_92], int(_240 + 2u));
- uvec4 _249 = imageLoad(_19[_92], int(_240 + 3u));
- vec4 _253 = uintBitsToFloat(uvec4(_241.x, _243.x, _246.x, _249.x));
- uint _262 = _37 * 2u;
- imageStore(_16[_68], int(_262), uvec4(floatBitsToUint(20.0)));
- imageStore(_16[_68], int(_262 + 1u), uvec4(floatBitsToUint(20.0)));
- uint _269 = _41 * 3u;
- imageStore(_22[_88], int(_269), uvec4(floatBitsToUint(30.0)));
- imageStore(_22[_88], int(_269 + 1u), uvec4(floatBitsToUint(30.0)));
- imageStore(_22[_88], int(_269 + 2u), uvec4(floatBitsToUint(30.0)));
- SV_Target.x = ((((((((((_109.x + uintBitsToFloat(texelFetch(_9[INDEX], int(_37)).x)) + _125.x) + _144.x) + uintBitsToFloat(_152.x)) + _163.x) + _178.x) + _198.x) + uintBitsToFloat(_207.x)) + _218.x) + _233.x) + _253.x;
- SV_Target.y = (((((((_125.y + _109.y) + _144.y) + _163.y) + _178.y) + _198.y) + _218.y) + _233.y) + _253.y;
- SV_Target.z = ((((_144.z + _125.z) + _178.z) + _198.z) + _233.z) + _253.z;
- SV_Target.w = (_198.w + _144.w) + _253.w;
+ uint _31 = uint(UV.x);
+ uint _35 = uint(UV.y);
+ uint _39 = uint(UV.z);
+ uint _43 = uint(UV.w);
+ uint _48 = INDEX + 1u;
+ uint _51 = INDEX + 2u;
+ uint _54 = INDEX + 3u;
+ uint _62 = INDEX + 5u;
+ uint _66 = INDEX + 6u;
+ uint _70 = INDEX + 7u;
+ uint _78 = INDEX + 9u;
+ uint _82 = INDEX + 10u;
+ uint _86 = INDEX + 11u;
+ uint _94 = _35 * 2u;
+ vec2 _103 = uintBitsToFloat(uvec2(texelFetch(_9[_48], int(_94)).x, texelFetch(_9[_48], int(_94 + 1u)).x));
+ uint _107 = _39 * 3u;
+ vec3 _119 = uintBitsToFloat(uvec3(texelFetch(_9[_51], int(_107)).x, texelFetch(_9[_51], int(_107 + 1u)).x, texelFetch(_9[_51], int(_107 + 2u)).x));
+ uint _125 = _43 * 4u;
+ vec4 _138 = uintBitsToFloat(uvec4(texelFetch(_9[_54], int(_125)).x, texelFetch(_9[_54], int(_125 + 1u)).x, texelFetch(_9[_54], int(_125 + 2u)).x, texelFetch(_9[_54], int(_125 + 3u)).x));
+ uvec4 _146 = imageLoad(_13[INDEX + 4u], int(_31));
+ uint _150 = _35 * 2u;
+ vec2 _157 = uintBitsToFloat(uvec2(imageLoad(_13[_62], int(_150)).x, imageLoad(_13[_62], int(_150 + 1u)).x));
+ uint _162 = _39 * 3u;
+ vec3 _172 = uintBitsToFloat(uvec3(imageLoad(_13[_66], int(_162)).x, imageLoad(_13[_66], int(_162 + 1u)).x, imageLoad(_13[_66], int(_162 + 2u)).x));
+ uint _179 = _43 * 4u;
+ uvec4 _180 = imageLoad(_13[_70], int(_179));
+ uvec4 _182 = imageLoad(_13[_70], int(_179 + 1u));
+ uvec4 _185 = imageLoad(_13[_70], int(_179 + 2u));
+ uvec4 _188 = imageLoad(_13[_70], int(_179 + 3u));
+ vec4 _192 = uintBitsToFloat(uvec4(_180.x, _182.x, _185.x, _188.x));
+ uvec4 _201 = imageLoad(_16[INDEX + 8u], int(_31));
+ uint _205 = _35 * 2u;
+ uvec4 _206 = imageLoad(_16[_78], int(_205));
+ uvec4 _208 = imageLoad(_16[_78], int(_205 + 1u));
+ vec2 _212 = uintBitsToFloat(uvec2(_206.x, _208.x));
+ uint _217 = _39 * 3u;
+ uvec4 _218 = imageLoad(_16[_82], int(_217));
+ uvec4 _220 = imageLoad(_16[_82], int(_217 + 1u));
+ uvec4 _223 = imageLoad(_16[_82], int(_217 + 2u));
+ vec3 _227 = uintBitsToFloat(uvec3(_218.x, _220.x, _223.x));
+ uint _234 = _43 * 4u;
+ uvec4 _235 = imageLoad(_16[_86], int(_234));
+ uvec4 _237 = imageLoad(_16[_86], int(_234 + 1u));
+ uvec4 _240 = imageLoad(_16[_86], int(_234 + 2u));
+ uvec4 _243 = imageLoad(_16[_86], int(_234 + 3u));
+ vec4 _247 = uintBitsToFloat(uvec4(_235.x, _237.x, _240.x, _243.x));
+ uint _256 = _31 * 2u;
+ imageStore(_13[_62], int(_256), uvec4(floatBitsToUint(20.0)));
+ imageStore(_13[_62], int(_256 + 1u), uvec4(floatBitsToUint(20.0)));
+ uint _263 = _35 * 3u;
+ imageStore(_16[_82], int(_263), uvec4(floatBitsToUint(30.0)));
+ imageStore(_16[_82], int(_263 + 1u), uvec4(floatBitsToUint(30.0)));
+ imageStore(_16[_82], int(_263 + 2u), uvec4(floatBitsToUint(30.0)));
+ SV_Target.x = ((((((((((_103.x + uintBitsToFloat(texelFetch(_9[INDEX], int(_31)).x)) + _119.x) + _138.x) + uintBitsToFloat(_146.x)) + _157.x) + _172.x) + _192.x) + uintBitsToFloat(_201.x)) + _212.x) + _227.x) + _247.x;
+ SV_Target.y = (((((((_119.y + _103.y) + _138.y) + _157.y) + _172.y) + _192.y) + _212.y) + _227.y) + _247.y;
+ SV_Target.z = ((((_138.z + _119.z) + _172.z) + _192.z) + _227.z) + _247.z;
+ SV_Target.w = (_192.w + _138.w) + _247.w;
}
@@ -78,7 +76,7 @@ void main()
; SPIR-V
; Version: 1.3
; Generator: Unknown(30017); 21022
-; Bound: 286
+; Bound: 280
; Schema: 0
OpCapability Shader
OpCapability SampledBuffer
@@ -86,31 +84,24 @@ OpCapability ImageBuffer
OpCapability RuntimeDescriptorArray
OpExtension "SPV_EXT_descriptor_indexing"
OpMemoryModel Logical GLSL450
-OpEntryPoint Fragment %3 "main" %24 %28 %32
+OpEntryPoint Fragment %3 "main" %18 %22 %26
OpExecutionMode %3 OriginUpperLeft
OpName %3 "main"
-OpName %24 "INDEX"
-OpName %28 "UV"
-OpName %32 "SV_Target"
+OpName %18 "INDEX"
+OpName %22 "UV"
+OpName %26 "SV_Target"
OpDecorate %9 DescriptorSet 0
OpDecorate %9 Binding 0
OpDecorate %13 DescriptorSet 0
OpDecorate %13 Binding 0
-OpDecorate %13 NonWritable
OpDecorate %16 DescriptorSet 0
OpDecorate %16 Binding 0
-OpDecorate %19 DescriptorSet 0
-OpDecorate %19 Binding 0
-OpDecorate %19 NonWritable
-OpDecorate %19 Coherent
-OpDecorate %22 DescriptorSet 0
-OpDecorate %22 Binding 0
-OpDecorate %22 Coherent
-OpDecorate %24 Flat
-OpDecorate %24 Location 0
-OpDecorate %28 Flat
-OpDecorate %28 Location 1
-OpDecorate %32 Location 0
+OpDecorate %16 Coherent
+OpDecorate %18 Flat
+OpDecorate %18 Location 0
+OpDecorate %22 Flat
+OpDecorate %22 Location 1
+OpDecorate %26 Location 0
%1 = OpTypeVoid
%2 = OpTypeFunction %1
%5 = OpTypeInt 32 0
@@ -125,286 +116,280 @@ OpDecorate %32 Location 0
%14 = OpTypeRuntimeArray %10
%15 = OpTypePointer UniformConstant %14
%16 = OpVariable %15 UniformConstant
-%17 = OpTypeRuntimeArray %10
-%18 = OpTypePointer UniformConstant %17
-%19 = OpVariable %18 UniformConstant
-%20 = OpTypeRuntimeArray %10
-%21 = OpTypePointer UniformConstant %20
-%22 = OpVariable %21 UniformConstant
-%23 = OpTypePointer Input %5
-%24 = OpVariable %23 Input
-%25 = OpTypeInt 32 1
-%26 = OpTypeVector %25 4
-%27 = OpTypePointer Input %26
-%28 = OpVariable %27 Input
-%29 = OpTypeFloat 32
-%30 = OpTypeVector %29 4
-%31 = OpTypePointer Output %30
-%32 = OpVariable %31 Output
-%33 = OpTypePointer Input %25
-%35 = OpConstant %5 0
-%39 = OpConstant %5 1
-%43 = OpConstant %5 2
-%47 = OpConstant %5 3
-%51 = OpTypePointer UniformConstant %6
-%64 = OpConstant %5 4
-%65 = OpTypePointer UniformConstant %10
-%69 = OpConstant %5 5
-%73 = OpConstant %5 6
-%77 = OpConstant %5 7
-%81 = OpConstant %5 8
-%85 = OpConstant %5 9
-%89 = OpConstant %5 10
-%93 = OpConstant %5 11
-%96 = OpTypeVector %5 4
-%106 = OpTypeVector %5 2
-%108 = OpTypeVector %29 2
-%122 = OpTypeVector %5 3
-%124 = OpTypeVector %29 3
-%263 = OpConstant %29 20
-%270 = OpConstant %29 30
-%279 = OpTypePointer Output %29
+%17 = OpTypePointer Input %5
+%18 = OpVariable %17 Input
+%19 = OpTypeInt 32 1
+%20 = OpTypeVector %19 4
+%21 = OpTypePointer Input %20
+%22 = OpVariable %21 Input
+%23 = OpTypeFloat 32
+%24 = OpTypeVector %23 4
+%25 = OpTypePointer Output %24
+%26 = OpVariable %25 Output
+%27 = OpTypePointer Input %19
+%29 = OpConstant %5 0
+%33 = OpConstant %5 1
+%37 = OpConstant %5 2
+%41 = OpConstant %5 3
+%45 = OpTypePointer UniformConstant %6
+%58 = OpConstant %5 4
+%59 = OpTypePointer UniformConstant %10
+%63 = OpConstant %5 5
+%67 = OpConstant %5 6
+%71 = OpConstant %5 7
+%75 = OpConstant %5 8
+%79 = OpConstant %5 9
+%83 = OpConstant %5 10
+%87 = OpConstant %5 11
+%90 = OpTypeVector %5 4
+%100 = OpTypeVector %5 2
+%102 = OpTypeVector %23 2
+%116 = OpTypeVector %5 3
+%118 = OpTypeVector %23 3
+%257 = OpConstant %23 20
+%264 = OpConstant %23 30
+%273 = OpTypePointer Output %23
%3 = OpFunction %1 None %2
%4 = OpLabel
-OpBranch %284
-%284 = OpLabel
-%34 = OpAccessChain %33 %28 %35
-%36 = OpLoad %25 %34
-%37 = OpBitcast %5 %36
-%38 = OpAccessChain %33 %28 %39
-%40 = OpLoad %25 %38
-%41 = OpBitcast %5 %40
-%42 = OpAccessChain %33 %28 %43
-%44 = OpLoad %25 %42
-%45 = OpBitcast %5 %44
-%46 = OpAccessChain %33 %28 %47
-%48 = OpLoad %25 %46
-%49 = OpBitcast %5 %48
-%50 = OpLoad %5 %24
-%52 = OpAccessChain %51 %9 %50
+OpBranch %278
+%278 = OpLabel
+%28 = OpAccessChain %27 %22 %29
+%30 = OpLoad %19 %28
+%31 = OpBitcast %5 %30
+%32 = OpAccessChain %27 %22 %33
+%34 = OpLoad %19 %32
+%35 = OpBitcast %5 %34
+%36 = OpAccessChain %27 %22 %37
+%38 = OpLoad %19 %36
+%39 = OpBitcast %5 %38
+%40 = OpAccessChain %27 %22 %41
+%42 = OpLoad %19 %40
+%43 = OpBitcast %5 %42
+%44 = OpLoad %5 %18
+%46 = OpAccessChain %45 %9 %44
+%47 = OpLoad %6 %46
+%48 = OpIAdd %5 %44 %33
+%49 = OpAccessChain %45 %9 %48
+%50 = OpLoad %6 %49
+%51 = OpIAdd %5 %44 %37
+%52 = OpAccessChain %45 %9 %51
%53 = OpLoad %6 %52
-%54 = OpIAdd %5 %50 %39
-%55 = OpAccessChain %51 %9 %54
+%54 = OpIAdd %5 %44 %41
+%55 = OpAccessChain %45 %9 %54
%56 = OpLoad %6 %55
-%57 = OpIAdd %5 %50 %43
-%58 = OpAccessChain %51 %9 %57
-%59 = OpLoad %6 %58
-%60 = OpIAdd %5 %50 %47
-%61 = OpAccessChain %51 %9 %60
-%62 = OpLoad %6 %61
-%63 = OpIAdd %5 %50 %64
-%66 = OpAccessChain %65 %13 %63
-%67 = OpLoad %10 %66
-%68 = OpIAdd %5 %50 %69
-%70 = OpAccessChain %65 %16 %68
-%71 = OpLoad %10 %70
-%72 = OpIAdd %5 %50 %73
-%74 = OpAccessChain %65 %13 %72
-%75 = OpLoad %10 %74
-%76 = OpIAdd %5 %50 %77
-%78 = OpAccessChain %65 %13 %76
-%79 = OpLoad %10 %78
-%80 = OpIAdd %5 %50 %81
-%82 = OpAccessChain %65 %19 %80
-%83 = OpLoad %10 %82
-%84 = OpIAdd %5 %50 %85
-%86 = OpAccessChain %65 %19 %84
-%87 = OpLoad %10 %86
-%88 = OpIAdd %5 %50 %89
-%90 = OpAccessChain %65 %22 %88
-%91 = OpLoad %10 %90
-%92 = OpIAdd %5 %50 %93
-%94 = OpAccessChain %65 %19 %92
-%95 = OpLoad %10 %94
-%97 = OpImageFetch %96 %53 %37
-%98 = OpCompositeExtract %5 %97 0
-%99 = OpBitcast %29 %98
-%100 = OpIMul %5 %41 %43
-%101 = OpImageFetch %96 %56 %100
-%102 = OpCompositeExtract %5 %101 0
-%104 = OpIAdd %5 %100 %39
-%103 = OpImageFetch %96 %56 %104
-%105 = OpCompositeExtract %5 %103 0
-%107 = OpCompositeConstruct %106 %102 %105
-%109 = OpBitcast %108 %107
-%110 = OpCompositeExtract %29 %109 0
-%111 = OpCompositeExtract %29 %109 1
-%112 = OpFAdd %29 %110 %99
-%113 = OpIMul %5 %45 %47
-%114 = OpImageFetch %96 %59 %113
-%115 = OpCompositeExtract %5 %114 0
-%117 = OpIAdd %5 %113 %39
-%116 = OpImageFetch %96 %59 %117
-%118 = OpCompositeExtract %5 %116 0
-%120 = OpIAdd %5 %113 %43
-%119 = OpImageFetch %96 %59 %120
-%121 = OpCompositeExtract %5 %119 0
-%123 = OpCompositeConstruct %122 %115 %118 %121
-%125 = OpBitcast %124 %123
-%126 = OpCompositeExtract %29 %125 0
-%127 = OpCompositeExtract %29 %125 1
-%128 = OpCompositeExtract %29 %125 2
-%129 = OpFAdd %29 %112 %126
-%130 = OpFAdd %29 %127 %111
-%131 = OpIMul %5 %49 %64
-%132 = OpImageFetch %96 %62 %131
-%133 = OpCompositeExtract %5 %132 0
-%135 = OpIAdd %5 %131 %39
-%134 = OpImageFetch %96 %62 %135
+%57 = OpIAdd %5 %44 %58
+%60 = OpAccessChain %59 %13 %57
+%61 = OpLoad %10 %60
+%62 = OpIAdd %5 %44 %63
+%64 = OpAccessChain %59 %13 %62
+%65 = OpLoad %10 %64
+%66 = OpIAdd %5 %44 %67
+%68 = OpAccessChain %59 %13 %66
+%69 = OpLoad %10 %68
+%70 = OpIAdd %5 %44 %71
+%72 = OpAccessChain %59 %13 %70
+%73 = OpLoad %10 %72
+%74 = OpIAdd %5 %44 %75
+%76 = OpAccessChain %59 %16 %74
+%77 = OpLoad %10 %76
+%78 = OpIAdd %5 %44 %79
+%80 = OpAccessChain %59 %16 %78
+%81 = OpLoad %10 %80
+%82 = OpIAdd %5 %44 %83
+%84 = OpAccessChain %59 %16 %82
+%85 = OpLoad %10 %84
+%86 = OpIAdd %5 %44 %87
+%88 = OpAccessChain %59 %16 %86
+%89 = OpLoad %10 %88
+%91 = OpImageFetch %90 %47 %31
+%92 = OpCompositeExtract %5 %91 0
+%93 = OpBitcast %23 %92
+%94 = OpIMul %5 %35 %37
+%95 = OpImageFetch %90 %50 %94
+%96 = OpCompositeExtract %5 %95 0
+%98 = OpIAdd %5 %94 %33
+%97 = OpImageFetch %90 %50 %98
+%99 = OpCompositeExtract %5 %97 0
+%101 = OpCompositeConstruct %100 %96 %99
+%103 = OpBitcast %102 %101
+%104 = OpCompositeExtract %23 %103 0
+%105 = OpCompositeExtract %23 %103 1
+%106 = OpFAdd %23 %104 %93
+%107 = OpIMul %5 %39 %41
+%108 = OpImageFetch %90 %53 %107
+%109 = OpCompositeExtract %5 %108 0
+%111 = OpIAdd %5 %107 %33
+%110 = OpImageFetch %90 %53 %111
+%112 = OpCompositeExtract %5 %110 0
+%114 = OpIAdd %5 %107 %37
+%113 = OpImageFetch %90 %53 %114
+%115 = OpCompositeExtract %5 %113 0
+%117 = OpCompositeConstruct %116 %109 %112 %115
+%119 = OpBitcast %118 %117
+%120 = OpCompositeExtract %23 %119 0
+%121 = OpCompositeExtract %23 %119 1
+%122 = OpCompositeExtract %23 %119 2
+%123 = OpFAdd %23 %106 %120
+%124 = OpFAdd %23 %121 %105
+%125 = OpIMul %5 %43 %58
+%126 = OpImageFetch %90 %56 %125
+%127 = OpCompositeExtract %5 %126 0
+%129 = OpIAdd %5 %125 %33
+%128 = OpImageFetch %90 %56 %129
+%130 = OpCompositeExtract %5 %128 0
+%132 = OpIAdd %5 %125 %37
+%131 = OpImageFetch %90 %56 %132
+%133 = OpCompositeExtract %5 %131 0
+%135 = OpIAdd %5 %125 %41
+%134 = OpImageFetch %90 %56 %135
%136 = OpCompositeExtract %5 %134 0
-%138 = OpIAdd %5 %131 %43
-%137 = OpImageFetch %96 %62 %138
-%139 = OpCompositeExtract %5 %137 0
-%141 = OpIAdd %5 %131 %47
-%140 = OpImageFetch %96 %62 %141
-%142 = OpCompositeExtract %5 %140 0
-%143 = OpCompositeConstruct %96 %133 %136 %139 %142
-%144 = OpBitcast %30 %143
-%145 = OpCompositeExtract %29 %144 0
-%146 = OpCompositeExtract %29 %144 1
-%147 = OpCompositeExtract %29 %144 2
-%148 = OpCompositeExtract %29 %144 3
-%149 = OpFAdd %29 %129 %145
-%150 = OpFAdd %29 %130 %146
-%151 = OpFAdd %29 %147 %128
-%152 = OpImageRead %96 %67 %37
-%153 = OpCompositeExtract %5 %152 0
-%154 = OpBitcast %29 %153
-%155 = OpFAdd %29 %149 %154
-%156 = OpIMul %5 %41 %43
-%157 = OpImageRead %96 %71 %156
-%158 = OpCompositeExtract %5 %157 0
-%160 = OpIAdd %5 %156 %39
-%159 = OpImageRead %96 %71 %160
-%161 = OpCompositeExtract %5 %159 0
-%162 = OpCompositeConstruct %106 %158 %161
-%163 = OpBitcast %108 %162
-%164 = OpCompositeExtract %29 %163 0
-%165 = OpCompositeExtract %29 %163 1
-%166 = OpFAdd %29 %155 %164
-%167 = OpFAdd %29 %150 %165
-%168 = OpIMul %5 %45 %47
-%169 = OpImageRead %96 %75 %168
-%170 = OpCompositeExtract %5 %169 0
-%172 = OpIAdd %5 %168 %39
-%171 = OpImageRead %96 %75 %172
-%173 = OpCompositeExtract %5 %171 0
-%175 = OpIAdd %5 %168 %43
-%174 = OpImageRead %96 %75 %175
-%176 = OpCompositeExtract %5 %174 0
-%177 = OpCompositeConstruct %122 %170 %173 %176
-%178 = OpBitcast %124 %177
-%179 = OpCompositeExtract %29 %178 0
-%180 = OpCompositeExtract %29 %178 1
-%181 = OpCompositeExtract %29 %178 2
-%182 = OpFAdd %29 %166 %179
-%183 = OpFAdd %29 %167 %180
-%184 = OpFAdd %29 %151 %181
-%185 = OpIMul %5 %49 %64
-%186 = OpImageRead %96 %79 %185
-%187 = OpCompositeExtract %5 %186 0
-%189 = OpIAdd %5 %185 %39
-%188 = OpImageRead %96 %79 %189
+%137 = OpCompositeConstruct %90 %127 %130 %133 %136
+%138 = OpBitcast %24 %137
+%139 = OpCompositeExtract %23 %138 0
+%140 = OpCompositeExtract %23 %138 1
+%141 = OpCompositeExtract %23 %138 2
+%142 = OpCompositeExtract %23 %138 3
+%143 = OpFAdd %23 %123 %139
+%144 = OpFAdd %23 %124 %140
+%145 = OpFAdd %23 %141 %122
+%146 = OpImageRead %90 %61 %31
+%147 = OpCompositeExtract %5 %146 0
+%148 = OpBitcast %23 %147
+%149 = OpFAdd %23 %143 %148
+%150 = OpIMul %5 %35 %37
+%151 = OpImageRead %90 %65 %150
+%152 = OpCompositeExtract %5 %151 0
+%154 = OpIAdd %5 %150 %33
+%153 = OpImageRead %90 %65 %154
+%155 = OpCompositeExtract %5 %153 0
+%156 = OpCompositeConstruct %100 %152 %155
+%157 = OpBitcast %102 %156
+%158 = OpCompositeExtract %23 %157 0
+%159 = OpCompositeExtract %23 %157 1
+%160 = OpFAdd %23 %149 %158
+%161 = OpFAdd %23 %144 %159
+%162 = OpIMul %5 %39 %41
+%163 = OpImageRead %90 %69 %162
+%164 = OpCompositeExtract %5 %163 0
+%166 = OpIAdd %5 %162 %33
+%165 = OpImageRead %90 %69 %166
+%167 = OpCompositeExtract %5 %165 0
+%169 = OpIAdd %5 %162 %37
+%168 = OpImageRead %90 %69 %169
+%170 = OpCompositeExtract %5 %168 0
+%171 = OpCompositeConstruct %116 %164 %167 %170
+%172 = OpBitcast %118 %171
+%173 = OpCompositeExtract %23 %172 0
+%174 = OpCompositeExtract %23 %172 1
+%175 = OpCompositeExtract %23 %172 2
+%176 = OpFAdd %23 %160 %173
+%177 = OpFAdd %23 %161 %174
+%178 = OpFAdd %23 %145 %175
+%179 = OpIMul %5 %43 %58
+%180 = OpImageRead %90 %73 %179
+%181 = OpCompositeExtract %5 %180 0
+%183 = OpIAdd %5 %179 %33
+%182 = OpImageRead %90 %73 %183
+%184 = OpCompositeExtract %5 %182 0
+%186 = OpIAdd %5 %179 %37
+%185 = OpImageRead %90 %73 %186
+%187 = OpCompositeExtract %5 %185 0
+%189 = OpIAdd %5 %179 %41
+%188 = OpImageRead %90 %73 %189
%190 = OpCompositeExtract %5 %188 0
-%192 = OpIAdd %5 %185 %43
-%191 = OpImageRead %96 %79 %192
-%193 = OpCompositeExtract %5 %191 0
-%195 = OpIAdd %5 %185 %47
-%194 = OpImageRead %96 %79 %195
-%196 = OpCompositeExtract %5 %194 0
-%197 = OpCompositeConstruct %96 %187 %190 %193 %196
-%198 = OpBitcast %30 %197
-%199 = OpCompositeExtract %29 %198 0
-%200 = OpCompositeExtract %29 %198 1
-%201 = OpCompositeExtract %29 %198 2
-%202 = OpCompositeExtract %29 %198 3
-%203 = OpFAdd %29 %182 %199
-%204 = OpFAdd %29 %183 %200
-%205 = OpFAdd %29 %184 %201
-%206 = OpFAdd %29 %202 %148
-%207 = OpImageRead %96 %83 %37
-%208 = OpCompositeExtract %5 %207 0
-%209 = OpBitcast %29 %208
-%210 = OpFAdd %29 %203 %209
-%211 = OpIMul %5 %41 %43
-%212 = OpImageRead %96 %87 %211
-%213 = OpCompositeExtract %5 %212 0
-%215 = OpIAdd %5 %211 %39
-%214 = OpImageRead %96 %87 %215
-%216 = OpCompositeExtract %5 %214 0
-%217 = OpCompositeConstruct %106 %213 %216
-%218 = OpBitcast %108 %217
-%219 = OpCompositeExtract %29 %218 0
-%220 = OpCompositeExtract %29 %218 1
-%221 = OpFAdd %29 %210 %219
-%222 = OpFAdd %29 %204 %220
-%223 = OpIMul %5 %45 %47
-%224 = OpImageRead %96 %91 %223
-%225 = OpCompositeExtract %5 %224 0
-%227 = OpIAdd %5 %223 %39
-%226 = OpImageRead %96 %91 %227
-%228 = OpCompositeExtract %5 %226 0
-%230 = OpIAdd %5 %223 %43
-%229 = OpImageRead %96 %91 %230
-%231 = OpCompositeExtract %5 %229 0
-%232 = OpCompositeConstruct %122 %225 %228 %231
-%233 = OpBitcast %124 %232
-%234 = OpCompositeExtract %29 %233 0
-%235 = OpCompositeExtract %29 %233 1
-%236 = OpCompositeExtract %29 %233 2
-%237 = OpFAdd %29 %221 %234
-%238 = OpFAdd %29 %222 %235
-%239 = OpFAdd %29 %205 %236
-%240 = OpIMul %5 %49 %64
-%241 = OpImageRead %96 %95 %240
-%242 = OpCompositeExtract %5 %241 0
-%244 = OpIAdd %5 %240 %39
-%243 = OpImageRead %96 %95 %244
+%191 = OpCompositeConstruct %90 %181 %184 %187 %190
+%192 = OpBitcast %24 %191
+%193 = OpCompositeExtract %23 %192 0
+%194 = OpCompositeExtract %23 %192 1
+%195 = OpCompositeExtract %23 %192 2
+%196 = OpCompositeExtract %23 %192 3
+%197 = OpFAdd %23 %176 %193
+%198 = OpFAdd %23 %177 %194
+%199 = OpFAdd %23 %178 %195
+%200 = OpFAdd %23 %196 %142
+%201 = OpImageRead %90 %77 %31
+%202 = OpCompositeExtract %5 %201 0
+%203 = OpBitcast %23 %202
+%204 = OpFAdd %23 %197 %203
+%205 = OpIMul %5 %35 %37
+%206 = OpImageRead %90 %81 %205
+%207 = OpCompositeExtract %5 %206 0
+%209 = OpIAdd %5 %205 %33
+%208 = OpImageRead %90 %81 %209
+%210 = OpCompositeExtract %5 %208 0
+%211 = OpCompositeConstruct %100 %207 %210
+%212 = OpBitcast %102 %211
+%213 = OpCompositeExtract %23 %212 0
+%214 = OpCompositeExtract %23 %212 1
+%215 = OpFAdd %23 %204 %213
+%216 = OpFAdd %23 %198 %214
+%217 = OpIMul %5 %39 %41
+%218 = OpImageRead %90 %85 %217
+%219 = OpCompositeExtract %5 %218 0
+%221 = OpIAdd %5 %217 %33
+%220 = OpImageRead %90 %85 %221
+%222 = OpCompositeExtract %5 %220 0
+%224 = OpIAdd %5 %217 %37
+%223 = OpImageRead %90 %85 %224
+%225 = OpCompositeExtract %5 %223 0
+%226 = OpCompositeConstruct %116 %219 %222 %225
+%227 = OpBitcast %118 %226
+%228 = OpCompositeExtract %23 %227 0
+%229 = OpCompositeExtract %23 %227 1
+%230 = OpCompositeExtract %23 %227 2
+%231 = OpFAdd %23 %215 %228
+%232 = OpFAdd %23 %216 %229
+%233 = OpFAdd %23 %199 %230
+%234 = OpIMul %5 %43 %58
+%235 = OpImageRead %90 %89 %234
+%236 = OpCompositeExtract %5 %235 0
+%238 = OpIAdd %5 %234 %33
+%237 = OpImageRead %90 %89 %238
+%239 = OpCompositeExtract %5 %237 0
+%241 = OpIAdd %5 %234 %37
+%240 = OpImageRead %90 %89 %241
+%242 = OpCompositeExtract %5 %240 0
+%244 = OpIAdd %5 %234 %41
+%243 = OpImageRead %90 %89 %244
%245 = OpCompositeExtract %5 %243 0
-%247 = OpIAdd %5 %240 %43
-%246 = OpImageRead %96 %95 %247
-%248 = OpCompositeExtract %5 %246 0
-%250 = OpIAdd %5 %240 %47
-%249 = OpImageRead %96 %95 %250
-%251 = OpCompositeExtract %5 %249 0
-%252 = OpCompositeConstruct %96 %242 %245 %248 %251
-%253 = OpBitcast %30 %252
-%254 = OpCompositeExtract %29 %253 0
-%255 = OpCompositeExtract %29 %253 1
-%256 = OpCompositeExtract %29 %253 2
-%257 = OpCompositeExtract %29 %253 3
-%258 = OpFAdd %29 %237 %254
-%259 = OpFAdd %29 %238 %255
-%260 = OpFAdd %29 %239 %256
-%261 = OpFAdd %29 %206 %257
-%262 = OpIMul %5 %37 %43
-%264 = OpBitcast %5 %263
-%265 = OpBitcast %5 %263
-%266 = OpCompositeConstruct %96 %264 %264 %264 %264
-OpImageWrite %71 %262 %266
-%267 = OpCompositeConstruct %96 %265 %265 %265 %265
-%268 = OpIAdd %5 %262 %39
-OpImageWrite %71 %268 %267
-%269 = OpIMul %5 %41 %47
-%271 = OpBitcast %5 %270
-%272 = OpBitcast %5 %270
-%273 = OpBitcast %5 %270
-%274 = OpCompositeConstruct %96 %271 %271 %271 %271
-OpImageWrite %91 %269 %274
-%275 = OpCompositeConstruct %96 %272 %272 %272 %272
-%276 = OpIAdd %5 %269 %39
-OpImageWrite %91 %276 %275
-%277 = OpCompositeConstruct %96 %273 %273 %273 %273
-%278 = OpIAdd %5 %269 %43
-OpImageWrite %91 %278 %277
-%280 = OpAccessChain %279 %32 %35
-OpStore %280 %258
-%281 = OpAccessChain %279 %32 %39
-OpStore %281 %259
-%282 = OpAccessChain %279 %32 %43
-OpStore %282 %260
-%283 = OpAccessChain %279 %32 %47
-OpStore %283 %261
+%246 = OpCompositeConstruct %90 %236 %239 %242 %245
+%247 = OpBitcast %24 %246
+%248 = OpCompositeExtract %23 %247 0
+%249 = OpCompositeExtract %23 %247 1
+%250 = OpCompositeExtract %23 %247 2
+%251 = OpCompositeExtract %23 %247 3
+%252 = OpFAdd %23 %231 %248
+%253 = OpFAdd %23 %232 %249
+%254 = OpFAdd %23 %233 %250
+%255 = OpFAdd %23 %200 %251
+%256 = OpIMul %5 %31 %37
+%258 = OpBitcast %5 %257
+%259 = OpBitcast %5 %257
+%260 = OpCompositeConstruct %90 %258 %258 %258 %258
+OpImageWrite %65 %256 %260
+%261 = OpCompositeConstruct %90 %259 %259 %259 %259
+%262 = OpIAdd %5 %256 %33
+OpImageWrite %65 %262 %261
+%263 = OpIMul %5 %35 %41
+%265 = OpBitcast %5 %264
+%266 = OpBitcast %5 %264
+%267 = OpBitcast %5 %264
+%268 = OpCompositeConstruct %90 %265 %265 %265 %265
+OpImageWrite %85 %263 %268
+%269 = OpCompositeConstruct %90 %266 %266 %266 %266
+%270 = OpIAdd %5 %263 %33
+OpImageWrite %85 %270 %269
+%271 = OpCompositeConstruct %90 %267 %267 %267 %267
+%272 = OpIAdd %5 %263 %37
+OpImageWrite %85 %272 %271
+%274 = OpAccessChain %273 %26 %29
+OpStore %274 %252
+%275 = OpAccessChain %273 %26 %33
+OpStore %275 %253
+%276 = OpAccessChain %273 %26 %37
+OpStore %276 %254
+%277 = OpAccessChain %273 %26 %41
+OpStore %277 %255
OpReturn
OpFunctionEnd
#endif
diff --git a/reference/shaders/resources/sm66/structured-buffer-heap.ssbo.sm66.frag b/reference/shaders/resources/sm66/structured-buffer-heap.ssbo.sm66.frag
index 4fdcdf0..9f32119 100644
--- a/reference/shaders/resources/sm66/structured-buffer-heap.ssbo.sm66.frag
+++ b/reference/shaders/resources/sm66/structured-buffer-heap.ssbo.sm66.frag
@@ -22,7 +22,7 @@ layout(set = 0, binding = 0, std430) restrict readonly buffer _25_28
uvec4 _m0[];
} _28[];
-layout(set = 0, binding = 0, std430) readonly buffer _30_33
+layout(set = 0, binding = 0, std430) buffer _30_33
{
uint _m0[];
} _33[];
@@ -32,22 +32,22 @@ layout(set = 0, binding = 0, std430) buffer _35_38
uvec2 _m0[];
} _38[];
-layout(set = 0, binding = 0, scalar) readonly buffer _40_43
+layout(set = 0, binding = 0, scalar) buffer _40_43
{
uvec3 _m0[];
} _43[];
-layout(set = 0, binding = 0, std430) readonly buffer _45_48
+layout(set = 0, binding = 0, std430) buffer _45_48
{
uvec4 _m0[];
} _48[];
-layout(set = 0, binding = 0, std430) coherent readonly buffer _50_53
+layout(set = 0, binding = 0, std430) coherent buffer _50_53
{
uint _m0[];
} _53[];
-layout(set = 0, binding = 0, std430) coherent readonly buffer _55_58
+layout(set = 0, binding = 0, std430) coherent buffer _55_58
{
uvec2 _m0[];
} _58[];
@@ -57,7 +57,7 @@ layout(set = 0, binding = 0, scalar) coherent buffer _60_63
uvec3 _m0[];
} _63[];
-layout(set = 0, binding = 0, std430) coherent readonly buffer _65_68
+layout(set = 0, binding = 0, std430) coherent buffer _65_68
{
uvec4 _m0[];
} _68[];
@@ -161,7 +161,6 @@ OpMemberDecorate %30 0 Offset 0
OpDecorate %30 Block
OpDecorate %33 DescriptorSet 0
OpDecorate %33 Binding 0
-OpDecorate %33 NonWritable
OpDecorate %34 ArrayStride 8
OpMemberDecorate %35 0 Offset 0
OpDecorate %35 Block
@@ -172,26 +171,22 @@ OpMemberDecorate %40 0 Offset 0
OpDecorate %40 Block
OpDecorate %43 DescriptorSet 0
OpDecorate %43 Binding 0
-OpDecorate %43 NonWritable
OpDecorate %44 ArrayStride 16
OpMemberDecorate %45 0 Offset 0
OpDecorate %45 Block
OpDecorate %48 DescriptorSet 0
OpDecorate %48 Binding 0
-OpDecorate %48 NonWritable
OpDecorate %49 ArrayStride 4
OpMemberDecorate %50 0 Offset 0
OpDecorate %50 Block
OpDecorate %53 DescriptorSet 0
OpDecorate %53 Binding 0
-OpDecorate %53 NonWritable
OpDecorate %53 Coherent
OpDecorate %54 ArrayStride 8
OpMemberDecorate %55 0 Offset 0
OpDecorate %55 Block
OpDecorate %58 DescriptorSet 0
OpDecorate %58 Binding 0
-OpDecorate %58 NonWritable
OpDecorate %58 Coherent
OpDecorate %59 ArrayStride 12
OpMemberDecorate %60 0 Offset 0
@@ -204,7 +199,6 @@ OpMemberDecorate %65 0 Offset 0
OpDecorate %65 Block
OpDecorate %68 DescriptorSet 0
OpDecorate %68 Binding 0
-OpDecorate %68 NonWritable
OpDecorate %68 Coherent
OpDecorate %70 Flat
OpDecorate %70 Location 0
diff --git a/reference/shaders/resources/sm66/structured-buffer-heap.ssbo.ssbo-align.sm66.frag b/reference/shaders/resources/sm66/structured-buffer-heap.ssbo.ssbo-align.sm66.frag
index 992a3be..d6d2c0b 100644
--- a/reference/shaders/resources/sm66/structured-buffer-heap.ssbo.ssbo-align.sm66.frag
+++ b/reference/shaders/resources/sm66/structured-buffer-heap.ssbo.ssbo-align.sm66.frag
@@ -22,7 +22,7 @@ layout(set = 0, binding = 0, std430) restrict readonly buffer _23_26
uvec4 _m0[];
} _26[];
-layout(set = 0, binding = 0, std430) readonly buffer _28_31
+layout(set = 0, binding = 0, std430) buffer _28_31
{
uint _m0[];
} _31[];
@@ -32,30 +32,25 @@ layout(set = 0, binding = 0, std430) buffer _33_36
uvec2 _m0[];
} _36[];
-layout(set = 0, binding = 0, std430) readonly buffer _38_41
+layout(set = 0, binding = 0, std430) buffer _38_41
{
uvec4 _m0[];
} _41[];
-layout(set = 0, binding = 0, std430) coherent readonly buffer _43_46
+layout(set = 0, binding = 0, std430) coherent buffer _43_46
{
uint _m0[];
} _46[];
-layout(set = 0, binding = 0, std430) coherent readonly buffer _48_51
+layout(set = 0, binding = 0, std430) coherent buffer _48_51
{
uvec2 _m0[];
} _51[];
layout(set = 0, binding = 0, std430) coherent buffer _53_56
{
- uint _m0[];
-} _56[];
-
-layout(set = 0, binding = 0, std430) coherent readonly buffer _58_61
-{
uvec4 _m0[];
-} _61[];
+} _56[];
layout(location = 0) flat in uint INDEX;
layout(location = 1) flat in ivec4 UV;
@@ -63,66 +58,66 @@ layout(location = 0) out vec4 SV_Target;
void main()
{
- uint _76 = uint(UV.x);
- uint _80 = uint(UV.y);
- uint _84 = uint(UV.z);
- uint _88 = uint(UV.w);
- uvec2 _96 = _10._m0[subgroupBroadcastFirst(INDEX)] >> uvec2(2u);
- uint _98 = INDEX + 1u;
- uvec2 _104 = _10._m0[subgroupBroadcastFirst(_98)] >> uvec2(3u);
- uint _106 = INDEX + 2u;
- uvec2 _111 = _10._m0[subgroupBroadcastFirst(_106)] >> uvec2(2u);
- uint _112 = INDEX + 3u;
- uvec2 _118 = _10._m0[subgroupBroadcastFirst(_112)] >> uvec2(4u);
- uint _121 = INDEX + 4u;
- uvec2 _127 = _10._m0[subgroupBroadcastFirst(_121)] >> uvec2(2u);
- uint _128 = INDEX + 5u;
- uvec2 _135 = _10._m0[subgroupBroadcastFirst(_128)] >> uvec2(3u);
- uint _136 = INDEX + 6u;
- uvec2 _142 = _10._m0[subgroupBroadcastFirst(_136)] >> uvec2(2u);
- uint _143 = INDEX + 7u;
- uvec2 _150 = _10._m0[subgroupBroadcastFirst(_143)] >> uvec2(4u);
- uint _151 = INDEX + 8u;
- uvec2 _158 = _10._m0[subgroupBroadcastFirst(_151)] >> uvec2(2u);
- uint _159 = INDEX + 9u;
- uvec2 _166 = _10._m0[subgroupBroadcastFirst(_159)] >> uvec2(3u);
- uint _167 = INDEX + 10u;
- uvec2 _174 = _10._m0[subgroupBroadcastFirst(_167)] >> uvec2(2u);
- uint _175 = INDEX + 11u;
- uvec2 _182 = _10._m0[subgroupBroadcastFirst(_175)] >> uvec2(4u);
- vec2 _203 = uintBitsToFloat(_20[_98]._m0[(_80 < _104.y) ? (_80 + _104.x) : 536870911u]);
- uint _207 = _84 * 3u;
- uint _212 = (_207 < _111.y) ? (_207 + _111.x) : 1073741820u;
- vec3 _224 = uintBitsToFloat(uvec3(_15[_106]._m0[_212], _15[_106]._m0[_212 + 1u], _15[_106]._m0[_212 + 2u]));
- vec4 _239 = uintBitsToFloat(_26[_112]._m0[(_88 < _118.y) ? (_88 + _118.x) : 268435455u]);
- uint _253 = _31[_121]._m0[(_76 < _127.y) ? (_76 + _127.x) : 1073741820u];
- vec2 _263 = uintBitsToFloat(_36[_128]._m0[(_80 < _135.y) ? (_80 + _135.x) : 536870911u]);
- uint _268 = _84 * 3u;
- uint _273 = (_268 < _142.y) ? (_268 + _142.x) : 1073741820u;
- vec3 _283 = uintBitsToFloat(uvec3(_31[_136]._m0[_273], _31[_136]._m0[_273 + 1u], _31[_136]._m0[_273 + 2u]));
- uvec4 _296 = _41[_143]._m0[(_88 < _150.y) ? (_88 + _150.x) : 268435455u];
- vec4 _297 = uintBitsToFloat(_296);
- uint _312 = _46[_151]._m0[(_76 < _158.y) ? (_76 + _158.x) : 1073741820u];
- uvec2 _321 = _51[_159]._m0[(_80 < _166.y) ? (_80 + _166.x) : 536870911u];
- vec2 _322 = uintBitsToFloat(_321);
- uint _327 = _84 * 3u;
- uint _332 = (_327 < _174.y) ? (_327 + _174.x) : 1073741820u;
- uint _334 = _56[_167]._m0[_332];
- uint _337 = _56[_167]._m0[_332 + 1u];
- uint _340 = _56[_167]._m0[_332 + 2u];
- vec3 _342 = uintBitsToFloat(uvec3(_334, _337, _340));
- uvec4 _355 = _61[_175]._m0[(_88 < _182.y) ? (_88 + _182.x) : 268435455u];
- vec4 _356 = uintBitsToFloat(_355);
- _36[_128]._m0[(_76 < _135.y) ? (_76 + _135.x) : 536870911u] = uvec2(floatBitsToUint(20.0), floatBitsToUint(20.0));
- uint _375 = _80 * 3u;
- uint _380 = (_375 < _174.y) ? (_375 + _174.x) : 1073741820u;
- _56[_167]._m0[_380] = floatBitsToUint(30.0);
- _56[_167]._m0[_380 + 1u] = floatBitsToUint(30.0);
- _56[_167]._m0[_380 + 2u] = floatBitsToUint(30.0);
- SV_Target.x = ((((((((((_203.x + uintBitsToFloat(_15[INDEX]._m0[(_76 < _96.y) ? (_76 + _96.x) : 1073741820u])) + _224.x) + _239.x) + uintBitsToFloat(_253)) + _263.x) + _283.x) + _297.x) + uintBitsToFloat(_312)) + _322.x) + _342.x) + _356.x;
- SV_Target.y = (((((((_224.y + _203.y) + _239.y) + _263.y) + _283.y) + _297.y) + _322.y) + _342.y) + _356.y;
- SV_Target.z = ((((_239.z + _224.z) + _283.z) + _297.z) + _342.z) + _356.z;
- SV_Target.w = (_297.w + _239.w) + _356.w;
+ uint _71 = uint(UV.x);
+ uint _75 = uint(UV.y);
+ uint _79 = uint(UV.z);
+ uint _83 = uint(UV.w);
+ uvec2 _91 = _10._m0[subgroupBroadcastFirst(INDEX)] >> uvec2(2u);
+ uint _93 = INDEX + 1u;
+ uvec2 _99 = _10._m0[subgroupBroadcastFirst(_93)] >> uvec2(3u);
+ uint _101 = INDEX + 2u;
+ uvec2 _106 = _10._m0[subgroupBroadcastFirst(_101)] >> uvec2(2u);
+ uint _107 = INDEX + 3u;
+ uvec2 _113 = _10._m0[subgroupBroadcastFirst(_107)] >> uvec2(4u);
+ uint _116 = INDEX + 4u;
+ uvec2 _122 = _10._m0[subgroupBroadcastFirst(_116)] >> uvec2(2u);
+ uint _123 = INDEX + 5u;
+ uvec2 _130 = _10._m0[subgroupBroadcastFirst(_123)] >> uvec2(3u);
+ uint _131 = INDEX + 6u;
+ uvec2 _137 = _10._m0[subgroupBroadcastFirst(_131)] >> uvec2(2u);
+ uint _138 = INDEX + 7u;
+ uvec2 _145 = _10._m0[subgroupBroadcastFirst(_138)] >> uvec2(4u);
+ uint _146 = INDEX + 8u;
+ uvec2 _153 = _10._m0[subgroupBroadcastFirst(_146)] >> uvec2(2u);
+ uint _154 = INDEX + 9u;
+ uvec2 _161 = _10._m0[subgroupBroadcastFirst(_154)] >> uvec2(3u);
+ uint _162 = INDEX + 10u;
+ uvec2 _168 = _10._m0[subgroupBroadcastFirst(_162)] >> uvec2(2u);
+ uint _169 = INDEX + 11u;
+ uvec2 _176 = _10._m0[subgroupBroadcastFirst(_169)] >> uvec2(4u);
+ vec2 _197 = uintBitsToFloat(_20[_93]._m0[(_75 < _99.y) ? (_75 + _99.x) : 536870911u]);
+ uint _201 = _79 * 3u;
+ uint _206 = (_201 < _106.y) ? (_201 + _106.x) : 1073741820u;
+ vec3 _218 = uintBitsToFloat(uvec3(_15[_101]._m0[_206], _15[_101]._m0[_206 + 1u], _15[_101]._m0[_206 + 2u]));
+ vec4 _233 = uintBitsToFloat(_26[_107]._m0[(_83 < _113.y) ? (_83 + _113.x) : 268435455u]);
+ uint _247 = _31[_116]._m0[(_71 < _122.y) ? (_71 + _122.x) : 1073741820u];
+ vec2 _257 = uintBitsToFloat(_36[_123]._m0[(_75 < _130.y) ? (_75 + _130.x) : 536870911u]);
+ uint _262 = _79 * 3u;
+ uint _267 = (_262 < _137.y) ? (_262 + _137.x) : 1073741820u;
+ vec3 _277 = uintBitsToFloat(uvec3(_31[_131]._m0[_267], _31[_131]._m0[_267 + 1u], _31[_131]._m0[_267 + 2u]));
+ uvec4 _290 = _41[_138]._m0[(_83 < _145.y) ? (_83 + _145.x) : 268435455u];
+ vec4 _291 = uintBitsToFloat(_290);
+ uint _306 = _46[_146]._m0[(_71 < _153.y) ? (_71 + _153.x) : 1073741820u];
+ uvec2 _315 = _51[_154]._m0[(_75 < _161.y) ? (_75 + _161.x) : 536870911u];
+ vec2 _316 = uintBitsToFloat(_315);
+ uint _321 = _79 * 3u;
+ uint _326 = (_321 < _168.y) ? (_321 + _168.x) : 1073741820u;
+ uint _328 = _46[_162]._m0[_326];
+ uint _331 = _46[_162]._m0[_326 + 1u];
+ uint _334 = _46[_162]._m0[_326 + 2u];
+ vec3 _336 = uintBitsToFloat(uvec3(_328, _331, _334));
+ uvec4 _349 = _56[_169]._m0[(_83 < _176.y) ? (_83 + _176.x) : 268435455u];
+ vec4 _350 = uintBitsToFloat(_349);
+ _36[_123]._m0[(_71 < _130.y) ? (_71 + _130.x) : 536870911u] = uvec2(floatBitsToUint(20.0), floatBitsToUint(20.0));
+ uint _369 = _75 * 3u;
+ uint _374 = (_369 < _168.y) ? (_369 + _168.x) : 1073741820u;
+ _46[_162]._m0[_374] = floatBitsToUint(30.0);
+ _46[_162]._m0[_374 + 1u] = floatBitsToUint(30.0);
+ _46[_162]._m0[_374 + 2u] = floatBitsToUint(30.0);
+ SV_Target.x = ((((((((((_197.x + uintBitsToFloat(_15[INDEX]._m0[(_71 < _91.y) ? (_71 + _91.x) : 1073741820u])) + _218.x) + _233.x) + uintBitsToFloat(_247)) + _257.x) + _277.x) + _291.x) + uintBitsToFloat(_306)) + _316.x) + _336.x) + _350.x;
+ SV_Target.y = (((((((_218.y + _197.y) + _233.y) + _257.y) + _277.y) + _291.y) + _316.y) + _336.y) + _350.y;
+ SV_Target.z = ((((_233.z + _218.z) + _277.z) + _291.z) + _336.z) + _350.z;
+ SV_Target.w = (_291.w + _233.w) + _350.w;
}
@@ -131,14 +126,14 @@ void main()
; SPIR-V
; Version: 1.3
; Generator: Unknown(30017); 21022
-; Bound: 397
+; Bound: 391
; Schema: 0
OpCapability Shader
OpCapability GroupNonUniformBallot
OpCapability RuntimeDescriptorArray
OpExtension "SPV_EXT_descriptor_indexing"
OpMemoryModel Logical GLSL450
-OpEntryPoint Fragment %3 "main" %63 %67 %71
+OpEntryPoint Fragment %3 "main" %58 %62 %66
OpExecutionMode %3 OriginUpperLeft
OpName %3 "main"
OpName %8 "SSBO_Offsets"
@@ -151,10 +146,9 @@ OpName %38 "SSBO"
OpName %43 "SSBO"
OpName %48 "SSBO"
OpName %53 "SSBO"
-OpName %58 "SSBO"
-OpName %63 "INDEX"
-OpName %67 "UV"
-OpName %71 "SV_Target"
+OpName %58 "INDEX"
+OpName %62 "UV"
+OpName %66 "SV_Target"
OpDecorate %7 ArrayStride 8
OpMemberDecorate %8 0 Offset 0
OpDecorate %8 Block
@@ -188,7 +182,6 @@ OpMemberDecorate %28 0 Offset 0
OpDecorate %28 Block
OpDecorate %31 DescriptorSet 0
OpDecorate %31 Binding 0
-OpDecorate %31 NonWritable
OpDecorate %32 ArrayStride 8
OpMemberDecorate %33 0 Offset 0
OpDecorate %33 Block
@@ -199,39 +192,29 @@ OpMemberDecorate %38 0 Offset 0
OpDecorate %38 Block
OpDecorate %41 DescriptorSet 0
OpDecorate %41 Binding 0
-OpDecorate %41 NonWritable
OpDecorate %42 ArrayStride 4
OpMemberDecorate %43 0 Offset 0
OpDecorate %43 Block
OpDecorate %46 DescriptorSet 0
OpDecorate %46 Binding 0
-OpDecorate %46 NonWritable
OpDecorate %46 Coherent
OpDecorate %47 ArrayStride 8
OpMemberDecorate %48 0 Offset 0
OpDecorate %48 Block
OpDecorate %51 DescriptorSet 0
OpDecorate %51 Binding 0
-OpDecorate %51 NonWritable
OpDecorate %51 Coherent
-OpDecorate %52 ArrayStride 4
+OpDecorate %52 ArrayStride 16
OpMemberDecorate %53 0 Offset 0
OpDecorate %53 Block
OpDecorate %56 DescriptorSet 0
OpDecorate %56 Binding 0
OpDecorate %56 Coherent
-OpDecorate %57 ArrayStride 16
-OpMemberDecorate %58 0 Offset 0
-OpDecorate %58 Block
-OpDecorate %61 DescriptorSet 0
-OpDecorate %61 Binding 0
-OpDecorate %61 NonWritable
-OpDecorate %61 Coherent
-OpDecorate %63 Flat
-OpDecorate %63 Location 0
-OpDecorate %67 Flat
-OpDecorate %67 Location 1
-OpDecorate %71 Location 0
+OpDecorate %58 Flat
+OpDecorate %58 Location 0
+OpDecorate %62 Flat
+OpDecorate %62 Location 1
+OpDecorate %66 Location 0
%1 = OpTypeVoid
%2 = OpTypeFunction %1
%5 = OpTypeInt 32 0
@@ -281,361 +264,355 @@ OpDecorate %71 Location 0
%49 = OpTypeRuntimeArray %48
%50 = OpTypePointer StorageBuffer %49
%51 = OpVariable %50 StorageBuffer
-%52 = OpTypeRuntimeArray %5
+%52 = OpTypeRuntimeArray %21
%53 = OpTypeStruct %52
%54 = OpTypeRuntimeArray %53
%55 = OpTypePointer StorageBuffer %54
%56 = OpVariable %55 StorageBuffer
-%57 = OpTypeRuntimeArray %21
-%58 = OpTypeStruct %57
-%59 = OpTypeRuntimeArray %58
-%60 = OpTypePointer StorageBuffer %59
-%61 = OpVariable %60 StorageBuffer
-%62 = OpTypePointer Input %5
-%63 = OpVariable %62 Input
-%64 = OpTypeInt 32 1
-%65 = OpTypeVector %64 4
-%66 = OpTypePointer Input %65
-%67 = OpVariable %66 Input
-%68 = OpTypeFloat 32
-%69 = OpTypeVector %68 4
-%70 = OpTypePointer Output %69
-%71 = OpVariable %70 Output
-%72 = OpTypePointer Input %64
-%74 = OpConstant %5 0
-%78 = OpConstant %5 1
-%82 = OpConstant %5 2
-%86 = OpConstant %5 3
-%90 = OpTypePointer StorageBuffer %12
-%93 = OpTypePointer StorageBuffer %6
-%97 = OpConstantComposite %6 %82 %82
-%99 = OpTypePointer StorageBuffer %17
-%105 = OpConstantComposite %6 %86 %86
-%113 = OpTypePointer StorageBuffer %23
-%119 = OpConstant %5 4
-%120 = OpConstantComposite %6 %119 %119
-%122 = OpTypePointer StorageBuffer %28
-%129 = OpConstant %5 5
-%130 = OpTypePointer StorageBuffer %33
-%137 = OpConstant %5 6
-%144 = OpConstant %5 7
-%145 = OpTypePointer StorageBuffer %38
-%152 = OpConstant %5 8
-%153 = OpTypePointer StorageBuffer %43
-%160 = OpConstant %5 9
-%161 = OpTypePointer StorageBuffer %48
-%168 = OpConstant %5 10
-%169 = OpTypePointer StorageBuffer %53
-%176 = OpConstant %5 11
-%177 = OpTypePointer StorageBuffer %58
-%186 = OpTypeBool
-%189 = OpConstant %5 1073741820
-%190 = OpTypePointer StorageBuffer %5
-%199 = OpConstant %5 536870911
-%202 = OpTypeVector %68 2
-%221 = OpTypeVector %5 3
-%223 = OpTypeVector %68 3
-%235 = OpConstant %5 268435455
-%236 = OpTypePointer StorageBuffer %21
-%370 = OpConstant %68 20
-%381 = OpConstant %68 30
-%390 = OpTypePointer Output %68
+%57 = OpTypePointer Input %5
+%58 = OpVariable %57 Input
+%59 = OpTypeInt 32 1
+%60 = OpTypeVector %59 4
+%61 = OpTypePointer Input %60
+%62 = OpVariable %61 Input
+%63 = OpTypeFloat 32
+%64 = OpTypeVector %63 4
+%65 = OpTypePointer Output %64
+%66 = OpVariable %65 Output
+%67 = OpTypePointer Input %59
+%69 = OpConstant %5 0
+%73 = OpConstant %5 1
+%77 = OpConstant %5 2
+%81 = OpConstant %5 3
+%85 = OpTypePointer StorageBuffer %12
+%88 = OpTypePointer StorageBuffer %6
+%92 = OpConstantComposite %6 %77 %77
+%94 = OpTypePointer StorageBuffer %17
+%100 = OpConstantComposite %6 %81 %81
+%108 = OpTypePointer StorageBuffer %23
+%114 = OpConstant %5 4
+%115 = OpConstantComposite %6 %114 %114
+%117 = OpTypePointer StorageBuffer %28
+%124 = OpConstant %5 5
+%125 = OpTypePointer StorageBuffer %33
+%132 = OpConstant %5 6
+%139 = OpConstant %5 7
+%140 = OpTypePointer StorageBuffer %38
+%147 = OpConstant %5 8
+%148 = OpTypePointer StorageBuffer %43
+%155 = OpConstant %5 9
+%156 = OpTypePointer StorageBuffer %48
+%163 = OpConstant %5 10
+%170 = OpConstant %5 11
+%171 = OpTypePointer StorageBuffer %53
+%180 = OpTypeBool
+%183 = OpConstant %5 1073741820
+%184 = OpTypePointer StorageBuffer %5
+%193 = OpConstant %5 536870911
+%196 = OpTypeVector %63 2
+%215 = OpTypeVector %5 3
+%217 = OpTypeVector %63 3
+%229 = OpConstant %5 268435455
+%230 = OpTypePointer StorageBuffer %21
+%364 = OpConstant %63 20
+%375 = OpConstant %63 30
+%384 = OpTypePointer Output %63
%3 = OpFunction %1 None %2
%4 = OpLabel
-OpBranch %395
-%395 = OpLabel
-%73 = OpAccessChain %72 %67 %74
-%75 = OpLoad %64 %73
-%76 = OpBitcast %5 %75
-%77 = OpAccessChain %72 %67 %78
-%79 = OpLoad %64 %77
-%80 = OpBitcast %5 %79
-%81 = OpAccessChain %72 %67 %82
-%83 = OpLoad %64 %81
-%84 = OpBitcast %5 %83
-%85 = OpAccessChain %72 %67 %86
-%87 = OpLoad %64 %85
-%88 = OpBitcast %5 %87
-%89 = OpLoad %5 %63
-%91 = OpAccessChain %90 %15 %89
-%92 = OpGroupNonUniformBroadcastFirst %5 %86 %89
-%94 = OpAccessChain %93 %10 %74 %92
-%95 = OpLoad %6 %94
-%96 = OpShiftRightLogical %6 %95 %97
-%98 = OpIAdd %5 %89 %78
-%100 = OpAccessChain %99 %20 %98
-%101 = OpGroupNonUniformBroadcastFirst %5 %86 %98
-%102 = OpAccessChain %93 %10 %74 %101
-%103 = OpLoad %6 %102
-%104 = OpShiftRightLogical %6 %103 %105
-%106 = OpIAdd %5 %89 %82
-%107 = OpAccessChain %90 %15 %106
-%108 = OpGroupNonUniformBroadcastFirst %5 %86 %106
-%109 = OpAccessChain %93 %10 %74 %108
-%110 = OpLoad %6 %109
-%111 = OpShiftRightLogical %6 %110 %97
-%112 = OpIAdd %5 %89 %86
-%114 = OpAccessChain %113 %26 %112
-%115 = OpGroupNonUniformBroadcastFirst %5 %86 %112
-%116 = OpAccessChain %93 %10 %74 %115
-%117 = OpLoad %6 %116
-%118 = OpShiftRightLogical %6 %117 %120
-%121 = OpIAdd %5 %89 %119
-%123 = OpAccessChain %122 %31 %121
-%124 = OpGroupNonUniformBroadcastFirst %5 %86 %121
-%125 = OpAccessChain %93 %10 %74 %124
-%126 = OpLoad %6 %125
-%127 = OpShiftRightLogical %6 %126 %97
-%128 = OpIAdd %5 %89 %129
-%131 = OpAccessChain %130 %36 %128
-%132 = OpGroupNonUniformBroadcastFirst %5 %86 %128
-%133 = OpAccessChain %93 %10 %74 %132
-%134 = OpLoad %6 %133
-%135 = OpShiftRightLogical %6 %134 %105
-%136 = OpIAdd %5 %89 %137
-%138 = OpAccessChain %122 %31 %136
-%139 = OpGroupNonUniformBroadcastFirst %5 %86 %136
-%140 = OpAccessChain %93 %10 %74 %139
-%141 = OpLoad %6 %140
-%142 = OpShiftRightLogical %6 %141 %97
-%143 = OpIAdd %5 %89 %144
-%146 = OpAccessChain %145 %41 %143
-%147 = OpGroupNonUniformBroadcastFirst %5 %86 %143
-%148 = OpAccessChain %93 %10 %74 %147
-%149 = OpLoad %6 %148
-%150 = OpShiftRightLogical %6 %149 %120
-%151 = OpIAdd %5 %89 %152
-%154 = OpAccessChain %153 %46 %151
-%155 = OpGroupNonUniformBroadcastFirst %5 %86 %151
-%156 = OpAccessChain %93 %10 %74 %155
-%157 = OpLoad %6 %156
-%158 = OpShiftRightLogical %6 %157 %97
-%159 = OpIAdd %5 %89 %160
-%162 = OpAccessChain %161 %51 %159
-%163 = OpGroupNonUniformBroadcastFirst %5 %86 %159
-%164 = OpAccessChain %93 %10 %74 %163
-%165 = OpLoad %6 %164
-%166 = OpShiftRightLogical %6 %165 %105
-%167 = OpIAdd %5 %89 %168
-%170 = OpAccessChain %169 %56 %167
-%171 = OpGroupNonUniformBroadcastFirst %5 %86 %167
-%172 = OpAccessChain %93 %10 %74 %171
-%173 = OpLoad %6 %172
-%174 = OpShiftRightLogical %6 %173 %97
-%175 = OpIAdd %5 %89 %176
-%178 = OpAccessChain %177 %61 %175
-%179 = OpGroupNonUniformBroadcastFirst %5 %86 %175
-%180 = OpAccessChain %93 %10 %74 %179
-%181 = OpLoad %6 %180
-%182 = OpShiftRightLogical %6 %181 %120
-%183 = OpCompositeExtract %5 %96 0
-%184 = OpCompositeExtract %5 %96 1
-%185 = OpIAdd %5 %76 %183
-%187 = OpULessThan %186 %76 %184
-%188 = OpSelect %5 %187 %185 %189
-%191 = OpAccessChain %190 %91 %74 %188
-%192 = OpLoad %5 %191
-%193 = OpBitcast %68 %192
-%194 = OpCompositeExtract %5 %104 0
-%195 = OpCompositeExtract %5 %104 1
-%196 = OpIAdd %5 %80 %194
-%197 = OpULessThan %186 %80 %195
-%198 = OpSelect %5 %197 %196 %199
-%200 = OpAccessChain %93 %100 %74 %198
-%201 = OpLoad %6 %200
-%203 = OpBitcast %202 %201
-%204 = OpCompositeExtract %68 %203 0
-%205 = OpCompositeExtract %68 %203 1
-%206 = OpFAdd %68 %204 %193
-%207 = OpIMul %5 %84 %86
-%208 = OpCompositeExtract %5 %111 0
-%209 = OpCompositeExtract %5 %111 1
-%210 = OpIAdd %5 %207 %208
-%211 = OpULessThan %186 %207 %209
-%212 = OpSelect %5 %211 %210 %189
-%213 = OpAccessChain %190 %107 %74 %212
-%214 = OpLoad %5 %213
-%216 = OpIAdd %5 %212 %78
-%215 = OpAccessChain %190 %107 %74 %216
-%217 = OpLoad %5 %215
-%219 = OpIAdd %5 %212 %82
-%218 = OpAccessChain %190 %107 %74 %219
-%220 = OpLoad %5 %218
-%222 = OpCompositeConstruct %221 %214 %217 %220
-%224 = OpBitcast %223 %222
-%225 = OpCompositeExtract %68 %224 0
-%226 = OpCompositeExtract %68 %224 1
-%227 = OpCompositeExtract %68 %224 2
-%228 = OpFAdd %68 %206 %225
-%229 = OpFAdd %68 %226 %205
-%230 = OpCompositeExtract %5 %118 0
-%231 = OpCompositeExtract %5 %118 1
-%232 = OpIAdd %5 %88 %230
-%233 = OpULessThan %186 %88 %231
-%234 = OpSelect %5 %233 %232 %235
-%237 = OpAccessChain %236 %114 %74 %234
-%238 = OpLoad %21 %237
-%239 = OpBitcast %69 %238
-%240 = OpCompositeExtract %68 %239 0
-%241 = OpCompositeExtract %68 %239 1
-%242 = OpCompositeExtract %68 %239 2
-%243 = OpCompositeExtract %68 %239 3
-%244 = OpFAdd %68 %228 %240
-%245 = OpFAdd %68 %229 %241
-%246 = OpFAdd %68 %242 %227
-%247 = OpCompositeExtract %5 %127 0
-%248 = OpCompositeExtract %5 %127 1
-%249 = OpIAdd %5 %76 %247
-%250 = OpULessThan %186 %76 %248
-%251 = OpSelect %5 %250 %249 %189
-%252 = OpAccessChain %190 %123 %74 %251
-%253 = OpLoad %5 %252
-%254 = OpBitcast %68 %253
-%255 = OpFAdd %68 %244 %254
-%256 = OpCompositeExtract %5 %135 0
-%257 = OpCompositeExtract %5 %135 1
-%258 = OpIAdd %5 %80 %256
-%259 = OpULessThan %186 %80 %257
-%260 = OpSelect %5 %259 %258 %199
-%261 = OpAccessChain %93 %131 %74 %260
-%262 = OpLoad %6 %261
-%263 = OpBitcast %202 %262
-%264 = OpCompositeExtract %68 %263 0
-%265 = OpCompositeExtract %68 %263 1
-%266 = OpFAdd %68 %255 %264
-%267 = OpFAdd %68 %245 %265
-%268 = OpIMul %5 %84 %86
-%269 = OpCompositeExtract %5 %142 0
-%270 = OpCompositeExtract %5 %142 1
-%271 = OpIAdd %5 %268 %269
-%272 = OpULessThan %186 %268 %270
-%273 = OpSelect %5 %272 %271 %189
-%274 = OpAccessChain %190 %138 %74 %273
-%275 = OpLoad %5 %274
-%277 = OpIAdd %5 %273 %78
-%276 = OpAccessChain %190 %138 %74 %277
-%278 = OpLoad %5 %276
-%280 = OpIAdd %5 %273 %82
-%279 = OpAccessChain %190 %138 %74 %280
-%281 = OpLoad %5 %279
-%282 = OpCompositeConstruct %221 %275 %278 %281
-%283 = OpBitcast %223 %282
-%284 = OpCompositeExtract %68 %283 0
-%285 = OpCompositeExtract %68 %283 1
-%286 = OpCompositeExtract %68 %283 2
-%287 = OpFAdd %68 %266 %284
-%288 = OpFAdd %68 %267 %285
-%289 = OpFAdd %68 %246 %286
-%290 = OpCompositeExtract %5 %150 0
-%291 = OpCompositeExtract %5 %150 1
-%292 = OpIAdd %5 %88 %290
-%293 = OpULessThan %186 %88 %291
-%294 = OpSelect %5 %293 %292 %235
-%295 = OpAccessChain %236 %146 %74 %294
-%296 = OpLoad %21 %295
-%297 = OpBitcast %69 %296
-%298 = OpCompositeExtract %68 %297 0
-%299 = OpCompositeExtract %68 %297 1
-%300 = OpCompositeExtract %68 %297 2
-%301 = OpCompositeExtract %68 %297 3
-%302 = OpFAdd %68 %287 %298
-%303 = OpFAdd %68 %288 %299
-%304 = OpFAdd %68 %289 %300
-%305 = OpFAdd %68 %301 %243
-%306 = OpCompositeExtract %5 %158 0
-%307 = OpCompositeExtract %5 %158 1
-%308 = OpIAdd %5 %76 %306
-%309 = OpULessThan %186 %76 %307
-%310 = OpSelect %5 %309 %308 %189
-%311 = OpAccessChain %190 %154 %74 %310
-%312 = OpLoad %5 %311
-%313 = OpBitcast %68 %312
-%314 = OpFAdd %68 %302 %313
-%315 = OpCompositeExtract %5 %166 0
-%316 = OpCompositeExtract %5 %166 1
-%317 = OpIAdd %5 %80 %315
-%318 = OpULessThan %186 %80 %316
-%319 = OpSelect %5 %318 %317 %199
-%320 = OpAccessChain %93 %162 %74 %319
-%321 = OpLoad %6 %320
-%322 = OpBitcast %202 %321
-%323 = OpCompositeExtract %68 %322 0
-%324 = OpCompositeExtract %68 %322 1
-%325 = OpFAdd %68 %314 %323
-%326 = OpFAdd %68 %303 %324
-%327 = OpIMul %5 %84 %86
-%328 = OpCompositeExtract %5 %174 0
-%329 = OpCompositeExtract %5 %174 1
-%330 = OpIAdd %5 %327 %328
-%331 = OpULessThan %186 %327 %329
-%332 = OpSelect %5 %331 %330 %189
-%333 = OpAccessChain %190 %170 %74 %332
-%334 = OpLoad %5 %333
-%336 = OpIAdd %5 %332 %78
-%335 = OpAccessChain %190 %170 %74 %336
-%337 = OpLoad %5 %335
-%339 = OpIAdd %5 %332 %82
-%338 = OpAccessChain %190 %170 %74 %339
-%340 = OpLoad %5 %338
-%341 = OpCompositeConstruct %221 %334 %337 %340
-%342 = OpBitcast %223 %341
-%343 = OpCompositeExtract %68 %342 0
-%344 = OpCompositeExtract %68 %342 1
-%345 = OpCompositeExtract %68 %342 2
-%346 = OpFAdd %68 %325 %343
-%347 = OpFAdd %68 %326 %344
-%348 = OpFAdd %68 %304 %345
-%349 = OpCompositeExtract %5 %182 0
-%350 = OpCompositeExtract %5 %182 1
-%351 = OpIAdd %5 %88 %349
-%352 = OpULessThan %186 %88 %350
-%353 = OpSelect %5 %352 %351 %235
-%354 = OpAccessChain %236 %178 %74 %353
-%355 = OpLoad %21 %354
-%356 = OpBitcast %69 %355
-%357 = OpCompositeExtract %68 %356 0
-%358 = OpCompositeExtract %68 %356 1
-%359 = OpCompositeExtract %68 %356 2
-%360 = OpCompositeExtract %68 %356 3
-%361 = OpFAdd %68 %346 %357
-%362 = OpFAdd %68 %347 %358
-%363 = OpFAdd %68 %348 %359
-%364 = OpFAdd %68 %305 %360
-%365 = OpCompositeExtract %5 %135 0
-%366 = OpCompositeExtract %5 %135 1
-%367 = OpIAdd %5 %76 %365
-%368 = OpULessThan %186 %76 %366
-%369 = OpSelect %5 %368 %367 %199
-%371 = OpBitcast %5 %370
-%372 = OpBitcast %5 %370
-%373 = OpCompositeConstruct %6 %371 %372
-%374 = OpAccessChain %93 %131 %74 %369
-OpStore %374 %373
-%375 = OpIMul %5 %80 %86
-%376 = OpCompositeExtract %5 %174 0
-%377 = OpCompositeExtract %5 %174 1
-%378 = OpIAdd %5 %375 %376
-%379 = OpULessThan %186 %375 %377
-%380 = OpSelect %5 %379 %378 %189
-%382 = OpBitcast %5 %381
-%383 = OpBitcast %5 %381
-%384 = OpBitcast %5 %381
-%385 = OpAccessChain %190 %170 %74 %380
-OpStore %385 %382
-%387 = OpIAdd %5 %380 %78
-%386 = OpAccessChain %190 %170 %74 %387
-OpStore %386 %383
-%389 = OpIAdd %5 %380 %82
-%388 = OpAccessChain %190 %170 %74 %389
-OpStore %388 %384
-%391 = OpAccessChain %390 %71 %74
-OpStore %391 %361
-%392 = OpAccessChain %390 %71 %78
-OpStore %392 %362
-%393 = OpAccessChain %390 %71 %82
-OpStore %393 %363
-%394 = OpAccessChain %390 %71 %86
-OpStore %394 %364
+OpBranch %389
+%389 = OpLabel
+%68 = OpAccessChain %67 %62 %69
+%70 = OpLoad %59 %68
+%71 = OpBitcast %5 %70
+%72 = OpAccessChain %67 %62 %73
+%74 = OpLoad %59 %72
+%75 = OpBitcast %5 %74
+%76 = OpAccessChain %67 %62 %77
+%78 = OpLoad %59 %76
+%79 = OpBitcast %5 %78
+%80 = OpAccessChain %67 %62 %81
+%82 = OpLoad %59 %80
+%83 = OpBitcast %5 %82
+%84 = OpLoad %5 %58
+%86 = OpAccessChain %85 %15 %84
+%87 = OpGroupNonUniformBroadcastFirst %5 %81 %84
+%89 = OpAccessChain %88 %10 %69 %87
+%90 = OpLoad %6 %89
+%91 = OpShiftRightLogical %6 %90 %92
+%93 = OpIAdd %5 %84 %73
+%95 = OpAccessChain %94 %20 %93
+%96 = OpGroupNonUniformBroadcastFirst %5 %81 %93
+%97 = OpAccessChain %88 %10 %69 %96
+%98 = OpLoad %6 %97
+%99 = OpShiftRightLogical %6 %98 %100
+%101 = OpIAdd %5 %84 %77
+%102 = OpAccessChain %85 %15 %101
+%103 = OpGroupNonUniformBroadcastFirst %5 %81 %101
+%104 = OpAccessChain %88 %10 %69 %103
+%105 = OpLoad %6 %104
+%106 = OpShiftRightLogical %6 %105 %92
+%107 = OpIAdd %5 %84 %81
+%109 = OpAccessChain %108 %26 %107
+%110 = OpGroupNonUniformBroadcastFirst %5 %81 %107
+%111 = OpAccessChain %88 %10 %69 %110
+%112 = OpLoad %6 %111
+%113 = OpShiftRightLogical %6 %112 %115
+%116 = OpIAdd %5 %84 %114
+%118 = OpAccessChain %117 %31 %116
+%119 = OpGroupNonUniformBroadcastFirst %5 %81 %116
+%120 = OpAccessChain %88 %10 %69 %119
+%121 = OpLoad %6 %120
+%122 = OpShiftRightLogical %6 %121 %92
+%123 = OpIAdd %5 %84 %124
+%126 = OpAccessChain %125 %36 %123
+%127 = OpGroupNonUniformBroadcastFirst %5 %81 %123
+%128 = OpAccessChain %88 %10 %69 %127
+%129 = OpLoad %6 %128
+%130 = OpShiftRightLogical %6 %129 %100
+%131 = OpIAdd %5 %84 %132
+%133 = OpAccessChain %117 %31 %131
+%134 = OpGroupNonUniformBroadcastFirst %5 %81 %131
+%135 = OpAccessChain %88 %10 %69 %134
+%136 = OpLoad %6 %135
+%137 = OpShiftRightLogical %6 %136 %92
+%138 = OpIAdd %5 %84 %139
+%141 = OpAccessChain %140 %41 %138
+%142 = OpGroupNonUniformBroadcastFirst %5 %81 %138
+%143 = OpAccessChain %88 %10 %69 %142
+%144 = OpLoad %6 %143
+%145 = OpShiftRightLogical %6 %144 %115
+%146 = OpIAdd %5 %84 %147
+%149 = OpAccessChain %148 %46 %146
+%150 = OpGroupNonUniformBroadcastFirst %5 %81 %146
+%151 = OpAccessChain %88 %10 %69 %150
+%152 = OpLoad %6 %151
+%153 = OpShiftRightLogical %6 %152 %92
+%154 = OpIAdd %5 %84 %155
+%157 = OpAccessChain %156 %51 %154
+%158 = OpGroupNonUniformBroadcastFirst %5 %81 %154
+%159 = OpAccessChain %88 %10 %69 %158
+%160 = OpLoad %6 %159
+%161 = OpShiftRightLogical %6 %160 %100
+%162 = OpIAdd %5 %84 %163
+%164 = OpAccessChain %148 %46 %162
+%165 = OpGroupNonUniformBroadcastFirst %5 %81 %162
+%166 = OpAccessChain %88 %10 %69 %165
+%167 = OpLoad %6 %166
+%168 = OpShiftRightLogical %6 %167 %92
+%169 = OpIAdd %5 %84 %170
+%172 = OpAccessChain %171 %56 %169
+%173 = OpGroupNonUniformBroadcastFirst %5 %81 %169
+%174 = OpAccessChain %88 %10 %69 %173
+%175 = OpLoad %6 %174
+%176 = OpShiftRightLogical %6 %175 %115
+%177 = OpCompositeExtract %5 %91 0
+%178 = OpCompositeExtract %5 %91 1
+%179 = OpIAdd %5 %71 %177
+%181 = OpULessThan %180 %71 %178
+%182 = OpSelect %5 %181 %179 %183
+%185 = OpAccessChain %184 %86 %69 %182
+%186 = OpLoad %5 %185
+%187 = OpBitcast %63 %186
+%188 = OpCompositeExtract %5 %99 0
+%189 = OpCompositeExtract %5 %99 1
+%190 = OpIAdd %5 %75 %188
+%191 = OpULessThan %180 %75 %189
+%192 = OpSelect %5 %191 %190 %193
+%194 = OpAccessChain %88 %95 %69 %192
+%195 = OpLoad %6 %194
+%197 = OpBitcast %196 %195
+%198 = OpCompositeExtract %63 %197 0
+%199 = OpCompositeExtract %63 %197 1
+%200 = OpFAdd %63 %198 %187
+%201 = OpIMul %5 %79 %81
+%202 = OpCompositeExtract %5 %106 0
+%203 = OpCompositeExtract %5 %106 1
+%204 = OpIAdd %5 %201 %202
+%205 = OpULessThan %180 %201 %203
+%206 = OpSelect %5 %205 %204 %183
+%207 = OpAccessChain %184 %102 %69 %206
+%208 = OpLoad %5 %207
+%210 = OpIAdd %5 %206 %73
+%209 = OpAccessChain %184 %102 %69 %210
+%211 = OpLoad %5 %209
+%213 = OpIAdd %5 %206 %77
+%212 = OpAccessChain %184 %102 %69 %213
+%214 = OpLoad %5 %212
+%216 = OpCompositeConstruct %215 %208 %211 %214
+%218 = OpBitcast %217 %216
+%219 = OpCompositeExtract %63 %218 0
+%220 = OpCompositeExtract %63 %218 1
+%221 = OpCompositeExtract %63 %218 2
+%222 = OpFAdd %63 %200 %219
+%223 = OpFAdd %63 %220 %199
+%224 = OpCompositeExtract %5 %113 0
+%225 = OpCompositeExtract %5 %113 1
+%226 = OpIAdd %5 %83 %224
+%227 = OpULessThan %180 %83 %225
+%228 = OpSelect %5 %227 %226 %229
+%231 = OpAccessChain %230 %109 %69 %228
+%232 = OpLoad %21 %231
+%233 = OpBitcast %64 %232
+%234 = OpCompositeExtract %63 %233 0
+%235 = OpCompositeExtract %63 %233 1
+%236 = OpCompositeExtract %63 %233 2
+%237 = OpCompositeExtract %63 %233 3
+%238 = OpFAdd %63 %222 %234
+%239 = OpFAdd %63 %223 %235
+%240 = OpFAdd %63 %236 %221
+%241 = OpCompositeExtract %5 %122 0
+%242 = OpCompositeExtract %5 %122 1
+%243 = OpIAdd %5 %71 %241
+%244 = OpULessThan %180 %71 %242
+%245 = OpSelect %5 %244 %243 %183
+%246 = OpAccessChain %184 %118 %69 %245
+%247 = OpLoad %5 %246
+%248 = OpBitcast %63 %247
+%249 = OpFAdd %63 %238 %248
+%250 = OpCompositeExtract %5 %130 0
+%251 = OpCompositeExtract %5 %130 1
+%252 = OpIAdd %5 %75 %250
+%253 = OpULessThan %180 %75 %251
+%254 = OpSelect %5 %253 %252 %193
+%255 = OpAccessChain %88 %126 %69 %254
+%256 = OpLoad %6 %255
+%257 = OpBitcast %196 %256
+%258 = OpCompositeExtract %63 %257 0
+%259 = OpCompositeExtract %63 %257 1
+%260 = OpFAdd %63 %249 %258
+%261 = OpFAdd %63 %239 %259
+%262 = OpIMul %5 %79 %81
+%263 = OpCompositeExtract %5 %137 0
+%264 = OpCompositeExtract %5 %137 1
+%265 = OpIAdd %5 %262 %263
+%266 = OpULessThan %180 %262 %264
+%267 = OpSelect %5 %266 %265 %183
+%268 = OpAccessChain %184 %133 %69 %267
+%269 = OpLoad %5 %268
+%271 = OpIAdd %5 %267 %73
+%270 = OpAccessChain %184 %133 %69 %271
+%272 = OpLoad %5 %270
+%274 = OpIAdd %5 %267 %77
+%273 = OpAccessChain %184 %133 %69 %274
+%275 = OpLoad %5 %273
+%276 = OpCompositeConstruct %215 %269 %272 %275
+%277 = OpBitcast %217 %276
+%278 = OpCompositeExtract %63 %277 0
+%279 = OpCompositeExtract %63 %277 1
+%280 = OpCompositeExtract %63 %277 2
+%281 = OpFAdd %63 %260 %278
+%282 = OpFAdd %63 %261 %279
+%283 = OpFAdd %63 %240 %280
+%284 = OpCompositeExtract %5 %145 0
+%285 = OpCompositeExtract %5 %145 1
+%286 = OpIAdd %5 %83 %284
+%287 = OpULessThan %180 %83 %285
+%288 = OpSelect %5 %287 %286 %229
+%289 = OpAccessChain %230 %141 %69 %288
+%290 = OpLoad %21 %289
+%291 = OpBitcast %64 %290
+%292 = OpCompositeExtract %63 %291 0
+%293 = OpCompositeExtract %63 %291 1
+%294 = OpCompositeExtract %63 %291 2
+%295 = OpCompositeExtract %63 %291 3
+%296 = OpFAdd %63 %281 %292
+%297 = OpFAdd %63 %282 %293
+%298 = OpFAdd %63 %283 %294
+%299 = OpFAdd %63 %295 %237
+%300 = OpCompositeExtract %5 %153 0
+%301 = OpCompositeExtract %5 %153 1
+%302 = OpIAdd %5 %71 %300
+%303 = OpULessThan %180 %71 %301
+%304 = OpSelect %5 %303 %302 %183
+%305 = OpAccessChain %184 %149 %69 %304
+%306 = OpLoad %5 %305
+%307 = OpBitcast %63 %306
+%308 = OpFAdd %63 %296 %307
+%309 = OpCompositeExtract %5 %161 0
+%310 = OpCompositeExtract %5 %161 1
+%311 = OpIAdd %5 %75 %309
+%312 = OpULessThan %180 %75 %310
+%313 = OpSelect %5 %312 %311 %193
+%314 = OpAccessChain %88 %157 %69 %313
+%315 = OpLoad %6 %314
+%316 = OpBitcast %196 %315
+%317 = OpCompositeExtract %63 %316 0
+%318 = OpCompositeExtract %63 %316 1
+%319 = OpFAdd %63 %308 %317
+%320 = OpFAdd %63 %297 %318
+%321 = OpIMul %5 %79 %81
+%322 = OpCompositeExtract %5 %168 0
+%323 = OpCompositeExtract %5 %168 1
+%324 = OpIAdd %5 %321 %322
+%325 = OpULessThan %180 %321 %323
+%326 = OpSelect %5 %325 %324 %183
+%327 = OpAccessChain %184 %164 %69 %326
+%328 = OpLoad %5 %327
+%330 = OpIAdd %5 %326 %73
+%329 = OpAccessChain %184 %164 %69 %330
+%331 = OpLoad %5 %329
+%333 = OpIAdd %5 %326 %77
+%332 = OpAccessChain %184 %164 %69 %333
+%334 = OpLoad %5 %332
+%335 = OpCompositeConstruct %215 %328 %331 %334
+%336 = OpBitcast %217 %335
+%337 = OpCompositeExtract %63 %336 0
+%338 = OpCompositeExtract %63 %336 1
+%339 = OpCompositeExtract %63 %336 2
+%340 = OpFAdd %63 %319 %337
+%341 = OpFAdd %63 %320 %338
+%342 = OpFAdd %63 %298 %339
+%343 = OpCompositeExtract %5 %176 0
+%344 = OpCompositeExtract %5 %176 1
+%345 = OpIAdd %5 %83 %343
+%346 = OpULessThan %180 %83 %344
+%347 = OpSelect %5 %346 %345 %229
+%348 = OpAccessChain %230 %172 %69 %347
+%349 = OpLoad %21 %348
+%350 = OpBitcast %64 %349
+%351 = OpCompositeExtract %63 %350 0
+%352 = OpCompositeExtract %63 %350 1
+%353 = OpCompositeExtract %63 %350 2
+%354 = OpCompositeExtract %63 %350 3
+%355 = OpFAdd %63 %340 %351
+%356 = OpFAdd %63 %341 %352
+%357 = OpFAdd %63 %342 %353
+%358 = OpFAdd %63 %299 %354
+%359 = OpCompositeExtract %5 %130 0
+%360 = OpCompositeExtract %5 %130 1
+%361 = OpIAdd %5 %71 %359
+%362 = OpULessThan %180 %71 %360
+%363 = OpSelect %5 %362 %361 %193
+%365 = OpBitcast %5 %364
+%366 = OpBitcast %5 %364
+%367 = OpCompositeConstruct %6 %365 %366
+%368 = OpAccessChain %88 %126 %69 %363
+OpStore %368 %367
+%369 = OpIMul %5 %75 %81
+%370 = OpCompositeExtract %5 %168 0
+%371 = OpCompositeExtract %5 %168 1
+%372 = OpIAdd %5 %369 %370
+%373 = OpULessThan %180 %369 %371
+%374 = OpSelect %5 %373 %372 %183
+%376 = OpBitcast %5 %375
+%377 = OpBitcast %5 %375
+%378 = OpBitcast %5 %375
+%379 = OpAccessChain %184 %164 %69 %374
+OpStore %379 %376
+%381 = OpIAdd %5 %374 %73
+%380 = OpAccessChain %184 %164 %69 %381
+OpStore %380 %377
+%383 = OpIAdd %5 %374 %77
+%382 = OpAccessChain %184 %164 %69 %383
+OpStore %382 %378
+%385 = OpAccessChain %384 %66 %69
+OpStore %385 %355
+%386 = OpAccessChain %384 %66 %73
+OpStore %386 %356
+%387 = OpAccessChain %384 %66 %77
+OpStore %387 %357
+%388 = OpAccessChain %384 %66 %81
+OpStore %388 %358
OpReturn
OpFunctionEnd
#endif
diff --git a/reference/shaders/resources/sm66/structured-buffer-heap.typed-buffer-offset.sm66.frag b/reference/shaders/resources/sm66/structured-buffer-heap.typed-buffer-offset.sm66.frag
index 2a62d9d..5fdd808 100644
--- a/reference/shaders/resources/sm66/structured-buffer-heap.typed-buffer-offset.sm66.frag
+++ b/reference/shaders/resources/sm66/structured-buffer-heap.typed-buffer-offset.sm66.frag
@@ -21,10 +21,8 @@ layout(push_constant, std430) uniform RootConstants
} registers;
layout(set = 0, binding = 0) uniform usamplerBuffer _17[];
-layout(set = 0, binding = 0, r32ui) uniform readonly uimageBuffer _21[];
-layout(set = 0, binding = 0, r32ui) uniform uimageBuffer _24[];
-layout(set = 0, binding = 0, r32ui) uniform coherent readonly uimageBuffer _27[];
-layout(set = 0, binding = 0, r32ui) uniform coherent uimageBuffer _30[];
+layout(set = 0, binding = 0, r32ui) uniform uimageBuffer _21[];
+layout(set = 0, binding = 0, r32ui) uniform coherent uimageBuffer _24[];
layout(location = 0) flat in uint INDEX;
layout(location = 1) flat in ivec4 UV;
@@ -32,91 +30,91 @@ layout(location = 0) out vec4 SV_Target;
void main()
{
- uint _45 = uint(UV.x);
- uint _49 = uint(UV.y);
- uint _53 = uint(UV.z);
- uint _57 = uint(UV.w);
- uint _62 = subgroupBroadcastFirst(INDEX);
- uint _66 = INDEX + 1u;
+ uint _39 = uint(UV.x);
+ uint _43 = uint(UV.y);
+ uint _47 = uint(UV.z);
+ uint _51 = uint(UV.w);
+ uint _56 = subgroupBroadcastFirst(INDEX);
+ uint _60 = INDEX + 1u;
+ uint _63 = subgroupBroadcastFirst(_60);
+ uint _66 = INDEX + 2u;
uint _69 = subgroupBroadcastFirst(_66);
- uint _72 = INDEX + 2u;
+ uint _72 = INDEX + 3u;
uint _75 = subgroupBroadcastFirst(_72);
- uint _78 = INDEX + 3u;
- uint _81 = subgroupBroadcastFirst(_78);
- uint _84 = INDEX + 4u;
- uint _89 = subgroupBroadcastFirst(_84);
- uint _92 = INDEX + 5u;
- uint _96 = subgroupBroadcastFirst(_92);
- uint _99 = INDEX + 6u;
- uint _103 = subgroupBroadcastFirst(_99);
- uint _106 = INDEX + 7u;
- uint _110 = subgroupBroadcastFirst(_106);
- uint _113 = INDEX + 8u;
- uint _117 = subgroupBroadcastFirst(_113);
- uint _120 = INDEX + 9u;
- uint _124 = subgroupBroadcastFirst(_120);
- uint _127 = INDEX + 10u;
- uint _131 = subgroupBroadcastFirst(_127);
- uint _134 = INDEX + 11u;
- uint _138 = subgroupBroadcastFirst(_134);
- uint _152 = _49 * 2u;
- uint _157 = (_152 < _13._m0[_69].y) ? (_152 + _13._m0[_69].x) : 1073741820u;
- vec2 _165 = uintBitsToFloat(uvec2(texelFetch(_17[_66], int(_157)).x, texelFetch(_17[_66], int(_157 + 1u)).x));
- uint _169 = _53 * 3u;
- uint _174 = (_169 < _13._m0[_75].y) ? (_169 + _13._m0[_75].x) : 1073741820u;
- vec3 _186 = uintBitsToFloat(uvec3(texelFetch(_17[_72], int(_174)).x, texelFetch(_17[_72], int(_174 + 1u)).x, texelFetch(_17[_72], int(_174 + 2u)).x));
- uint _192 = _57 * 4u;
- uint _197 = (_192 < _13._m0[_81].y) ? (_192 + _13._m0[_81].x) : 1073741820u;
- vec4 _210 = uintBitsToFloat(uvec4(texelFetch(_17[_78], int(_197)).x, texelFetch(_17[_78], int(_197 + 1u)).x, texelFetch(_17[_78], int(_197 + 2u)).x, texelFetch(_17[_78], int(_197 + 3u)).x));
- uvec4 _223 = imageLoad(_21[_84], int((_45 < _13._m0[_89].y) ? (_45 + _13._m0[_89].x) : 1073741820u));
- uint _227 = _49 * 2u;
- uint _232 = (_227 < _13._m0[_96].y) ? (_227 + _13._m0[_96].x) : 1073741820u;
- vec2 _239 = uintBitsToFloat(uvec2(imageLoad(_24[_92], int(_232)).x, imageLoad(_24[_92], int(_232 + 1u)).x));
- uint _244 = _53 * 3u;
- uint _249 = (_244 < _13._m0[_103].y) ? (_244 + _13._m0[_103].x) : 1073741820u;
- uvec4 _250 = imageLoad(_21[_99], int(_249));
- uvec4 _252 = imageLoad(_21[_99], int(_249 + 1u));
- uvec4 _255 = imageLoad(_21[_99], int(_249 + 2u));
- vec3 _259 = uintBitsToFloat(uvec3(_250.x, _252.x, _255.x));
- uint _266 = _57 * 4u;
- uint _271 = (_266 < _13._m0[_110].y) ? (_266 + _13._m0[_110].x) : 1073741820u;
- uvec4 _272 = imageLoad(_21[_106], int(_271));
- uvec4 _274 = imageLoad(_21[_106], int(_271 + 1u));
- uvec4 _277 = imageLoad(_21[_106], int(_271 + 2u));
- uvec4 _280 = imageLoad(_21[_106], int(_271 + 3u));
- vec4 _284 = uintBitsToFloat(uvec4(_272.x, _274.x, _277.x, _280.x));
- uvec4 _298 = imageLoad(_27[_113], int((_45 < _13._m0[_117].y) ? (_45 + _13._m0[_117].x) : 1073741820u));
- uint _302 = _49 * 2u;
- uint _307 = (_302 < _13._m0[_124].y) ? (_302 + _13._m0[_124].x) : 1073741820u;
- uvec4 _308 = imageLoad(_27[_120], int(_307));
- uvec4 _310 = imageLoad(_27[_120], int(_307 + 1u));
- vec2 _314 = uintBitsToFloat(uvec2(_308.x, _310.x));
- uint _319 = _53 * 3u;
- uint _324 = (_319 < _13._m0[_131].y) ? (_319 + _13._m0[_131].x) : 1073741820u;
- uvec4 _325 = imageLoad(_30[_127], int(_324));
- uvec4 _327 = imageLoad(_30[_127], int(_324 + 1u));
- uvec4 _330 = imageLoad(_30[_127], int(_324 + 2u));
- vec3 _334 = uintBitsToFloat(uvec3(_325.x, _327.x, _330.x));
- uint _341 = _57 * 4u;
- uint _346 = (_341 < _13._m0[_138].y) ? (_341 + _13._m0[_138].x) : 1073741820u;
- uvec4 _347 = imageLoad(_27[_134], int(_346));
- uvec4 _349 = imageLoad(_27[_134], int(_346 + 1u));
- uvec4 _352 = imageLoad(_27[_134], int(_346 + 2u));
- uvec4 _355 = imageLoad(_27[_134], int(_346 + 3u));
- vec4 _359 = uintBitsToFloat(uvec4(_347.x, _349.x, _352.x, _355.x));
- uint _368 = _45 * 2u;
- uint _373 = (_368 < _13._m0[_96].y) ? (_368 + _13._m0[_96].x) : 1073741820u;
- imageStore(_24[_92], int(_373), uvec4(floatBitsToUint(20.0)));
- imageStore(_24[_92], int(_373 + 1u), uvec4(floatBitsToUint(20.0)));
- uint _380 = _49 * 3u;
- uint _385 = (_380 < _13._m0[_131].y) ? (_380 + _13._m0[_131].x) : 1073741820u;
- imageStore(_30[_127], int(_385), uvec4(floatBitsToUint(30.0)));
- imageStore(_30[_127], int(_385 + 1u), uvec4(floatBitsToUint(30.0)));
- imageStore(_30[_127], int(_385 + 2u), uvec4(floatBitsToUint(30.0)));
- SV_Target.x = ((((((((((_165.x + uintBitsToFloat(texelFetch(_17[INDEX], int((_45 < _13._m0[_62].y) ? (_45 + _13._m0[_62].x) : 1073741820u)).x)) + _186.x) + _210.x) + uintBitsToFloat(_223.x)) + _239.x) + _259.x) + _284.x) + uintBitsToFloat(_298.x)) + _314.x) + _334.x) + _359.x;
- SV_Target.y = (((((((_186.y + _165.y) + _210.y) + _239.y) + _259.y) + _284.y) + _314.y) + _334.y) + _359.y;
- SV_Target.z = ((((_210.z + _186.z) + _259.z) + _284.z) + _334.z) + _359.z;
- SV_Target.w = (_284.w + _210.w) + _359.w;
+ uint _78 = INDEX + 4u;
+ uint _83 = subgroupBroadcastFirst(_78);
+ uint _86 = INDEX + 5u;
+ uint _90 = subgroupBroadcastFirst(_86);
+ uint _93 = INDEX + 6u;
+ uint _97 = subgroupBroadcastFirst(_93);
+ uint _100 = INDEX + 7u;
+ uint _104 = subgroupBroadcastFirst(_100);
+ uint _107 = INDEX + 8u;
+ uint _111 = subgroupBroadcastFirst(_107);
+ uint _114 = INDEX + 9u;
+ uint _118 = subgroupBroadcastFirst(_114);
+ uint _121 = INDEX + 10u;
+ uint _125 = subgroupBroadcastFirst(_121);
+ uint _128 = INDEX + 11u;
+ uint _132 = subgroupBroadcastFirst(_128);
+ uint _146 = _43 * 2u;
+ uint _151 = (_146 < _13._m0[_63].y) ? (_146 + _13._m0[_63].x) : 1073741820u;
+ vec2 _159 = uintBitsToFloat(uvec2(texelFetch(_17[_60], int(_151)).x, texelFetch(_17[_60], int(_151 + 1u)).x));
+ uint _163 = _47 * 3u;
+ uint _168 = (_163 < _13._m0[_69].y) ? (_163 + _13._m0[_69].x) : 1073741820u;
+ vec3 _180 = uintBitsToFloat(uvec3(texelFetch(_17[_66], int(_168)).x, texelFetch(_17[_66], int(_168 + 1u)).x, texelFetch(_17[_66], int(_168 + 2u)).x));
+ uint _186 = _51 * 4u;
+ uint _191 = (_186 < _13._m0[_75].y) ? (_186 + _13._m0[_75].x) : 1073741820u;
+ vec4 _204 = uintBitsToFloat(uvec4(texelFetch(_17[_72], int(_191)).x, texelFetch(_17[_72], int(_191 + 1u)).x, texelFetch(_17[_72], int(_191 + 2u)).x, texelFetch(_17[_72], int(_191 + 3u)).x));
+ uvec4 _217 = imageLoad(_21[_78], int((_39 < _13._m0[_83].y) ? (_39 + _13._m0[_83].x) : 1073741820u));
+ uint _221 = _43 * 2u;
+ uint _226 = (_221 < _13._m0[_90].y) ? (_221 + _13._m0[_90].x) : 1073741820u;
+ vec2 _233 = uintBitsToFloat(uvec2(imageLoad(_21[_86], int(_226)).x, imageLoad(_21[_86], int(_226 + 1u)).x));
+ uint _238 = _47 * 3u;
+ uint _243 = (_238 < _13._m0[_97].y) ? (_238 + _13._m0[_97].x) : 1073741820u;
+ uvec4 _244 = imageLoad(_21[_93], int(_243));
+ uvec4 _246 = imageLoad(_21[_93], int(_243 + 1u));
+ uvec4 _249 = imageLoad(_21[_93], int(_243 + 2u));
+ vec3 _253 = uintBitsToFloat(uvec3(_244.x, _246.x, _249.x));
+ uint _260 = _51 * 4u;
+ uint _265 = (_260 < _13._m0[_104].y) ? (_260 + _13._m0[_104].x) : 1073741820u;
+ uvec4 _266 = imageLoad(_21[_100], int(_265));
+ uvec4 _268 = imageLoad(_21[_100], int(_265 + 1u));
+ uvec4 _271 = imageLoad(_21[_100], int(_265 + 2u));
+ uvec4 _274 = imageLoad(_21[_100], int(_265 + 3u));
+ vec4 _278 = uintBitsToFloat(uvec4(_266.x, _268.x, _271.x, _274.x));
+ uvec4 _292 = imageLoad(_24[_107], int((_39 < _13._m0[_111].y) ? (_39 + _13._m0[_111].x) : 1073741820u));
+ uint _296 = _43 * 2u;
+ uint _301 = (_296 < _13._m0[_118].y) ? (_296 + _13._m0[_118].x) : 1073741820u;
+ uvec4 _302 = imageLoad(_24[_114], int(_301));
+ uvec4 _304 = imageLoad(_24[_114], int(_301 + 1u));
+ vec2 _308 = uintBitsToFloat(uvec2(_302.x, _304.x));
+ uint _313 = _47 * 3u;
+ uint _318 = (_313 < _13._m0[_125].y) ? (_313 + _13._m0[_125].x) : 1073741820u;
+ uvec4 _319 = imageLoad(_24[_121], int(_318));
+ uvec4 _321 = imageLoad(_24[_121], int(_318 + 1u));
+ uvec4 _324 = imageLoad(_24[_121], int(_318 + 2u));
+ vec3 _328 = uintBitsToFloat(uvec3(_319.x, _321.x, _324.x));
+ uint _335 = _51 * 4u;
+ uint _340 = (_335 < _13._m0[_132].y) ? (_335 + _13._m0[_132].x) : 1073741820u;
+ uvec4 _341 = imageLoad(_24[_128], int(_340));
+ uvec4 _343 = imageLoad(_24[_128], int(_340 + 1u));
+ uvec4 _346 = imageLoad(_24[_128], int(_340 + 2u));
+ uvec4 _349 = imageLoad(_24[_128], int(_340 + 3u));
+ vec4 _353 = uintBitsToFloat(uvec4(_341.x, _343.x, _346.x, _349.x));
+ uint _362 = _39 * 2u;
+ uint _367 = (_362 < _13._m0[_90].y) ? (_362 + _13._m0[_90].x) : 1073741820u;
+ imageStore(_21[_86], int(_367), uvec4(floatBitsToUint(20.0)));
+ imageStore(_21[_86], int(_367 + 1u), uvec4(floatBitsToUint(20.0)));
+ uint _374 = _43 * 3u;
+ uint _379 = (_374 < _13._m0[_125].y) ? (_374 + _13._m0[_125].x) : 1073741820u;
+ imageStore(_24[_121], int(_379), uvec4(floatBitsToUint(30.0)));
+ imageStore(_24[_121], int(_379 + 1u), uvec4(floatBitsToUint(30.0)));
+ imageStore(_24[_121], int(_379 + 2u), uvec4(floatBitsToUint(30.0)));
+ SV_Target.x = ((((((((((_159.x + uintBitsToFloat(texelFetch(_17[INDEX], int((_39 < _13._m0[_56].y) ? (_39 + _13._m0[_56].x) : 1073741820u)).x)) + _180.x) + _204.x) + uintBitsToFloat(_217.x)) + _233.x) + _253.x) + _278.x) + uintBitsToFloat(_292.x)) + _308.x) + _328.x) + _353.x;
+ SV_Target.y = (((((((_180.y + _159.y) + _204.y) + _233.y) + _253.y) + _278.y) + _308.y) + _328.y) + _353.y;
+ SV_Target.z = ((((_204.z + _180.z) + _253.z) + _278.z) + _328.z) + _353.z;
+ SV_Target.w = (_278.w + _204.w) + _353.w;
}
@@ -125,7 +123,7 @@ void main()
; SPIR-V
; Version: 1.3
; Generator: Unknown(30017); 21022
-; Bound: 402
+; Bound: 396
; Schema: 0
OpCapability Shader
OpCapability SampledBuffer
@@ -136,15 +134,15 @@ OpCapability PhysicalStorageBufferAddresses
OpExtension "SPV_EXT_descriptor_indexing"
OpExtension "SPV_KHR_physical_storage_buffer"
OpMemoryModel PhysicalStorageBuffer64 GLSL450
-OpEntryPoint Fragment %3 "main" %32 %36 %40
+OpEntryPoint Fragment %3 "main" %26 %30 %34
OpExecutionMode %3 OriginUpperLeft
OpName %3 "main"
OpName %6 "RootConstants"
OpName %8 "registers"
OpName %11 "SSBO_Offsets"
-OpName %32 "INDEX"
-OpName %36 "UV"
-OpName %40 "SV_Target"
+OpName %26 "INDEX"
+OpName %30 "UV"
+OpName %34 "SV_Target"
OpDecorate %6 Block
OpMemberDecorate %6 0 Offset 0
OpMemberDecorate %6 1 Offset 4
@@ -165,21 +163,14 @@ OpDecorate %17 DescriptorSet 0
OpDecorate %17 Binding 0
OpDecorate %21 DescriptorSet 0
OpDecorate %21 Binding 0
-OpDecorate %21 NonWritable
OpDecorate %24 DescriptorSet 0
OpDecorate %24 Binding 0
-OpDecorate %27 DescriptorSet 0
-OpDecorate %27 Binding 0
-OpDecorate %27 NonWritable
-OpDecorate %27 Coherent
-OpDecorate %30 DescriptorSet 0
-OpDecorate %30 Binding 0
-OpDecorate %30 Coherent
-OpDecorate %32 Flat
-OpDecorate %32 Location 0
-OpDecorate %36 Flat
-OpDecorate %36 Location 1
-OpDecorate %40 Location 0
+OpDecorate %24 Coherent
+OpDecorate %26 Flat
+OpDecorate %26 Location 0
+OpDecorate %30 Flat
+OpDecorate %30 Location 1
+OpDecorate %34 Location 0
%1 = OpTypeVoid
%2 = OpTypeFunction %1
%5 = OpTypeInt 32 0
@@ -202,394 +193,388 @@ OpDecorate %40 Location 0
%22 = OpTypeRuntimeArray %18
%23 = OpTypePointer UniformConstant %22
%24 = OpVariable %23 UniformConstant
-%25 = OpTypeRuntimeArray %18
-%26 = OpTypePointer UniformConstant %25
-%27 = OpVariable %26 UniformConstant
-%28 = OpTypeRuntimeArray %18
-%29 = OpTypePointer UniformConstant %28
-%30 = OpVariable %29 UniformConstant
-%31 = OpTypePointer Input %5
-%32 = OpVariable %31 Input
-%33 = OpTypeInt 32 1
-%34 = OpTypeVector %33 4
-%35 = OpTypePointer Input %34
-%36 = OpVariable %35 Input
-%37 = OpTypeFloat 32
-%38 = OpTypeVector %37 4
-%39 = OpTypePointer Output %38
-%40 = OpVariable %39 Output
-%41 = OpTypePointer Input %33
-%43 = OpConstant %5 0
-%47 = OpConstant %5 1
-%51 = OpConstant %5 2
-%55 = OpConstant %5 3
-%59 = OpTypePointer UniformConstant %14
-%63 = OpTypePointer StorageBuffer %9
-%85 = OpConstant %5 4
-%86 = OpTypePointer UniformConstant %18
-%93 = OpConstant %5 5
-%100 = OpConstant %5 6
-%107 = OpConstant %5 7
-%114 = OpConstant %5 8
-%121 = OpConstant %5 9
-%128 = OpConstant %5 10
-%135 = OpConstant %5 11
-%144 = OpTypeBool
-%147 = OpConstant %5 1073741820
-%148 = OpTypeVector %5 4
-%164 = OpTypeVector %37 2
-%183 = OpTypeVector %5 3
-%185 = OpTypeVector %37 3
-%374 = OpConstant %37 20
-%386 = OpConstant %37 30
-%395 = OpTypePointer Output %37
+%25 = OpTypePointer Input %5
+%26 = OpVariable %25 Input
+%27 = OpTypeInt 32 1
+%28 = OpTypeVector %27 4
+%29 = OpTypePointer Input %28
+%30 = OpVariable %29 Input
+%31 = OpTypeFloat 32
+%32 = OpTypeVector %31 4
+%33 = OpTypePointer Output %32
+%34 = OpVariable %33 Output
+%35 = OpTypePointer Input %27
+%37 = OpConstant %5 0
+%41 = OpConstant %5 1
+%45 = OpConstant %5 2
+%49 = OpConstant %5 3
+%53 = OpTypePointer UniformConstant %14
+%57 = OpTypePointer StorageBuffer %9
+%79 = OpConstant %5 4
+%80 = OpTypePointer UniformConstant %18
+%87 = OpConstant %5 5
+%94 = OpConstant %5 6
+%101 = OpConstant %5 7
+%108 = OpConstant %5 8
+%115 = OpConstant %5 9
+%122 = OpConstant %5 10
+%129 = OpConstant %5 11
+%138 = OpTypeBool
+%141 = OpConstant %5 1073741820
+%142 = OpTypeVector %5 4
+%158 = OpTypeVector %31 2
+%177 = OpTypeVector %5 3
+%179 = OpTypeVector %31 3
+%368 = OpConstant %31 20
+%380 = OpConstant %31 30
+%389 = OpTypePointer Output %31
%3 = OpFunction %1 None %2
%4 = OpLabel
-OpBranch %400
-%400 = OpLabel
-%42 = OpAccessChain %41 %36 %43
-%44 = OpLoad %33 %42
-%45 = OpBitcast %5 %44
-%46 = OpAccessChain %41 %36 %47
-%48 = OpLoad %33 %46
-%49 = OpBitcast %5 %48
-%50 = OpAccessChain %41 %36 %51
-%52 = OpLoad %33 %50
-%53 = OpBitcast %5 %52
-%54 = OpAccessChain %41 %36 %55
-%56 = OpLoad %33 %54
-%57 = OpBitcast %5 %56
-%58 = OpLoad %5 %32
-%60 = OpAccessChain %59 %17 %58
-%61 = OpLoad %14 %60
-%62 = OpGroupNonUniformBroadcastFirst %5 %55 %58
-%64 = OpAccessChain %63 %13 %43 %62
+OpBranch %394
+%394 = OpLabel
+%36 = OpAccessChain %35 %30 %37
+%38 = OpLoad %27 %36
+%39 = OpBitcast %5 %38
+%40 = OpAccessChain %35 %30 %41
+%42 = OpLoad %27 %40
+%43 = OpBitcast %5 %42
+%44 = OpAccessChain %35 %30 %45
+%46 = OpLoad %27 %44
+%47 = OpBitcast %5 %46
+%48 = OpAccessChain %35 %30 %49
+%50 = OpLoad %27 %48
+%51 = OpBitcast %5 %50
+%52 = OpLoad %5 %26
+%54 = OpAccessChain %53 %17 %52
+%55 = OpLoad %14 %54
+%56 = OpGroupNonUniformBroadcastFirst %5 %49 %52
+%58 = OpAccessChain %57 %13 %37 %56
+%59 = OpLoad %9 %58
+%60 = OpIAdd %5 %52 %41
+%61 = OpAccessChain %53 %17 %60
+%62 = OpLoad %14 %61
+%63 = OpGroupNonUniformBroadcastFirst %5 %49 %60
+%64 = OpAccessChain %57 %13 %37 %63
%65 = OpLoad %9 %64
-%66 = OpIAdd %5 %58 %47
-%67 = OpAccessChain %59 %17 %66
+%66 = OpIAdd %5 %52 %45
+%67 = OpAccessChain %53 %17 %66
%68 = OpLoad %14 %67
-%69 = OpGroupNonUniformBroadcastFirst %5 %55 %66
-%70 = OpAccessChain %63 %13 %43 %69
+%69 = OpGroupNonUniformBroadcastFirst %5 %49 %66
+%70 = OpAccessChain %57 %13 %37 %69
%71 = OpLoad %9 %70
-%72 = OpIAdd %5 %58 %51
-%73 = OpAccessChain %59 %17 %72
+%72 = OpIAdd %5 %52 %49
+%73 = OpAccessChain %53 %17 %72
%74 = OpLoad %14 %73
-%75 = OpGroupNonUniformBroadcastFirst %5 %55 %72
-%76 = OpAccessChain %63 %13 %43 %75
+%75 = OpGroupNonUniformBroadcastFirst %5 %49 %72
+%76 = OpAccessChain %57 %13 %37 %75
%77 = OpLoad %9 %76
-%78 = OpIAdd %5 %58 %55
-%79 = OpAccessChain %59 %17 %78
-%80 = OpLoad %14 %79
-%81 = OpGroupNonUniformBroadcastFirst %5 %55 %78
-%82 = OpAccessChain %63 %13 %43 %81
-%83 = OpLoad %9 %82
-%84 = OpIAdd %5 %58 %85
-%87 = OpAccessChain %86 %21 %84
-%88 = OpLoad %18 %87
-%89 = OpGroupNonUniformBroadcastFirst %5 %55 %84
-%90 = OpAccessChain %63 %13 %43 %89
-%91 = OpLoad %9 %90
-%92 = OpIAdd %5 %58 %93
-%94 = OpAccessChain %86 %24 %92
-%95 = OpLoad %18 %94
-%96 = OpGroupNonUniformBroadcastFirst %5 %55 %92
-%97 = OpAccessChain %63 %13 %43 %96
-%98 = OpLoad %9 %97
-%99 = OpIAdd %5 %58 %100
-%101 = OpAccessChain %86 %21 %99
-%102 = OpLoad %18 %101
-%103 = OpGroupNonUniformBroadcastFirst %5 %55 %99
-%104 = OpAccessChain %63 %13 %43 %103
-%105 = OpLoad %9 %104
-%106 = OpIAdd %5 %58 %107
-%108 = OpAccessChain %86 %21 %106
-%109 = OpLoad %18 %108
-%110 = OpGroupNonUniformBroadcastFirst %5 %55 %106
-%111 = OpAccessChain %63 %13 %43 %110
-%112 = OpLoad %9 %111
-%113 = OpIAdd %5 %58 %114
-%115 = OpAccessChain %86 %27 %113
-%116 = OpLoad %18 %115
-%117 = OpGroupNonUniformBroadcastFirst %5 %55 %113
-%118 = OpAccessChain %63 %13 %43 %117
-%119 = OpLoad %9 %118
-%120 = OpIAdd %5 %58 %121
-%122 = OpAccessChain %86 %27 %120
-%123 = OpLoad %18 %122
-%124 = OpGroupNonUniformBroadcastFirst %5 %55 %120
-%125 = OpAccessChain %63 %13 %43 %124
-%126 = OpLoad %9 %125
-%127 = OpIAdd %5 %58 %128
-%129 = OpAccessChain %86 %30 %127
-%130 = OpLoad %18 %129
-%131 = OpGroupNonUniformBroadcastFirst %5 %55 %127
-%132 = OpAccessChain %63 %13 %43 %131
-%133 = OpLoad %9 %132
-%134 = OpIAdd %5 %58 %135
-%136 = OpAccessChain %86 %27 %134
-%137 = OpLoad %18 %136
-%138 = OpGroupNonUniformBroadcastFirst %5 %55 %134
-%139 = OpAccessChain %63 %13 %43 %138
-%140 = OpLoad %9 %139
-%141 = OpCompositeExtract %5 %65 0
-%142 = OpCompositeExtract %5 %65 1
-%143 = OpIAdd %5 %45 %141
-%145 = OpULessThan %144 %45 %142
-%146 = OpSelect %5 %145 %143 %147
-%149 = OpImageFetch %148 %61 %146
-%150 = OpCompositeExtract %5 %149 0
-%151 = OpBitcast %37 %150
-%152 = OpIMul %5 %49 %51
-%153 = OpCompositeExtract %5 %71 0
-%154 = OpCompositeExtract %5 %71 1
-%155 = OpIAdd %5 %152 %153
-%156 = OpULessThan %144 %152 %154
-%157 = OpSelect %5 %156 %155 %147
-%158 = OpImageFetch %148 %68 %157
-%159 = OpCompositeExtract %5 %158 0
-%161 = OpIAdd %5 %157 %47
-%160 = OpImageFetch %148 %68 %161
-%162 = OpCompositeExtract %5 %160 0
-%163 = OpCompositeConstruct %9 %159 %162
-%165 = OpBitcast %164 %163
-%166 = OpCompositeExtract %37 %165 0
-%167 = OpCompositeExtract %37 %165 1
-%168 = OpFAdd %37 %166 %151
-%169 = OpIMul %5 %53 %55
-%170 = OpCompositeExtract %5 %77 0
-%171 = OpCompositeExtract %5 %77 1
-%172 = OpIAdd %5 %169 %170
-%173 = OpULessThan %144 %169 %171
-%174 = OpSelect %5 %173 %172 %147
-%175 = OpImageFetch %148 %74 %174
-%176 = OpCompositeExtract %5 %175 0
-%178 = OpIAdd %5 %174 %47
-%177 = OpImageFetch %148 %74 %178
-%179 = OpCompositeExtract %5 %177 0
-%181 = OpIAdd %5 %174 %51
-%180 = OpImageFetch %148 %74 %181
-%182 = OpCompositeExtract %5 %180 0
-%184 = OpCompositeConstruct %183 %176 %179 %182
-%186 = OpBitcast %185 %184
-%187 = OpCompositeExtract %37 %186 0
-%188 = OpCompositeExtract %37 %186 1
-%189 = OpCompositeExtract %37 %186 2
-%190 = OpFAdd %37 %168 %187
-%191 = OpFAdd %37 %188 %167
-%192 = OpIMul %5 %57 %85
-%193 = OpCompositeExtract %5 %83 0
-%194 = OpCompositeExtract %5 %83 1
-%195 = OpIAdd %5 %192 %193
-%196 = OpULessThan %144 %192 %194
-%197 = OpSelect %5 %196 %195 %147
-%198 = OpImageFetch %148 %80 %197
-%199 = OpCompositeExtract %5 %198 0
-%201 = OpIAdd %5 %197 %47
-%200 = OpImageFetch %148 %80 %201
+%78 = OpIAdd %5 %52 %79
+%81 = OpAccessChain %80 %21 %78
+%82 = OpLoad %18 %81
+%83 = OpGroupNonUniformBroadcastFirst %5 %49 %78
+%84 = OpAccessChain %57 %13 %37 %83
+%85 = OpLoad %9 %84
+%86 = OpIAdd %5 %52 %87
+%88 = OpAccessChain %80 %21 %86
+%89 = OpLoad %18 %88
+%90 = OpGroupNonUniformBroadcastFirst %5 %49 %86
+%91 = OpAccessChain %57 %13 %37 %90
+%92 = OpLoad %9 %91
+%93 = OpIAdd %5 %52 %94
+%95 = OpAccessChain %80 %21 %93
+%96 = OpLoad %18 %95
+%97 = OpGroupNonUniformBroadcastFirst %5 %49 %93
+%98 = OpAccessChain %57 %13 %37 %97
+%99 = OpLoad %9 %98
+%100 = OpIAdd %5 %52 %101
+%102 = OpAccessChain %80 %21 %100
+%103 = OpLoad %18 %102
+%104 = OpGroupNonUniformBroadcastFirst %5 %49 %100
+%105 = OpAccessChain %57 %13 %37 %104
+%106 = OpLoad %9 %105
+%107 = OpIAdd %5 %52 %108
+%109 = OpAccessChain %80 %24 %107
+%110 = OpLoad %18 %109
+%111 = OpGroupNonUniformBroadcastFirst %5 %49 %107
+%112 = OpAccessChain %57 %13 %37 %111
+%113 = OpLoad %9 %112
+%114 = OpIAdd %5 %52 %115
+%116 = OpAccessChain %80 %24 %114
+%117 = OpLoad %18 %116
+%118 = OpGroupNonUniformBroadcastFirst %5 %49 %114
+%119 = OpAccessChain %57 %13 %37 %118
+%120 = OpLoad %9 %119
+%121 = OpIAdd %5 %52 %122
+%123 = OpAccessChain %80 %24 %121
+%124 = OpLoad %18 %123
+%125 = OpGroupNonUniformBroadcastFirst %5 %49 %121
+%126 = OpAccessChain %57 %13 %37 %125
+%127 = OpLoad %9 %126
+%128 = OpIAdd %5 %52 %129
+%130 = OpAccessChain %80 %24 %128
+%131 = OpLoad %18 %130
+%132 = OpGroupNonUniformBroadcastFirst %5 %49 %128
+%133 = OpAccessChain %57 %13 %37 %132
+%134 = OpLoad %9 %133
+%135 = OpCompositeExtract %5 %59 0
+%136 = OpCompositeExtract %5 %59 1
+%137 = OpIAdd %5 %39 %135
+%139 = OpULessThan %138 %39 %136
+%140 = OpSelect %5 %139 %137 %141
+%143 = OpImageFetch %142 %55 %140
+%144 = OpCompositeExtract %5 %143 0
+%145 = OpBitcast %31 %144
+%146 = OpIMul %5 %43 %45
+%147 = OpCompositeExtract %5 %65 0
+%148 = OpCompositeExtract %5 %65 1
+%149 = OpIAdd %5 %146 %147
+%150 = OpULessThan %138 %146 %148
+%151 = OpSelect %5 %150 %149 %141
+%152 = OpImageFetch %142 %62 %151
+%153 = OpCompositeExtract %5 %152 0
+%155 = OpIAdd %5 %151 %41
+%154 = OpImageFetch %142 %62 %155
+%156 = OpCompositeExtract %5 %154 0
+%157 = OpCompositeConstruct %9 %153 %156
+%159 = OpBitcast %158 %157
+%160 = OpCompositeExtract %31 %159 0
+%161 = OpCompositeExtract %31 %159 1
+%162 = OpFAdd %31 %160 %145
+%163 = OpIMul %5 %47 %49
+%164 = OpCompositeExtract %5 %71 0
+%165 = OpCompositeExtract %5 %71 1
+%166 = OpIAdd %5 %163 %164
+%167 = OpULessThan %138 %163 %165
+%168 = OpSelect %5 %167 %166 %141
+%169 = OpImageFetch %142 %68 %168
+%170 = OpCompositeExtract %5 %169 0
+%172 = OpIAdd %5 %168 %41
+%171 = OpImageFetch %142 %68 %172
+%173 = OpCompositeExtract %5 %171 0
+%175 = OpIAdd %5 %168 %45
+%174 = OpImageFetch %142 %68 %175
+%176 = OpCompositeExtract %5 %174 0
+%178 = OpCompositeConstruct %177 %170 %173 %176
+%180 = OpBitcast %179 %178
+%181 = OpCompositeExtract %31 %180 0
+%182 = OpCompositeExtract %31 %180 1
+%183 = OpCompositeExtract %31 %180 2
+%184 = OpFAdd %31 %162 %181
+%185 = OpFAdd %31 %182 %161
+%186 = OpIMul %5 %51 %79
+%187 = OpCompositeExtract %5 %77 0
+%188 = OpCompositeExtract %5 %77 1
+%189 = OpIAdd %5 %186 %187
+%190 = OpULessThan %138 %186 %188
+%191 = OpSelect %5 %190 %189 %141
+%192 = OpImageFetch %142 %74 %191
+%193 = OpCompositeExtract %5 %192 0
+%195 = OpIAdd %5 %191 %41
+%194 = OpImageFetch %142 %74 %195
+%196 = OpCompositeExtract %5 %194 0
+%198 = OpIAdd %5 %191 %45
+%197 = OpImageFetch %142 %74 %198
+%199 = OpCompositeExtract %5 %197 0
+%201 = OpIAdd %5 %191 %49
+%200 = OpImageFetch %142 %74 %201
%202 = OpCompositeExtract %5 %200 0
-%204 = OpIAdd %5 %197 %51
-%203 = OpImageFetch %148 %80 %204
-%205 = OpCompositeExtract %5 %203 0
-%207 = OpIAdd %5 %197 %55
-%206 = OpImageFetch %148 %80 %207
-%208 = OpCompositeExtract %5 %206 0
-%209 = OpCompositeConstruct %148 %199 %202 %205 %208
-%210 = OpBitcast %38 %209
-%211 = OpCompositeExtract %37 %210 0
-%212 = OpCompositeExtract %37 %210 1
-%213 = OpCompositeExtract %37 %210 2
-%214 = OpCompositeExtract %37 %210 3
-%215 = OpFAdd %37 %190 %211
-%216 = OpFAdd %37 %191 %212
-%217 = OpFAdd %37 %213 %189
-%218 = OpCompositeExtract %5 %91 0
-%219 = OpCompositeExtract %5 %91 1
-%220 = OpIAdd %5 %45 %218
-%221 = OpULessThan %144 %45 %219
-%222 = OpSelect %5 %221 %220 %147
-%223 = OpImageRead %148 %88 %222
-%224 = OpCompositeExtract %5 %223 0
-%225 = OpBitcast %37 %224
-%226 = OpFAdd %37 %215 %225
-%227 = OpIMul %5 %49 %51
-%228 = OpCompositeExtract %5 %98 0
-%229 = OpCompositeExtract %5 %98 1
-%230 = OpIAdd %5 %227 %228
-%231 = OpULessThan %144 %227 %229
-%232 = OpSelect %5 %231 %230 %147
-%233 = OpImageRead %148 %95 %232
-%234 = OpCompositeExtract %5 %233 0
-%236 = OpIAdd %5 %232 %47
-%235 = OpImageRead %148 %95 %236
-%237 = OpCompositeExtract %5 %235 0
-%238 = OpCompositeConstruct %9 %234 %237
-%239 = OpBitcast %164 %238
-%240 = OpCompositeExtract %37 %239 0
-%241 = OpCompositeExtract %37 %239 1
-%242 = OpFAdd %37 %226 %240
-%243 = OpFAdd %37 %216 %241
-%244 = OpIMul %5 %53 %55
-%245 = OpCompositeExtract %5 %105 0
-%246 = OpCompositeExtract %5 %105 1
-%247 = OpIAdd %5 %244 %245
-%248 = OpULessThan %144 %244 %246
-%249 = OpSelect %5 %248 %247 %147
-%250 = OpImageRead %148 %102 %249
-%251 = OpCompositeExtract %5 %250 0
-%253 = OpIAdd %5 %249 %47
-%252 = OpImageRead %148 %102 %253
-%254 = OpCompositeExtract %5 %252 0
-%256 = OpIAdd %5 %249 %51
-%255 = OpImageRead %148 %102 %256
-%257 = OpCompositeExtract %5 %255 0
-%258 = OpCompositeConstruct %183 %251 %254 %257
-%259 = OpBitcast %185 %258
-%260 = OpCompositeExtract %37 %259 0
-%261 = OpCompositeExtract %37 %259 1
-%262 = OpCompositeExtract %37 %259 2
-%263 = OpFAdd %37 %242 %260
-%264 = OpFAdd %37 %243 %261
-%265 = OpFAdd %37 %217 %262
-%266 = OpIMul %5 %57 %85
-%267 = OpCompositeExtract %5 %112 0
-%268 = OpCompositeExtract %5 %112 1
-%269 = OpIAdd %5 %266 %267
-%270 = OpULessThan %144 %266 %268
-%271 = OpSelect %5 %270 %269 %147
-%272 = OpImageRead %148 %109 %271
-%273 = OpCompositeExtract %5 %272 0
-%275 = OpIAdd %5 %271 %47
-%274 = OpImageRead %148 %109 %275
+%203 = OpCompositeConstruct %142 %193 %196 %199 %202
+%204 = OpBitcast %32 %203
+%205 = OpCompositeExtract %31 %204 0
+%206 = OpCompositeExtract %31 %204 1
+%207 = OpCompositeExtract %31 %204 2
+%208 = OpCompositeExtract %31 %204 3
+%209 = OpFAdd %31 %184 %205
+%210 = OpFAdd %31 %185 %206
+%211 = OpFAdd %31 %207 %183
+%212 = OpCompositeExtract %5 %85 0
+%213 = OpCompositeExtract %5 %85 1
+%214 = OpIAdd %5 %39 %212
+%215 = OpULessThan %138 %39 %213
+%216 = OpSelect %5 %215 %214 %141
+%217 = OpImageRead %142 %82 %216
+%218 = OpCompositeExtract %5 %217 0
+%219 = OpBitcast %31 %218
+%220 = OpFAdd %31 %209 %219
+%221 = OpIMul %5 %43 %45
+%222 = OpCompositeExtract %5 %92 0
+%223 = OpCompositeExtract %5 %92 1
+%224 = OpIAdd %5 %221 %222
+%225 = OpULessThan %138 %221 %223
+%226 = OpSelect %5 %225 %224 %141
+%227 = OpImageRead %142 %89 %226
+%228 = OpCompositeExtract %5 %227 0
+%230 = OpIAdd %5 %226 %41
+%229 = OpImageRead %142 %89 %230
+%231 = OpCompositeExtract %5 %229 0
+%232 = OpCompositeConstruct %9 %228 %231
+%233 = OpBitcast %158 %232
+%234 = OpCompositeExtract %31 %233 0
+%235 = OpCompositeExtract %31 %233 1
+%236 = OpFAdd %31 %220 %234
+%237 = OpFAdd %31 %210 %235
+%238 = OpIMul %5 %47 %49
+%239 = OpCompositeExtract %5 %99 0
+%240 = OpCompositeExtract %5 %99 1
+%241 = OpIAdd %5 %238 %239
+%242 = OpULessThan %138 %238 %240
+%243 = OpSelect %5 %242 %241 %141
+%244 = OpImageRead %142 %96 %243
+%245 = OpCompositeExtract %5 %244 0
+%247 = OpIAdd %5 %243 %41
+%246 = OpImageRead %142 %96 %247
+%248 = OpCompositeExtract %5 %246 0
+%250 = OpIAdd %5 %243 %45
+%249 = OpImageRead %142 %96 %250
+%251 = OpCompositeExtract %5 %249 0
+%252 = OpCompositeConstruct %177 %245 %248 %251
+%253 = OpBitcast %179 %252
+%254 = OpCompositeExtract %31 %253 0
+%255 = OpCompositeExtract %31 %253 1
+%256 = OpCompositeExtract %31 %253 2
+%257 = OpFAdd %31 %236 %254
+%258 = OpFAdd %31 %237 %255
+%259 = OpFAdd %31 %211 %256
+%260 = OpIMul %5 %51 %79
+%261 = OpCompositeExtract %5 %106 0
+%262 = OpCompositeExtract %5 %106 1
+%263 = OpIAdd %5 %260 %261
+%264 = OpULessThan %138 %260 %262
+%265 = OpSelect %5 %264 %263 %141
+%266 = OpImageRead %142 %103 %265
+%267 = OpCompositeExtract %5 %266 0
+%269 = OpIAdd %5 %265 %41
+%268 = OpImageRead %142 %103 %269
+%270 = OpCompositeExtract %5 %268 0
+%272 = OpIAdd %5 %265 %45
+%271 = OpImageRead %142 %103 %272
+%273 = OpCompositeExtract %5 %271 0
+%275 = OpIAdd %5 %265 %49
+%274 = OpImageRead %142 %103 %275
%276 = OpCompositeExtract %5 %274 0
-%278 = OpIAdd %5 %271 %51
-%277 = OpImageRead %148 %109 %278
-%279 = OpCompositeExtract %5 %277 0
-%281 = OpIAdd %5 %271 %55
-%280 = OpImageRead %148 %109 %281
-%282 = OpCompositeExtract %5 %280 0
-%283 = OpCompositeConstruct %148 %273 %276 %279 %282
-%284 = OpBitcast %38 %283
-%285 = OpCompositeExtract %37 %284 0
-%286 = OpCompositeExtract %37 %284 1
-%287 = OpCompositeExtract %37 %284 2
-%288 = OpCompositeExtract %37 %284 3
-%289 = OpFAdd %37 %263 %285
-%290 = OpFAdd %37 %264 %286
-%291 = OpFAdd %37 %265 %287
-%292 = OpFAdd %37 %288 %214
-%293 = OpCompositeExtract %5 %119 0
-%294 = OpCompositeExtract %5 %119 1
-%295 = OpIAdd %5 %45 %293
-%296 = OpULessThan %144 %45 %294
-%297 = OpSelect %5 %296 %295 %147
-%298 = OpImageRead %148 %116 %297
-%299 = OpCompositeExtract %5 %298 0
-%300 = OpBitcast %37 %299
-%301 = OpFAdd %37 %289 %300
-%302 = OpIMul %5 %49 %51
-%303 = OpCompositeExtract %5 %126 0
-%304 = OpCompositeExtract %5 %126 1
-%305 = OpIAdd %5 %302 %303
-%306 = OpULessThan %144 %302 %304
-%307 = OpSelect %5 %306 %305 %147
-%308 = OpImageRead %148 %123 %307
-%309 = OpCompositeExtract %5 %308 0
-%311 = OpIAdd %5 %307 %47
-%310 = OpImageRead %148 %123 %311
-%312 = OpCompositeExtract %5 %310 0
-%313 = OpCompositeConstruct %9 %309 %312
-%314 = OpBitcast %164 %313
-%315 = OpCompositeExtract %37 %314 0
-%316 = OpCompositeExtract %37 %314 1
-%317 = OpFAdd %37 %301 %315
-%318 = OpFAdd %37 %290 %316
-%319 = OpIMul %5 %53 %55
-%320 = OpCompositeExtract %5 %133 0
-%321 = OpCompositeExtract %5 %133 1
-%322 = OpIAdd %5 %319 %320
-%323 = OpULessThan %144 %319 %321
-%324 = OpSelect %5 %323 %322 %147
-%325 = OpImageRead %148 %130 %324
-%326 = OpCompositeExtract %5 %325 0
-%328 = OpIAdd %5 %324 %47
-%327 = OpImageRead %148 %130 %328
-%329 = OpCompositeExtract %5 %327 0
-%331 = OpIAdd %5 %324 %51
-%330 = OpImageRead %148 %130 %331
-%332 = OpCompositeExtract %5 %330 0
-%333 = OpCompositeConstruct %183 %326 %329 %332
-%334 = OpBitcast %185 %333
-%335 = OpCompositeExtract %37 %334 0
-%336 = OpCompositeExtract %37 %334 1
-%337 = OpCompositeExtract %37 %334 2
-%338 = OpFAdd %37 %317 %335
-%339 = OpFAdd %37 %318 %336
-%340 = OpFAdd %37 %291 %337
-%341 = OpIMul %5 %57 %85
-%342 = OpCompositeExtract %5 %140 0
-%343 = OpCompositeExtract %5 %140 1
-%344 = OpIAdd %5 %341 %342
-%345 = OpULessThan %144 %341 %343
-%346 = OpSelect %5 %345 %344 %147
-%347 = OpImageRead %148 %137 %346
-%348 = OpCompositeExtract %5 %347 0
-%350 = OpIAdd %5 %346 %47
-%349 = OpImageRead %148 %137 %350
+%277 = OpCompositeConstruct %142 %267 %270 %273 %276
+%278 = OpBitcast %32 %277
+%279 = OpCompositeExtract %31 %278 0
+%280 = OpCompositeExtract %31 %278 1
+%281 = OpCompositeExtract %31 %278 2
+%282 = OpCompositeExtract %31 %278 3
+%283 = OpFAdd %31 %257 %279
+%284 = OpFAdd %31 %258 %280
+%285 = OpFAdd %31 %259 %281
+%286 = OpFAdd %31 %282 %208
+%287 = OpCompositeExtract %5 %113 0
+%288 = OpCompositeExtract %5 %113 1
+%289 = OpIAdd %5 %39 %287
+%290 = OpULessThan %138 %39 %288
+%291 = OpSelect %5 %290 %289 %141
+%292 = OpImageRead %142 %110 %291
+%293 = OpCompositeExtract %5 %292 0
+%294 = OpBitcast %31 %293
+%295 = OpFAdd %31 %283 %294
+%296 = OpIMul %5 %43 %45
+%297 = OpCompositeExtract %5 %120 0
+%298 = OpCompositeExtract %5 %120 1
+%299 = OpIAdd %5 %296 %297
+%300 = OpULessThan %138 %296 %298
+%301 = OpSelect %5 %300 %299 %141
+%302 = OpImageRead %142 %117 %301
+%303 = OpCompositeExtract %5 %302 0
+%305 = OpIAdd %5 %301 %41
+%304 = OpImageRead %142 %117 %305
+%306 = OpCompositeExtract %5 %304 0
+%307 = OpCompositeConstruct %9 %303 %306
+%308 = OpBitcast %158 %307
+%309 = OpCompositeExtract %31 %308 0
+%310 = OpCompositeExtract %31 %308 1
+%311 = OpFAdd %31 %295 %309
+%312 = OpFAdd %31 %284 %310
+%313 = OpIMul %5 %47 %49
+%314 = OpCompositeExtract %5 %127 0
+%315 = OpCompositeExtract %5 %127 1
+%316 = OpIAdd %5 %313 %314
+%317 = OpULessThan %138 %313 %315
+%318 = OpSelect %5 %317 %316 %141
+%319 = OpImageRead %142 %124 %318
+%320 = OpCompositeExtract %5 %319 0
+%322 = OpIAdd %5 %318 %41
+%321 = OpImageRead %142 %124 %322
+%323 = OpCompositeExtract %5 %321 0
+%325 = OpIAdd %5 %318 %45
+%324 = OpImageRead %142 %124 %325
+%326 = OpCompositeExtract %5 %324 0
+%327 = OpCompositeConstruct %177 %320 %323 %326
+%328 = OpBitcast %179 %327
+%329 = OpCompositeExtract %31 %328 0
+%330 = OpCompositeExtract %31 %328 1
+%331 = OpCompositeExtract %31 %328 2
+%332 = OpFAdd %31 %311 %329
+%333 = OpFAdd %31 %312 %330
+%334 = OpFAdd %31 %285 %331
+%335 = OpIMul %5 %51 %79
+%336 = OpCompositeExtract %5 %134 0
+%337 = OpCompositeExtract %5 %134 1
+%338 = OpIAdd %5 %335 %336
+%339 = OpULessThan %138 %335 %337
+%340 = OpSelect %5 %339 %338 %141
+%341 = OpImageRead %142 %131 %340
+%342 = OpCompositeExtract %5 %341 0
+%344 = OpIAdd %5 %340 %41
+%343 = OpImageRead %142 %131 %344
+%345 = OpCompositeExtract %5 %343 0
+%347 = OpIAdd %5 %340 %45
+%346 = OpImageRead %142 %131 %347
+%348 = OpCompositeExtract %5 %346 0
+%350 = OpIAdd %5 %340 %49
+%349 = OpImageRead %142 %131 %350
%351 = OpCompositeExtract %5 %349 0
-%353 = OpIAdd %5 %346 %51
-%352 = OpImageRead %148 %137 %353
-%354 = OpCompositeExtract %5 %352 0
-%356 = OpIAdd %5 %346 %55
-%355 = OpImageRead %148 %137 %356
-%357 = OpCompositeExtract %5 %355 0
-%358 = OpCompositeConstruct %148 %348 %351 %354 %357
-%359 = OpBitcast %38 %358
-%360 = OpCompositeExtract %37 %359 0
-%361 = OpCompositeExtract %37 %359 1
-%362 = OpCompositeExtract %37 %359 2
-%363 = OpCompositeExtract %37 %359 3
-%364 = OpFAdd %37 %338 %360
-%365 = OpFAdd %37 %339 %361
-%366 = OpFAdd %37 %340 %362
-%367 = OpFAdd %37 %292 %363
-%368 = OpIMul %5 %45 %51
-%369 = OpCompositeExtract %5 %98 0
-%370 = OpCompositeExtract %5 %98 1
-%371 = OpIAdd %5 %368 %369
-%372 = OpULessThan %144 %368 %370
-%373 = OpSelect %5 %372 %371 %147
-%375 = OpBitcast %5 %374
-%376 = OpBitcast %5 %374
-%377 = OpCompositeConstruct %148 %375 %375 %375 %375
-OpImageWrite %95 %373 %377
-%378 = OpCompositeConstruct %148 %376 %376 %376 %376
-%379 = OpIAdd %5 %373 %47
-OpImageWrite %95 %379 %378
-%380 = OpIMul %5 %49 %55
-%381 = OpCompositeExtract %5 %133 0
-%382 = OpCompositeExtract %5 %133 1
-%383 = OpIAdd %5 %380 %381
-%384 = OpULessThan %144 %380 %382
-%385 = OpSelect %5 %384 %383 %147
-%387 = OpBitcast %5 %386
-%388 = OpBitcast %5 %386
-%389 = OpBitcast %5 %386
-%390 = OpCompositeConstruct %148 %387 %387 %387 %387
-OpImageWrite %130 %385 %390
-%391 = OpCompositeConstruct %148 %388 %388 %388 %388
-%392 = OpIAdd %5 %385 %47
-OpImageWrite %130 %392 %391
-%393 = OpCompositeConstruct %148 %389 %389 %389 %389
-%394 = OpIAdd %5 %385 %51
-OpImageWrite %130 %394 %393
-%396 = OpAccessChain %395 %40 %43
-OpStore %396 %364
-%397 = OpAccessChain %395 %40 %47
-OpStore %397 %365
-%398 = OpAccessChain %395 %40 %51
-OpStore %398 %366
-%399 = OpAccessChain %395 %40 %55
-OpStore %399 %367
+%352 = OpCompositeConstruct %142 %342 %345 %348 %351
+%353 = OpBitcast %32 %352
+%354 = OpCompositeExtract %31 %353 0
+%355 = OpCompositeExtract %31 %353 1
+%356 = OpCompositeExtract %31 %353 2
+%357 = OpCompositeExtract %31 %353 3
+%358 = OpFAdd %31 %332 %354
+%359 = OpFAdd %31 %333 %355
+%360 = OpFAdd %31 %334 %356
+%361 = OpFAdd %31 %286 %357
+%362 = OpIMul %5 %39 %45
+%363 = OpCompositeExtract %5 %92 0
+%364 = OpCompositeExtract %5 %92 1
+%365 = OpIAdd %5 %362 %363
+%366 = OpULessThan %138 %362 %364
+%367 = OpSelect %5 %366 %365 %141
+%369 = OpBitcast %5 %368
+%370 = OpBitcast %5 %368
+%371 = OpCompositeConstruct %142 %369 %369 %369 %369
+OpImageWrite %89 %367 %371
+%372 = OpCompositeConstruct %142 %370 %370 %370 %370
+%373 = OpIAdd %5 %367 %41
+OpImageWrite %89 %373 %372
+%374 = OpIMul %5 %43 %49
+%375 = OpCompositeExtract %5 %127 0
+%376 = OpCompositeExtract %5 %127 1
+%377 = OpIAdd %5 %374 %375
+%378 = OpULessThan %138 %374 %376
+%379 = OpSelect %5 %378 %377 %141
+%381 = OpBitcast %5 %380
+%382 = OpBitcast %5 %380
+%383 = OpBitcast %5 %380
+%384 = OpCompositeConstruct %142 %381 %381 %381 %381
+OpImageWrite %124 %379 %384
+%385 = OpCompositeConstruct %142 %382 %382 %382 %382
+%386 = OpIAdd %5 %379 %41
+OpImageWrite %124 %386 %385
+%387 = OpCompositeConstruct %142 %383 %383 %383 %383
+%388 = OpIAdd %5 %379 %45
+OpImageWrite %124 %388 %387
+%390 = OpAccessChain %389 %34 %37
+OpStore %390 %358
+%391 = OpAccessChain %389 %34 %41
+OpStore %391 %359
+%392 = OpAccessChain %389 %34 %45
+OpStore %392 %360
+%393 = OpAccessChain %389 %34 %49
+OpStore %393 %361
OpReturn
OpFunctionEnd
#endif
diff --git a/shaders/memory-model/uav-coherent-promotion.bindless.ssbo.comp b/shaders/memory-model/uav-coherent-promotion.bindless.ssbo.comp
new file mode 100644
index 0000000..14ef577
--- /dev/null
+++ b/shaders/memory-model/uav-coherent-promotion.bindless.ssbo.comp
@@ -0,0 +1,27 @@
+RWStructuredBuffer<float4> RW : register(u0);
+RWStructuredBuffer<float4> RW_RDONLY : register(u1);
+RWStructuredBuffer<float4> RW_WRONLY : register(u2);
+StructuredBuffer<uint> WorkList : register(t0);
+StructuredBuffer<float4> RO : register(t1);
+
+cbuffer Constants : register(b0) { uint count; };
+
+[numthreads(256, 1, 1)]
+void main(uint id : SV_GroupIndex)
+{
+ // Prime the L0 caches.
+ RW[id] = 0.0.xxxx;
+
+ for (uint iter = 0; iter < count; iter++)
+ {
+ uint increment_offset = WorkList[256 * iter + id];
+ // globallycoherent is not needed when sharing data between threads in the same group.
+ DeviceMemoryBarrierWithGroupSync();
+
+ // If caches are incoherent here in the workgroup, this will break hard.
+ if (increment_offset < 256)
+ RW[increment_offset] += RO[256 * iter + id];
+ }
+
+ RW_WRONLY[id] = RW_RDONLY[id];
+}
diff --git a/shaders/memory-model/uav-coherent-promotion.root-descriptor.ssbo.comp b/shaders/memory-model/uav-coherent-promotion.root-descriptor.ssbo.comp
new file mode 100644
index 0000000..14ef577
--- /dev/null
+++ b/shaders/memory-model/uav-coherent-promotion.root-descriptor.ssbo.comp
@@ -0,0 +1,27 @@
+RWStructuredBuffer<float4> RW : register(u0);
+RWStructuredBuffer<float4> RW_RDONLY : register(u1);
+RWStructuredBuffer<float4> RW_WRONLY : register(u2);
+StructuredBuffer<uint> WorkList : register(t0);
+StructuredBuffer<float4> RO : register(t1);
+
+cbuffer Constants : register(b0) { uint count; };
+
+[numthreads(256, 1, 1)]
+void main(uint id : SV_GroupIndex)
+{
+ // Prime the L0 caches.
+ RW[id] = 0.0.xxxx;
+
+ for (uint iter = 0; iter < count; iter++)
+ {
+ uint increment_offset = WorkList[256 * iter + id];
+ // globallycoherent is not needed when sharing data between threads in the same group.
+ DeviceMemoryBarrierWithGroupSync();
+
+ // If caches are incoherent here in the workgroup, this will break hard.
+ if (increment_offset < 256)
+ RW[increment_offset] += RO[256 * iter + id];
+ }
+
+ RW_WRONLY[id] = RW_RDONLY[id];
+}
diff --git a/shaders/memory-model/uav-coherent-promotion.sm66.bindless.ssbo.comp b/shaders/memory-model/uav-coherent-promotion.sm66.bindless.ssbo.comp
new file mode 100644
index 0000000..5a268ef
--- /dev/null
+++ b/shaders/memory-model/uav-coherent-promotion.sm66.bindless.ssbo.comp
@@ -0,0 +1,27 @@
+StructuredBuffer<uint> WorkList : register(t0);
+StructuredBuffer<float4> RO : register(t1);
+cbuffer Constants : register(b0) { uint count; };
+
+[numthreads(256, 1, 1)]
+void main(uint id : SV_GroupIndex)
+{
+ RWStructuredBuffer<float4> RW = ResourceDescriptorHeap[0];
+ RWStructuredBuffer<float4> RW_RDONLY = ResourceDescriptorHeap[1];
+ RWStructuredBuffer<float4> RW_WRONLY = ResourceDescriptorHeap[2];
+
+ // Prime the L0 caches.
+ RW[id] = 0.0.xxxx;
+
+ for (uint iter = 0; iter < count; iter++)
+ {
+ uint increment_offset = WorkList[256 * iter + id];
+ // globallycoherent is not needed when sharing data between threads in the same group.
+ DeviceMemoryBarrierWithGroupSync();
+
+ // If caches are incoherent here in the workgroup, this will break hard.
+ if (increment_offset < 256)
+ RW[increment_offset] += RO[256 * iter + id];
+ }
+
+ RW_WRONLY[id] = RW_RDONLY[id];
+}
diff --git a/shaders/memory-model/uav-coherent-promotion.sm66.ssbo.comp b/shaders/memory-model/uav-coherent-promotion.sm66.ssbo.comp
new file mode 100644
index 0000000..5a268ef
--- /dev/null
+++ b/shaders/memory-model/uav-coherent-promotion.sm66.ssbo.comp
@@ -0,0 +1,27 @@
+StructuredBuffer<uint> WorkList : register(t0);
+StructuredBuffer<float4> RO : register(t1);
+cbuffer Constants : register(b0) { uint count; };
+
+[numthreads(256, 1, 1)]
+void main(uint id : SV_GroupIndex)
+{
+ RWStructuredBuffer<float4> RW = ResourceDescriptorHeap[0];
+ RWStructuredBuffer<float4> RW_RDONLY = ResourceDescriptorHeap[1];
+ RWStructuredBuffer<float4> RW_WRONLY = ResourceDescriptorHeap[2];
+
+ // Prime the L0 caches.
+ RW[id] = 0.0.xxxx;
+
+ for (uint iter = 0; iter < count; iter++)
+ {
+ uint increment_offset = WorkList[256 * iter + id];
+ // globallycoherent is not needed when sharing data between threads in the same group.
+ DeviceMemoryBarrierWithGroupSync();
+
+ // If caches are incoherent here in the workgroup, this will break hard.
+ if (increment_offset < 256)
+ RW[increment_offset] += RO[256 * iter + id];
+ }
+
+ RW_WRONLY[id] = RW_RDONLY[id];
+}
diff --git a/shaders/memory-model/uav-coherent-promotion.ssbo.comp b/shaders/memory-model/uav-coherent-promotion.ssbo.comp
new file mode 100644
index 0000000..14ef577
--- /dev/null
+++ b/shaders/memory-model/uav-coherent-promotion.ssbo.comp
@@ -0,0 +1,27 @@
+RWStructuredBuffer<float4> RW : register(u0);
+RWStructuredBuffer<float4> RW_RDONLY : register(u1);
+RWStructuredBuffer<float4> RW_WRONLY : register(u2);
+StructuredBuffer<uint> WorkList : register(t0);
+StructuredBuffer<float4> RO : register(t1);
+
+cbuffer Constants : register(b0) { uint count; };
+
+[numthreads(256, 1, 1)]
+void main(uint id : SV_GroupIndex)
+{
+ // Prime the L0 caches.
+ RW[id] = 0.0.xxxx;
+
+ for (uint iter = 0; iter < count; iter++)
+ {
+ uint increment_offset = WorkList[256 * iter + id];
+ // globallycoherent is not needed when sharing data between threads in the same group.
+ DeviceMemoryBarrierWithGroupSync();
+
+ // If caches are incoherent here in the workgroup, this will break hard.
+ if (increment_offset < 256)
+ RW[increment_offset] += RO[256 * iter + id];
+ }
+
+ RW_WRONLY[id] = RW_RDONLY[id];
+}
diff --git a/shaders/memory-model/uav-coherent.root-descriptor.ssbo.comp b/shaders/memory-model/uav-coherent.root-descriptor.ssbo.comp
new file mode 100644
index 0000000..0653601
--- /dev/null
+++ b/shaders/memory-model/uav-coherent.root-descriptor.ssbo.comp
@@ -0,0 +1,27 @@
+globallycoherent RWStructuredBuffer<float4> RW : register(u0);
+RWStructuredBuffer<float4> RW_RDONLY : register(u1);
+RWStructuredBuffer<float4> RW_WRONLY : register(u2);
+StructuredBuffer<uint> WorkList : register(t0);
+StructuredBuffer<float4> RO : register(t1);
+
+cbuffer Constants : register(b0) { uint count; };
+
+[numthreads(256, 1, 1)]
+void main(uint id : SV_GroupIndex)
+{
+ // Prime the L0 caches.
+ RW[id] = 0.0.xxxx;
+
+ for (uint iter = 0; iter < count; iter++)
+ {
+ uint increment_offset = WorkList[256 * iter + id];
+ // globallycoherent is not needed when sharing data between threads in the same group.
+ DeviceMemoryBarrierWithGroupSync();
+
+ // If caches are incoherent here in the workgroup, this will break hard.
+ if (increment_offset < 256)
+ RW[increment_offset] += RO[256 * iter + id];
+ }
+
+ RW_WRONLY[id] = RW_RDONLY[id];
+}
diff --git a/shaders/memory-model/uav-coherent.sm66.ssbo.comp b/shaders/memory-model/uav-coherent.sm66.ssbo.comp
new file mode 100644
index 0000000..b4572c0
--- /dev/null
+++ b/shaders/memory-model/uav-coherent.sm66.ssbo.comp
@@ -0,0 +1,27 @@
+StructuredBuffer<uint> WorkList : register(t0);
+StructuredBuffer<float4> RO : register(t1);
+cbuffer Constants : register(b0) { uint count; };
+
+[numthreads(256, 1, 1)]
+void main(uint id : SV_GroupIndex)
+{
+ globallycoherent RWStructuredBuffer<float4> RW = ResourceDescriptorHeap[0];
+ RWStructuredBuffer<float4> RW_RDONLY = ResourceDescriptorHeap[1];
+ RWStructuredBuffer<float4> RW_WRONLY = ResourceDescriptorHeap[2];
+
+ // Prime the L0 caches.
+ RW[id] = 0.0.xxxx;
+
+ for (uint iter = 0; iter < count; iter++)
+ {
+ uint increment_offset = WorkList[256 * iter + id];
+ // globallycoherent is not needed when sharing data between threads in the same group.
+ DeviceMemoryBarrierWithGroupSync();
+
+ // If caches are incoherent here in the workgroup, this will break hard.
+ if (increment_offset < 256)
+ RW[increment_offset] += RO[256 * iter + id];
+ }
+
+ RW_WRONLY[id] = RW_RDONLY[id];
+}
diff --git a/shaders/memory-model/uav-coherent.ssbo.comp b/shaders/memory-model/uav-coherent.ssbo.comp
new file mode 100644
index 0000000..0653601
--- /dev/null
+++ b/shaders/memory-model/uav-coherent.ssbo.comp
@@ -0,0 +1,27 @@
+globallycoherent RWStructuredBuffer<float4> RW : register(u0);
+RWStructuredBuffer<float4> RW_RDONLY : register(u1);
+RWStructuredBuffer<float4> RW_WRONLY : register(u2);
+StructuredBuffer<uint> WorkList : register(t0);
+StructuredBuffer<float4> RO : register(t1);
+
+cbuffer Constants : register(b0) { uint count; };
+
+[numthreads(256, 1, 1)]
+void main(uint id : SV_GroupIndex)
+{
+ // Prime the L0 caches.
+ RW[id] = 0.0.xxxx;
+
+ for (uint iter = 0; iter < count; iter++)
+ {
+ uint increment_offset = WorkList[256 * iter + id];
+ // globallycoherent is not needed when sharing data between threads in the same group.
+ DeviceMemoryBarrierWithGroupSync();
+
+ // If caches are incoherent here in the workgroup, this will break hard.
+ if (increment_offset < 256)
+ RW[increment_offset] += RO[256 * iter + id];
+ }
+
+ RW_WRONLY[id] = RW_RDONLY[id];
+}