Mesa (staging/20.0): radv: Properly handle all sizes of specialization constants
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 27 18:08:04 UTC 2020
Module: Mesa
Branch: staging/20.0
Commit: 844b3828061f8519f33af75895e63beb3c74d412
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=844b3828061f8519f33af75895e63beb3c74d412
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Wed Apr 22 13:42:12 2020 -0500
radv: Properly handle all sizes of specialization constants
cc: mesa-stable at lists.freedesktop.org
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Acked-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4675>
(cherry picked from commit a4885df9f82130132fe361a547b9e61c96787d61)
---
.pick_status.json | 2 +-
src/amd/vulkan/radv_shader.c | 17 +++++++++++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index aea092f24ab..1359da32fb8 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1237,7 +1237,7 @@
"description": "radv: Properly handle all sizes of specialization constants",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": null
},
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 9b387889bb7..d7e2bce0672 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -330,10 +330,23 @@ radv_shader_compile_to_nir(struct radv_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;
+ }
}
}
const struct spirv_to_nir_options spirv_options = {
More information about the mesa-commit
mailing list