diff options
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs')
-rw-r--r-- | Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs index 78f41e8e..ceb76de1 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs @@ -366,23 +366,33 @@ namespace Ryujinx.Graphics.Shader.Instructions Operand value = Register(isRz ? rd : rd + index, RegisterType.Gpr); Operand elemOffset = context.IAdd(wordOffset, Const(index)); - if (isSmallInt) + if (isSmallInt && region == MemoryRegion.Local) { - Operand word = null; - - switch (region) - { - case MemoryRegion.Local: word = context.LoadLocal(elemOffset); break; - case MemoryRegion.Shared: word = context.LoadShared(elemOffset); break; - } + Operand word = context.LoadLocal(elemOffset); value = InsertSmallInt(context, (LsSize)size, bitOffset, word, value); } - switch (region) + if (region == MemoryRegion.Local) { - case MemoryRegion.Local: context.StoreLocal(elemOffset, value); break; - case MemoryRegion.Shared: context.StoreShared(elemOffset, value); break; + context.StoreLocal(elemOffset, value); + } + else if (region == MemoryRegion.Shared) + { + switch (size) + { + case LsSize2.U8: + case LsSize2.S8: + context.StoreShared8(baseOffset, value); + break; + case LsSize2.U16: + case LsSize2.S16: + context.StoreShared16(baseOffset, value); + break; + default: + context.StoreShared(elemOffset, value); + break; + } } } } @@ -401,8 +411,6 @@ namespace Ryujinx.Graphics.Shader.Instructions return; } - bool isSmallInt = size < LsSize2.B32; - int count = GetVectorCount((LsSize)size); (Operand addrLow, Operand addrHigh) = Get40BitsAddress(context, new Register(ra, RegisterType.Gpr), extended, offset); @@ -415,14 +423,20 @@ namespace Ryujinx.Graphics.Shader.Instructions Operand value = Register(isRz ? rd : rd + index, RegisterType.Gpr); - if (isSmallInt) - { - Operand word = context.LoadGlobal(addrLow, addrHigh); + Operand addrLowOffset = context.IAdd(addrLow, Const(index * 4)); - value = InsertSmallInt(context, (LsSize)size, bitOffset, word, value); + if (size == LsSize2.U8 || size == LsSize2.S8) + { + context.StoreGlobal8(addrLowOffset, addrHigh, value); + } + else if (size == LsSize2.U16 || size == LsSize2.S16) + { + context.StoreGlobal16(addrLowOffset, addrHigh, value); + } + else + { + context.StoreGlobal(addrLowOffset, addrHigh, value); } - - context.StoreGlobal(context.IAdd(addrLow, Const(index * 4)), addrHigh, value); } } |