nv30: reset fragprog bufctx at bind time
authorIlia Mirkin <imirkin@alum.mit.edu>
Mon, 29 Jun 2015 06:38:38 +0000 (02:38 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Tue, 30 Jun 2015 03:03:27 +0000 (23:03 -0400)
A clear will do a partial validate, which will in turn reference all the
buffers in the bufctx again. However the fragprog last validated might
have already been deleted. So reset the bufctx when updating state.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/nv30/nv30_fragprog.c

index dbf36fd53b51e6dcf9c1307609c229f123ca9668..54f91bbd48b50694c5dd63bdfb9a2ee9c12b5f24 100644 (file)
@@ -165,8 +165,15 @@ static void
 nv30_fp_state_bind(struct pipe_context *pipe, void *hwcso)
 {
    struct nv30_context *nv30 = nv30_context(pipe);
+   struct nv30_fragprog *fp = hwcso;
+
+   /* reset the bucftx so that we don't keep a dangling reference to the fp
+    * code
+    */
+   if (fp != nv30->state.fragprog)
+      PUSH_RESET(nv30->base.pushbuf, BUFCTX_FRAGPROG);
 
-   nv30->fragprog.program = hwcso;
+   nv30->fragprog.program = fp;
    nv30->dirty |= NV30_NEW_FRAGPROG;
 }