st/nine: Remove group_mask argument from nine_update_state

It was only used to discriminate update framebuffer vs update
everything. Instead use two functions.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
This commit is contained in:
Axel Davy 2015-02-15 09:19:16 +01:00
parent 360ba5b748
commit 99537f68db
4 changed files with 28 additions and 14 deletions

View file

@ -434,7 +434,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
NineDevice9_RestoreNonCSOState(This, ~0);
This->update = &This->state;
nine_update_state(This, ~0);
nine_update_state(This);
ID3DPresentGroup_Release(This->present);
@ -1902,7 +1902,7 @@ NineDevice9_Clear( struct NineDevice9 *This,
return D3D_OK;
d3dcolor_to_pipe_color_union(&rgba, Color);
nine_update_state(This, NINE_STATE_FB);
nine_update_state_framebuffer(This);
rect.x1 = This->state.viewport.X;
rect.y1 = This->state.viewport.Y;
@ -2882,7 +2882,7 @@ NineDevice9_DrawPrimitive( struct NineDevice9 *This,
DBG("iface %p, PrimitiveType %u, StartVertex %u, PrimitiveCount %u\n",
This, PrimitiveType, StartVertex, PrimitiveCount);
nine_update_state(This, ~0);
nine_update_state(This);
init_draw_info(&info, This, PrimitiveType, PrimitiveCount);
info.indexed = FALSE;
@ -2915,7 +2915,7 @@ NineDevice9_DrawIndexedPrimitive( struct NineDevice9 *This,
user_assert(This->state.idxbuf, D3DERR_INVALIDCALL);
user_assert(This->state.vdecl, D3DERR_INVALIDCALL);
nine_update_state(This, ~0);
nine_update_state(This);
init_draw_info(&info, This, PrimitiveType, PrimitiveCount);
info.indexed = TRUE;
@ -2947,7 +2947,7 @@ NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
user_assert(pVertexStreamZeroData && VertexStreamZeroStride,
D3DERR_INVALIDCALL);
nine_update_state(This, ~0);
nine_update_state(This);
init_draw_info(&info, This, PrimitiveType, PrimitiveCount);
info.indexed = FALSE;
@ -3009,7 +3009,7 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This,
user_assert(IndexDataFormat == D3DFMT_INDEX16 ||
IndexDataFormat == D3DFMT_INDEX32, D3DERR_INVALIDCALL);
nine_update_state(This, ~0);
nine_update_state(This);
init_draw_info(&info, This, PrimitiveType, PrimitiveCount);
info.indexed = TRUE;
@ -3093,7 +3093,7 @@ NineDevice9_ProcessVertices( struct NineDevice9 *This,
if (!screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS))
STUB(D3DERR_INVALIDCALL);
nine_update_state(This, ~0);
nine_update_state(This);
/* TODO: Create shader with stream output. */
STUB(D3DERR_INVALIDCALL);

View file

@ -885,8 +885,21 @@ update_textures_and_samplers(struct NineDevice9 *device)
NINE_STATE_VS | \
NINE_STATE_PS)
void
nine_update_state_framebuffer(struct NineDevice9 *device)
{
struct nine_state *state = &device->state;
validate_textures(device);
if (state->changed.group & NINE_STATE_FB)
update_framebuffer(device);
state->changed.group &= ~NINE_STATE_FB;
}
boolean
nine_update_state(struct NineDevice9 *device, uint32_t mask)
nine_update_state(struct NineDevice9 *device)
{
struct pipe_context *pipe = device->pipe;
struct nine_state *state = &device->state;
@ -905,16 +918,16 @@ nine_update_state(struct NineDevice9 *device, uint32_t mask)
validate_textures(device); /* may clobber state */
/* ff_update may change VS/PS dirty bits */
if ((mask & NINE_STATE_FF) && unlikely(!state->vs || !state->ps))
if (unlikely(!state->vs || !state->ps))
nine_ff_update(device);
group = state->changed.group & mask;
group = state->changed.group;
if (group & NINE_STATE_SHADER_VARIANT_GROUP)
group |= update_shader_variant_keys(device);
if (group & NINE_STATE_FREQ_GROUP_0) {
if (group & NINE_STATE_FB)
group = update_framebuffer(device) & mask;
group = update_framebuffer(device);
if (group & NINE_STATE_VIEWPORT)
update_viewport(device);
if (group & NINE_STATE_SCISSOR)
@ -981,7 +994,7 @@ nine_update_state(struct NineDevice9 *device, uint32_t mask)
if (state->changed.vtxbuf)
update_vertex_buffers(device);
device->state.changed.group &= ~mask |
device->state.changed.group &=
(NINE_STATE_FF | NINE_STATE_VS_CONST | NINE_STATE_PS_CONST);
DBG("finished\n");

View file

@ -221,7 +221,8 @@ extern const uint32_t nine_render_states_vertex[(NINED3DRS_COUNT + 31) / 32];
struct NineDevice9;
boolean nine_update_state(struct NineDevice9 *, uint32_t group_mask);
void nine_update_state_framebuffer(struct NineDevice9 *);
boolean nine_update_state(struct NineDevice9 *);
void nine_state_set_defaults(struct NineDevice9 *, const D3DCAPS9 *,
boolean is_reset);

View file

@ -840,7 +840,7 @@ NineSwapChain9_Present( struct NineSwapChain9 *This,
ID3DPresent_WaitBufferReleased(This->present, This->present_handles[0]);
This->base.device->state.changed.group |= NINE_STATE_FB;
nine_update_state(This->base.device, NINE_STATE_FB);
nine_update_state_framebuffer(This->base.device);
return hr;
}