1 #include "nv40_context.h"
4 nv40_state_viewport_validate(struct nv40_context
*nv40
)
6 struct pipe_viewport_state
*vpt
= &nv40
->viewport
;
7 struct nouveau_stateobj
*so
;
10 if (nv40
->render_mode
== HW
&&
11 !nv40
->rasterizer
->pipe
.bypass_vs_clip_and_viewport
)
16 if (nv40
->state
.hw
[NV40_STATE_VIEWPORT
] &&
17 (bypass
|| !(nv40
->dirty
& NV40_NEW_VIEWPORT
)) &&
18 nv40
->state
.viewport_bypass
== bypass
)
20 nv40
->state
.viewport_bypass
= bypass
;
24 so_method(so
, nv40
->screen
->curie
,
25 NV40TCL_VIEWPORT_TRANSLATE_X
, 8);
26 so_data (so
, fui(vpt
->translate
[0]));
27 so_data (so
, fui(vpt
->translate
[1]));
28 so_data (so
, fui(vpt
->translate
[2]));
29 so_data (so
, fui(vpt
->translate
[3]));
30 so_data (so
, fui(vpt
->scale
[0]));
31 so_data (so
, fui(vpt
->scale
[1]));
32 so_data (so
, fui(vpt
->scale
[2]));
33 so_data (so
, fui(vpt
->scale
[3]));
34 so_method(so
, nv40
->screen
->curie
, 0x1d78, 1);
37 so_method(so
, nv40
->screen
->curie
,
38 NV40TCL_VIEWPORT_TRANSLATE_X
, 8);
39 so_data (so
, fui(0.0));
40 so_data (so
, fui(0.0));
41 so_data (so
, fui(0.0));
42 so_data (so
, fui(0.0));
43 so_data (so
, fui(1.0));
44 so_data (so
, fui(1.0));
45 so_data (so
, fui(1.0));
46 so_data (so
, fui(0.0));
47 /* Not entirely certain what this is yet. The DDX uses this
48 * value also as it fixes rendering when you pass
49 * pre-transformed vertices to the GPU. My best gusss is that
50 * this bypasses some culling/clipping stage. Might be worth
51 * noting that points/lines are uneffected by whatever this
52 * value fixes, only filled polygons are effected.
54 so_method(so
, nv40
->screen
->curie
, 0x1d78, 1);
58 so_ref(so
, &nv40
->state
.hw
[NV40_STATE_VIEWPORT
]);
63 struct nv40_state_entry nv40_state_viewport
= {
64 .validate
= nv40_state_viewport_validate
,
66 .pipe
= NV40_NEW_VIEWPORT
| NV40_NEW_RAST
,
67 .hw
= NV40_STATE_VIEWPORT