[Mesa-dev] [PATCH 3/9] anv/pipeline: Refactor specialization constant handling a bit

Jason Ekstrand jason at jlekstrand.net
Wed Jun 1 21:44:54 UTC 2016


Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
Cc: "12.0" <mesa-stable at lists.freedesktop.org>
Cc: Jordan Justen <jljusten at gmail.com>
---
 src/intel/vulkan/anv_pipeline.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 789bc1a..372feeb 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -123,13 +123,12 @@ anv_shader_compile_to_nir(struct anv_device *device,
          num_spec_entries = spec_info->mapEntryCount;
          spec_entries = malloc(num_spec_entries * sizeof(*spec_entries));
          for (uint32_t i = 0; i < num_spec_entries; i++) {
-            const uint32_t *data =
-               spec_info->pData + spec_info->pMapEntries[i].offset;
-            assert((const void *)(data + 1) <=
-                   spec_info->pData + spec_info->dataSize);
+            VkSpecializationMapEntry entry = spec_info->pMapEntries[i];
+            const void *data = spec_info->pData + entry.offset;
+            assert(data + entry.size <= spec_info->pData + spec_info->dataSize);
 
             spec_entries[i].id = spec_info->pMapEntries[i].constantID;
-            spec_entries[i].data = *data;
+            spec_entries[i].data = *(const uint32_t *)data;
          }
       }
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list