1 #include "nv30_context.h"
4 nv30_state_viewport_validate(struct nv30_context
*nv30
)
6 struct pipe_viewport_state
*vpt
= &nv30
->viewport
;
7 struct nouveau_stateobj
*so
;
10 if (/*nv30->render_mode == HW &&*/
11 !nv30
->rasterizer
->pipe
.bypass_vs_clip_and_viewport
)
16 if (nv30
->state
.hw
[NV30_STATE_VIEWPORT
] &&
17 (bypass
|| !(nv30
->dirty
& NV30_NEW_VIEWPORT
)) &&
18 nv30
->state
.viewport_bypass
== bypass
)
20 nv30
->state
.viewport_bypass
= bypass
;
22 so
= so_new(3, 10, 0);
24 so_method(so
, nv30
->screen
->rankine
,
25 NV34TCL_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, nv30->screen->rankine, 0x1d78, 1);
37 so_method(so
, nv30
->screen
->rankine
,
38 NV34TCL_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, nv30->screen->rankine, 0x1d78, 1);
57 /* TODO/FIXME: never saw value 0x0110 in renouveau dumps, only 0x0001 */
58 so_method(so
, nv30
->screen
->rankine
, 0x1d78, 1);
61 so_ref(so
, &nv30
->state
.hw
[NV30_STATE_VIEWPORT
]);
66 struct nv30_state_entry nv30_state_viewport
= {
67 .validate
= nv30_state_viewport_validate
,
69 .pipe
= NV30_NEW_VIEWPORT
| NV30_NEW_RAST
,
70 .hw
= NV30_STATE_VIEWPORT