summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2012-08-21 16:13:17 -0700
committerKenneth Graunke <kenneth@whitecape.org>2013-08-19 13:16:59 -0700
commited4459b10bda151de0d147936c848939c5da045a (patch)
tree39fc71a7dff575807625ce4dec37b0e7ff756770
parentf5a690cb68d69c0279ab95ecb2d188ede13ada03 (diff)
i965: Un-hardcode border color table from upload_default_color.
When we begin uploading separate sampler state tables for VS and FS, we won't be able to use &brw->wm.sdc_offset[ss_index]. By passing it in as a parameter, we push the problem up to the caller. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Paul Berry <stereotype441@gmail.com>
-rw-r--r--src/mesa/drivers/dri/i965/brw_state.h3
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_sampler_state.c12
-rw-r--r--src/mesa/drivers/dri/i965/gen7_sampler_state.c2
3 files changed, 10 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index a1236b7c08f..dde9f1f4423 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -208,7 +208,8 @@ void gen7_upload_3dstate_so_decl_list(struct brw_context *brw,
uint32_t translate_wrap_mode(GLenum wrap, bool using_nearest);
void upload_default_color(struct brw_context *brw,
struct gl_sampler_object *sampler,
- int unit, int ss_index);
+ int unit,
+ uint32_t *sdc_offset);
/* gen6_sf_state.c */
uint32_t
diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index 40a6d5be1d6..5984e459f45 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -79,8 +79,10 @@ translate_wrap_mode(GLenum wrap, bool using_nearest)
* Upload SAMPLER_BORDER_COLOR_STATE.
*/
void
-upload_default_color(struct brw_context *brw, struct gl_sampler_object *sampler,
- int unit, int ss_index)
+upload_default_color(struct brw_context *brw,
+ struct gl_sampler_object *sampler,
+ int unit,
+ uint32_t *sdc_offset)
{
struct gl_context *ctx = &brw->ctx;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -142,7 +144,7 @@ upload_default_color(struct brw_context *brw, struct gl_sampler_object *sampler,
struct gen5_sampler_default_color *sdc;
sdc = brw_state_batch(brw, AUB_TRACE_SAMPLER_DEFAULT_COLOR,
- sizeof(*sdc), 32, &brw->wm.sdc_offset[ss_index]);
+ sizeof(*sdc), 32, sdc_offset);
memset(sdc, 0, sizeof(*sdc));
@@ -179,7 +181,7 @@ upload_default_color(struct brw_context *brw, struct gl_sampler_object *sampler,
struct brw_sampler_default_color *sdc;
sdc = brw_state_batch(brw, AUB_TRACE_SAMPLER_DEFAULT_COLOR,
- sizeof(*sdc), 32, &brw->wm.sdc_offset[ss_index]);
+ sizeof(*sdc), 32, sdc_offset);
COPY_4V(sdc->color, color);
}
@@ -334,7 +336,7 @@ static void brw_update_sampler_state(struct brw_context *brw,
sampler->ss3.non_normalized_coord = 1;
}
- upload_default_color(brw, gl_sampler, unit, ss_index);
+ upload_default_color(brw, gl_sampler, unit, &brw->wm.sdc_offset[ss_index]);
if (brw->gen >= 6) {
sampler->ss2.default_color_pointer = brw->wm.sdc_offset[ss_index] >> 5;
diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
index f09c6b3ffe6..4200f8dff70 100644
--- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
@@ -168,7 +168,7 @@ gen7_update_sampler_state(struct brw_context *brw, int unit, int ss_index,
sampler->ss3.non_normalized_coord = 1;
}
- upload_default_color(brw, gl_sampler, unit, ss_index);
+ upload_default_color(brw, gl_sampler, unit, &brw->wm.sdc_offset[ss_index]);
sampler->ss2.default_color_pointer = brw->wm.sdc_offset[ss_index] >> 5;