From 70f8d78aa7748de1046752ccdf5ebf00ea80cb45 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Thu, 11 Mar 2021 20:55:48 +0100 Subject: [PATCH] st/nine: Handle D3DFMT_NULL multisampling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When D3DFMT_NULL is set as render target, we must take the multisampling state from the depth buffer. Signed-off-by: Axel Davy Acked-by: Timur Kristóf Part-of: --- src/gallium/frontends/nine/nine_state.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gallium/frontends/nine/nine_state.c b/src/gallium/frontends/nine/nine_state.c index 1833725362d..d3b57862a6d 100644 --- a/src/gallium/frontends/nine/nine_state.c +++ b/src/gallium/frontends/nine/nine_state.c @@ -345,10 +345,16 @@ nine_context_is_worker( struct NineDevice9 *device ) static inline DWORD check_multisample(struct NineDevice9 *device) { - DWORD *rs = device->context.rs; - DWORD new_value = device->context.rt[0] && - device->context.rt[0]->desc.MultiSampleType >= 1 && - rs[D3DRS_MULTISAMPLEANTIALIAS]; + struct nine_context *context = &device->context; + DWORD *rs = context->rs; + struct NineSurface9 *rt0 = context->rt[0]; + bool multisampled_target; + DWORD new_value; + + multisampled_target = rt0 && rt0->desc.MultiSampleType >= 1; + if (rt0 && rt0->desc.Format == D3DFMT_NULL && context->ds) + multisampled_target = context->ds->desc.MultiSampleType >= 1; + new_value = (multisampled_target && rs[D3DRS_MULTISAMPLEANTIALIAS]) ? 1 : 0; if (rs[NINED3DRS_MULTISAMPLE] != new_value) { rs[NINED3DRS_MULTISAMPLE] = new_value; return NINE_STATE_RASTERIZER;