[Mesa-dev] [PATCH mesa] anv: return true only if all the writes succeed, not just the last one

Eric Engestrom eric.engestrom at intel.com
Tue May 29 16:12:31 UTC 2018


Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
---
 src/intel/vulkan/anv_pipeline_cache.c | 38 +++++++++++++--------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c
index 82551e9f81f293ecadbe..6c0edaf1ec1b773802e1 100644
--- a/src/intel/vulkan/anv_pipeline_cache.c
+++ b/src/intel/vulkan/anv_pipeline_cache.c
@@ -96,29 +96,29 @@ static bool
 anv_shader_bin_write_to_blob(const struct anv_shader_bin *shader,
                              struct blob *blob)
 {
-   bool ok;
+   bool ok = true;
 
-   ok = blob_write_uint32(blob, shader->key->size);
-   ok = 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);
 
-   ok = blob_write_uint32(blob, shader->kernel_size);
-   ok = 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);
 
-   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));
+   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));
 
-   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));
+   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;
 }
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list