From 9a1a8cb84d940313130e2ef4e7a94079fa4092b7 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 6 May 2014 22:35:27 -0700 Subject: [PATCH] i965: Drop the degenerate brw_sampler_default_color structure. It's just an array of four floats, and we have an array of four floats, so this is literally just a memcpy...but with custom structs and strange macros to give the appearance of doing something more. Signed-off-by: Kenneth Graunke Reviewed-by: Topi Pohjolainen --- src/mesa/drivers/dri/i965/brw_sampler_state.c | 9 +++------ src/mesa/drivers/dri/i965/brw_state_dump.c | 11 +++++------ src/mesa/drivers/dri/i965/brw_structs.h | 4 ---- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c b/src/mesa/drivers/dri/i965/brw_sampler_state.c index 12aea39dc74..6343ceb7d22 100644 --- a/src/mesa/drivers/dri/i965/brw_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c @@ -197,12 +197,9 @@ upload_default_color(struct brw_context *brw, sdc->f[2] = color[2]; sdc->f[3] = color[3]; } else { - struct brw_sampler_default_color *sdc; - - sdc = brw_state_batch(brw, AUB_TRACE_SAMPLER_DEFAULT_COLOR, - sizeof(*sdc), 32, sdc_offset); - - COPY_4V(sdc->color, color); + float *sdc = brw_state_batch(brw, AUB_TRACE_SAMPLER_DEFAULT_COLOR, + 4 * 4, 32, sdc_offset); + memcpy(sdc, color, 4 * 4); } } diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c index f0f185b0f87..9d838591cde 100644 --- a/src/mesa/drivers/dri/i965/brw_state_dump.c +++ b/src/mesa/drivers/dri/i965/brw_state_dump.c @@ -243,12 +243,11 @@ dump_sdc(struct brw_context *brw, uint32_t offset) batch_out(brw, name, offset, 10, "s16 ba\n"); batch_out(brw, name, offset, 11, "s8 rgba\n"); } else { - struct brw_sampler_default_color *sdc = (brw->batch.bo->virtual + - offset); - batch_out(brw, name, offset, 0, "r %f\n", sdc->color[0]); - batch_out(brw, name, offset, 1, "g %f\n", sdc->color[1]); - batch_out(brw, name, offset, 2, "b %f\n", sdc->color[2]); - batch_out(brw, name, offset, 3, "a %f\n", sdc->color[3]); + float *sdc = brw->batch.bo->virtual + offset; + batch_out(brw, name, offset, 0, "r %f\n", sdc[0]); + batch_out(brw, name, offset, 1, "g %f\n", sdc[1]); + batch_out(brw, name, offset, 2, "b %f\n", sdc[2]); + batch_out(brw, name, offset, 3, "a %f\n", sdc[3]); } } diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h index 620962e27f6..9408ba210c7 100644 --- a/src/mesa/drivers/dri/i965/brw_structs.h +++ b/src/mesa/drivers/dri/i965/brw_structs.h @@ -589,10 +589,6 @@ struct brw_wm_unit_state } wm10; }; -struct brw_sampler_default_color { - float color[4]; -}; - struct gen5_sampler_default_color { uint8_t ub[4]; float f[4]; -- 2.30.2