From b0275ad0c9a5ee74b06c7ad48549f8dd6e40bbc8 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 29 Apr 2016 12:34:10 -0700 Subject: [PATCH] i965/blorp: Refactor getting the blit kernel into a helper Reviewed-by: Topi Pohjolainen --- src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 35 ++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index ca20015190e..a3ebdb87486 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -1737,6 +1737,27 @@ brw_blorp_blit_program::texture_lookup(struct brw_reg dst, #undef S #undef SWAP_XY_AND_XPYP +static void +brw_blorp_get_blit_kernel(struct brw_context *brw, + struct brw_blorp_params *params, + const struct brw_blorp_blit_prog_key *prog_key) +{ + if (brw_search_cache(&brw->cache, BRW_CACHE_BLORP_PROG, + prog_key, sizeof(*prog_key), + ¶ms->wm_prog_kernel, ¶ms->wm_prog_data)) + return; + + brw_blorp_blit_program prog(brw, prog_key); + GLuint program_size; + const GLuint *program = prog.compile(brw, INTEL_DEBUG & DEBUG_BLORP, + &program_size); + brw_upload_cache(&brw->cache, BRW_CACHE_BLORP_PROG, + prog_key, sizeof(*prog_key), + program, program_size, + &prog.prog_data, sizeof(prog.prog_data), + ¶ms->wm_prog_kernel, ¶ms->wm_prog_data); +} + void brw_blorp_blit_program::render_target_write() { @@ -2203,19 +2224,7 @@ brw_blorp_blit_miptrees(struct brw_context *brw, params.src.y_offset /= 2; } - if (!brw_search_cache(&brw->cache, BRW_CACHE_BLORP_PROG, - &wm_prog_key, sizeof(wm_prog_key), - ¶ms.wm_prog_kernel, ¶ms.wm_prog_data)) { - brw_blorp_blit_program prog(brw, &wm_prog_key); - GLuint program_size; - const GLuint *program = prog.compile(brw, INTEL_DEBUG & DEBUG_BLORP, - &program_size); - brw_upload_cache(&brw->cache, BRW_CACHE_BLORP_PROG, - &wm_prog_key, sizeof(wm_prog_key), - program, program_size, - &prog.prog_data, sizeof(prog.prog_data), - ¶ms.wm_prog_kernel, ¶ms.wm_prog_data); - } + brw_blorp_get_blit_kernel(brw, ¶ms, &wm_prog_key); params.src.swizzle = src_swizzle; -- 2.30.2