Use index fragment shader output when dual source blend is enabled (#4404)
* Use index fragment shader output when dual source blend is enabled * Shader cache version bump * Actually set DualSourceBlendEnabled to true * Fix XML doc --------- Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
parent
52d6f2e656
commit
c532118d94
12 changed files with 141 additions and 25 deletions
|
@ -612,6 +612,19 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
|
|||
else
|
||||
{
|
||||
int usedAttributes = context.Config.UsedOutputAttributes;
|
||||
|
||||
if (context.Config.Stage == ShaderStage.Fragment && context.Config.GpuAccessor.QueryDualSourceBlendEnable())
|
||||
{
|
||||
int firstOutput = BitOperations.TrailingZeroCount(usedAttributes);
|
||||
int mask = 3 << firstOutput;
|
||||
|
||||
if ((usedAttributes & mask) == mask)
|
||||
{
|
||||
usedAttributes &= ~mask;
|
||||
DeclareOutputDualSourceBlendAttribute(context, firstOutput);
|
||||
}
|
||||
}
|
||||
|
||||
while (usedAttributes != 0)
|
||||
{
|
||||
int index = BitOperations.TrailingZeroCount(usedAttributes);
|
||||
|
@ -690,6 +703,15 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
|
|||
}
|
||||
}
|
||||
|
||||
private static void DeclareOutputDualSourceBlendAttribute(CodeGenContext context, int attr)
|
||||
{
|
||||
string name = $"{DefaultNames.OAttributePrefix}{attr}";
|
||||
string name2 = $"{DefaultNames.OAttributePrefix}{(attr + 1)}";
|
||||
|
||||
context.AppendLine($"layout (location = {attr}, index = 0) out vec4 {name};");
|
||||
context.AppendLine($"layout (location = {attr}, index = 1) out vec4 {name2};");
|
||||
}
|
||||
|
||||
private static void DeclareUsedOutputAttributesPerPatch(CodeGenContext context, HashSet<int> attrs)
|
||||
{
|
||||
foreach (int attr in attrs.Order())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue