[Mesa-dev] [PATCH 20/31] i965/blorp: Take a blorp_context in compile_nir_shader

Jason Ekstrand jason at jlekstrand.net
Fri Aug 19 16:55:57 UTC 2016


---
 src/mesa/drivers/dri/i965/blorp.c       | 7 ++++---
 src/mesa/drivers/dri/i965/blorp.h       | 2 ++
 src/mesa/drivers/dri/i965/blorp_blit.c  | 2 +-
 src/mesa/drivers/dri/i965/blorp_clear.c | 2 +-
 src/mesa/drivers/dri/i965/blorp_priv.h  | 2 +-
 src/mesa/drivers/dri/i965/brw_blorp.c   | 2 ++
 6 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/blorp.c b/src/mesa/drivers/dri/i965/blorp.c
index df10e50..8a334a7 100644
--- a/src/mesa/drivers/dri/i965/blorp.c
+++ b/src/mesa/drivers/dri/i965/blorp.c
@@ -279,13 +279,13 @@ nir_uniform_type_size(const struct glsl_type *type)
 }
 
 const unsigned *
-brw_blorp_compile_nir_shader(struct brw_context *brw, struct nir_shader *nir,
+brw_blorp_compile_nir_shader(struct blorp_context *blorp, struct nir_shader *nir,
                              const struct brw_wm_prog_key *wm_key,
                              bool use_repclear,
                              struct brw_blorp_prog_data *prog_data,
                              unsigned *program_size)
 {
-   const struct brw_compiler *compiler = brw->intelScreen->compiler;
+   const struct brw_compiler *compiler = blorp->compiler;
 
    void *mem_ctx = ralloc_context(NULL);
 
@@ -325,7 +325,8 @@ brw_blorp_compile_nir_shader(struct brw_context *brw, struct nir_shader *nir,
    nir_lower_io(nir, nir_var_uniform, nir_uniform_type_size);
 
    const unsigned *program =
-      brw_compile_fs(compiler, brw, mem_ctx, wm_key, &wm_prog_data, nir,
+      brw_compile_fs(compiler, blorp->driver_ctx, mem_ctx,
+                     wm_key, &wm_prog_data, nir,
                      NULL, -1, -1, false, use_repclear, program_size, NULL);
 
    /* Copy the relavent bits of wm_prog_data over into the blorp prog data */
diff --git a/src/mesa/drivers/dri/i965/blorp.h b/src/mesa/drivers/dri/i965/blorp.h
index 671731e..c37ec3f 100644
--- a/src/mesa/drivers/dri/i965/blorp.h
+++ b/src/mesa/drivers/dri/i965/blorp.h
@@ -46,6 +46,8 @@ struct blorp_context {
 
    const struct isl_device *isl_dev;
 
+   const struct brw_compiler *compiler;
+
    void *ralloc_ctx;
    mtx_t cache_mtx;
    struct hash_table *shader_cache;
diff --git a/src/mesa/drivers/dri/i965/blorp_blit.c b/src/mesa/drivers/dri/i965/blorp_blit.c
index 449e09d..8ac05c4 100644
--- a/src/mesa/drivers/dri/i965/blorp_blit.c
+++ b/src/mesa/drivers/dri/i965/blorp_blit.c
@@ -1214,7 +1214,7 @@ brw_blorp_get_blit_kernel(struct brw_context *brw,
    wm_key.tex.msaa_16 = prog_key->tex_samples == 16;
    wm_key.multisample_fbo = prog_key->rt_samples > 1;
 
-   program = brw_blorp_compile_nir_shader(brw, nir, &wm_key, false,
+   program = brw_blorp_compile_nir_shader(&brw->blorp, nir, &wm_key, false,
                                           &prog_data, &program_size);
 
    blorp_upload_shader(&brw->blorp, BLORP_SHADER_TYPE_BLIT, prog_key,
diff --git a/src/mesa/drivers/dri/i965/blorp_clear.c b/src/mesa/drivers/dri/i965/blorp_clear.c
index 14672de..14f979e 100644
--- a/src/mesa/drivers/dri/i965/blorp_clear.c
+++ b/src/mesa/drivers/dri/i965/blorp_clear.c
@@ -76,7 +76,7 @@ brw_blorp_params_get_clear_kernel(struct brw_context *brw,
    struct brw_blorp_prog_data prog_data;
    unsigned program_size;
    const unsigned *program =
-      brw_blorp_compile_nir_shader(brw, b.shader, &wm_key, use_replicated_data,
+      brw_blorp_compile_nir_shader(&brw->blorp, b.shader, &wm_key, use_replicated_data,
                                    &prog_data, &program_size);
 
    blorp_upload_shader(&brw->blorp, shader_type, NULL,
diff --git a/src/mesa/drivers/dri/i965/blorp_priv.h b/src/mesa/drivers/dri/i965/blorp_priv.h
index c7a2a03..01d7a2e 100644
--- a/src/mesa/drivers/dri/i965/blorp_priv.h
+++ b/src/mesa/drivers/dri/i965/blorp_priv.h
@@ -295,7 +295,7 @@ blorp_upload_shader(struct blorp_context *blorp,
                     const struct brw_blorp_prog_data **prog_data_out);
 
 const unsigned *
-brw_blorp_compile_nir_shader(struct brw_context *brw, struct nir_shader *nir,
+brw_blorp_compile_nir_shader(struct blorp_context *blorp, struct nir_shader *nir,
                              const struct brw_wm_prog_key *wm_key,
                              bool use_repclear,
                              struct brw_blorp_prog_data *prog_data,
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
index e4898a3..ad1f980 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -74,6 +74,8 @@ brw_blorp_init(struct brw_context *brw)
 {
    blorp_init(&brw->blorp, brw, &brw->isl_dev);
 
+   brw->blorp.compiler = brw->intelScreen->compiler;
+
    switch (brw->gen) {
    case 6:
       brw->blorp.mocs.tex = 0;
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list