From 465519679654636e2e585c573226f00f1f631d3f Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Tue, 14 Sep 2021 23:14:51 +0200 Subject: [PATCH] r300: make global variables const (if possible) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Part-of: --- .../drivers/r300/compiler/r300_fragprog_swizzle.c | 2 +- .../drivers/r300/compiler/r300_fragprog_swizzle.h | 2 +- src/gallium/drivers/r300/compiler/r3xx_vertprog.c | 2 +- src/gallium/drivers/r300/compiler/r3xx_vertprog_dump.c | 10 +++++----- src/gallium/drivers/r300/compiler/r500_fragprog.c | 2 +- src/gallium/drivers/r300/compiler/r500_fragprog.h | 2 +- src/gallium/drivers/r300/compiler/radeon_compiler.h | 2 +- src/gallium/drivers/r300/compiler/radeon_opcodes.c | 2 +- src/gallium/drivers/r300/compiler/radeon_opcodes.h | 2 +- src/gallium/drivers/r300/compiler/radeon_swizzle.h | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/r300/compiler/r300_fragprog_swizzle.c b/src/gallium/drivers/r300/compiler/r300_fragprog_swizzle.c index 89cb9b6d9b5..da2a484d2a8 100644 --- a/src/gallium/drivers/r300/compiler/r300_fragprog_swizzle.c +++ b/src/gallium/drivers/r300/compiler/r300_fragprog_swizzle.c @@ -195,7 +195,7 @@ static void r300_swizzle_split( } } -struct rc_swizzle_caps r300_swizzle_caps = { +const struct rc_swizzle_caps r300_swizzle_caps = { .IsNative = r300_swizzle_is_native, .Split = r300_swizzle_split }; diff --git a/src/gallium/drivers/r300/compiler/r300_fragprog_swizzle.h b/src/gallium/drivers/r300/compiler/r300_fragprog_swizzle.h index f2635be140d..b125944181e 100644 --- a/src/gallium/drivers/r300/compiler/r300_fragprog_swizzle.h +++ b/src/gallium/drivers/r300/compiler/r300_fragprog_swizzle.h @@ -30,7 +30,7 @@ #include "radeon_swizzle.h" -extern struct rc_swizzle_caps r300_swizzle_caps; +extern const struct rc_swizzle_caps r300_swizzle_caps; unsigned int r300FPTranslateRGBSwizzle(unsigned int src, unsigned int swizzle); unsigned int r300FPTranslateAlphaSwizzle(unsigned int src, unsigned int swizzle); diff --git a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c index bd4b16117e3..1f1c9adf5be 100644 --- a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c +++ b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c @@ -864,7 +864,7 @@ static void rc_emulate_negative_addressing(struct radeon_compiler *compiler, voi transform_negative_addressing(c, lastARL, inst, min_offset); } -struct rc_swizzle_caps r300_vertprog_swizzle_caps = { +const struct rc_swizzle_caps r300_vertprog_swizzle_caps = { .IsNative = &swizzle_is_native, .Split = 0 /* should never be called */ }; diff --git a/src/gallium/drivers/r300/compiler/r3xx_vertprog_dump.c b/src/gallium/drivers/r300/compiler/r3xx_vertprog_dump.c index 3cffe4458e8..dde74795b19 100644 --- a/src/gallium/drivers/r300/compiler/r3xx_vertprog_dump.c +++ b/src/gallium/drivers/r300/compiler/r3xx_vertprog_dump.c @@ -26,7 +26,7 @@ #include -static char* r300_vs_ve_ops[] = { +static const char* r300_vs_ve_ops[] = { /* R300 vector ops */ " VE_NO_OP", " VE_DOT_PRODUCT", @@ -63,7 +63,7 @@ static char* r300_vs_ve_ops[] = { " (reserved)", }; -static char* r300_vs_me_ops[] = { +static const char* r300_vs_me_ops[] = { /* R300 math ops */ " ME_NO_OP", " ME_EXP_BASE2_DX", @@ -101,14 +101,14 @@ static char* r300_vs_me_ops[] = { }; /* XXX refactor to avoid clashing symbols */ -static char* r300_vs_src_debug[] = { +static const char* r300_vs_src_debug[] = { "t", "i", "c", "a", }; -static char* r300_vs_dst_debug[] = { +static const char* r300_vs_dst_debug[] = { "t", "a0", "o", @@ -119,7 +119,7 @@ static char* r300_vs_dst_debug[] = { "u", }; -static char* r300_vs_swiz_debug[] = { +static const char* r300_vs_swiz_debug[] = { "X", "Y", "Z", diff --git a/src/gallium/drivers/r300/compiler/r500_fragprog.c b/src/gallium/drivers/r300/compiler/r500_fragprog.c index 8198ff2a36a..6be615f33d4 100644 --- a/src/gallium/drivers/r300/compiler/r500_fragprog.c +++ b/src/gallium/drivers/r300/compiler/r500_fragprog.c @@ -266,7 +266,7 @@ static void r500_swizzle_split(struct rc_src_register src, unsigned int usemask, } } -struct rc_swizzle_caps r500_swizzle_caps = { +const struct rc_swizzle_caps r500_swizzle_caps = { .IsNative = r500_swizzle_is_native, .Split = r500_swizzle_split }; diff --git a/src/gallium/drivers/r300/compiler/r500_fragprog.h b/src/gallium/drivers/r300/compiler/r500_fragprog.h index 6aa448cc6f7..1c30dc0e854 100644 --- a/src/gallium/drivers/r300/compiler/r500_fragprog.h +++ b/src/gallium/drivers/r300/compiler/r500_fragprog.h @@ -40,7 +40,7 @@ extern void r500BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user extern void r500FragmentProgramDump(struct radeon_compiler *c, void *user); -extern struct rc_swizzle_caps r500_swizzle_caps; +extern const struct rc_swizzle_caps r500_swizzle_caps; extern int r500_transform_IF( struct radeon_compiler * c, diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.h b/src/gallium/drivers/r300/compiler/radeon_compiler.h index 9dc6855be3c..7089bcbea2c 100644 --- a/src/gallium/drivers/r300/compiler/radeon_compiler.h +++ b/src/gallium/drivers/r300/compiler/radeon_compiler.h @@ -68,7 +68,7 @@ struct radeon_compiler { * of the compiler */ /*@{*/ - struct rc_swizzle_caps * SwizzleCaps; + const struct rc_swizzle_caps * SwizzleCaps; /*@}*/ struct emulate_loop_state loop_state; diff --git a/src/gallium/drivers/r300/compiler/radeon_opcodes.c b/src/gallium/drivers/r300/compiler/radeon_opcodes.c index 10033e02873..3e08a09499e 100644 --- a/src/gallium/drivers/r300/compiler/radeon_opcodes.c +++ b/src/gallium/drivers/r300/compiler/radeon_opcodes.c @@ -32,7 +32,7 @@ #include "util/compiler.h" -struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { +const struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { { .Opcode = RC_OPCODE_NOP, .Name = "NOP" diff --git a/src/gallium/drivers/r300/compiler/radeon_opcodes.h b/src/gallium/drivers/r300/compiler/radeon_opcodes.h index 1c425050727..3f695ff4801 100644 --- a/src/gallium/drivers/r300/compiler/radeon_opcodes.h +++ b/src/gallium/drivers/r300/compiler/radeon_opcodes.h @@ -268,7 +268,7 @@ struct rc_opcode_info { unsigned int IsStandardScalar:1; }; -extern struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE]; +extern const struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE]; static inline const struct rc_opcode_info * rc_get_opcode_info(rc_opcode opcode) { diff --git a/src/gallium/drivers/r300/compiler/radeon_swizzle.h b/src/gallium/drivers/r300/compiler/radeon_swizzle.h index 9a048e4eacd..f7a9baae1b6 100644 --- a/src/gallium/drivers/r300/compiler/radeon_swizzle.h +++ b/src/gallium/drivers/r300/compiler/radeon_swizzle.h @@ -54,6 +54,6 @@ struct rc_swizzle_caps { void (*Split)(struct rc_src_register reg, unsigned int mask, struct rc_swizzle_split * split); }; -extern struct rc_swizzle_caps r300_vertprog_swizzle_caps; +extern const struct rc_swizzle_caps r300_vertprog_swizzle_caps; #endif /* RADEON_SWIZZLE_H */