Module: Mesa Branch: staging/20.0 Commit: ca9452e34c9b4f5bdd4feea7f34c532d39fd9bc9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca9452e34c9b4f5bdd4feea7f34c532d39fd9bc9
Author: Jason Ekstrand <[email protected]> Date: Wed Apr 22 13:41:14 2020 -0500 anv: Properly handle all sizes of specialization constants Closes: #2812 cc: [email protected] Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4675> (cherry picked from commit a44e63398b045f0a5f56e4d719d25a8501ab53cd) --- .pick_status.json | 2 +- src/intel/vulkan/anv_pipeline.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index e0b674193ff..aea092f24ab 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1246,7 +1246,7 @@ "description": "anv: 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/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index c5059204978..f0bc24437e4 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -156,10 +156,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; + } } } _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
