summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nvc0/nvc0_state_validate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nvc0/nvc0_state_validate.c')
-rw-r--r--src/gallium/drivers/nvc0/nvc0_state_validate.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nvc0/nvc0_state_validate.c
index 3533a5e1ba4..5d34f2b0bcc 100644
--- a/src/gallium/drivers/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nvc0/nvc0_state_validate.c
@@ -250,17 +250,17 @@ nvc0_validate_viewport(struct nvc0_context *nvc0)
250} 250}
251 251
252static INLINE void 252static INLINE void
253nvc0_upload_uclip_planes(struct nvc0_context *nvc0) 253nvc0_upload_uclip_planes(struct nvc0_context *nvc0, unsigned s)
254{ 254{
255 struct nouveau_pushbuf *push = nvc0->base.pushbuf; 255 struct nouveau_pushbuf *push = nvc0->base.pushbuf;
256 struct nouveau_bo *bo = nvc0->screen->uniforms; 256 struct nouveau_bo *bo = nvc0->screen->uniform_bo;
257 257
258 BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3); 258 BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
259 PUSH_DATA (push, 256); 259 PUSH_DATA (push, 512);
260 PUSH_DATAh(push, bo->offset + (5 << 16)); 260 PUSH_DATAh(push, bo->offset + (5 << 16) + (s << 9));
261 PUSH_DATA (push, bo->offset + (5 << 16)); 261 PUSH_DATA (push, bo->offset + (5 << 16) + (s << 9));
262 BEGIN_1IC0(push, NVC0_3D(CB_POS), PIPE_MAX_CLIP_PLANES * 4 + 1); 262 BEGIN_1IC0(push, NVC0_3D(CB_POS), PIPE_MAX_CLIP_PLANES * 4 + 1);
263 PUSH_DATA (push, 0); 263 PUSH_DATA (push, 256);
264 PUSH_DATAp(push, &nvc0->clip.ucp[0][0], PIPE_MAX_CLIP_PLANES * 4); 264 PUSH_DATAp(push, &nvc0->clip.ucp[0][0], PIPE_MAX_CLIP_PLANES * 4);
265} 265}
266 266
@@ -289,21 +289,28 @@ nvc0_validate_clip(struct nvc0_context *nvc0)
289{ 289{
290 struct nouveau_pushbuf *push = nvc0->base.pushbuf; 290 struct nouveau_pushbuf *push = nvc0->base.pushbuf;
291 struct nvc0_program *vp; 291 struct nvc0_program *vp;
292 unsigned stage;
292 uint8_t clip_enable = nvc0->rast->pipe.clip_plane_enable; 293 uint8_t clip_enable = nvc0->rast->pipe.clip_plane_enable;
293 294
294 if (nvc0->dirty & NVC0_NEW_CLIP) 295 if (nvc0->gmtyprog) {
295 nvc0_upload_uclip_planes(nvc0); 296 stage = 3;
296 297 vp = nvc0->gmtyprog;
297 vp = nvc0->gmtyprog; 298 } else
298 if (!vp) { 299 if (nvc0->tevlprog) {
300 stage = 2;
299 vp = nvc0->tevlprog; 301 vp = nvc0->tevlprog;
300 if (!vp) 302 } else {
301 vp = nvc0->vertprog; 303 stage = 0;
304 vp = nvc0->vertprog;
302 } 305 }
303 306
304 if (clip_enable && vp->vp.num_ucps < PIPE_MAX_CLIP_PLANES) 307 if (clip_enable && vp->vp.num_ucps < PIPE_MAX_CLIP_PLANES)
305 nvc0_check_program_ucps(nvc0, vp, clip_enable); 308 nvc0_check_program_ucps(nvc0, vp, clip_enable);
306 309
310 if (nvc0->dirty & (NVC0_NEW_CLIP | (NVC0_NEW_VERTPROG << stage)))
311 if (vp->vp.num_ucps <= PIPE_MAX_CLIP_PLANES)
312 nvc0_upload_uclip_planes(nvc0, stage);
313
307 clip_enable &= vp->vp.clip_enable; 314 clip_enable &= vp->vp.clip_enable;
308 315
309 if (nvc0->state.clip_enable != clip_enable) { 316 if (nvc0->state.clip_enable != clip_enable) {
@@ -375,7 +382,7 @@ nvc0_constbufs_validate(struct nvc0_context *nvc0)
375 if (!nouveau_resource_mapped_by_gpu(&res->base)) { 382 if (!nouveau_resource_mapped_by_gpu(&res->base)) {
376 if (i == 0 && (res->status & NOUVEAU_BUFFER_STATUS_USER_MEMORY)) { 383 if (i == 0 && (res->status & NOUVEAU_BUFFER_STATUS_USER_MEMORY)) {
377 base = s << 16; 384 base = s << 16;
378 bo = nvc0->screen->uniforms; 385 bo = nvc0->screen->uniform_bo;
379 386
380 if (nvc0->state.uniform_buffer_bound[s] >= res->base.width0) 387 if (nvc0->state.uniform_buffer_bound[s] >= res->base.width0)
381 rebind = FALSE; 388 rebind = FALSE;
@@ -396,7 +403,7 @@ nvc0_constbufs_validate(struct nvc0_context *nvc0)
396 nvc0->state.uniform_buffer_bound[s] = 0; 403 nvc0->state.uniform_buffer_bound[s] = 0;
397 } 404 }
398 405
399 if (bo != nvc0->screen->uniforms) 406 if (bo != nvc0->screen->uniform_bo)
400 BCTX_REFN(nvc0->bufctx_3d, CB(s, i), res, RD); 407 BCTX_REFN(nvc0->bufctx_3d, CB(s, i), res, RD);
401 408
402 if (rebind) { 409 if (rebind) {
@@ -517,6 +524,7 @@ static struct state_validate {
517 { nvc0_constbufs_validate, NVC0_NEW_CONSTBUF }, 524 { nvc0_constbufs_validate, NVC0_NEW_CONSTBUF },
518 { nvc0_validate_textures, NVC0_NEW_TEXTURES }, 525 { nvc0_validate_textures, NVC0_NEW_TEXTURES },
519 { nvc0_validate_samplers, NVC0_NEW_SAMPLERS }, 526 { nvc0_validate_samplers, NVC0_NEW_SAMPLERS },
527 { nve4_set_tex_handles, NVC0_NEW_TEXTURES | NVC0_NEW_SAMPLERS },
520 { nvc0_vertex_arrays_validate, NVC0_NEW_VERTEX | NVC0_NEW_ARRAYS }, 528 { nvc0_vertex_arrays_validate, NVC0_NEW_VERTEX | NVC0_NEW_ARRAYS },
521 { nvc0_idxbuf_validate, NVC0_NEW_IDXBUF }, 529 { nvc0_idxbuf_validate, NVC0_NEW_IDXBUF },
522 { nvc0_tfb_validate, NVC0_NEW_TFB_TARGETS | NVC0_NEW_GMTYPROG } 530 { nvc0_tfb_validate, NVC0_NEW_TFB_TARGETS | NVC0_NEW_GMTYPROG }