[Mesa-dev] [PATCH] i965: Don't use brw->fragment_program in the old brw_wm_pass2.c.

Kenneth Graunke kenneth at whitecape.org
Fri Aug 31 22:50:26 PDT 2012


Reading brw->fragment_program is nonsensical in compiler code: it
contains the currently active program (if any), not the one currently
being compiled.  Attempting to access it may either lead to crashes
(null pointer dereference if no program is active) or wrong results.

Not known to fix anything, but that's probably just due to a lack of
testing.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reported-by: Paul Berry <stereotype441 at gmail.com>
---
 src/mesa/drivers/dri/i965/brw_wm_pass2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass2.c b/src/mesa/drivers/dri/i965/brw_wm_pass2.c
index 562a189..f20e0b7 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_pass2.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_pass2.c
@@ -86,7 +86,7 @@ static void init_registers( struct brw_wm_compile *c )
 
    if (intel->gen >= 6) {
       for (unsigned int j = 0; j < FRAG_ATTRIB_MAX; j++) {
-	 if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(j)) {
+	 if (c->fp->program.Base.InputsRead & BITFIELD64_BIT(j)) {
 	    nr_interp_regs++;
 	    prealloc_reg(c, &c->payload.input_interp[j], i++);
 	 }
-- 
1.7.11.4



More information about the mesa-dev mailing list