[Mesa-dev] [PATCH] i965: Set dirty bit for NOS fragment shader change

Mike Stroyan mike at lunarg.com
Mon Dec 22 16:22:06 PST 2014


This patch fixes a problem I reported as
[Bug 87619] Changes to state such as render targets change fragment shader without marking it dirty.

I sent a test that demonstrates the problem to the piglit mailing list as
fbo: Changing mrt binding with same shader source

The root cause of problem is rather generic.
brw_upload_wm_prog() calls brw_search_cache() to find the right
 fragment shader for a particular key from brw_wm_populate_key().
It does not set any dirty bit for changes to the shader.
There is a test in brw_upload_state() that checks for changes-

   if (brw->fragment_program != ctx->FragmentProgram._Current) {
      brw->fragment_program = ctx->FragmentProgram._Current;
      brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
   }

But that test is not looking for changes to NOS in the cache key.
It only sees more direct changes to the fragment program.

Setting BRW_NEW_FRAGMENT_PROGRAM in brw_upload_wm_prog() fixes the
particular program that I was debuggging and the piglit test I created.
But I wonder how many other cases occur.  There are six other callers
of brw_search_cache() that may not be getting the right dirty bits
set when cache key changes.


More information about the mesa-dev mailing list