summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2015-01-23 23:20:17 +0100
committerAxel Davy <[email protected]>2015-02-06 00:07:19 +0100
commit9ac74e604bbce3b24565a9c277dc8f8fe9826e97 (patch)
tree67282c85dcde9e0dbc20294a4124916268bdc059
parentee606b47800021d74732bf5155a1d7d68822fa02 (diff)
st/nine: Fix update_framebuffer binding cbufs the pixel shader wouldn't render to
Reviewed-by: Tiziano Bacocco <[email protected]> Signed-off-by: Axel Davy <[email protected]>
-rw-r--r--src/gallium/state_trackers/nine/device9.c8
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c16
2 files changed, 12 insertions, 12 deletions
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;