Support shared color mask, implement more shader instructions

Support shared color masks (used by Nouveau and maybe the NVIDIA
driver).
Support draw buffers (also required by OpenGL).
Support viewport transform disable (disabled for now as it breaks some
games).
Fix instanced rendering draw being ignored for multi draw.
Fix IADD and IADD3 immediate shader encodings, that was not matching
some ops.
Implement FFMA32I shader instruction.
Implement IMAD shader instruction.
This commit is contained in:
gdkchan 2019-12-06 19:37:00 -03:00 committed by Thog
parent e25b7c9848
commit cb171f6ebf
32 changed files with 313 additions and 92 deletions

View file

@ -11,18 +11,25 @@ namespace Ryujinx.Graphics.Shader.Translation
public Block CurrBlock { get; set; }
public OpCode CurrOp { get; set; }
private ShaderStage _stage;
private ShaderHeader _header;
private ShaderStage _stage;
private ShaderHeader _header;
private ShaderCapabilities _capabilities;
private TranslationFlags _flags;
private List<Operation> _operations;
private Dictionary<ulong, Operand> _labels;
public EmitterContext(ShaderStage stage, ShaderHeader header)
public EmitterContext(
ShaderStage stage,
ShaderHeader header,
ShaderCapabilities capabilities,
TranslationFlags flags)
{
_stage = stage;
_header = header;
_stage = stage;
_header = header;
_capabilities = capabilities;
_flags = flags;
_operations = new List<Operation>();
@ -62,7 +69,18 @@ namespace Ryujinx.Graphics.Shader.Translation
public void PrepareForReturn()
{
if (_stage == ShaderStage.Fragment)
if (_stage == ShaderStage.Vertex)
{
if ((_flags & TranslationFlags.DividePosXY) != 0)
{
Operand posX = Attribute(AttributeConsts.PositionX);
Operand posY = Attribute(AttributeConsts.PositionY);
this.Copy(posX, this.FPDivide(posX, ConstF(_capabilities.MaximumViewportDimensions / 2)));
this.Copy(posY, this.FPDivide(posY, ConstF(_capabilities.MaximumViewportDimensions / 2)));
}
}
else if (_stage == ShaderStage.Fragment)
{
if (_header.OmapDepth)
{