Mesa (master): anv: Properly handle all sizes of specialization constants
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 24 09:40:45 UTC 2020
Module: Mesa
Branch: master
Commit: a44e63398b045f0a5f56e4d719d25a8501ab53cd
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a44e63398b045f0a5f56e4d719d25a8501ab53cd
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Wed Apr 22 13:41:14 2020 -0500
anv: Properly handle all sizes of specialization constants
Closes: #2812
cc: mesa-stable at lists.freedesktop.org
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4675>
---
src/intel/vulkan/anv_pipeline.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 3eee3b74d84..ea232944666 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -147,10 +147,23 @@ anv_shader_compile_to_nir(struct anv_device *device,
assert(data + entry.size <= spec_info->pData + spec_info->dataSize);
spec_entries[i].id = spec_info->pMapEntries[i].constantID;
- if (spec_info->dataSize == 8)
+ switch (entry.size) {
+ case 8:
spec_entries[i].data64 = *(const uint64_t *)data;
- else
+ break;
+ case 4:
spec_entries[i].data32 = *(const uint32_t *)data;
+ break;
+ case 2:
+ spec_entries[i].data32 = *(const uint16_t *)data;
+ break;
+ case 1:
+ spec_entries[i].data32 = *(const uint8_t *)data;
+ break;
+ default:
+ assert(!"Invalid spec constant size");
+ break;
+ }
}
}
More information about the mesa-commit
mailing list