i965: Un-hardcode border color table from upload_default_color.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 21 Aug 2012 23:13:17 +0000 (16:13 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 19 Aug 2013 20:16:59 +0000 (13:16 -0700)
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>
src/mesa/drivers/dri/i965/brw_state.h
src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
src/mesa/drivers/dri/i965/gen7_sampler_state.c

index a1236b7c08ff903408c3fdf55f6908916bd4ea52..dde9f1f4423a75734b65e9207156ac57d2691d6f 100644 (file)
@@ -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
index 40a6d5be1d630e91be38fec49dfc95ef024f0337..5984e459f45a95ad25959365e4be8f0617b96692 100644 (file)
@@ -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;
index f09c6b3ffe6dda214596df3eb2696898e134ee69..4200f8dff7057ea65a67a308ffe80780d1fe32fa 100644 (file)
@@ -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;