iris: Extend iris_context dirty state flags to 128 bits.
[mesa.git] / src / gallium / drivers / iris / iris_program.c
index 1b37245199c5396db576ed5ebee21a12b0df5079..98c1c3e93e7a2c9ae60772b66ec342b6af66c044 100644 (file)
@@ -1176,10 +1176,10 @@ iris_update_compiled_vs(struct iris_context *ice)
 
    if (old != shader) {
       ice->shaders.prog[IRIS_CACHE_VS] = shader;
-      ice->state.dirty |= IRIS_DIRTY_VS |
-                          IRIS_DIRTY_BINDINGS_VS |
-                          IRIS_DIRTY_CONSTANTS_VS |
-                          IRIS_DIRTY_VF_SGVS;
+      ice->state.dirty |= IRIS_DIRTY_VF_SGVS;
+      ice->state.stage_dirty |= IRIS_STAGE_DIRTY_VS |
+                                IRIS_STAGE_DIRTY_BINDINGS_VS |
+                                IRIS_STAGE_DIRTY_CONSTANTS_VS;
       shs->sysvals_need_upload = true;
 
       const struct brw_vs_prog_data *vs_prog_data =
@@ -1397,9 +1397,9 @@ iris_update_compiled_tcs(struct iris_context *ice)
 
    if (old != shader) {
       ice->shaders.prog[IRIS_CACHE_TCS] = shader;
-      ice->state.dirty |= IRIS_DIRTY_TCS |
-                          IRIS_DIRTY_BINDINGS_TCS |
-                          IRIS_DIRTY_CONSTANTS_TCS;
+      ice->state.stage_dirty |= IRIS_STAGE_DIRTY_TCS |
+                                IRIS_STAGE_DIRTY_BINDINGS_TCS |
+                                IRIS_STAGE_DIRTY_CONSTANTS_TCS;
       shs->sysvals_need_upload = true;
    }
 }
@@ -1512,16 +1512,16 @@ iris_update_compiled_tes(struct iris_context *ice)
 
    if (old != shader) {
       ice->shaders.prog[IRIS_CACHE_TES] = shader;
-      ice->state.dirty |= IRIS_DIRTY_TES |
-                          IRIS_DIRTY_BINDINGS_TES |
-                          IRIS_DIRTY_CONSTANTS_TES;
+      ice->state.stage_dirty |= IRIS_STAGE_DIRTY_TES |
+                                IRIS_STAGE_DIRTY_BINDINGS_TES |
+                                IRIS_STAGE_DIRTY_CONSTANTS_TES;
       shs->sysvals_need_upload = true;
    }
 
    /* TODO: Could compare and avoid flagging this. */
    const struct shader_info *tes_info = &ish->nir->info;
    if (tes_info->system_values_read & (1ull << SYSTEM_VALUE_VERTICES_IN)) {
-      ice->state.dirty |= IRIS_DIRTY_CONSTANTS_TES;
+      ice->state.stage_dirty |= IRIS_STAGE_DIRTY_CONSTANTS_TES;
       ice->state.shaders[MESA_SHADER_TESS_EVAL].sysvals_need_upload = true;
    }
 }
@@ -1635,9 +1635,9 @@ iris_update_compiled_gs(struct iris_context *ice)
 
    if (old != shader) {
       ice->shaders.prog[IRIS_CACHE_GS] = shader;
-      ice->state.dirty |= IRIS_DIRTY_GS |
-                          IRIS_DIRTY_BINDINGS_GS |
-                          IRIS_DIRTY_CONSTANTS_GS;
+      ice->state.stage_dirty |= IRIS_STAGE_DIRTY_GS |
+                                IRIS_STAGE_DIRTY_BINDINGS_GS |
+                                IRIS_STAGE_DIRTY_CONSTANTS_GS;
       shs->sysvals_need_upload = true;
    }
 }
@@ -1751,12 +1751,12 @@ iris_update_compiled_fs(struct iris_context *ice)
       // XXX: only need to flag CLIP if barycentric has NONPERSPECTIVE
       // toggles.  might be able to avoid flagging SBE too.
       ice->shaders.prog[IRIS_CACHE_FS] = shader;
-      ice->state.dirty |= IRIS_DIRTY_FS |
-                          IRIS_DIRTY_BINDINGS_FS |
-                          IRIS_DIRTY_CONSTANTS_FS |
-                          IRIS_DIRTY_WM |
+      ice->state.dirty |= IRIS_DIRTY_WM |
                           IRIS_DIRTY_CLIP |
                           IRIS_DIRTY_SBE;
+      ice->state.stage_dirty |= IRIS_STAGE_DIRTY_FS |
+                                IRIS_STAGE_DIRTY_BINDINGS_FS |
+                                IRIS_STAGE_DIRTY_CONSTANTS_FS;
       shs->sysvals_need_upload = true;
    }
 }
@@ -1783,9 +1783,9 @@ update_last_vue_map(struct iris_context *ice,
       ice->state.dirty |= IRIS_DIRTY_CLIP |
                           IRIS_DIRTY_SF_CL_VIEWPORT |
                           IRIS_DIRTY_CC_VIEWPORT |
-                          IRIS_DIRTY_SCISSOR_RECT |
-                          IRIS_DIRTY_UNCOMPILED_FS |
-                          ice->state.dirty_for_nos[IRIS_NOS_LAST_VUE_MAP];
+                          IRIS_DIRTY_SCISSOR_RECT;
+      ice->state.stage_dirty |= IRIS_STAGE_DIRTY_UNCOMPILED_FS |
+         ice->state.stage_dirty_for_nos[IRIS_NOS_LAST_VUE_MAP];
    }
 
    if (changed_slots || (old_map && old_map->separate != vue_map->separate)) {
@@ -1821,7 +1821,7 @@ iris_update_pull_constant_descriptors(struct iris_context *ice,
    }
 
    if (any_new_descriptors)
-      ice->state.dirty |= IRIS_DIRTY_BINDINGS_VS << stage;
+      ice->state.stage_dirty |= IRIS_STAGE_DIRTY_BINDINGS_VS << stage;
 }
 
 /**
@@ -1850,6 +1850,7 @@ void
 iris_update_compiled_shaders(struct iris_context *ice)
 {
    const uint64_t dirty = ice->state.dirty;
+   const uint64_t stage_dirty = ice->state.stage_dirty;
 
    struct brw_vue_prog_data *old_prog_datas[4];
    if (!(dirty & IRIS_DIRTY_URB)) {
@@ -1857,7 +1858,8 @@ iris_update_compiled_shaders(struct iris_context *ice)
          old_prog_datas[i] = get_vue_prog_data(ice, i);
    }
 
-   if (dirty & (IRIS_DIRTY_UNCOMPILED_TCS | IRIS_DIRTY_UNCOMPILED_TES)) {
+   if (stage_dirty & (IRIS_STAGE_DIRTY_UNCOMPILED_TCS |
+                      IRIS_STAGE_DIRTY_UNCOMPILED_TES)) {
        struct iris_uncompiled_shader *tes =
           ice->shaders.uncompiled[MESA_SHADER_TESS_EVAL];
        if (tes) {
@@ -1866,19 +1868,20 @@ iris_update_compiled_shaders(struct iris_context *ice)
        } else {
           ice->shaders.prog[IRIS_CACHE_TCS] = NULL;
           ice->shaders.prog[IRIS_CACHE_TES] = NULL;
-          ice->state.dirty |=
-             IRIS_DIRTY_TCS | IRIS_DIRTY_TES |
-             IRIS_DIRTY_BINDINGS_TCS | IRIS_DIRTY_BINDINGS_TES |
-             IRIS_DIRTY_CONSTANTS_TCS | IRIS_DIRTY_CONSTANTS_TES;
+          ice->state.stage_dirty |=
+             IRIS_STAGE_DIRTY_TCS | IRIS_STAGE_DIRTY_TES |
+             IRIS_STAGE_DIRTY_BINDINGS_TCS | IRIS_STAGE_DIRTY_BINDINGS_TES |
+             IRIS_STAGE_DIRTY_CONSTANTS_TCS | IRIS_STAGE_DIRTY_CONSTANTS_TES;
        }
    }
 
-   if (dirty & IRIS_DIRTY_UNCOMPILED_VS)
+   if (stage_dirty & IRIS_STAGE_DIRTY_UNCOMPILED_VS)
       iris_update_compiled_vs(ice);
-   if (dirty & IRIS_DIRTY_UNCOMPILED_GS)
+   if (stage_dirty & IRIS_STAGE_DIRTY_UNCOMPILED_GS)
       iris_update_compiled_gs(ice);
 
-   if (dirty & (IRIS_DIRTY_UNCOMPILED_GS | IRIS_DIRTY_UNCOMPILED_TES)) {
+   if (stage_dirty & (IRIS_STAGE_DIRTY_UNCOMPILED_GS |
+                      IRIS_STAGE_DIRTY_UNCOMPILED_TES)) {
       const struct iris_compiled_shader *gs =
          ice->shaders.prog[MESA_SHADER_GEOMETRY];
       const struct iris_compiled_shader *tes =
@@ -1923,7 +1926,7 @@ iris_update_compiled_shaders(struct iris_context *ice)
       }
    }
 
-   if (dirty & IRIS_DIRTY_UNCOMPILED_FS)
+   if (stage_dirty & IRIS_STAGE_DIRTY_UNCOMPILED_FS)
       iris_update_compiled_fs(ice);
 
    /* Changing shader interfaces may require a URB configuration. */
@@ -1940,7 +1943,7 @@ iris_update_compiled_shaders(struct iris_context *ice)
    }
 
    for (int i = MESA_SHADER_VERTEX; i <= MESA_SHADER_FRAGMENT; i++) {
-      if (ice->state.dirty & (IRIS_DIRTY_CONSTANTS_VS << i))
+      if (ice->state.stage_dirty & (IRIS_STAGE_DIRTY_CONSTANTS_VS << i))
          iris_update_pull_constant_descriptors(ice, i);
    }
 }
@@ -2024,9 +2027,9 @@ iris_update_compiled_cs(struct iris_context *ice)
 
    if (old != shader) {
       ice->shaders.prog[IRIS_CACHE_CS] = shader;
-      ice->state.dirty |= IRIS_DIRTY_CS |
-                          IRIS_DIRTY_BINDINGS_CS |
-                          IRIS_DIRTY_CONSTANTS_CS;
+      ice->state.stage_dirty |= IRIS_STAGE_DIRTY_CS |
+                                IRIS_STAGE_DIRTY_BINDINGS_CS |
+                                IRIS_STAGE_DIRTY_CONSTANTS_CS;
       shs->sysvals_need_upload = true;
    }
 }
@@ -2034,10 +2037,10 @@ iris_update_compiled_cs(struct iris_context *ice)
 void
 iris_update_compiled_compute_shader(struct iris_context *ice)
 {
-   if (ice->state.dirty & IRIS_DIRTY_UNCOMPILED_CS)
+   if (ice->state.stage_dirty & IRIS_STAGE_DIRTY_UNCOMPILED_CS)
       iris_update_compiled_cs(ice);
 
-   if (ice->state.dirty & IRIS_DIRTY_CONSTANTS_CS)
+   if (ice->state.stage_dirty & IRIS_STAGE_DIRTY_CONSTANTS_CS)
       iris_update_pull_constant_descriptors(ice, MESA_SHADER_COMPUTE);
 }
 
@@ -2409,7 +2412,7 @@ iris_delete_shader_state(struct pipe_context *ctx, void *state, gl_shader_stage
 
    if (ice->shaders.uncompiled[stage] == ish) {
       ice->shaders.uncompiled[stage] = NULL;
-      ice->state.dirty |= IRIS_DIRTY_UNCOMPILED_VS << stage;
+      ice->state.stage_dirty |= IRIS_STAGE_DIRTY_UNCOMPILED_VS << stage;
    }
 
    if (ish->const_data) {
@@ -2468,7 +2471,7 @@ bind_shader_state(struct iris_context *ice,
                   struct iris_uncompiled_shader *ish,
                   gl_shader_stage stage)
 {
-   uint64_t dirty_bit = IRIS_DIRTY_UNCOMPILED_VS << stage;
+   uint64_t stage_dirty_bit = IRIS_STAGE_DIRTY_UNCOMPILED_VS << stage;
    const uint64_t nos = ish ? ish->nos : 0;
 
    const struct shader_info *old_info = iris_get_shader_info(ice, stage);
@@ -2476,20 +2479,20 @@ bind_shader_state(struct iris_context *ice,
 
    if ((old_info ? util_last_bit(old_info->textures_used) : 0) !=
        (new_info ? util_last_bit(new_info->textures_used) : 0)) {
-      ice->state.dirty |= IRIS_DIRTY_SAMPLER_STATES_VS << stage;
+      ice->state.stage_dirty |= IRIS_STAGE_DIRTY_SAMPLER_STATES_VS << stage;
    }
 
    ice->shaders.uncompiled[stage] = ish;
-   ice->state.dirty |= dirty_bit;
+   ice->state.stage_dirty |= stage_dirty_bit;
 
    /* Record that CSOs need to mark IRIS_DIRTY_UNCOMPILED_XS when they change
     * (or that they no longer need to do so).
     */
    for (int i = 0; i < IRIS_NOS_COUNT; i++) {
       if (nos & (1 << i))
-         ice->state.dirty_for_nos[i] |= dirty_bit;
+         ice->state.stage_dirty_for_nos[i] |= stage_dirty_bit;
       else
-         ice->state.dirty_for_nos[i] &= ~dirty_bit;
+         ice->state.stage_dirty_for_nos[i] &= ~stage_dirty_bit;
    }
 }