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.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to