diff options
-rw-r--r-- | src/gallium/state_trackers/nine/device9.c | 7 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.c | 32 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.h | 6 |
3 files changed, 38 insertions, 7 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 7b0009d9349..8f9872c1560 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -105,6 +105,8 @@ NineDevice9_SetDefaultState( struct NineDevice9 *This, boolean is_reset ) This->state.scissor.maxx = refSurf->desc.Width; This->state.scissor.maxy = refSurf->desc.Height; + nine_context_set_scissor(This, &This->state.scissor); + if (This->nswapchains && This->swapchains[0]->params.EnableAutoDepthStencil) { nine_context_set_render_state(This, D3DRS_ZENABLE, TRUE); This->state.rs_advertised[D3DRS_ZENABLE] = TRUE; @@ -2711,7 +2713,10 @@ NineDevice9_SetScissorRect( struct NineDevice9 *This, state->scissor.maxx = pRect->right; state->scissor.maxy = pRect->bottom; - state->changed.group |= NINE_STATE_SCISSOR; + if (unlikely(This->is_recording)) + state->changed.group |= NINE_STATE_SCISSOR; + else + nine_context_set_scissor(This, &state->scissor); return D3D_OK; } diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 4b5b199e560..89d7b1004ec 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -824,7 +824,7 @@ commit_scissor(struct NineDevice9 *device) { struct pipe_context *pipe = device->pipe; - pipe->set_scissor_states(pipe, 0, 1, &device->state.scissor); + pipe->set_scissor_states(pipe, 0, 1, &device->context.scissor); } static inline void @@ -1441,7 +1441,12 @@ nine_context_set_render_target(struct NineDevice9 *device, const unsigned i = RenderTargetIndex; if (i == 0) { - /* viewport and scissor changes */ + context->scissor.minx = 0; + context->scissor.miny = 0; + context->scissor.maxx = rt->desc.Width; + context->scissor.maxy = rt->desc.Height; + + /* viewport changes */ state->changed.group |= NINE_STATE_VIEWPORT | NINE_STATE_SCISSOR | NINE_STATE_MULTISAMPLE; if (context->rt[0] && @@ -1457,6 +1462,17 @@ nine_context_set_render_target(struct NineDevice9 *device, } void +nine_context_set_scissor(struct NineDevice9 *device, + const struct pipe_scissor_state *scissor) +{ + struct nine_state *state = &device->state; + struct nine_context *context = &device->context; + + context->scissor = *scissor; + state->changed.group |= NINE_STATE_SCISSOR; +} + +void nine_context_apply_stateblock(struct NineDevice9 *device, const struct nine_state *src) { @@ -1605,6 +1621,10 @@ nine_context_apply_stateblock(struct NineDevice9 *device, context->changed.ps_const_i = !!src->changed.ps_const_i; context->changed.ps_const_b = !!src->changed.ps_const_b; } + + /* Scissor */ + if (src->changed.group & NINE_STATE_SCISSOR) + context->scissor = src->scissor; } static void @@ -1659,10 +1679,10 @@ nine_context_clear_fb(struct NineDevice9 *device, /* Both rectangles apply, which is weird, but that's D3D9. */ if (context->rs[D3DRS_SCISSORTESTENABLE]) { - rect.x1 = MAX2(rect.x1, device->state.scissor.minx); - rect.y1 = MAX2(rect.y1, device->state.scissor.miny); - rect.x2 = MIN2(rect.x2, device->state.scissor.maxx); - rect.y2 = MIN2(rect.y2, device->state.scissor.maxy); + rect.x1 = MAX2(rect.x1, context->scissor.minx); + rect.y1 = MAX2(rect.y1, context->scissor.miny); + rect.x2 = MIN2(rect.x2, context->scissor.maxx); + rect.y2 = MIN2(rect.y2, context->scissor.maxy); } if (Count) { diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h index 50fecd0f0e2..28a6d6cfeee 100644 --- a/src/gallium/state_trackers/nine/nine_state.h +++ b/src/gallium/state_trackers/nine/nine_state.h @@ -238,6 +238,8 @@ struct nine_context { uint8_t rt_mask; + struct pipe_scissor_state scissor; + struct NineVertexShader9 *vs; BOOL programmable_vs; float *vs_const_f; @@ -383,6 +385,10 @@ nine_context_set_pixel_shader_constant_b(struct NineDevice9 *device, UINT BoolCount); void +nine_context_set_scissor(struct NineDevice9 *device, + const struct pipe_scissor_state *scissor); + +void nine_context_set_render_target(struct NineDevice9 *device, DWORD RenderTargetIndex, struct NineSurface9 *rt); |