summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-04-27 17:18:02 -0700
committerJason Ekstrand <[email protected]>2016-05-14 13:34:53 -0700
commitbb45f42f55ba769e4b2bba573043fca3aa533225 (patch)
treedbb9fc37ecd8ea87ab86ff0afe8fad1cbda2f6e6 /src/mesa
parentc1fe8859d3ec28bd7046390a1c0e9ec76074e2d1 (diff)
i965/blorp: Create the program key in get_clear_kernel
There's no reason to be passing a whole struct around just for a single boolean. We can create it later when we actually need to use it as a key. Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_clear.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index ae7286220e1..341a03ac62a 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -99,16 +99,20 @@ brw_blorp_const_color_program::~brw_blorp_const_color_program()
static void
brw_blorp_params_get_clear_kernel(struct brw_context *brw,
struct brw_blorp_params *params,
- brw_blorp_const_color_prog_key *wm_prog_key)
+ bool use_replicated_data)
{
+ struct brw_blorp_const_color_prog_key blorp_key;
+ memset(&blorp_key, 0, sizeof(blorp_key));
+ blorp_key.use_simd16_replicated_data = use_replicated_data;
+
if (!brw_search_cache(&brw->cache, BRW_CACHE_BLORP_PROG,
- wm_prog_key, sizeof(*wm_prog_key),
+ &blorp_key, sizeof(blorp_key),
&params->wm_prog_kernel, &params->wm_prog_data)) {
- brw_blorp_const_color_program prog(brw, wm_prog_key);
+ brw_blorp_const_color_program prog(brw, &blorp_key);
GLuint program_size;
const GLuint *program = prog.compile(brw, &program_size);
brw_upload_cache(&brw->cache, BRW_CACHE_BLORP_PROG,
- wm_prog_key, sizeof(*wm_prog_key),
+ &blorp_key, sizeof(blorp_key),
program, program_size,
&prog.prog_data, sizeof(prog.prog_data),
&params->wm_prog_kernel, &params->wm_prog_data);
@@ -257,10 +261,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
memcpy(&params.wm_push_consts.dst_x0,
ctx->Color.ClearColor.f, sizeof(float) * 4);
- brw_blorp_const_color_prog_key wm_prog_key;
- memset(&wm_prog_key, 0, sizeof(wm_prog_key));
-
- wm_prog_key.use_simd16_replicated_data = true;
+ bool use_simd16_replicated_data = true;
/* From the SNB PRM (Vol4_Part1):
*
@@ -269,17 +270,17 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
* (untiled) memory is UNDEFINED."
*/
if (irb->mt->tiling == I915_TILING_NONE)
- wm_prog_key.use_simd16_replicated_data = false;
+ use_simd16_replicated_data = false;
/* Constant color writes ignore everyting in blend and color calculator
* state. This is not documented.
*/
if (set_write_disables(irb, ctx->Color.ColorMask[buf],
params.color_write_disable))
- wm_prog_key.use_simd16_replicated_data = false;
+ use_simd16_replicated_data = false;
if (irb->mt->fast_clear_state != INTEL_FAST_CLEAR_STATE_NO_MCS &&
- !partial_clear && wm_prog_key.use_simd16_replicated_data &&
+ !partial_clear && use_simd16_replicated_data &&
brw_is_color_fast_clear_compatible(brw, irb->mt,
&ctx->Color.ClearColor)) {
memset(&params.wm_push_consts, 0xff, 4*sizeof(float));
@@ -292,7 +293,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
&params.x1, &params.y1);
}
- brw_blorp_params_get_clear_kernel(brw, &params, &wm_prog_key);
+ brw_blorp_params_get_clear_kernel(brw, &params, use_simd16_replicated_data);
const bool is_fast_clear =
params.fast_clear_op == GEN7_PS_RENDER_TARGET_FAST_CLEAR_ENABLE;
@@ -328,7 +329,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
const char *clear_type;
if (is_fast_clear)
clear_type = "fast";
- else if (wm_prog_key.use_simd16_replicated_data)
+ else if (use_simd16_replicated_data)
clear_type = "replicated";
else
clear_type = "slow";
@@ -429,11 +430,8 @@ brw_blorp_resolve_color(struct brw_context *brw, struct intel_mipmap_tree *mt)
* ensure that the fragment shader delivers the data using the "replicated
* color" message.
*/
- brw_blorp_const_color_prog_key wm_prog_key;
- memset(&wm_prog_key, 0, sizeof(wm_prog_key));
- wm_prog_key.use_simd16_replicated_data = true;
- brw_blorp_params_get_clear_kernel(brw, &params, &wm_prog_key);
+ brw_blorp_params_get_clear_kernel(brw, &params, true);
brw_blorp_exec(brw, &params);
mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;