From 3c89dbdbfea5b5797756782045d0c53206ebf7fa Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 2 Dec 2021 14:16:02 -0600 Subject: intel/fs: Implement the sample_pos_or_center system value Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/compiler/brw_fs.cpp | 5 ++++- src/intel/compiler/brw_fs_nir.cpp | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 4c6c5c70244..65c0f2df1e4 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -9480,7 +9480,10 @@ brw_nir_populate_wm_prog_data(const nir_shader *shader, * persample dispatch, we hard-code it to 0.5. */ prog_data->uses_pos_offset = prog_data->persample_dispatch && - BITSET_TEST(shader->info.system_values_read, SYSTEM_VALUE_SAMPLE_POS); + (BITSET_TEST(shader->info.system_values_read, + SYSTEM_VALUE_SAMPLE_POS) || + BITSET_TEST(shader->info.system_values_read, + SYSTEM_VALUE_SAMPLE_POS_OR_CENTER)); } prog_data->has_render_target_reads = shader->info.outputs_read != 0ull; diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp index 917dbdc745c..6b87bf92af1 100644 --- a/src/intel/compiler/brw_fs_nir.cpp +++ b/src/intel/compiler/brw_fs_nir.cpp @@ -179,6 +179,7 @@ emit_system_values_block(nir_block *block, fs_visitor *v) break; case nir_intrinsic_load_sample_pos: + case nir_intrinsic_load_sample_pos_or_center: assert(v->stage == MESA_SHADER_FRAGMENT); reg = &v->nir_system_values[SYSTEM_VALUE_SAMPLE_POS]; if (reg->file == BAD_FILE) @@ -3444,7 +3445,8 @@ fs_visitor::nir_emit_fs_intrinsic(const fs_builder &bld, emit_frontfacing_interpolation()); break; - case nir_intrinsic_load_sample_pos: { + case nir_intrinsic_load_sample_pos: + case nir_intrinsic_load_sample_pos_or_center: { fs_reg sample_pos = nir_system_values[SYSTEM_VALUE_SAMPLE_POS]; assert(sample_pos.file != BAD_FILE); dest.type = sample_pos.type; -- cgit v1.2.3