diff options
Diffstat (limited to 'Ryujinx.Graphics.Shader/IntermediateRepresentation')
| -rw-r--r-- | Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs | 14 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureOperation.cs | 12 |
2 files changed, 25 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs b/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs index 6b7fb82f..2c4a88cd 100644 --- a/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs +++ b/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs @@ -1,3 +1,5 @@ +using System; + namespace Ryujinx.Graphics.Shader.IntermediateRepresentation { class Operation : INode @@ -78,6 +80,18 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation _sources[index] = source; } + protected void RemoveSource(int index) + { + SetSource(index, null); + + Operand[] newSources = new Operand[_sources.Length - 1]; + + Array.Copy(_sources, 0, newSources, 0, index); + Array.Copy(_sources, index + 1, newSources, index, _sources.Length - (index + 1)); + + _sources = newSources; + } + public void TurnIntoCopy(Operand source) { TurnInto(Instruction.Copy, source); diff --git a/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureOperation.cs b/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureOperation.cs index 06541f90..9c5cd25c 100644 --- a/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureOperation.cs +++ b/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureOperation.cs @@ -26,8 +26,18 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation public void TurnIntoIndexed(int handle) { Type |= SamplerType.Indexed; - Flags &= ~TextureFlags.Bindless; + Handle = handle; + } + + public void SetHandle(int handle) + { + if ((Flags & TextureFlags.Bindless) != 0) + { + Flags &= ~TextureFlags.Bindless; + + RemoveSource(0); + } Handle = handle; } |
