OGL: Fall back to the old dual-source blending behaviour.
This commit is contained in:
parent
41563c55cd
commit
ce9f717045
|
@ -445,8 +445,7 @@ Renderer::Renderer()
|
|||
|
||||
g_Config.backend_info.bSupportsDualSourceBlend =
|
||||
(GLExtensions::Supports("GL_ARB_blend_func_extended") ||
|
||||
GLExtensions::Supports("GL_EXT_blend_func_extended")) &&
|
||||
!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DUAL_SOURCE_BLENDING);
|
||||
GLExtensions::Supports("GL_EXT_blend_func_extended"));
|
||||
g_Config.backend_info.bSupportsPrimitiveRestart =
|
||||
!DriverDetails::HasBug(DriverDetails::BUG_PRIMITIVERESTART) &&
|
||||
((GLExtensions::Version() >= 310) || GLExtensions::Supports("GL_NV_primitive_restart"));
|
||||
|
@ -1244,6 +1243,10 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
|||
bool useDstAlpha = bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && target_has_alpha;
|
||||
bool useDualSource = g_ActiveConfig.backend_info.bSupportsDualSourceBlend;
|
||||
|
||||
// Only use dual-source blending when required on drivers that don't support it very well.
|
||||
if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DUAL_SOURCE_BLENDING) && !useDstAlpha)
|
||||
useDualSource = false;
|
||||
|
||||
const GLenum glSrcFactors[8] = {
|
||||
GL_ZERO,
|
||||
GL_ONE,
|
||||
|
|
|
@ -507,7 +507,9 @@ ShaderCode GeneratePixelShaderCode(APIType ApiType, const pixel_shader_uid_data*
|
|||
|
||||
if (ApiType == APIType::OpenGL || ApiType == APIType::Vulkan)
|
||||
{
|
||||
if (g_ActiveConfig.backend_info.bSupportsDualSourceBlend)
|
||||
if (g_ActiveConfig.backend_info.bSupportsDualSourceBlend &&
|
||||
(!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DUAL_SOURCE_BLENDING) ||
|
||||
uid_data->dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND))
|
||||
{
|
||||
if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_FRAGMENT_SHADER_INDEX_DECORATION))
|
||||
{
|
||||
|
@ -523,6 +525,7 @@ ShaderCode GeneratePixelShaderCode(APIType ApiType, const pixel_shader_uid_data*
|
|||
else
|
||||
{
|
||||
out.Write("FRAGMENT_OUTPUT_LOCATION(0) out vec4 ocol0;\n");
|
||||
out.Write("vec4 ocol1;\n"); // Consume the output we don't use
|
||||
}
|
||||
|
||||
if (uid_data->per_pixel_depth)
|
||||
|
@ -1207,8 +1210,7 @@ static void WriteAlphaTest(ShaderCode& out, const pixel_shader_uid_data* uid_dat
|
|||
out.Write(")) {\n");
|
||||
|
||||
out.Write("\t\tocol0 = float4(0.0, 0.0, 0.0, 0.0);\n");
|
||||
if (g_ActiveConfig.backend_info.bSupportsDualSourceBlend)
|
||||
out.Write("\t\tocol1 = float4(0.0, 0.0, 0.0, 0.0);\n");
|
||||
out.Write("\t\tocol1 = float4(0.0, 0.0, 0.0, 0.0);\n");
|
||||
if (per_pixel_depth)
|
||||
{
|
||||
out.Write("\t\tdepth = %s;\n",
|
||||
|
@ -1304,8 +1306,7 @@ static void WriteColor(ShaderCode& out, const pixel_shader_uid_data* uid_data)
|
|||
if (uid_data->dstAlphaMode == DSTALPHA_NONE)
|
||||
{
|
||||
out.Write("\tocol0.a = float(prev.a >> 2) / 63.0;\n");
|
||||
if (g_ActiveConfig.backend_info.bSupportsDualSourceBlend)
|
||||
out.Write("\tocol1.a = float(prev.a) / 255.0;\n");
|
||||
out.Write("\tocol1.a = float(prev.a) / 255.0;\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1313,12 +1314,9 @@ static void WriteColor(ShaderCode& out, const pixel_shader_uid_data* uid_data)
|
|||
out.Write("\tocol0.a = float(" I_ALPHA ".a >> 2) / 63.0;\n");
|
||||
|
||||
// Use dual-source color blending to perform dst alpha in a single pass
|
||||
if (g_ActiveConfig.backend_info.bSupportsDualSourceBlend)
|
||||
{
|
||||
if (uid_data->dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND)
|
||||
out.Write("\tocol1.a = float(prev.a) / 255.0;\n");
|
||||
else
|
||||
out.Write("\tocol1.a = float(" I_ALPHA ".a) / 255.0;\n");
|
||||
}
|
||||
if (uid_data->dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND)
|
||||
out.Write("\tocol1.a = float(prev.a) / 255.0;\n");
|
||||
else
|
||||
out.Write("\tocol1.a = float(" I_ALPHA ".a) / 255.0;\n");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue