#define NV50_NEW_SAMPLER (1 << 15)
#define NV50_NEW_TEXTURE (1 << 16)
#define NV50_NEW_STENCIL_REF (1 << 17)
+#define NV50_NEW_CLIP (1 << 18)
struct nv50_blend_stateobj {
struct pipe_blend_state pipe;
struct pipe_scissor_state scissor;
struct pipe_viewport_state viewport;
struct pipe_framebuffer_state framebuffer;
+ struct pipe_clip_state clip;
struct nv50_program *vertprog;
struct nv50_program *fragprog;
struct nv50_program *geomprog;
case PIPE_CAP_MAX_VS_TEMPS:
case PIPE_CAP_MAX_FS_TEMPS: /* no spilling atm */
return 128 / 4;
+ case PIPE_CAP_DEPTH_CLAMP:
+ return 1;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
OUT_RINGf (chan, 0.0f);
OUT_RINGf (chan, 1.0f);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_VIEWPORT_TRANSFORM_EN, 1);
+ OUT_RING (chan, 1);
+
/* no dynamic combination of TIC & TSC entries => only BIND_TIC used */
BEGIN_RING(chan, screen->tesla, NV50TCL_LINKED_TSC, 1);
OUT_RING (chan, 1);
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]));
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);
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;
{ 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]))