diff options
Diffstat (limited to 'src/shader_recompiler')
| -rw-r--r-- | src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp b/src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp index 336338e62..d1e59f22e 100644 --- a/src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp +++ b/src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp | |||
| @@ -35,6 +35,7 @@ struct Bias { | |||
| 35 | u32 index; | 35 | u32 index; |
| 36 | u32 offset_begin; | 36 | u32 offset_begin; |
| 37 | u32 offset_end; | 37 | u32 offset_end; |
| 38 | u32 alignment; | ||
| 38 | }; | 39 | }; |
| 39 | 40 | ||
| 40 | using boost::container::flat_set; | 41 | using boost::container::flat_set; |
| @@ -349,7 +350,8 @@ std::optional<StorageBufferAddr> Track(const IR::Value& value, const Bias* bias) | |||
| 349 | .index = index.U32(), | 350 | .index = index.U32(), |
| 350 | .offset = offset.U32(), | 351 | .offset = offset.U32(), |
| 351 | }; | 352 | }; |
| 352 | if (!Common::IsAligned(storage_buffer.offset, 16)) { | 353 | const u32 alignment{bias ? bias->alignment : 8U}; |
| 354 | if (!Common::IsAligned(storage_buffer.offset, alignment)) { | ||
| 353 | // The SSBO pointer has to be aligned | 355 | // The SSBO pointer has to be aligned |
| 354 | return std::nullopt; | 356 | return std::nullopt; |
| 355 | } | 357 | } |
| @@ -371,6 +373,7 @@ void CollectStorageBuffers(IR::Block& block, IR::Inst& inst, StorageInfo& info) | |||
| 371 | .index = 0, | 373 | .index = 0, |
| 372 | .offset_begin = 0x110, | 374 | .offset_begin = 0x110, |
| 373 | .offset_end = 0x610, | 375 | .offset_end = 0x610, |
| 376 | .alignment = 16, | ||
| 374 | }; | 377 | }; |
| 375 | // Track the low address of the instruction | 378 | // Track the low address of the instruction |
| 376 | const std::optional<LowAddrInfo> low_addr_info{TrackLowAddress(&inst)}; | 379 | const std::optional<LowAddrInfo> low_addr_info{TrackLowAddress(&inst)}; |
| @@ -386,8 +389,11 @@ void CollectStorageBuffers(IR::Block& block, IR::Inst& inst, StorageInfo& info) | |||
| 386 | storage_buffer = Track(low_addr, nullptr); | 389 | storage_buffer = Track(low_addr, nullptr); |
| 387 | if (!storage_buffer) { | 390 | if (!storage_buffer) { |
| 388 | // If that also fails, use NVN fallbacks | 391 | // If that also fails, use NVN fallbacks |
| 392 | LOG_WARNING(Shader, "Storage buffer failed to track, using global memory fallbacks"); | ||
| 389 | return; | 393 | return; |
| 390 | } | 394 | } |
| 395 | LOG_WARNING(Shader, "Storage buffer tracked without bias, index {} offset {}", | ||
| 396 | storage_buffer->index, storage_buffer->offset); | ||
| 391 | } | 397 | } |
| 392 | // Collect storage buffer and the instruction | 398 | // Collect storage buffer and the instruction |
| 393 | if (IsGlobalMemoryWrite(inst)) { | 399 | if (IsGlobalMemoryWrite(inst)) { |