Signed-off-by: Topi Pohjolainen <topi.pohjolai...@intel.com> --- src/intel/vulkan/anv_pipeline.c | 6 ++++-- src/mesa/drivers/dri/i965/brw_blorp.c | 5 ++--- src/mesa/drivers/dri/i965/brw_blorp.h | 3 +-- src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 2 +- src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 4 +++- src/mesa/drivers/dri/i965/brw_compiler.h | 8 ++++++-- src/mesa/drivers/dri/i965/brw_fs.cpp | 12 +++++++----- src/mesa/drivers/dri/i965/brw_fs.h | 2 +- src/mesa/drivers/dri/i965/brw_wm.c | 6 ++++-- 9 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index d63e50e..c56c377 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -679,10 +679,12 @@ anv_pipeline_compile_fs(struct anv_pipeline *pipeline, ralloc_steal(mem_ctx, nir); unsigned code_size; + const int flags = + BRW_FS_COMPILER_OPTION_ALLOW_SPILLING | + (pipeline->use_repclear ? BRW_FS_COMPILER_OPTION_REP_SEND : 0); const unsigned *shader_code = brw_compile_fs(compiler, NULL, mem_ctx, &key, &prog_data, nir, - NULL, -1, -1, true, pipeline->use_repclear, - &code_size, NULL); + NULL, -1, -1, flags, &code_size, NULL); if (shader_code == NULL) { ralloc_free(mem_ctx); return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c index ce37838..7a5f1d2 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.c +++ b/src/mesa/drivers/dri/i965/brw_blorp.c @@ -167,8 +167,7 @@ nir_uniform_type_size(const struct glsl_type *type) const unsigned * brw_blorp_compile_nir_shader(struct brw_context *brw, struct nir_shader *nir, - const struct brw_wm_prog_key *wm_key, - bool use_repclear, + const struct brw_wm_prog_key *wm_key, int flags, struct brw_blorp_prog_data *prog_data, unsigned *program_size) { @@ -222,7 +221,7 @@ brw_blorp_compile_nir_shader(struct brw_context *brw, struct nir_shader *nir, const unsigned *program = brw_compile_fs(compiler, brw, mem_ctx, wm_key, &wm_prog_data, nir, - NULL, -1, -1, false, use_repclear, program_size, NULL); + NULL, -1, -1, flags, program_size, NULL); /* Copy the relavent bits of wm_prog_data over into the blorp prog data */ prog_data->dispatch_8 = wm_prog_data.dispatch_8; diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h index 3918f83..4e619d2 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.h +++ b/src/mesa/drivers/dri/i965/brw_blorp.h @@ -373,8 +373,7 @@ void brw_blorp_init_wm_prog_key(struct brw_wm_prog_key *wm_key); const unsigned * brw_blorp_compile_nir_shader(struct brw_context *brw, struct nir_shader *nir, - const struct brw_wm_prog_key *wm_key, - bool use_repclear, + const struct brw_wm_prog_key *wm_key, int flags, struct brw_blorp_prog_data *prog_data, unsigned *program_size); diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index 1b8e112..633c438 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -1520,7 +1520,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, nir, &wm_key, 0, &prog_data, &program_size); brw_upload_cache(&brw->cache, BRW_CACHE_BLORP_PROG, diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp index 2515a04..5aa420f 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp @@ -83,8 +83,10 @@ brw_blorp_params_get_clear_kernel(struct brw_context *brw, struct brw_blorp_prog_data prog_data; unsigned program_size; + const int flags = + use_replicated_data ? BRW_FS_COMPILER_OPTION_REP_SEND : 0; const unsigned *program = - brw_blorp_compile_nir_shader(brw, b.shader, &wm_key, use_replicated_data, + brw_blorp_compile_nir_shader(brw, b.shader, &wm_key, flags, &prog_data, &program_size); brw_upload_cache(&brw->cache, BRW_CACHE_BLORP_PROG, diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h index a8fb486..3c3b35a 100644 --- a/src/mesa/drivers/dri/i965/brw_compiler.h +++ b/src/mesa/drivers/dri/i965/brw_compiler.h @@ -127,6 +127,11 @@ enum PACKED gen6_gather_sampler_wa { WA_16BIT = 4, /* if we have a 16bit format needing wa */ }; +enum { + BRW_FS_COMPILER_OPTION_ALLOW_SPILLING = 1 << 0, + BRW_FS_COMPILER_OPTION_REP_SEND = 1 << 1, +}; + /** * Sampler information needed by VS, WM, and GS program cache keys. */ @@ -797,8 +802,7 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data, struct gl_program *prog, int shader_time_index8, int shader_time_index16, - bool allow_spilling, - bool use_rep_send, + int flags, unsigned *final_assembly_size, char **error_str); diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index bb2caa5..4d0c7aa 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -5750,8 +5750,10 @@ fs_visitor::run_gs() } bool -fs_visitor::run_fs(bool allow_spilling, bool do_rep_send) +fs_visitor::run_fs(int flags) { + const bool allow_spilling = flags & BRW_FS_COMPILER_OPTION_ALLOW_SPILLING; + const bool do_rep_send = flags & BRW_FS_COMPILER_OPTION_REP_SEND; brw_wm_prog_data *wm_prog_data = (brw_wm_prog_data *) this->prog_data; brw_wm_prog_key *wm_key = (brw_wm_prog_key *) this->key; @@ -5982,8 +5984,7 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data, const nir_shader *src_shader, struct gl_program *prog, int shader_time_index8, int shader_time_index16, - bool allow_spilling, - bool use_rep_send, + int flags, unsigned *final_assembly_size, char **error_str) { @@ -6026,7 +6027,7 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data, fs_visitor v8(compiler, log_data, mem_ctx, key, &prog_data->base, prog, shader, 8, shader_time_index8); - if (!v8.run_fs(allow_spilling, false /* do_rep_send */)) { + if (!v8.run_fs(flags & BRW_FS_COMPILER_OPTION_ALLOW_SPILLING)) { if (error_str) *error_str = ralloc_strdup(mem_ctx, v8.fail_msg); @@ -6037,6 +6038,7 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data, simd8_grf_used = v8.grf_used; } + const bool use_rep_send = flags & BRW_FS_COMPILER_OPTION_REP_SEND; if (!v8.simd16_unsupported && likely(!(INTEL_DEBUG & DEBUG_NO16) || use_rep_send)) { /* Try a SIMD16 compile */ @@ -6044,7 +6046,7 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data, &prog_data->base, prog, shader, 16, shader_time_index16); v16.import_uniforms(&v8); - if (!v16.run_fs(allow_spilling, use_rep_send)) { + if (!v16.run_fs(flags)) { compiler->shader_perf_log(log_data, "SIMD16 shader failed to compile: %s", v16.fail_msg); diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 062fcd5..67fd3f5 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -105,7 +105,7 @@ public: uint32_t const_offset); void DEP_RESOLVE_MOV(const brw::fs_builder &bld, int grf); - bool run_fs(bool allow_spilling, bool do_rep_send); + bool run_fs(int flags); bool run_vs(gl_clip_plane *clip_planes); bool run_tcs_single_patch(); bool run_tes(); diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 1943d08..822bec8 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -135,11 +135,13 @@ brw_codegen_wm_prog(struct brw_context *brw, } char *error_str = NULL; + const int flags = + BRW_FS_COMPILER_OPTION_ALLOW_SPILLING | + (brw->use_rep_send ? BRW_FS_COMPILER_OPTION_REP_SEND : 0); program = brw_compile_fs(brw->intelScreen->compiler, brw, mem_ctx, key, &prog_data, fp->program.Base.nir, &fp->program.Base, st_index8, st_index16, - true, brw->use_rep_send, - &program_size, &error_str); + flags, &program_size, &error_str); if (program == NULL) { if (prog) { prog->LinkStatus = false; -- 2.5.5 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev