intel/fs: Move more prog_data setup into populate_wm_prog_data
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 24 Oct 2019 22:31:18 +0000 (17:31 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 23 Jun 2020 17:43:53 +0000 (17:43 +0000)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5596>

src/intel/compiler/brw_fs.cpp
src/intel/compiler/brw_wm_iz.cpp

index 70ffe28d40867ba3a45468cb96c424c4db2a232d..bab816227c0ed8bc8e209dd15199863ddb59d9ab 100644 (file)
@@ -7220,24 +7220,6 @@ fs_visitor::setup_fs_payload_gen6()
    assert(dispatch_width % payload_width == 0);
    assert(devinfo->gen >= 6);
 
-   prog_data->uses_src_depth = prog_data->uses_src_w =
-      (nir->info.system_values_read & (1ull << SYSTEM_VALUE_FRAG_COORD)) != 0;
-
-   prog_data->uses_sample_mask =
-      (nir->info.system_values_read & SYSTEM_BIT_SAMPLE_MASK_IN) != 0;
-
-   /* From the Ivy Bridge PRM documentation for 3DSTATE_PS:
-    *
-    *    "MSDISPMODE_PERSAMPLE is required in order to select
-    *    POSOFFSET_SAMPLE"
-    *
-    * So we can only really get sample positions if we are doing real
-    * per-sample dispatch.  If we need gl_SamplePosition and we don't have
-    * persample dispatch, we hard-code it to 0.5.
-    */
-   prog_data->uses_pos_offset = prog_data->persample_dispatch &&
-      (nir->info.system_values_read & SYSTEM_BIT_SAMPLE_POS);
-
    /* R0: PS thread payload header. */
    payload.num_regs++;
 
@@ -8515,6 +8497,9 @@ brw_nir_populate_wm_prog_data(const nir_shader *shader,
                               const struct brw_wm_prog_key *key,
                               struct brw_wm_prog_data *prog_data)
 {
+   prog_data->uses_src_depth = prog_data->uses_src_w =
+      shader->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_FRAG_COORD);
+
    /* key->alpha_test_func means simulating alpha testing via discards,
     * so the shader definitely kills pixels.
     */
@@ -8534,6 +8519,23 @@ brw_nir_populate_wm_prog_data(const nir_shader *shader,
        shader->info.fs.uses_sample_qualifier ||
        shader->info.outputs_read);
 
+   if (devinfo->gen >= 6) {
+      prog_data->uses_sample_mask =
+         shader->info.system_values_read & SYSTEM_BIT_SAMPLE_MASK_IN;
+
+      /* From the Ivy Bridge PRM documentation for 3DSTATE_PS:
+       *
+       *    "MSDISPMODE_PERSAMPLE is required in order to select
+       *    POSOFFSET_SAMPLE"
+       *
+       * So we can only really get sample positions if we are doing real
+       * per-sample dispatch.  If we need gl_SamplePosition and we don't have
+       * persample dispatch, we hard-code it to 0.5.
+       */
+      prog_data->uses_pos_offset = prog_data->persample_dispatch &&
+         (shader->info.system_values_read & SYSTEM_BIT_SAMPLE_POS);
+   }
+
    prog_data->has_render_target_reads = shader->info.outputs_read != 0ull;
 
    prog_data->early_fragment_tests = shader->info.fs.early_fragment_tests;
index c2ea4aafd2b6bdeff4df8b441147b01a6e4811fb..8b280d8f0508a147a7c24506e3dabb9ee112c11a 100644 (file)
@@ -144,8 +144,6 @@ void fs_visitor::setup_fs_payload_gen4()
 
    payload.subspan_coord_reg[0] = reg++;
 
-   prog_data->uses_src_depth =
-      (nir->info.system_values_read & (1ull << SYSTEM_VALUE_FRAG_COORD)) != 0;
    if (wm_iz_table[lookup].sd_present || prog_data->uses_src_depth ||
        kill_stats_promoted_workaround) {
       payload.source_depth_reg[0] = reg;