Merge branch '7.8'
[mesa.git] / src / gallium / drivers / nvfx / nvfx_state_viewport.c
1 #include "nvfx_context.h"
2
3 /* Having this depend on FB and RAST looks wrong, but it seems
4 necessary to make this work on nv3x
5 TODO: find the right fix
6 */
7
8 static boolean
9 nvfx_state_viewport_validate(struct nvfx_context *nvfx)
10 {
11 struct pipe_viewport_state *vpt = &nvfx->viewport;
12 struct nouveau_stateobj *so;
13
14 so = so_new(2, 9, 0);
15 so_method(so, nvfx->screen->eng3d,
16 NV34TCL_VIEWPORT_TRANSLATE_X, 8);
17 if(nvfx->render_mode == HW) {
18 so_data (so, fui(vpt->translate[0]));
19 so_data (so, fui(vpt->translate[1]));
20 so_data (so, fui(vpt->translate[2]));
21 so_data (so, fui(vpt->translate[3]));
22 so_data (so, fui(vpt->scale[0]));
23 so_data (so, fui(vpt->scale[1]));
24 so_data (so, fui(vpt->scale[2]));
25 so_data (so, fui(vpt->scale[3]));
26 so_method(so, nvfx->screen->eng3d, 0x1d78, 1);
27 so_data (so, 1);
28 } else {
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(0.0f));
33 so_data (so, fui(1.0f));
34 so_data (so, fui(1.0f));
35 so_data (so, fui(1.0f));
36 so_data (so, fui(1.0f));
37 so_method(so, nvfx->screen->eng3d, 0x1d78, 1);
38 so_data (so, nvfx->is_nv4x ? 0x110 : 1);
39 }
40
41 so_ref(so, &nvfx->state.hw[NVFX_STATE_VIEWPORT]);
42 so_ref(NULL, &so);
43 return TRUE;
44 }
45
46 struct nvfx_state_entry nvfx_state_viewport = {
47 .validate = nvfx_state_viewport_validate,
48 .dirty = {
49 .pipe = NVFX_NEW_VIEWPORT | NVFX_NEW_FB | NVFX_NEW_RAST,
50 .hw = NVFX_STATE_VIEWPORT
51 }
52 };