forked from Mirror/Ryujinx
Implement shader HelperThreadNV (#2163)
* Implement shader HelperThreadNV * Bump shader cache version * Use gl_HelperInvocation since its supported across all vendors * Nit
This commit is contained in:
parent
f2cdceb846
commit
524fe3bea4
6 changed files with 24 additions and 15 deletions
|
@ -35,7 +35,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version of the codegen (to be changed when codegen or guest format change).
|
/// Version of the codegen (to be changed when codegen or guest format change).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const ulong ShaderCodeGenVersion = 2147;
|
private const ulong ShaderCodeGenVersion = 2163;
|
||||||
|
|
||||||
// Progress reporting helpers
|
// Progress reporting helpers
|
||||||
private volatile int _shaderCount;
|
private volatile int _shaderCount;
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
|
||||||
|
|
||||||
public static void Declare(CodeGenContext context, StructuredProgramInfo info)
|
public static void Declare(CodeGenContext context, StructuredProgramInfo info)
|
||||||
{
|
{
|
||||||
context.AppendLine("#version 440 core");
|
context.AppendLine("#version 450 core");
|
||||||
context.AppendLine("#extension GL_ARB_gpu_shader_int64 : enable");
|
context.AppendLine("#extension GL_ARB_gpu_shader_int64 : enable");
|
||||||
context.AppendLine("#extension GL_ARB_shader_ballot : enable");
|
context.AppendLine("#extension GL_ARB_shader_ballot : enable");
|
||||||
context.AppendLine("#extension GL_ARB_shader_group_vote : enable");
|
context.AppendLine("#extension GL_ARB_shader_group_vote : enable");
|
||||||
|
|
|
@ -53,6 +53,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
|
||||||
|
|
||||||
// Special.
|
// Special.
|
||||||
{ AttributeConsts.FragmentOutputDepth, new BuiltInAttribute("gl_FragDepth", VariableType.F32) },
|
{ AttributeConsts.FragmentOutputDepth, new BuiltInAttribute("gl_FragDepth", VariableType.F32) },
|
||||||
|
{ AttributeConsts.ThreadKill, new BuiltInAttribute("gl_HelperInvocation", VariableType.Bool) },
|
||||||
{ AttributeConsts.ThreadIdX, new BuiltInAttribute("gl_LocalInvocationID.x", VariableType.U32) },
|
{ AttributeConsts.ThreadIdX, new BuiltInAttribute("gl_LocalInvocationID.x", VariableType.U32) },
|
||||||
{ AttributeConsts.ThreadIdY, new BuiltInAttribute("gl_LocalInvocationID.y", VariableType.U32) },
|
{ AttributeConsts.ThreadIdY, new BuiltInAttribute("gl_LocalInvocationID.y", VariableType.U32) },
|
||||||
{ AttributeConsts.ThreadIdZ, new BuiltInAttribute("gl_LocalInvocationID.z", VariableType.U32) },
|
{ AttributeConsts.ThreadIdZ, new BuiltInAttribute("gl_LocalInvocationID.z", VariableType.U32) },
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
|
||||||
{
|
{
|
||||||
LaneId = 0,
|
LaneId = 0,
|
||||||
YDirection = 0x12,
|
YDirection = 0x12,
|
||||||
|
ThreadKill = 0x13,
|
||||||
ThreadId = 0x20,
|
ThreadId = 0x20,
|
||||||
ThreadIdX = 0x21,
|
ThreadIdX = 0x21,
|
||||||
ThreadIdY = 0x22,
|
ThreadIdY = 0x22,
|
||||||
|
|
|
@ -63,6 +63,11 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||||
// TODO: Use value from Y direction GPU register.
|
// TODO: Use value from Y direction GPU register.
|
||||||
case SystemRegister.YDirection: src = ConstF(1); break;
|
case SystemRegister.YDirection: src = ConstF(1); break;
|
||||||
|
|
||||||
|
case SystemRegister.ThreadKill: src = context.Config.Stage == ShaderStage.Fragment
|
||||||
|
? Attribute(AttributeConsts.ThreadKill)
|
||||||
|
: Const(0);
|
||||||
|
break;
|
||||||
|
|
||||||
case SystemRegister.ThreadId:
|
case SystemRegister.ThreadId:
|
||||||
{
|
{
|
||||||
Operand tidX = Attribute(AttributeConsts.ThreadIdX);
|
Operand tidX = Attribute(AttributeConsts.ThreadIdX);
|
||||||
|
|
|
@ -54,5 +54,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
public const int GtMask = 0x200002c;
|
public const int GtMask = 0x200002c;
|
||||||
public const int LeMask = 0x2000030;
|
public const int LeMask = 0x2000030;
|
||||||
public const int LtMask = 0x2000034;
|
public const int LtMask = 0x2000034;
|
||||||
|
|
||||||
|
public const int ThreadKill = 0x2000038;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue