1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-04 20:12:03 +00:00
Ryujinx/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureOperation.cs
gdkchan 934a78005e
Simplify logic for bindless texture handling (#1667)
* Simplify logic for bindless texture handling

* Nits
2020-11-09 19:35:04 -03:00

51 lines
No EOL
1.4 KiB
C#

namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
{
class TextureOperation : Operation
{
private const int DefaultCbufSlot = -1;
public SamplerType Type { get; private set; }
public TextureFlags Flags { get; private set; }
public int CbufSlot { get; private set; }
public int Handle { get; private set; }
public TextureFormat Format { get; set; }
public TextureOperation(
Instruction inst,
SamplerType type,
TextureFlags flags,
int handle,
int compIndex,
Operand dest,
params Operand[] sources) : base(inst, compIndex, dest, sources)
{
Type = type;
Flags = flags;
CbufSlot = DefaultCbufSlot;
Handle = handle;
}
public void TurnIntoIndexed(int handle)
{
Type |= SamplerType.Indexed;
Flags &= ~TextureFlags.Bindless;
Handle = handle;
}
public void SetHandle(int handle, int cbufSlot = DefaultCbufSlot)
{
if ((Flags & TextureFlags.Bindless) != 0)
{
Flags &= ~TextureFlags.Bindless;
RemoveSource(0);
}
CbufSlot = cbufSlot;
Handle = handle;
}
}
}