aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2024-09-18 15:48:55 -0300
committerGitHub <noreply@github.com>2024-09-18 15:48:55 -0300
commitef81658fbd5b2aa23bf7e71b22a636da9a16c67b (patch)
tree162068fa579f06f78db9528a5da51627a2e5867c
parent062ef43eb46ffec0ddc441907d38da3cfc235f09 (diff)
Implement support for shader ATOM.EXCH instruction (#7320)1.1.1394
* Implement support for shader ATOM.EXCH instruction * Shader cache version bump * Check type
-rw-r--r--src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs2
-rw-r--r--src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs51
2 files changed, 33 insertions, 20 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
index c1f592011..e1e696ca8 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
@@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
22 private const ushort FileFormatVersionMajor = 1; 22 private const ushort FileFormatVersionMajor = 1;
23 private const ushort FileFormatVersionMinor = 2; 23 private const ushort FileFormatVersionMinor = 2;
24 private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor; 24 private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
25 private const uint CodeGenVersion = 7131; 25 private const uint CodeGenVersion = 7320;
26 26
27 private const string SharedTocFileName = "shared.toc"; 27 private const string SharedTocFileName = "shared.toc";
28 private const string SharedDataFileName = "shared.data"; 28 private const string SharedDataFileName = "shared.data";
diff --git a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
index 40129252a..3fcb821d3 100644
--- a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
+++ b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
@@ -222,20 +222,38 @@ namespace Ryujinx.Graphics.Shader.Instructions
222 context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}."); 222 context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
223 } 223 }
224 break; 224 break;
225 case AtomOp.And: 225 case AtomOp.Min:
226 if (type == AtomSize.S32 || type == AtomSize.U32) 226 if (type == AtomSize.S32)
227 { 227 {
228 res = context.AtomicAnd(storageKind, e0, e1, value); 228 res = context.AtomicMinS32(storageKind, e0, e1, value);
229 }
230 else if (type == AtomSize.U32)
231 {
232 res = context.AtomicMinU32(storageKind, e0, e1, value);
229 } 233 }
230 else 234 else
231 { 235 {
232 context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}."); 236 context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
233 } 237 }
234 break; 238 break;
235 case AtomOp.Xor: 239 case AtomOp.Max:
240 if (type == AtomSize.S32)
241 {
242 res = context.AtomicMaxS32(storageKind, e0, e1, value);
243 }
244 else if (type == AtomSize.U32)
245 {
246 res = context.AtomicMaxU32(storageKind, e0, e1, value);
247 }
248 else
249 {
250 context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
251 }
252 break;
253 case AtomOp.And:
236 if (type == AtomSize.S32 || type == AtomSize.U32) 254 if (type == AtomSize.S32 || type == AtomSize.U32)
237 { 255 {
238 res = context.AtomicXor(storageKind, e0, e1, value); 256 res = context.AtomicAnd(storageKind, e0, e1, value);
239 } 257 }
240 else 258 else
241 { 259 {
@@ -252,34 +270,29 @@ namespace Ryujinx.Graphics.Shader.Instructions
252 context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}."); 270 context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
253 } 271 }
254 break; 272 break;
255 case AtomOp.Max: 273 case AtomOp.Xor:
256 if (type == AtomSize.S32) 274 if (type == AtomSize.S32 || type == AtomSize.U32)
257 {
258 res = context.AtomicMaxS32(storageKind, e0, e1, value);
259 }
260 else if (type == AtomSize.U32)
261 { 275 {
262 res = context.AtomicMaxU32(storageKind, e0, e1, value); 276 res = context.AtomicXor(storageKind, e0, e1, value);
263 } 277 }
264 else 278 else
265 { 279 {
266 context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}."); 280 context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
267 } 281 }
268 break; 282 break;
269 case AtomOp.Min: 283 case AtomOp.Exch:
270 if (type == AtomSize.S32) 284 if (type == AtomSize.S32 || type == AtomSize.U32)
271 {
272 res = context.AtomicMinS32(storageKind, e0, e1, value);
273 }
274 else if (type == AtomSize.U32)
275 { 285 {
276 res = context.AtomicMinU32(storageKind, e0, e1, value); 286 res = context.AtomicSwap(storageKind, e0, e1, value);
277 } 287 }
278 else 288 else
279 { 289 {
280 context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}."); 290 context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
281 } 291 }
282 break; 292 break;
293 default:
294 context.TranslatorContext.GpuAccessor.Log($"Invalid atomic operation: {op}.");
295 break;
283 } 296 }
284 297
285 return res; 298 return res;