Add support for fragment shader interlock (#2768)

* Support coherent images

* Add support for fragment shader interlock

* Change to tree based match approach

* Refactor + check for branch targets and external registers

* Make detection more robust

* Use Intel fragment shader ordering if interlock is not available, use nothing if both are not available

* Remove unused field
This commit is contained in:
gdkchan 2021-10-28 19:53:12 -03:00 committed by GitHub
parent a7a40a77f2
commit 99445dd0a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 1309 additions and 179 deletions

View file

@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Shader.Translation
{
public class TranslatorContext
{
private readonly Block[][] _cfg;
private readonly DecodedProgram _program;
private ShaderConfig _config;
public ulong Address { get; }
@ -23,11 +23,11 @@ namespace Ryujinx.Graphics.Shader.Translation
public IGpuAccessor GpuAccessor => _config.GpuAccessor;
internal TranslatorContext(ulong address, Block[][] cfg, ShaderConfig config)
internal TranslatorContext(ulong address, DecodedProgram program, ShaderConfig config)
{
Address = address;
_program = program;
_config = config;
_cfg = cfg;
}
private static bool IsUserAttribute(Operand operand)
@ -141,13 +141,13 @@ namespace Ryujinx.Graphics.Shader.Translation
nextStage._config.UsedInputAttributesPerPatch);
}
FunctionCode[] code = EmitShader(_cfg, _config, initializeOutputs: other == null, out _);
FunctionCode[] code = EmitShader(_program, _config, initializeOutputs: other == null, out _);
if (other != null)
{
other._config.MergeOutputUserAttributes(_config.UsedOutputAttributes, 0);
FunctionCode[] otherCode = EmitShader(other._cfg, other._config, initializeOutputs: true, out int aStart);
FunctionCode[] otherCode = EmitShader(other._program, other._config, initializeOutputs: true, out int aStart);
code = Combine(otherCode, code, aStart);