summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-04-29 12:34:10 -0700
committerJason Ekstrand <[email protected]>2016-05-14 13:34:53 -0700
commitb0275ad0c9a5ee74b06c7ad48549f8dd6e40bbc8 (patch)
tree250b1091fbe01b8f329ed3677afb00183d769a2c
parent6df3d75206adeae3bb6386c0ed8536a25e6ca3e3 (diff)
i965/blorp: Refactor getting the blit kernel into a helper
Reviewed-by: Topi Pohjolainen <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_blit.cpp35
1 files 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),
+ &params->wm_prog_kernel, &params->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),
+ &params->wm_prog_kernel, &params->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),
- &params.wm_prog_kernel, &params.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),
- &params.wm_prog_kernel, &params.wm_prog_data);
- }
+ brw_blorp_get_blit_kernel(brw, &params, &wm_prog_key);
params.src.swizzle = src_swizzle;