summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2020-04-22 13:42:12 -0500
committerDylan Baker <[email protected]>2020-04-27 10:33:09 -0700
commit844b3828061f8519f33af75895e63beb3c74d412 (patch)
tree0d18cafd32bc4e17d95e671bcc6a3c5e2edcfae2 /src/amd
parentca9452e34c9b4f5bdd4feea7f34c532d39fd9bc9 (diff)
radv: Properly handle all sizes of specialization constants
cc: [email protected] Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4675> (cherry picked from commit a4885df9f82130132fe361a547b9e61c96787d61)
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/vulkan/radv_shader.c17
1 files changed, 15 insertions, 2 deletions
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 = {