Compare commits

...

5 commits

Author SHA1 Message Date
Keaton
09fca86b86 Merge branch 'feature/dsb-ub' into 'master'
Workaround undefined behavior in bad dual source blend states

See merge request ryubing/ryujinx!14
2025-03-29 04:02:10 -05:00
Shinyoyo
dfdbb23f0d Updated Simplified Chinese translation. 2025-03-29 03:47:24 -05:00
Isaac Marovitz
c1051a9d6a Return 2025-03-27 18:29:26 -05:00
Isaac Marovitz
27b042ca16 Always declare even in bad state on GLSL 2025-03-27 18:29:26 -05:00
Isaac Marovitz
27b5251bd3 Initial Changes 2025-03-27 18:29:26 -05:00
3 changed files with 28 additions and 16 deletions

View file

@ -512,13 +512,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
if (context.Definitions.Stage == ShaderStage.Fragment && context.Definitions.DualSourceBlend)
{
IoDefinition firstOutput = outputs.ElementAtOrDefault(0);
IoDefinition secondOutput = outputs.ElementAtOrDefault(1);
if (firstOutput.Location + 1 == secondOutput.Location)
{
DeclareOutputDualSourceBlendAttribute(context, firstOutput.Location);
outputs = outputs.Skip(2);
}
DeclareOutputDualSourceBlendAttribute(context, firstOutput.Location);
outputs = outputs.Skip(2);
}
foreach (IoDefinition ioDefinition in outputs)

View file

@ -181,13 +181,29 @@ namespace Ryujinx.Graphics.Shader.Translation
private static void EmitOutputsInitialization(EmitterContext context, AttributeUsage attributeUsage, IGpuAccessor gpuAccessor, ShaderStage stage)
{
// Compute has no output attributes, and fragment is the last stage, so we
// don't need to initialize outputs on those stages.
if (stage == ShaderStage.Compute || stage == ShaderStage.Fragment)
// Compute has no output attributes, so we
// don't need to initialize outputs on that stage.
if (stage == ShaderStage.Compute)
{
return;
}
if (stage == ShaderStage.Fragment)
{
// Fragment is the last stage, so we don't need to
// initialize outputs unless we're using DSB, in which
// we need to make sure the ouput has a valid value.
if (gpuAccessor.QueryGraphicsState().DualSourceBlendEnable)
{
for (int i = 0; i < 4; i++)
{
context.Store(StorageKind.Output, IoVariable.FragmentOutputColor, null, Const(1), Const(i), ConstF(0));
}
}
return;
}
if (stage == ShaderStage.Vertex)
{
InitializeVertexOutputs(context);

View file

@ -4943,7 +4943,7 @@
"th_TH": "",
"tr_TR": "",
"uk_UA": "",
"zh_CN": "",
"zh_CN": "涡轮模式倍数:",
"zh_TW": ""
}
},
@ -4968,7 +4968,7 @@
"th_TH": "",
"tr_TR": "",
"uk_UA": "",
"zh_CN": "",
"zh_CN": "涡轮模式倍数的目标值。\n\n如果不确定请保留为 200。",
"zh_TW": ""
}
},
@ -4993,7 +4993,7 @@
"th_TH": "",
"tr_TR": "",
"uk_UA": "",
"zh_CN": "",
"zh_CN": "涡轮模式是一种模拟器功能当游戏对帧率不敏感时它可以有效地导致加速或降速。\n您可以在游戏中使用热键切换此功能,它可以在 Ryujinx 的键盘热键设置进行设置。\n\n如果不确定则保留为 200。",
"zh_TW": ""
}
},
@ -18218,7 +18218,7 @@
"th_TH": "",
"tr_TR": "",
"uk_UA": "",
"zh_CN": "",
"zh_CN": "{0} FPS ({1}ms), 涡轮 ({2}%)",
"zh_TW": ""
}
},
@ -23968,7 +23968,7 @@
"th_TH": "",
"tr_TR": "",
"uk_UA": "",
"zh_CN": "",
"zh_CN": "涡轮模式: ",
"zh_TW": ""
}
},
@ -23993,7 +23993,7 @@
"th_TH": "",
"tr_TR": "",
"uk_UA": "",
"zh_CN": "",
"zh_CN": "涡轮模式热键。\n可以在 Ryujinx CPU 设置中配置涡轮模式的行为。\n\n如果不确定请保留为未绑定。",
"zh_TW": ""
}
},
@ -24018,7 +24018,7 @@
"th_TH": "",
"tr_TR": "",
"uk_UA": "",
"zh_CN": "",
"zh_CN": "仅在按下时",
"zh_TW": ""
}
},