i965: Move some /* CACHE_NEW_SAMPLER */ comments.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 25 Nov 2014 06:20:29 +0000 (22:20 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 29 Nov 2014 10:18:44 +0000 (02:18 -0800)
Marking brw_stage_state::sampler_count as CACHE_NEW_SAMPLER is wrong.

The number of samplers used by each program is actually computed at
draw time (brw_try_draw_prims), based purely on the currently bound
shader programs (gl_program::SamplersUsed).

CACHE_NEW_SAMPLER means that we've emitted a new SAMPLER_STATE table.
Although this could indicate that the number of samplers has changed,
it could also simply mean that the contents of the table has changed
(i.e. we've bound different textures).

The real reason these atoms depend on CACHE_NEW_SAMPLER is because they
include a pointer to the SAMPLER_STATE table.  This was not commented.

So, move the comments to the appropriate place.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_vs_state.c
src/mesa/drivers/dri/i965/brw_wm_state.c

index cd740db3ee67ed079f3cd332de72189ee2649315..351f7ef8cfa0f7dd50bd2fbfd03119910dc9fa4f 100644 (file)
@@ -145,7 +145,6 @@ brw_upload_vs_unit(struct brw_context *brw)
    if (brw->gen == 5)
       vs->vs5.sampler_count = 0; /* hardware requirement */
    else {
-      /* CACHE_NEW_SAMPLER */
       vs->vs5.sampler_count = (stage_state->sampler_count + 3) / 4;
    }
 
@@ -160,6 +159,7 @@ brw_upload_vs_unit(struct brw_context *brw)
    /* Set the sampler state pointer, and its reloc
     */
    if (stage_state->sampler_count) {
+      /* CACHE_NEW_SAMPLER - reloc */
       vs->vs5.sampler_state_pointer =
          (brw->batch.bo->offset64 + stage_state->sampler_offset) >> 5;
       drm_intel_bo_emit_reloc(brw->batch.bo,
index 6a53a98eec62bf19a1af6e6274d318095734c22a..2f315c6996fce9a5bd587e954483151a98df2ae3 100644 (file)
@@ -150,12 +150,11 @@ brw_upload_wm_unit(struct brw_context *brw)
    if (brw->gen == 5)
       wm->wm4.sampler_count = 0; /* hardware requirement */
    else {
-      /* CACHE_NEW_SAMPLER */
       wm->wm4.sampler_count = (brw->wm.base.sampler_count + 1) / 4;
    }
 
    if (brw->wm.base.sampler_count) {
-      /* reloc */
+      /* CACHE_NEW_SAMPLER - reloc */
       wm->wm4.sampler_state_pointer = (brw->batch.bo->offset64 +
                                       brw->wm.base.sampler_offset) >> 5;
    } else {