summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv50/nv50_state_validate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_state_validate.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index 14c3490599d..524696f35d1 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -277,7 +277,7 @@ static struct nouveau_stateobj *
validate_viewport(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct nouveau_stateobj *so = so_new(5, 9, 0);
+ struct nouveau_stateobj *so = so_new(3, 7, 0);
so_method(so, tesla, NV50TCL_VIEWPORT_TRANSLATE_X(0), 3);
so_data (so, fui(nv50->viewport.translate[0]));
@@ -288,15 +288,6 @@ validate_viewport(struct nv50_context *nv50)
so_data (so, fui(nv50->viewport.scale[1]));
so_data (so, fui(nv50->viewport.scale[2]));
- so_method(so, tesla, NV50TCL_VIEWPORT_TRANSFORM_EN, 1);
- so_data (so, 1);
- /* 0x0000 = remove whole primitive only (xyz)
- * 0x1018 = remove whole primitive only (xy), clamp z
- * 0x1080 = clip primitive (xyz)
- * 0x1098 = clip primitive (xy), clamp z
- */
- so_method(so, tesla, NV50TCL_VIEW_VOLUME_CLIP_CTRL, 1);
- so_data (so, 0x1080);
/* no idea what 0f90 does */
so_method(so, tesla, 0x0f90, 1);
so_data (so, 0);
@@ -341,6 +332,26 @@ validate_vtxattr(struct nv50_context *nv50)
return so;
}
+static struct nouveau_stateobj *
+validate_clip(struct nv50_context *nv50)
+{
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nouveau_stateobj *so = so_new(1, 1, 0);
+ uint32_t vvcc;
+
+ /* 0x0000 = remove whole primitive only (xyz)
+ * 0x1018 = remove whole primitive only (xy), clamp z
+ * 0x1080 = clip primitive (xyz)
+ * 0x1098 = clip primitive (xy), clamp z
+ */
+ vvcc = nv50->clip.depth_clamp ? 0x1098 : 0x1080;
+
+ so_method(so, tesla, NV50TCL_VIEW_VOLUME_CLIP_CTRL, 1);
+ so_data (so, vvcc);
+
+ return so;
+}
+
struct state_validate {
struct nouveau_stateobj *(*func)(struct nv50_context *nv50);
unsigned states;
@@ -365,6 +376,7 @@ struct state_validate {
{ nv50_vbo_validate , NV50_NEW_ARRAYS },
{ validate_vtxbuf , NV50_NEW_ARRAYS },
{ validate_vtxattr , NV50_NEW_ARRAYS },
+ { validate_clip , NV50_NEW_CLIP },
{}
};
#define validate_list_len (sizeof(validate_list) / sizeof(validate_list[0]))