diff options
author | Iago Toral Quiroga <[email protected]> | 2017-03-14 13:12:22 +0100 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2017-03-16 11:40:05 +0100 |
commit | e2f707ce5b569e40c2a3821149f87659553467f9 (patch) | |
tree | 6039a8acdac044540ca7a644be34084d4ae754b8 /src/intel/blorp | |
parent | 808503b8f8c0732fccd875ed9183a56672430097 (diff) |
intel/blorp: make upload_shader() return a bool indicating success or failure
For now we always return true, follow-up patches will handle fail scenarios.
Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/intel/blorp')
-rw-r--r-- | src/intel/blorp/blorp.h | 2 | ||||
-rw-r--r-- | src/intel/blorp/blorp_blit.c | 17 | ||||
-rw-r--r-- | src/intel/blorp/blorp_clear.c | 46 |
3 files changed, 39 insertions, 26 deletions
diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h index e0687e92614..eab75d70ab9 100644 --- a/src/intel/blorp/blorp.h +++ b/src/intel/blorp/blorp.h @@ -54,7 +54,7 @@ struct blorp_context { bool (*lookup_shader)(struct blorp_context *blorp, const void *key, uint32_t key_size, uint32_t *kernel_out, void *prog_data_out); - void (*upload_shader)(struct blorp_context *blorp, + bool (*upload_shader)(struct blorp_context *blorp, const void *key, uint32_t key_size, const void *kernel, uint32_t kernel_size, const struct brw_stage_prog_data *prog_data, diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c index e650d5e7bf1..280b76ab70c 100644 --- a/src/intel/blorp/blorp_blit.c +++ b/src/intel/blorp/blorp_blit.c @@ -1285,14 +1285,14 @@ brw_blorp_build_nir_shader(struct blorp_context *blorp, void *mem_ctx, return b.shader; } -static void +static bool brw_blorp_get_blit_kernel(struct blorp_context *blorp, struct blorp_params *params, const struct brw_blorp_blit_prog_key *prog_key) { if (blorp->lookup_shader(blorp, prog_key, sizeof(*prog_key), ¶ms->wm_prog_kernel, ¶ms->wm_prog_data)) - return; + return true; void *mem_ctx = ralloc_context(NULL); @@ -1313,12 +1313,14 @@ brw_blorp_get_blit_kernel(struct blorp_context *blorp, program = blorp_compile_fs(blorp, mem_ctx, nir, &wm_key, false, &prog_data, &program_size); - blorp->upload_shader(blorp, prog_key, sizeof(*prog_key), - program, program_size, - &prog_data.base, sizeof(prog_data), - ¶ms->wm_prog_kernel, ¶ms->wm_prog_data); + bool result = + blorp->upload_shader(blorp, prog_key, sizeof(*prog_key), + program, program_size, + &prog_data.base, sizeof(prog_data), + ¶ms->wm_prog_kernel, ¶ms->wm_prog_data); ralloc_free(mem_ctx); + return result; } static void @@ -1821,7 +1823,8 @@ try_blorp_blit(struct blorp_batch *batch, /* For some texture types, we need to pass the layer through the sampler. */ params->wm_inputs.src_z = params->src.z_offset; - brw_blorp_get_blit_kernel(batch->blorp, params, wm_prog_key); + if (!brw_blorp_get_blit_kernel(batch->blorp, params, wm_prog_key)) + return 0; unsigned result = 0; unsigned max_surface_size = get_max_surface_size(devinfo, params); diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c index 627528defac..4e834ba123e 100644 --- a/src/intel/blorp/blorp_clear.c +++ b/src/intel/blorp/blorp_clear.c @@ -40,7 +40,7 @@ struct brw_blorp_const_color_prog_key bool pad[3]; }; -static void +static bool blorp_params_get_clear_kernel(struct blorp_context *blorp, struct blorp_params *params, bool use_replicated_data) @@ -52,7 +52,7 @@ blorp_params_get_clear_kernel(struct blorp_context *blorp, if (blorp->lookup_shader(blorp, &blorp_key, sizeof(blorp_key), ¶ms->wm_prog_kernel, ¶ms->wm_prog_data)) - return; + return true; void *mem_ctx = ralloc_context(NULL); @@ -79,12 +79,14 @@ blorp_params_get_clear_kernel(struct blorp_context *blorp, blorp_compile_fs(blorp, mem_ctx, b.shader, &wm_key, use_replicated_data, &prog_data, &program_size); - blorp->upload_shader(blorp, &blorp_key, sizeof(blorp_key), - program, program_size, - &prog_data.base, sizeof(prog_data), - ¶ms->wm_prog_kernel, ¶ms->wm_prog_data); + bool result = + blorp->upload_shader(blorp, &blorp_key, sizeof(blorp_key), + program, program_size, + &prog_data.base, sizeof(prog_data), + ¶ms->wm_prog_kernel, ¶ms->wm_prog_data); ralloc_free(mem_ctx); + return result; } struct layer_offset_vs_key { @@ -99,7 +101,7 @@ struct layer_offset_vs_key { * no real concept of "base instance", so we have to do it manually in a * vertex shader. */ -static void +static bool blorp_params_get_layer_offset_vs(struct blorp_context *blorp, struct blorp_params *params) { @@ -112,7 +114,7 @@ blorp_params_get_layer_offset_vs(struct blorp_context *blorp, if (blorp->lookup_shader(blorp, &blorp_key, sizeof(blorp_key), ¶ms->vs_prog_kernel, ¶ms->vs_prog_data)) - return; + return true; void *mem_ctx = ralloc_context(NULL); @@ -168,12 +170,14 @@ blorp_params_get_layer_offset_vs(struct blorp_context *blorp, const unsigned *program = blorp_compile_vs(blorp, mem_ctx, b.shader, &vs_prog_data, &program_size); - blorp->upload_shader(blorp, &blorp_key, sizeof(blorp_key), - program, program_size, - &vs_prog_data.base.base, sizeof(vs_prog_data), - ¶ms->vs_prog_kernel, ¶ms->vs_prog_data); + bool result = + blorp->upload_shader(blorp, &blorp_key, sizeof(blorp_key), + program, program_size, + &vs_prog_data.base.base, sizeof(vs_prog_data), + ¶ms->vs_prog_kernel, ¶ms->vs_prog_data); ralloc_free(mem_ctx); + return result; } /* The x0, y0, x1, and y1 parameters must already be populated with the render @@ -319,7 +323,8 @@ blorp_fast_clear(struct blorp_batch *batch, get_fast_clear_rect(batch->blorp->isl_dev, surf->aux_surf, ¶ms.x0, ¶ms.y0, ¶ms.x1, ¶ms.y1); - blorp_params_get_clear_kernel(batch->blorp, ¶ms, true); + if (!blorp_params_get_clear_kernel(batch->blorp, ¶ms, true)) + return; brw_blorp_surface_info_init(batch->blorp, ¶ms.dst, surf, level, start_layer, format, true); @@ -410,8 +415,9 @@ blorp_clear(struct blorp_batch *batch, } } - blorp_params_get_clear_kernel(batch->blorp, ¶ms, - use_simd16_replicated_data); + if (!blorp_params_get_clear_kernel(batch->blorp, ¶ms, + use_simd16_replicated_data)) + return; while (num_layers > 0) { brw_blorp_surface_info_init(batch->blorp, ¶ms.dst, surf, level, @@ -633,7 +639,8 @@ blorp_clear_attachments(struct blorp_batch *batch, * is tiled or not, we have to assume it may be linear. This means no * SIMD16_REPDATA for us. :-( */ - blorp_params_get_clear_kernel(batch->blorp, ¶ms, false); + if (!blorp_params_get_clear_kernel(batch->blorp, ¶ms, false)) + return; } if (clear_depth) { @@ -650,7 +657,9 @@ blorp_clear_attachments(struct blorp_batch *batch, params.stencil_ref = stencil_value; } - blorp_params_get_layer_offset_vs(batch->blorp, ¶ms); + if (!blorp_params_get_layer_offset_vs(batch->blorp, ¶ms)) + return; + params.vs_inputs.base_layer = start_layer; batch->blorp->exec(batch, ¶ms); @@ -717,7 +726,8 @@ blorp_ccs_resolve(struct blorp_batch *batch, * color" message. */ - blorp_params_get_clear_kernel(batch->blorp, ¶ms, true); + if (!blorp_params_get_clear_kernel(batch->blorp, ¶ms, true)) + return; batch->blorp->exec(batch, ¶ms); } |