summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2022-01-29 20:06:03 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2022-01-30 01:56:02 +0100
commit90a0506d564ce0ce44ad8ab662f035c21fc03e71 (patch)
tree787c3f7a82675c97a7cb1d40010695f81eb2c2b2 /src
parentshaders: Add U64->U32x2 Atomic fallback functions (diff)
downloadyuzu-90a0506d564ce0ce44ad8ab662f035c21fc03e71.tar
yuzu-90a0506d564ce0ce44ad8ab662f035c21fc03e71.tar.gz
yuzu-90a0506d564ce0ce44ad8ab662f035c21fc03e71.tar.bz2
yuzu-90a0506d564ce0ce44ad8ab662f035c21fc03e71.tar.lz
yuzu-90a0506d564ce0ce44ad8ab662f035c21fc03e71.tar.xz
yuzu-90a0506d564ce0ce44ad8ab662f035c21fc03e71.tar.zst
yuzu-90a0506d564ce0ce44ad8ab662f035c21fc03e71.zip
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.inc18
-rw-r--r--src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp49
-rw-r--r--src/shader_recompiler/ir_opt/lower_int64_to_int32.cpp20
3 files changed, 76 insertions, 11 deletions
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc
index 8da5df97c..efb6bfac3 100644
--- a/src/shader_recompiler/frontend/ir/opcodes.inc
+++ b/src/shader_recompiler/frontend/ir/opcodes.inc
@@ -363,15 +363,15 @@ OPCODE(GlobalAtomicAnd64, U64, U64,
OPCODE(GlobalAtomicOr64, U64, U64, U64, )
OPCODE(GlobalAtomicXor64, U64, U64, U64, )
OPCODE(GlobalAtomicExchange64, U64, U64, U64, )
-OPCODE(GlobalAtomicIAdd32x2, U32x2, U64, U32x2, )
-OPCODE(GlobalAtomicSMin32x2, U32x2, U64, U32x2, )
-OPCODE(GlobalAtomicUMin32x2, U32x2, U64, U32x2, )
-OPCODE(GlobalAtomicSMax32x2, U32x2, U64, U32x2, )
-OPCODE(GlobalAtomicUMax32x2, U32x2, U64, U32x2, )
-OPCODE(GlobalAtomicAnd32x2, U32x2, U64, U32x2, )
-OPCODE(GlobalAtomicOr32x2, U32x2, U64, U32x2, )
-OPCODE(GlobalAtomicXor32x2, U32x2, U64, U32x2, )
-OPCODE(GlobalAtomicExchange32x2, U32x2, U64, U32x2, )
+OPCODE(GlobalAtomicIAdd32x2, U32x2, U32x2, U32x2, )
+OPCODE(GlobalAtomicSMin32x2, U32x2, U32x2, U32x2, )
+OPCODE(GlobalAtomicUMin32x2, U32x2, U32x2, U32x2, )
+OPCODE(GlobalAtomicSMax32x2, U32x2, U32x2, U32x2, )
+OPCODE(GlobalAtomicUMax32x2, U32x2, U32x2, U32x2, )
+OPCODE(GlobalAtomicAnd32x2, U32x2, U32x2, U32x2, )
+OPCODE(GlobalAtomicOr32x2, U32x2, U32x2, U32x2, )
+OPCODE(GlobalAtomicXor32x2, U32x2, U32x2, U32x2, )
+OPCODE(GlobalAtomicExchange32x2, U32x2, U32x2, U32x2, )
OPCODE(GlobalAtomicAddF32, F32, U64, F32, )
OPCODE(GlobalAtomicAddF16x2, U32, U64, F16x2, )
OPCODE(GlobalAtomicAddF32x2, U32, U64, F32x2, )
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 4197b0095..38592afd0 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
@@ -92,6 +92,15 @@ bool IsGlobalMemory(const IR::Inst& inst) {
case IR::Opcode::GlobalAtomicOr64:
case IR::Opcode::GlobalAtomicXor64:
case IR::Opcode::GlobalAtomicExchange64:
+ case IR::Opcode::GlobalAtomicIAdd32x2:
+ case IR::Opcode::GlobalAtomicSMin32x2:
+ case IR::Opcode::GlobalAtomicUMin32x2:
+ case IR::Opcode::GlobalAtomicSMax32x2:
+ case IR::Opcode::GlobalAtomicUMax32x2:
+ case IR::Opcode::GlobalAtomicAnd32x2:
+ case IR::Opcode::GlobalAtomicOr32x2:
+ case IR::Opcode::GlobalAtomicXor32x2:
+ case IR::Opcode::GlobalAtomicExchange32x2:
case IR::Opcode::GlobalAtomicAddF32:
case IR::Opcode::GlobalAtomicAddF16x2:
case IR::Opcode::GlobalAtomicAddF32x2:
@@ -135,6 +144,15 @@ bool IsGlobalMemoryWrite(const IR::Inst& inst) {
case IR::Opcode::GlobalAtomicOr64:
case IR::Opcode::GlobalAtomicXor64:
case IR::Opcode::GlobalAtomicExchange64:
+ case IR::Opcode::GlobalAtomicIAdd32x2:
+ case IR::Opcode::GlobalAtomicSMin32x2:
+ case IR::Opcode::GlobalAtomicUMin32x2:
+ case IR::Opcode::GlobalAtomicSMax32x2:
+ case IR::Opcode::GlobalAtomicUMax32x2:
+ case IR::Opcode::GlobalAtomicAnd32x2:
+ case IR::Opcode::GlobalAtomicOr32x2:
+ case IR::Opcode::GlobalAtomicXor32x2:
+ case IR::Opcode::GlobalAtomicExchange32x2:
case IR::Opcode::GlobalAtomicAddF32:
case IR::Opcode::GlobalAtomicAddF16x2:
case IR::Opcode::GlobalAtomicAddF32x2:
@@ -199,6 +217,8 @@ IR::Opcode GlobalToStorage(IR::Opcode opcode) {
return IR::Opcode::StorageAtomicOr32;
case IR::Opcode::GlobalAtomicXor32:
return IR::Opcode::StorageAtomicXor32;
+ case IR::Opcode::GlobalAtomicExchange32:
+ return IR::Opcode::StorageAtomicExchange32;
case IR::Opcode::GlobalAtomicIAdd64:
return IR::Opcode::StorageAtomicIAdd64;
case IR::Opcode::GlobalAtomicSMin64:
@@ -215,10 +235,26 @@ IR::Opcode GlobalToStorage(IR::Opcode opcode) {
return IR::Opcode::StorageAtomicOr64;
case IR::Opcode::GlobalAtomicXor64:
return IR::Opcode::StorageAtomicXor64;
- case IR::Opcode::GlobalAtomicExchange32:
- return IR::Opcode::StorageAtomicExchange32;
case IR::Opcode::GlobalAtomicExchange64:
return IR::Opcode::StorageAtomicExchange64;
+ case IR::Opcode::GlobalAtomicIAdd32x2:
+ return IR::Opcode::StorageAtomicIAdd32x2;
+ case IR::Opcode::GlobalAtomicSMin32x2:
+ return IR::Opcode::StorageAtomicSMin32x2;
+ case IR::Opcode::GlobalAtomicUMin32x2:
+ return IR::Opcode::StorageAtomicUMin32x2;
+ case IR::Opcode::GlobalAtomicSMax32x2:
+ return IR::Opcode::StorageAtomicSMax32x2;
+ case IR::Opcode::GlobalAtomicUMax32x2:
+ return IR::Opcode::StorageAtomicUMax32x2;
+ case IR::Opcode::GlobalAtomicAnd32x2:
+ return IR::Opcode::StorageAtomicAnd32x2;
+ case IR::Opcode::GlobalAtomicOr32x2:
+ return IR::Opcode::StorageAtomicOr32x2;
+ case IR::Opcode::GlobalAtomicXor32x2:
+ return IR::Opcode::StorageAtomicXor32x2;
+ case IR::Opcode::GlobalAtomicExchange32x2:
+ return IR::Opcode::StorageAtomicExchange32x2;
case IR::Opcode::GlobalAtomicAddF32:
return IR::Opcode::StorageAtomicAddF32;
case IR::Opcode::GlobalAtomicAddF16x2:
@@ -454,6 +490,15 @@ void Replace(IR::Block& block, IR::Inst& inst, const IR::U32& storage_index,
case IR::Opcode::GlobalAtomicOr64:
case IR::Opcode::GlobalAtomicXor64:
case IR::Opcode::GlobalAtomicExchange64:
+ case IR::Opcode::GlobalAtomicIAdd32x2:
+ case IR::Opcode::GlobalAtomicSMin32x2:
+ case IR::Opcode::GlobalAtomicUMin32x2:
+ case IR::Opcode::GlobalAtomicSMax32x2:
+ case IR::Opcode::GlobalAtomicUMax32x2:
+ case IR::Opcode::GlobalAtomicAnd32x2:
+ case IR::Opcode::GlobalAtomicOr32x2:
+ case IR::Opcode::GlobalAtomicXor32x2:
+ case IR::Opcode::GlobalAtomicExchange32x2:
case IR::Opcode::GlobalAtomicAddF32:
case IR::Opcode::GlobalAtomicAddF16x2:
case IR::Opcode::GlobalAtomicAddF32x2:
diff --git a/src/shader_recompiler/ir_opt/lower_int64_to_int32.cpp b/src/shader_recompiler/ir_opt/lower_int64_to_int32.cpp
index e80d3d1d9..c2654cd9b 100644
--- a/src/shader_recompiler/ir_opt/lower_int64_to_int32.cpp
+++ b/src/shader_recompiler/ir_opt/lower_int64_to_int32.cpp
@@ -199,6 +199,26 @@ void Lower(IR::Block& block, IR::Inst& inst) {
return ShiftRightLogical64To32(block, inst);
case IR::Opcode::ShiftRightArithmetic64:
return ShiftRightArithmetic64To32(block, inst);
+ case IR::Opcode::SharedAtomicExchange64:
+ return inst.ReplaceOpcode(IR::Opcode::SharedAtomicExchange32x2);
+ case IR::Opcode::GlobalAtomicIAdd64:
+ return inst.ReplaceOpcode(IR::Opcode::GlobalAtomicIAdd32x2);
+ case IR::Opcode::GlobalAtomicSMin64:
+ return inst.ReplaceOpcode(IR::Opcode::GlobalAtomicSMin32x2);
+ case IR::Opcode::GlobalAtomicUMin64:
+ return inst.ReplaceOpcode(IR::Opcode::GlobalAtomicUMin32x2);
+ case IR::Opcode::GlobalAtomicSMax64:
+ return inst.ReplaceOpcode(IR::Opcode::GlobalAtomicSMax32x2);
+ case IR::Opcode::GlobalAtomicUMax64:
+ return inst.ReplaceOpcode(IR::Opcode::GlobalAtomicUMax32x2);
+ case IR::Opcode::GlobalAtomicAnd64:
+ return inst.ReplaceOpcode(IR::Opcode::GlobalAtomicAnd32x2);
+ case IR::Opcode::GlobalAtomicOr64:
+ return inst.ReplaceOpcode(IR::Opcode::GlobalAtomicOr32x2);
+ case IR::Opcode::GlobalAtomicXor64:
+ return inst.ReplaceOpcode(IR::Opcode::GlobalAtomicXor32x2);
+ case IR::Opcode::GlobalAtomicExchange64:
+ return inst.ReplaceOpcode(IR::Opcode::GlobalAtomicExchange32x2);
default:
break;
}