Ryujinx/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureOperation.cs
gdkchan 49745cfa37
Move shader resource descriptor creation out of the backend (#2290)
* Move shader resource descriptor creation out of the backend

* Remove now unused code, and other nits

* Shader cache version bump

* Nits

* Set format for bindless image load/store

* Fix buffer write flag
2021-05-19 23:15:26 +02:00

51 lines
1.4 KiB
C#

namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
{
class TextureOperation : Operation
{
public const int DefaultCbufSlot = -1;
public SamplerType Type { get; private set; }
public TextureFormat Format { get; set; }
public TextureFlags Flags { get; private set; }
public int CbufSlot { get; private set; }
public int Handle { get; private set; }
public TextureOperation(
Instruction inst,
SamplerType type,
TextureFormat format,
TextureFlags flags,
int handle,
int compIndex,
Operand dest,
params Operand[] sources) : base(inst, compIndex, dest, sources)
{
Type = type;
Format = format;
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;
}
}
}