Refactor shader GPU state and memory access (#1203)

* Refactor shader GPU state and memory access

* Fix NVDEC project build

* Address PR feedback and add missing XML comments
This commit is contained in:
gdkchan 2020-05-05 22:02:28 -03:00 committed by GitHub
parent 7f500e7cae
commit b8eb6abecc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 633 additions and 684 deletions

View file

@ -72,7 +72,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (intType == IntegerType.U64)
{
context.Config.PrintLog("Unimplemented 64-bits F2I.");
context.Config.GpuAccessor.Log("Unimplemented 64-bits F2I.");
return;
}
@ -184,7 +184,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (srcType == IntegerType.U64 || dstType == IntegerType.U64)
{
context.Config.PrintLog("Invalid I2I encoding.");
context.Config.GpuAccessor.Log("Invalid I2I encoding.");
return;
}

View file

@ -431,7 +431,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (scale.AsFloat() == 1)
{
context.Config.PrintLog($"Invalid FP multiply scale \"{op.Scale}\".");
context.Config.GpuAccessor.Log($"Invalid FP multiply scale \"{op.Scale}\".");
}
if (isFP64)

View file

@ -88,7 +88,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
context.Config.PrintLog($"Invalid barrier mode: {op.Mode}.");
context.Config.GpuAccessor.Log($"Invalid barrier mode: {op.Mode}.");
}
}
@ -141,7 +141,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (op.Size > IntegerSize.B64)
{
context.Config.PrintLog($"Invalid LDC size: {op.Size}.");
context.Config.GpuAccessor.Log($"Invalid LDC size: {op.Size}.");
}
bool isSmallInt = op.Size < IntegerSize.B32;
@ -209,7 +209,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (!(emit || cut))
{
context.Config.PrintLog("Invalid OUT encoding.");
context.Config.GpuAccessor.Log("Invalid OUT encoding.");
}
if (emit)
@ -274,7 +274,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
context.Config.PrintLog($"Invalid reduction type: {type}.");
context.Config.GpuAccessor.Log($"Invalid reduction type: {type}.");
}
break;
case AtomicOp.BitwiseAnd:
@ -284,7 +284,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
context.Config.PrintLog($"Invalid reduction type: {type}.");
context.Config.GpuAccessor.Log($"Invalid reduction type: {type}.");
}
break;
case AtomicOp.BitwiseExclusiveOr:
@ -294,7 +294,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
context.Config.PrintLog($"Invalid reduction type: {type}.");
context.Config.GpuAccessor.Log($"Invalid reduction type: {type}.");
}
break;
case AtomicOp.BitwiseOr:
@ -304,7 +304,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
context.Config.PrintLog($"Invalid reduction type: {type}.");
context.Config.GpuAccessor.Log($"Invalid reduction type: {type}.");
}
break;
case AtomicOp.Maximum:
@ -318,7 +318,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
context.Config.PrintLog($"Invalid reduction type: {type}.");
context.Config.GpuAccessor.Log($"Invalid reduction type: {type}.");
}
break;
case AtomicOp.Minimum:
@ -332,7 +332,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
context.Config.PrintLog($"Invalid reduction type: {type}.");
context.Config.GpuAccessor.Log($"Invalid reduction type: {type}.");
}
break;
}
@ -346,7 +346,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (op.Size > IntegerSize.B128)
{
context.Config.PrintLog($"Invalid load size: {op.Size}.");
context.Config.GpuAccessor.Log($"Invalid load size: {op.Size}.");
}
bool isSmallInt = op.Size < IntegerSize.B32;
@ -432,7 +432,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (op.Size > IntegerSize.B128)
{
context.Config.PrintLog($"Invalid store size: {op.Size}.");
context.Config.GpuAccessor.Log($"Invalid store size: {op.Size}.");
}
bool isSmallInt = op.Size < IntegerSize.B32;

View file

@ -32,7 +32,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (isCC)
{
// TODO: Support Register to condition code flags copy.
context.Config.PrintLog("R2P.CC not implemented.");
context.Config.GpuAccessor.Log("R2P.CC not implemented.");
}
else
{

View file

@ -19,7 +19,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (type == SamplerType.None)
{
context.Config.PrintLog("Invalid image store sampler type.");
context.Config.GpuAccessor.Log("Invalid image store sampler type.");
return;
}
@ -158,7 +158,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (type == SamplerType.None)
{
context.Config.PrintLog("Invalid image store sampler type.");
context.Config.GpuAccessor.Log("Invalid image store sampler type.");
return;
}
@ -344,7 +344,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (type == SamplerType.None)
{
context.Config.PrintLog("Invalid texture sampler type.");
context.Config.GpuAccessor.Log("Invalid texture sampler type.");
return;
}
@ -423,14 +423,14 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (type == SamplerType.None)
{
context.Config.PrintLog("Invalid texel fetch sampler type.");
context.Config.GpuAccessor.Log("Invalid texel fetch sampler type.");
return;
}
flags = ConvertTextureFlags(tldsOp.Target) | TextureFlags.IntCoords;
if (tldsOp.Target == TexelLoadTarget.Texture1DLodZero && context.Config.QueryInfoBool(QueryInfoName.IsTextureBuffer, tldsOp.Immediate))
if (tldsOp.Target == TexelLoadTarget.Texture1DLodZero && context.Config.GpuAccessor.QueryIsTextureBuffer(tldsOp.Immediate))
{
type = SamplerType.TextureBuffer;
flags &= ~TextureFlags.LodLevel;
@ -1020,7 +1020,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (type == SamplerType.Texture1D && flags == TextureFlags.IntCoords && !isBindless)
{
bool isTypeBuffer = context.Config.QueryInfoBool(QueryInfoName.IsTextureBuffer, op.Immediate);
bool isTypeBuffer = context.Config.GpuAccessor.QueryIsTextureBuffer(op.Immediate);
if (isTypeBuffer)
{
@ -1093,11 +1093,11 @@ namespace Ryujinx.Graphics.Shader.Instructions
private static TextureFormat GetTextureFormat(EmitterContext context, int handle)
{
var format = (TextureFormat)context.Config.QueryInfo(QueryInfoName.TextureFormat, handle);
var format = context.Config.GpuAccessor.QueryTextureFormat(handle);
if (format == TextureFormat.Unknown)
{
context.Config.PrintLog($"Unknown format for texture {handle}.");
context.Config.GpuAccessor.Log($"Unknown format for texture {handle}.");
format = TextureFormat.R8G8B8A8Unorm;
}

View file

@ -36,7 +36,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
context.Config.PrintLog($"Invalid vote operation: {op.VoteOp}.");
context.Config.GpuAccessor.Log($"Invalid vote operation: {op.VoteOp}.");
}
if (!op.Rd.IsRZ)