OpenGLDevice: Cache intermediate state

This commit is contained in:
Stenzek
2023-10-08 01:47:29 +10:00
parent eb080834ad
commit ce7f6128e9
5 changed files with 75 additions and 36 deletions

View File

@ -861,12 +861,20 @@ bool GPU_HW::CompilePipelines()
}
else
{
const u32 factor = (static_cast<GPUTransparencyMode>(transparency_mode) ==
GPUTransparencyMode::HalfBackgroundPlusHalfForeground) ?
0xFF808080u :
0xFFFFFFFFu;
// TODO: This isn't entirely accurate, 127.5 versus 128.
// But if we use fbfetch on Mali, it doesn't matter.
plconfig.blend.src_blend = GPUPipeline::BlendFunc::One;
plconfig.blend.dst_blend = GPUPipeline::BlendFunc::ConstantColor;
plconfig.blend.dst_blend = GPUPipeline::BlendFunc::One;
if (static_cast<GPUTransparencyMode>(transparency_mode) ==
GPUTransparencyMode::HalfBackgroundPlusHalfForeground ||
static_cast<GPUTransparencyMode>(transparency_mode) ==
GPUTransparencyMode::BackgroundPlusQuarterForeground)
{
plconfig.blend.dst_blend = GPUPipeline::BlendFunc::ConstantColor;
plconfig.blend.dst_alpha_blend = GPUPipeline::BlendFunc::ConstantColor;
plconfig.blend.constant = 0x00808080u;
}
plconfig.blend.blend_op =
(static_cast<GPUTransparencyMode>(transparency_mode) ==
GPUTransparencyMode::BackgroundMinusForeground &&
@ -874,7 +882,6 @@ bool GPU_HW::CompilePipelines()
static_cast<BatchRenderMode>(render_mode) != BatchRenderMode::OnlyOpaque) ?
GPUPipeline::BlendOp::ReverseSubtract :
GPUPipeline::BlendOp::Add;
plconfig.blend.constant = factor;
}
}