From: Axel Davy Date: Fri, 23 Jan 2015 22:20:17 +0000 (+0100) Subject: st/nine: Fix update_framebuffer binding cbufs the pixel shader wouldn't render to X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9ac74e604bbce3b24565a9c277dc8f8fe9826e97;p=mesa.git st/nine: Fix update_framebuffer binding cbufs the pixel shader wouldn't render to Reviewed-by: Tiziano Bacocco Signed-off-by: Axel Davy --- diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 5eb9d54f457..25e1444f6b4 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -3297,6 +3297,8 @@ NineDevice9_SetPixelShader( struct NineDevice9 *This, IDirect3DPixelShader9 *pShader ) { struct nine_state *state = This->update; + unsigned old_mask = state->ps ? state->ps->rt_mask : 1; + unsigned mask; DBG("This=%p pShader=%p\n", This, pShader); @@ -3304,6 +3306,12 @@ NineDevice9_SetPixelShader( struct NineDevice9 *This, state->changed.group |= NINE_STATE_PS; + mask = state->ps ? state->ps->rt_mask : 1; + /* We need to update cbufs if the pixel shader would + * write to different render targets */ + if (mask != old_mask) + state->changed.group |= NINE_STATE_FB; + return D3D_OK; } diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 02fef9a381d..86a6ca8ee40 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -48,7 +48,7 @@ update_framebuffer(struct NineDevice9 *device) unsigned w = rt0->desc.Width; unsigned h = rt0->desc.Height; D3DMULTISAMPLE_TYPE nr_samples = rt0->desc.MultiSampleType; - + unsigned mask = state->ps ? state->ps->rt_mask : 1; const int sRGB = state->rs[D3DRS_SRGBWRITEENABLE] ? 1 : 0; DBG("\n"); @@ -75,8 +75,9 @@ update_framebuffer(struct NineDevice9 *device) for (i = 0; i < device->caps.NumSimultaneousRTs; ++i) { struct NineSurface9 *rt = state->rt[i]; - if (rt && rt->desc.Format != D3DFMT_NULL && rt->desc.Width == w && - rt->desc.Height == h && rt->desc.MultiSampleType == nr_samples) { + if (rt && rt->desc.Format != D3DFMT_NULL && (mask & (1 << i)) && + rt->desc.Width == w && rt->desc.Height == h && + rt->desc.MultiSampleType == nr_samples) { fb->cbufs[i] = NineSurface9_GetSurface(rt, sRGB); state->rt_mask |= 1 << i; fb->nr_cbufs = i + 1; @@ -127,12 +128,6 @@ update_framebuffer(struct NineDevice9 *device) } } -#ifdef DEBUG - if (state->rt_mask & (state->ps ? ~state->ps->rt_mask : 0)) - WARN_ONCE("FIXME: writing undefined values to cbufs 0x%x\n", - state->rt_mask & ~state->ps->rt_mask); -#endif - return state->changed.group; } @@ -329,9 +324,6 @@ update_ps(struct NineDevice9 *device) for (s = 0; mask; ++s, mask >>= 1) if ((mask & 1) && !(device->state.texture[NINE_SAMPLER_PS(s)])) WARN_ONCE("FIXME: unbound sampler should return alpha=1\n"); - if (device->state.rt_mask & ~ps->rt_mask) - WARN_ONCE("FIXME: writing undefined values to cbufs 0x%x\n", - device->state.rt_mask & ~ps->rt_mask); } #endif return 0;