st/nine: Back viewport 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:
parent
9498613607
commit
4a6d83ebc2
|
@ -100,6 +100,8 @@ NineDevice9_SetDefaultState( struct NineDevice9 *This, boolean is_reset )
|
|||
This->state.viewport.Width = refSurf->desc.Width;
|
||||
This->state.viewport.Height = refSurf->desc.Height;
|
||||
|
||||
nine_context_set_viewport(This, &This->state.viewport);
|
||||
|
||||
This->state.scissor.minx = 0;
|
||||
This->state.scissor.miny = 0;
|
||||
This->state.scissor.maxx = refSurf->desc.Width;
|
||||
|
@ -2025,7 +2027,7 @@ NineDevice9_SetViewport( struct NineDevice9 *This,
|
|||
pViewport->MinZ, pViewport->MaxZ);
|
||||
|
||||
state->viewport = *pViewport;
|
||||
state->changed.group |= NINE_STATE_VIEWPORT;
|
||||
nine_context_set_viewport(This, pViewport);
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
|
|
@ -2019,7 +2019,7 @@ nine_ff_load_ps_params(struct NineDevice9 *device)
|
|||
static void
|
||||
nine_ff_load_viewport_info(struct NineDevice9 *device)
|
||||
{
|
||||
D3DVIEWPORT9 *viewport = &device->state.viewport;
|
||||
D3DVIEWPORT9 *viewport = &device->context.viewport;
|
||||
struct fvec4 *dst = (struct fvec4 *)device->ff.vs_const;
|
||||
float diffZ = viewport->MaxZ - viewport->MinZ;
|
||||
|
||||
|
|
|
@ -494,7 +494,7 @@ update_framebuffer(struct NineDevice9 *device, bool is_clear)
|
|||
static void
|
||||
update_viewport(struct NineDevice9 *device)
|
||||
{
|
||||
const D3DVIEWPORT9 *vport = &device->state.viewport;
|
||||
const D3DVIEWPORT9 *vport = &device->context.viewport;
|
||||
struct pipe_viewport_state pvport;
|
||||
|
||||
/* D3D coordinates are:
|
||||
|
@ -1441,12 +1441,18 @@ nine_context_set_render_target(struct NineDevice9 *device,
|
|||
const unsigned i = RenderTargetIndex;
|
||||
|
||||
if (i == 0) {
|
||||
context->viewport.X = 0;
|
||||
context->viewport.Y = 0;
|
||||
context->viewport.Width = rt->desc.Width;
|
||||
context->viewport.Height = rt->desc.Height;
|
||||
context->viewport.MinZ = 0.0f;
|
||||
context->viewport.MaxZ = 1.0f;
|
||||
|
||||
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] &&
|
||||
|
@ -1461,6 +1467,17 @@ nine_context_set_render_target(struct NineDevice9 *device,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nine_context_set_viewport(struct NineDevice9 *device,
|
||||
const D3DVIEWPORT9 *viewport)
|
||||
{
|
||||
struct nine_state *state = &device->state;
|
||||
struct nine_context *context = &device->context;
|
||||
|
||||
context->viewport = *viewport;
|
||||
state->changed.group |= NINE_STATE_VIEWPORT;
|
||||
}
|
||||
|
||||
void
|
||||
nine_context_set_scissor(struct NineDevice9 *device,
|
||||
const struct pipe_scissor_state *scissor)
|
||||
|
@ -1622,6 +1639,10 @@ nine_context_apply_stateblock(struct NineDevice9 *device,
|
|||
context->changed.ps_const_b = !!src->changed.ps_const_b;
|
||||
}
|
||||
|
||||
/* Viewport */
|
||||
if (src->changed.group & NINE_STATE_VIEWPORT)
|
||||
context->viewport = src->viewport;
|
||||
|
||||
/* Scissor */
|
||||
if (src->changed.group & NINE_STATE_SCISSOR)
|
||||
context->scissor = src->scissor;
|
||||
|
@ -1672,10 +1693,10 @@ nine_context_clear_fb(struct NineDevice9 *device,
|
|||
return;
|
||||
d3dcolor_to_pipe_color_union(&rgba, Color);
|
||||
|
||||
rect.x1 = device->state.viewport.X;
|
||||
rect.y1 = device->state.viewport.Y;
|
||||
rect.x2 = device->state.viewport.Width + rect.x1;
|
||||
rect.y2 = device->state.viewport.Height + rect.y1;
|
||||
rect.x1 = context->viewport.X;
|
||||
rect.y1 = context->viewport.Y;
|
||||
rect.x2 = context->viewport.Width + rect.x1;
|
||||
rect.y2 = context->viewport.Height + rect.y1;
|
||||
|
||||
/* Both rectangles apply, which is weird, but that's D3D9. */
|
||||
if (context->rs[D3DRS_SCISSORTESTENABLE]) {
|
||||
|
@ -2120,8 +2141,8 @@ nine_state_set_defaults(struct NineDevice9 *device, const D3DCAPS9 *caps,
|
|||
state->ff.changed.transform[D3DTS_WORLD / 32] |= 1 << (D3DTS_WORLD % 32);
|
||||
|
||||
if (!is_reset) {
|
||||
state->viewport.MinZ = 0.0f;
|
||||
state->viewport.MaxZ = 1.0f;
|
||||
state->viewport.MinZ = context->viewport.MinZ = 0.0f;
|
||||
state->viewport.MaxZ = context->viewport.MaxZ = 1.0f;
|
||||
}
|
||||
|
||||
for (s = 0; s < NINE_MAX_SAMPLERS; ++s)
|
||||
|
|
|
@ -238,6 +238,8 @@ struct nine_context {
|
|||
|
||||
uint8_t rt_mask;
|
||||
|
||||
D3DVIEWPORT9 viewport;
|
||||
|
||||
struct pipe_scissor_state scissor;
|
||||
|
||||
struct NineVertexShader9 *vs;
|
||||
|
@ -384,6 +386,10 @@ nine_context_set_pixel_shader_constant_b(struct NineDevice9 *device,
|
|||
const BOOL *pConstantData,
|
||||
UINT BoolCount);
|
||||
|
||||
void
|
||||
nine_context_set_viewport(struct NineDevice9 *device,
|
||||
const D3DVIEWPORT9 *viewport);
|
||||
|
||||
void
|
||||
nine_context_set_scissor(struct NineDevice9 *device,
|
||||
const struct pipe_scissor_state *scissor);
|
||||
|
|
Loading…
Reference in New Issue