st/nine: Back scissor to nine_context

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
This commit is contained in:
Axel Davy 2016-10-19 21:47:02 +02:00
parent 7f6e01052b
commit 9498613607
3 changed files with 38 additions and 7 deletions

View file

@ -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;
}

View file

@ -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] &&
@ -1456,6 +1461,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) {

View file

@ -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;
@ -382,6 +384,10 @@ nine_context_set_pixel_shader_constant_b(struct NineDevice9 *device,
const BOOL *pConstantData,
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,