[Mesa-dev] [PATCH 11/12] r600g: cleanup magic numbers in set_xx_sampler

Marek Olšák maraeo at gmail.com
Tue Feb 21 16:56:02 PST 2012


---
 src/gallium/drivers/r600/evergreen_hw_context.c |    4 ++--
 src/gallium/drivers/r600/r600_hw_context.c      |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c b/src/gallium/drivers/r600/evergreen_hw_context.c
index 989473b..0bc2863 100644
--- a/src/gallium/drivers/r600/evergreen_hw_context.c
+++ b/src/gallium/drivers/r600/evergreen_hw_context.c
@@ -820,7 +820,7 @@ void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struc
 {
 	unsigned offset;
 
-	offset = 0x0003C000 + id * 0xc;
+	offset = R_03C000_SQ_TEX_SAMPLER_WORD0_0 + 12*id;
 	r600_context_pipe_state_set_sampler(ctx, state, offset);
 	evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, id);
 }
@@ -829,7 +829,7 @@ void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struc
 {
 	unsigned offset;
 
-	offset = 0x0003C0D8 + id * 0xc;
+	offset = R_03C000_SQ_TEX_SAMPLER_WORD0_0 + 12*(id + 18);
 	r600_context_pipe_state_set_sampler(ctx, state, offset);
 	evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, id);
 }
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index 526b02a..c1fa9db 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -1059,9 +1059,9 @@ void r600_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r60
 {
 	unsigned offset;
 
-	offset = 0x0003C000 + id * 0xc;
+	offset = R_03C000_SQ_TEX_SAMPLER_WORD0_0 + 12*id;
 	r600_context_pipe_state_set_sampler(ctx, state, offset);
-	offset = 0x0000A400 + id * 0x10;
+	offset = R_00A400_TD_PS_SAMPLER0_BORDER_RED + 16*id;
 	r600_context_pipe_state_set_sampler_border(ctx, state, offset);
 }
 
@@ -1069,9 +1069,9 @@ void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r60
 {
 	unsigned offset;
 
-	offset = 0x0003C0D8 + id * 0xc;
+	offset = R_03C000_SQ_TEX_SAMPLER_WORD0_0 + 12*(id + 18);
 	r600_context_pipe_state_set_sampler(ctx, state, offset);
-	offset = 0x0000A600 + id * 0x10;
+	offset = R_00A600_TD_VS_SAMPLER0_BORDER_RED + 16*id;
 	r600_context_pipe_state_set_sampler_border(ctx, state, offset);
 }
 
-- 
1.7.5.4



More information about the mesa-dev mailing list