Mesa (master): nir: gather information about fbfetch and dual source color
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Sep 25 06:56:03 UTC 2020
Module: Mesa
Branch: master
Commit: ea77958fea2b358a9b3de0bf5022e5c72ef63064
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea77958fea2b358a9b3de0bf5022e5c72ef63064
Author: Marek Olšák <marek.olsak at amd.com>
Date: Thu Sep 17 20:25:22 2020 -0400
nir: gather information about fbfetch and dual source color
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6758>
---
src/compiler/nir/nir_gather_info.c | 19 ++++++++++++++++++-
src/compiler/shader_info.h | 2 ++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index 95472782852..90320cbf7db 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -151,8 +151,15 @@ set_io_mask(nir_shader *shader, nir_variable *var, int offset, int len,
}
- if (var->data.fb_fetch_output)
+ if (var->data.fb_fetch_output) {
shader->info.outputs_read |= bitfield;
+ if (shader->info.stage == MESA_SHADER_FRAGMENT)
+ shader->info.fs.uses_fbfetch_output = true;
+ }
+
+ if (shader->info.stage == MESA_SHADER_FRAGMENT &&
+ !is_output_read && var->data.index == 1)
+ shader->info.fs.color_is_dual_source = true;
}
}
}
@@ -402,6 +409,10 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
instr->intrinsic == nir_intrinsic_load_per_vertex_output &&
!src_is_invocation_id(nir_get_io_vertex_index_src(instr)))
shader->info.tess.tcs_cross_invocation_outputs_read |= slot_mask;
+
+ if (shader->info.stage == MESA_SHADER_FRAGMENT &&
+ nir_intrinsic_io_semantics(instr).fb_fetch_output)
+ shader->info.fs.uses_fbfetch_output = true;
break;
case nir_intrinsic_store_output:
@@ -416,6 +427,10 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
if (!nir_src_is_const(*nir_get_io_offset_src(instr)))
shader->info.outputs_accessed_indirectly |= slot_mask;
}
+
+ if (shader->info.stage == MESA_SHADER_FRAGMENT &&
+ nir_intrinsic_io_semantics(instr).dual_source_blend_index)
+ shader->info.fs.color_is_dual_source = true;
break;
case nir_intrinsic_load_subgroup_size:
@@ -777,6 +792,8 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
shader->info.fs.uses_sample_qualifier = false;
shader->info.fs.uses_discard = false;
shader->info.fs.uses_demote = false;
+ shader->info.fs.color_is_dual_source = false;
+ shader->info.fs.uses_fbfetch_output = false;
shader->info.fs.needs_helper_invocations = false;
}
if (shader->info.stage == MESA_SHADER_TESS_CTRL) {
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index eeb1cb0a791..23d174af1a7 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -248,6 +248,8 @@ typedef struct shader_info {
struct {
bool uses_discard:1;
bool uses_demote:1;
+ bool uses_fbfetch_output:1;
+ bool color_is_dual_source:1;
/**
* True if this fragment shader requires helper invocations. This
More information about the mesa-commit
mailing list