Compare commits

..

3 Commits

Author SHA1 Message Date
EmulationFanatic
2d252db0a7 GTK & Avalonia changes (#3480) 2022-07-23 12:05:51 -03:00
gdkchan
7f8a3541eb Fix decoding of block after shader BRA.CC instructions without predicate (#3472)
* Fix decoding of block after BRA.CC instructions without predicate

* Shader cache version bump
2022-07-23 11:53:14 -03:00
gdkchan
b34de74f81 Avoid adding shader buffer descriptors for constant buffers that are not used (#3478)
* Avoid adding shader buffer descriptors for constant buffers that are not used

* Shader cache version
2022-07-23 11:15:58 -03:00
10 changed files with 27 additions and 23 deletions

View File

@@ -118,7 +118,7 @@
"SettingsTabSystemAudioBackendSoundIO": "SoundIO", "SettingsTabSystemAudioBackendSoundIO": "SoundIO",
"SettingsTabSystemAudioBackendSDL2": "SDL2", "SettingsTabSystemAudioBackendSDL2": "SDL2",
"SettingsTabSystemHacks": "Hacks", "SettingsTabSystemHacks": "Hacks",
"SettingsTabSystemHacksNote": " - These may cause instabilities", "SettingsTabSystemHacksNote": " (may cause instability)",
"SettingsTabSystemExpandDramSize": "Expand DRAM Size to 6GB", "SettingsTabSystemExpandDramSize": "Expand DRAM Size to 6GB",
"SettingsTabSystemIgnoreMissingServices": "Ignore Missing Services", "SettingsTabSystemIgnoreMissingServices": "Ignore Missing Services",
"SettingsTabGraphics": "Graphics", "SettingsTabGraphics": "Graphics",

View File

@@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
private const ushort FileFormatVersionMajor = 1; private const ushort FileFormatVersionMajor = 1;
private const ushort FileFormatVersionMinor = 1; private const ushort FileFormatVersionMinor = 1;
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor; private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
private const uint CodeGenVersion = 3457; private const uint CodeGenVersion = 3472;
private const string SharedTocFileName = "shared.toc"; private const string SharedTocFileName = "shared.toc";
private const string SharedDataFileName = "shared.data"; private const string SharedDataFileName = "shared.data";

View File

@@ -92,7 +92,11 @@ namespace Ryujinx.Graphics.Shader.Decoders
pushOpInfo.Consumers.Add(rightBlock, local); pushOpInfo.Consumers.Add(rightBlock, local);
} }
rightBlock.SyncTargets.Union(SyncTargets); foreach ((ulong key, SyncTarget value) in SyncTargets)
{
rightBlock.SyncTargets.Add(key, value);
}
SyncTargets.Clear(); SyncTargets.Clear();
// Move push ops. // Move push ops.

View File

@@ -340,7 +340,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
{ {
InstConditional condOp = new InstConditional(op.RawOpCode); InstConditional condOp = new InstConditional(op.RawOpCode);
if (op.Name == InstName.Exit && condOp.Ccc != Ccc.T) if ((op.Name == InstName.Bra || op.Name == InstName.Exit) && condOp.Ccc != Ccc.T)
{ {
return false; return false;
} }
@@ -672,6 +672,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
// Make sure we found the correct address, // Make sure we found the correct address,
// the push and pop instruction types must match, so: // the push and pop instruction types must match, so:
// - BRK can only consume addresses pushed by PBK. // - BRK can only consume addresses pushed by PBK.
// - CONT can only consume addresses pushed by PCNT.
// - SYNC can only consume addresses pushed by SSY. // - SYNC can only consume addresses pushed by SSY.
if (found) if (found)
{ {

View File

@@ -45,12 +45,12 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (isFP64) if (isFP64)
{ {
return context.PackDouble2x32( return context.PackDouble2x32(
context.Config.CreateCbuf(cbufSlot, cbufOffset), Cbuf(cbufSlot, cbufOffset),
context.Config.CreateCbuf(cbufSlot, cbufOffset + 1)); Cbuf(cbufSlot, cbufOffset + 1));
} }
else else
{ {
return context.Config.CreateCbuf(cbufSlot, cbufOffset); return Cbuf(cbufSlot, cbufOffset);
} }
} }

View File

@@ -300,6 +300,11 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
if (operand.Type != OperandType.LocalVariable) if (operand.Type != OperandType.LocalVariable)
{ {
if (operand.Type == OperandType.ConstantBuffer)
{
Config.SetUsedConstantBuffer(operand.GetCbufSlot());
}
return new AstOperand(operand); return new AstOperand(operand);
} }

View File

@@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
{ {
Operand addrLow = operation.GetSource(0); Operand addrLow = operation.GetSource(0);
Operand baseAddrLow = config.CreateCbuf(0, GetStorageCbOffset(config.Stage, storageIndex)); Operand baseAddrLow = Cbuf(0, GetStorageCbOffset(config.Stage, storageIndex));
Operand baseAddrTrunc = Local(); Operand baseAddrTrunc = Local();
@@ -152,7 +152,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
{ {
Operand addrLow = operation.GetSource(0); Operand addrLow = operation.GetSource(0);
Operand baseAddrLow = config.CreateCbuf(0, UbeBaseOffset + storageIndex * StorageDescSize); Operand baseAddrLow = Cbuf(0, UbeBaseOffset + storageIndex * StorageDescSize);
Operand baseAddrTrunc = Local(); Operand baseAddrTrunc = Local();

View File

@@ -75,9 +75,9 @@ namespace Ryujinx.Graphics.Shader.Translation
int cbOffset = GetStorageCbOffset(config.Stage, slot); int cbOffset = GetStorageCbOffset(config.Stage, slot);
Operand baseAddrLow = config.CreateCbuf(0, cbOffset); Operand baseAddrLow = Cbuf(0, cbOffset);
Operand baseAddrHigh = config.CreateCbuf(0, cbOffset + 1); Operand baseAddrHigh = Cbuf(0, cbOffset + 1);
Operand size = config.CreateCbuf(0, cbOffset + 2); Operand size = Cbuf(0, cbOffset + 2);
Operand offset = PrependOperation(Instruction.Subtract, addrLow, baseAddrLow); Operand offset = PrependOperation(Instruction.Subtract, addrLow, baseAddrLow);
Operand borrow = PrependOperation(Instruction.CompareLessU32, addrLow, baseAddrLow); Operand borrow = PrependOperation(Instruction.CompareLessU32, addrLow, baseAddrLow);
@@ -164,7 +164,7 @@ namespace Ryujinx.Graphics.Shader.Translation
bool isBindless = (texOp.Flags & TextureFlags.Bindless) != 0; bool isBindless = (texOp.Flags & TextureFlags.Bindless) != 0;
bool isCoordNormalized = !isBindless && config.GpuAccessor.QueryTextureCoordNormalized(texOp.Handle, texOp.CbufSlot); bool isCoordNormalized = isBindless || config.GpuAccessor.QueryTextureCoordNormalized(texOp.Handle, texOp.CbufSlot);
if (!hasInvalidOffset && isCoordNormalized) if (!hasInvalidOffset && isCoordNormalized)
{ {

View File

@@ -360,12 +360,6 @@ namespace Ryujinx.Graphics.Shader.Translation
UsedFeatures |= flags; UsedFeatures |= flags;
} }
public Operand CreateCbuf(int slot, int offset)
{
SetUsedConstantBuffer(slot);
return OperandHelper.Cbuf(slot, offset);
}
public void SetUsedConstantBuffer(int slot) public void SetUsedConstantBuffer(int slot)
{ {
_usedConstantBuffers |= 1 << slot; _usedConstantBuffers |= 1 << slot;

View File

@@ -1509,7 +1509,7 @@
</child> </child>
<child> <child>
<object class="GtkCheckButton" id="_internetToggle"> <object class="GtkCheckButton" id="_internetToggle">
<property name="label" translatable="yes">Enable guest Internet access</property> <property name="label" translatable="yes">Enable Guest Internet Access</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">False</property> <property name="receives-default">False</property>
@@ -1643,7 +1643,7 @@
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="_mmHostUnsafe"> <object class="GtkRadioButton" id="_mmHostUnsafe">
<property name="label" translatable="yes">Host unchecked (fastest, unsafe)</property> <property name="label" translatable="yes">Host Unchecked (fastest, unsafe)</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">False</property> <property name="receives-default">False</property>
@@ -1725,7 +1725,7 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="label" translatable="yes"> - These may cause instability</property> <property name="label" translatable="yes"> (may cause instability)</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -1749,7 +1749,7 @@
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkCheckButton" id="_expandRamToggle"> <object class="GtkCheckButton" id="_expandRamToggle">
<property name="label" translatable="yes">Expand DRAM size to 6GB</property> <property name="label" translatable="yes">Expand DRAM Size to 6GB</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">False</property> <property name="receives-default">False</property>