Mesa (master): ac: add 'const' qualifiers to the shader info pass

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Fri Jan 12 11:29:57 UTC 2018


Module: Mesa
Branch: master
Commit: 0eb30d81c4896d27204b83293fb9e32c8a3a5820
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0eb30d81c4896d27204b83293fb9e32c8a3a5820

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Thu Jan 11 22:07:25 2018 +0100

ac: add 'const' qualifiers to the shader info pass

For clarification purposes.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/amd/common/ac_shader_info.c | 17 ++++++++++-------
 src/amd/common/ac_shader_info.h |  2 +-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/amd/common/ac_shader_info.c b/src/amd/common/ac_shader_info.c
index 9dc85fb74f..5716ec043d 100644
--- a/src/amd/common/ac_shader_info.c
+++ b/src/amd/common/ac_shader_info.c
@@ -24,13 +24,15 @@
 #include "ac_shader_info.h"
 #include "ac_nir_to_llvm.h"
 
-static void mark_sampler_desc(nir_variable *var, struct ac_shader_info *info)
+static void mark_sampler_desc(const nir_variable *var,
+			      struct ac_shader_info *info)
 {
 	info->desc_set_used_mask = (1 << var->data.descriptor_set);
 }
 
 static void
-gather_intrinsic_info(nir_intrinsic_instr *instr, struct ac_shader_info *info)
+gather_intrinsic_info(const nir_intrinsic_instr *instr,
+		      struct ac_shader_info *info)
 {
 	switch (instr->intrinsic) {
 	case nir_intrinsic_interp_var_at_sample:
@@ -110,7 +112,7 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, struct ac_shader_info *info)
 }
 
 static void
-gather_tex_info(nir_tex_instr *instr, struct ac_shader_info *info)
+gather_tex_info(const nir_tex_instr *instr, struct ac_shader_info *info)
 {
 	if (instr->sampler)
 		mark_sampler_desc(instr->sampler->var, info);
@@ -119,7 +121,7 @@ gather_tex_info(nir_tex_instr *instr, struct ac_shader_info *info)
 }
 
 static void
-gather_info_block(nir_block *block, struct ac_shader_info *info)
+gather_info_block(const nir_block *block, struct ac_shader_info *info)
 {
 	nir_foreach_instr(instr, block) {
 		switch (instr->type) {
@@ -136,7 +138,7 @@ gather_info_block(nir_block *block, struct ac_shader_info *info)
 }
 
 static void
-gather_info_input_decl(nir_shader *nir, nir_variable *var,
+gather_info_input_decl(const nir_shader *nir, const nir_variable *var,
 		       struct ac_shader_info *info)
 {
 	switch (nir->info.stage) {
@@ -149,11 +151,12 @@ gather_info_input_decl(nir_shader *nir, nir_variable *var,
 }
 
 void
-ac_nir_shader_info_pass(struct nir_shader *nir,
+ac_nir_shader_info_pass(const struct nir_shader *nir,
 			const struct ac_nir_compiler_options *options,
 			struct ac_shader_info *info)
 {
-	struct nir_function *func = (struct nir_function *)exec_list_get_head(&nir->functions);
+	struct nir_function *func =
+		(struct nir_function *)exec_list_get_head_const(&nir->functions);
 
 	if (options->layout->dynamic_offset_count)
 		info->loads_push_constants = true;
diff --git a/src/amd/common/ac_shader_info.h b/src/amd/common/ac_shader_info.h
index 9c9a8473a4..2be61679fc 100644
--- a/src/amd/common/ac_shader_info.h
+++ b/src/amd/common/ac_shader_info.h
@@ -55,7 +55,7 @@ struct ac_shader_info {
  * for the RADV user sgprs
  */
 void
-ac_nir_shader_info_pass(struct nir_shader *nir,
+ac_nir_shader_info_pass(const struct nir_shader *nir,
 			const struct ac_nir_compiler_options *options,
 			struct ac_shader_info *info);
 




More information about the mesa-commit mailing list