[Mesa-dev] [PATCH 20/28] i965/blorp: Refactor getting the blit kernel into a helper
Jason Ekstrand
jason at jlekstrand.net
Tue May 10 23:16:40 UTC 2016
---
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 7067c06..ea64b11 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()
{
@@ -2185,19 +2206,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.5.0.400.gff86faf
More information about the mesa-dev
mailing list