nv30, nv40: unify nv[34]0_query.c
[mesa.git] / src / gallium / drivers / nv40 / nv40_state_viewport.c
1 #include "nv40_context.h"
2
3 static boolean
4 nv40_state_viewport_validate(struct nvfx_context *nvfx)
5 {
6 struct pipe_viewport_state *vpt = &nvfx->viewport;
7 struct nouveau_stateobj *so;
8
9 if (nvfx->state.hw[NVFX_STATE_VIEWPORT] &&
10 !(nvfx->dirty & NVFX_NEW_VIEWPORT))
11 return FALSE;
12
13 so = so_new(2, 9, 0);
14 so_method(so, nvfx->screen->eng3d,
15 NV34TCL_VIEWPORT_TRANSLATE_X, 8);
16 so_data (so, fui(vpt->translate[0]));
17 so_data (so, fui(vpt->translate[1]));
18 so_data (so, fui(vpt->translate[2]));
19 so_data (so, fui(vpt->translate[3]));
20 so_data (so, fui(vpt->scale[0]));
21 so_data (so, fui(vpt->scale[1]));
22 so_data (so, fui(vpt->scale[2]));
23 so_data (so, fui(vpt->scale[3]));
24 so_method(so, nvfx->screen->eng3d, 0x1d78, 1);
25 so_data (so, 1);
26
27 so_ref(so, &nvfx->state.hw[NVFX_STATE_VIEWPORT]);
28 so_ref(NULL, &so);
29 return TRUE;
30 }
31
32 struct nvfx_state_entry nv40_state_viewport = {
33 .validate = nv40_state_viewport_validate,
34 .dirty = {
35 .pipe = NVFX_NEW_VIEWPORT | NVFX_NEW_RAST,
36 .hw = NVFX_STATE_VIEWPORT
37 }
38 };