1
0
Fork 0
forked from wry/wry

metal: disable direct scanout if blending would change the appearance

This commit is contained in:
Julian Orth 2025-09-05 19:35:32 +02:00
parent fc6dda9c24
commit b6ef623643

View file

@ -626,6 +626,7 @@ impl MetalConnector {
&self,
pass: &GfxRenderPass,
plane: &Rc<MetalPlane>,
blend_cd: &Rc<ColorDescription>,
cd: &Rc<ColorDescription>,
) -> Option<DirectScanoutData> {
let ct = 'ct: {
@ -647,6 +648,10 @@ impl MetalConnector {
// Direct scanout requires embeddable color descriptions.
return None;
}
if !ct.opaque && !ct.cd.embeds_into(blend_cd) {
// Blending changes the appearance of translucent buffers.
return None;
}
if ct.alpha.is_some() {
// Direct scanout with alpha factor is not supported.
return None;
@ -818,7 +823,7 @@ impl MetalConnector {
&& self.dev.is_render_device();
let mut direct_scanout_data = None;
if try_direct_scanout {
direct_scanout_data = self.prepare_direct_scanout(&latched.pass, plane, cd);
direct_scanout_data = self.prepare_direct_scanout(&latched.pass, plane, blend_cd, cd);
}
let direct_scanout_active = direct_scanout_data.is_some();
if self.direct_scanout_active.replace(direct_scanout_active) != direct_scanout_active {