Merge branch '7.8' into master
[mesa.git] / src / gallium / drivers / nvfx / nvfx_state_viewport.c
1 #include "nvfx_context.h"
2
3 static boolean
4 nvfx_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 if(nvfx->render_mode == HW) {
17 so_data (so, fui(vpt->translate[0]));
18 so_data (so, fui(vpt->translate[1]));
19 so_data (so, fui(vpt->translate[2]));
20 so_data (so, fui(vpt->translate[3]));
21 so_data (so, fui(vpt->scale[0]));
22 so_data (so, fui(vpt->scale[1]));
23 so_data (so, fui(vpt->scale[2]));
24 so_data (so, fui(vpt->scale[3]));
25 so_method(so, nvfx->screen->eng3d, 0x1d78, 1);
26 so_data (so, 1);
27 } else {
28 so_data (so, fui(0.0f));
29 so_data (so, fui(0.0f));
30 so_data (so, fui(0.0f));
31 so_data (so, fui(0.0f));
32 so_data (so, fui(1.0f));
33 so_data (so, fui(1.0f));
34 so_data (so, fui(1.0f));
35 so_data (so, fui(1.0f));
36 so_method(so, nvfx->screen->eng3d, 0x1d78, 1);
37 so_data (so, nvfx->is_nv4x ? 0x110 : 1);
38 }
39
40 so_ref(so, &nvfx->state.hw[NVFX_STATE_VIEWPORT]);
41 so_ref(NULL, &so);
42 return TRUE;
43 }
44
45 struct nvfx_state_entry nvfx_state_viewport = {
46 .validate = nvfx_state_viewport_validate,
47 .dirty = {
48 .pipe = NVFX_NEW_VIEWPORT,
49 .hw = NVFX_STATE_VIEWPORT
50 }
51 };