Support bindless texture gather shader instruction
This commit is contained in:
parent
7ce5584f9e
commit
6b13c5b439
7 changed files with 69 additions and 3 deletions
23
Ryujinx.Graphics.Shader/Decoders/IOpCodeTexture.cs
Normal file
23
Ryujinx.Graphics.Shader/Decoders/IOpCodeTexture.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
namespace Ryujinx.Graphics.Shader.Decoders
|
||||
{
|
||||
interface IOpCodeTexture : IOpCode
|
||||
{
|
||||
Register Rd { get; }
|
||||
Register Ra { get; }
|
||||
Register Rb { get; }
|
||||
|
||||
bool IsArray { get; }
|
||||
|
||||
TextureDimensions Dimensions { get; }
|
||||
|
||||
int ComponentMask { get; }
|
||||
|
||||
int Immediate { get; }
|
||||
|
||||
TextureLodMode LodMode { get; }
|
||||
|
||||
bool HasOffset { get; }
|
||||
bool HasDepthCompare { get; }
|
||||
bool IsMultisample { get; }
|
||||
}
|
||||
}
|
11
Ryujinx.Graphics.Shader/Decoders/IOpCodeTld4.cs
Normal file
11
Ryujinx.Graphics.Shader/Decoders/IOpCodeTld4.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace Ryujinx.Graphics.Shader.Decoders
|
||||
{
|
||||
interface IOpCodeTld4 : IOpCodeTexture
|
||||
{
|
||||
TextureGatherOffset Offset { get; }
|
||||
|
||||
int GatherCompIndex { get; }
|
||||
|
||||
bool Bindless { get; }
|
||||
}
|
||||
}
|
|
@ -184,6 +184,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
|
|||
Set("11011100xx111x", InstEmit.Tld, typeof(OpCodeTld));
|
||||
Set("11011101xx111x", InstEmit.TldB, typeof(OpCodeTld));
|
||||
Set("110010xxxx111x", InstEmit.Tld4, typeof(OpCodeTld4));
|
||||
Set("1101111011111x", InstEmit.Tld4, typeof(OpCodeTld4B));
|
||||
Set("110111100x1110", InstEmit.Txd, typeof(OpCodeTxd));
|
||||
Set("1101111101001x", InstEmit.Txq, typeof(OpCodeTex));
|
||||
Set("1101111101010x", InstEmit.TxqB, typeof(OpCodeTex));
|
||||
|
|
|
@ -2,7 +2,7 @@ using Ryujinx.Graphics.Shader.Instructions;
|
|||
|
||||
namespace Ryujinx.Graphics.Shader.Decoders
|
||||
{
|
||||
class OpCodeTexture : OpCode
|
||||
class OpCodeTexture : OpCode, IOpCodeTexture
|
||||
{
|
||||
public Register Rd { get; }
|
||||
public Register Ra { get; }
|
||||
|
|
|
@ -2,12 +2,14 @@ using Ryujinx.Graphics.Shader.Instructions;
|
|||
|
||||
namespace Ryujinx.Graphics.Shader.Decoders
|
||||
{
|
||||
class OpCodeTld4 : OpCodeTexture
|
||||
class OpCodeTld4 : OpCodeTexture, IOpCodeTld4
|
||||
{
|
||||
public TextureGatherOffset Offset { get; }
|
||||
|
||||
public int GatherCompIndex { get; }
|
||||
|
||||
public bool Bindless => false;
|
||||
|
||||
public OpCodeTld4(InstEmitter emitter, ulong address, long opCode) : base(emitter, address, opCode)
|
||||
{
|
||||
HasDepthCompare = opCode.Extract(50);
|
||||
|
|
22
Ryujinx.Graphics.Shader/Decoders/OpCodeTld4B.cs
Normal file
22
Ryujinx.Graphics.Shader/Decoders/OpCodeTld4B.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using Ryujinx.Graphics.Shader.Instructions;
|
||||
|
||||
namespace Ryujinx.Graphics.Shader.Decoders
|
||||
{
|
||||
class OpCodeTld4B : OpCodeTexture, IOpCodeTld4
|
||||
{
|
||||
public TextureGatherOffset Offset { get; }
|
||||
|
||||
public int GatherCompIndex { get; }
|
||||
|
||||
public bool Bindless => true;
|
||||
|
||||
public OpCodeTld4B(InstEmitter emitter, ulong address, long opCode) : base(emitter, address, opCode)
|
||||
{
|
||||
HasDepthCompare = opCode.Extract(50);
|
||||
|
||||
Offset = (TextureGatherOffset)opCode.Extract(36, 2);
|
||||
|
||||
GatherCompIndex = opCode.Extract(38, 2);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -417,7 +417,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
|
||||
public static void Tld4(EmitterContext context)
|
||||
{
|
||||
OpCodeTld4 op = (OpCodeTld4)context.CurrOp;
|
||||
IOpCodeTld4 op = (IOpCodeTld4)context.CurrOp;
|
||||
|
||||
if (op.Rd.IsRZ)
|
||||
{
|
||||
|
@ -455,6 +455,13 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
|
||||
TextureFlags flags = TextureFlags.Gather;
|
||||
|
||||
if (op.Bindless)
|
||||
{
|
||||
sourcesList.Add(Rb());
|
||||
|
||||
flags |= TextureFlags.Bindless;
|
||||
}
|
||||
|
||||
int coordsCount = type.GetDimensions();
|
||||
|
||||
for (int index = 0; index < coordsCount; index++)
|
||||
|
|
Loading…
Reference in a new issue