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;
pViewport->MinZ, pViewport->MaxZ);
state->viewport = *pViewport;
- state->changed.group |= NINE_STATE_VIEWPORT;
+ nine_context_set_viewport(This, pViewport);
return D3D_OK;
}
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:
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] &&
}
}
+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)
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;
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]) {
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)