aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_pipeline_cache.c
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2019-02-14 10:12:49 +0200
committerTapani Pälli <[email protected]>2019-02-20 15:39:19 +0200
commit886cee1f96b41b786f9699d57d0048151b3f8c8e (patch)
treeb21b3e7b2abcd9c7f101ff0cca7f1337062c4c3e /src/intel/vulkan/anv_pipeline_cache.c
parent30a01cd9232ed83a0259d184b82e050bae219ed3 (diff)
anv: anv: refactor error handling in anv_shader_bin_write_to_blob()
v2: blob manages error state internally, just return true if errors did not occur (Jason) CID: 1442546 Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_pipeline_cache.c')
-rw-r--r--src/intel/vulkan/anv_pipeline_cache.c54
1 files changed, 26 insertions, 28 deletions
diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c
index 911427b7bf8..5c6dc58f24d 100644
--- a/src/intel/vulkan/anv_pipeline_cache.c
+++ b/src/intel/vulkan/anv_pipeline_cache.c
@@ -127,44 +127,42 @@ static bool
anv_shader_bin_write_to_blob(const struct anv_shader_bin *shader,
struct blob *blob)
{
- bool ok;
+ blob_write_uint32(blob, shader->key->size);
+ blob_write_bytes(blob, shader->key->data, shader->key->size);
- ok = blob_write_uint32(blob, shader->key->size);
- ok = blob_write_bytes(blob, shader->key->data, shader->key->size);
+ blob_write_uint32(blob, shader->kernel_size);
+ blob_write_bytes(blob, shader->kernel.map, shader->kernel_size);
- ok = blob_write_uint32(blob, shader->kernel_size);
- ok = blob_write_bytes(blob, shader->kernel.map, shader->kernel_size);
+ blob_write_uint32(blob, shader->constant_data_size);
+ blob_write_bytes(blob, shader->constant_data.map,
+ shader->constant_data_size);
- ok = blob_write_uint32(blob, shader->constant_data_size);
- ok = blob_write_bytes(blob, shader->constant_data.map,
- shader->constant_data_size);
-
- ok = blob_write_uint32(blob, shader->prog_data_size);
- ok = blob_write_bytes(blob, shader->prog_data, shader->prog_data_size);
- ok = blob_write_bytes(blob, shader->prog_data->param,
- shader->prog_data->nr_params *
- sizeof(*shader->prog_data->param));
+ blob_write_uint32(blob, shader->prog_data_size);
+ blob_write_bytes(blob, shader->prog_data, shader->prog_data_size);
+ blob_write_bytes(blob, shader->prog_data->param,
+ shader->prog_data->nr_params *
+ sizeof(*shader->prog_data->param));
if (shader->xfb_info) {
uint32_t xfb_info_size =
nir_xfb_info_size(shader->xfb_info->output_count);
- ok = blob_write_uint32(blob, xfb_info_size);
- ok = blob_write_bytes(blob, shader->xfb_info, xfb_info_size);
+ blob_write_uint32(blob, xfb_info_size);
+ blob_write_bytes(blob, shader->xfb_info, xfb_info_size);
} else {
- ok = blob_write_uint32(blob, 0);
+ blob_write_uint32(blob, 0);
}
- ok = blob_write_uint32(blob, shader->bind_map.surface_count);
- ok = blob_write_uint32(blob, shader->bind_map.sampler_count);
- ok = blob_write_uint32(blob, shader->bind_map.image_count);
- ok = blob_write_bytes(blob, shader->bind_map.surface_to_descriptor,
- shader->bind_map.surface_count *
- sizeof(*shader->bind_map.surface_to_descriptor));
- ok = blob_write_bytes(blob, shader->bind_map.sampler_to_descriptor,
- shader->bind_map.sampler_count *
- sizeof(*shader->bind_map.sampler_to_descriptor));
-
- return ok;
+ blob_write_uint32(blob, shader->bind_map.surface_count);
+ blob_write_uint32(blob, shader->bind_map.sampler_count);
+ blob_write_uint32(blob, shader->bind_map.image_count);
+ blob_write_bytes(blob, shader->bind_map.surface_to_descriptor,
+ shader->bind_map.surface_count *
+ sizeof(*shader->bind_map.surface_to_descriptor));
+ blob_write_bytes(blob, shader->bind_map.sampler_to_descriptor,
+ shader->bind_map.sampler_count *
+ sizeof(*shader->bind_map.sampler_to_descriptor));
+
+ return !blob->out_of_memory;
}
static struct anv_shader_bin *