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
&& !nv40
->rasterizer
->pipe
.bypass_clipping
)
15 if (nv40
->state
.hw
[NV40_STATE_VIEWPORT
] &&
16 (bypass
|| !(nv40
->dirty
& NV40_NEW_VIEWPORT
)) &&
17 nv40
->state
.viewport_bypass
== bypass
)
19 nv40
->state
.viewport_bypass
= bypass
;
23 so_method(so
, nv40
->screen
->curie
,
24 NV40TCL_VIEWPORT_TRANSLATE_X
, 8);
25 so_data (so
, fui(vpt
->translate
[0]));
26 so_data (so
, fui(vpt
->translate
[1]));
27 so_data (so
, fui(vpt
->translate
[2]));
28 so_data (so
, fui(vpt
->translate
[3]));
29 so_data (so
, fui(vpt
->scale
[0]));
30 so_data (so
, fui(vpt
->scale
[1]));
31 so_data (so
, fui(vpt
->scale
[2]));
32 so_data (so
, fui(vpt
->scale
[3]));
33 so_method(so
, nv40
->screen
->curie
, 0x1d78, 1);
36 so_method(so
, nv40
->screen
->curie
,
37 NV40TCL_VIEWPORT_TRANSLATE_X
, 8);
38 so_data (so
, fui(0.0));
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(1.0));
43 so_data (so
, fui(1.0));
44 so_data (so
, fui(1.0));
45 so_data (so
, fui(0.0));
46 /* Not entirely certain what this is yet. The DDX uses this
47 * value also as it fixes rendering when you pass
48 * pre-transformed vertices to the GPU. My best gusss is that
49 * this bypasses some culling/clipping stage. Might be worth
50 * noting that points/lines are uneffected by whatever this
51 * value fixes, only filled polygons are effected.
53 so_method(so
, nv40
->screen
->curie
, 0x1d78, 1);
57 so_ref(so
, &nv40
->state
.hw
[NV40_STATE_VIEWPORT
]);
61 struct nv40_state_entry nv40_state_viewport
= {
62 .validate
= nv40_state_viewport_validate
,
64 .pipe
= NV40_NEW_VIEWPORT
| NV40_NEW_RAST
,
65 .hw
= NV40_STATE_VIEWPORT