diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-28 15:43:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 15:43:47 +0100 |
commit | 039ffda9917205428747eedc125d60afbc48993f (patch) | |
tree | ef719735ea871095ad76008e297a7817e0e551b7 | |
parent | 54a777b523fecb773b1b598bc648d4e979dcefdf (diff) | |
parent | fe5bb06df97c7165e40bc34a94795422f361470b (diff) |
Merge pull request #58628 from BastiaanOlij/fix_parsing_specialisation_constants
Fixing retrospective code for specialisation constants
-rw-r--r-- | drivers/vulkan/rendering_device_vulkan.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 2947a9b04e..9cc505cff1 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -4763,19 +4763,22 @@ Vector<uint8_t> RenderingDeviceVulkan::shader_compile_binary_from_spirv(const Ve for (uint32_t j = 0; j < sc_count; j++) { int32_t existing = -1; RenderingDeviceVulkanShaderBinarySpecializationConstant sconst; - sconst.constant_id = spec_constants[j]->constant_id; - switch (spec_constants[j]->constant_type) { + SpvReflectSpecializationConstant *spc = spec_constants[j]; + + sconst.constant_id = spc->constant_id; + sconst.int_value = 0.0; // clear previous value JIC + switch (spc->constant_type) { case SPV_REFLECT_SPECIALIZATION_CONSTANT_BOOL: { sconst.type = PIPELINE_SPECIALIZATION_CONSTANT_TYPE_BOOL; - sconst.bool_value = spec_constants[j]->default_value.int_bool_value != 0; + sconst.bool_value = spc->default_value.int_bool_value != 0; } break; case SPV_REFLECT_SPECIALIZATION_CONSTANT_INT: { sconst.type = PIPELINE_SPECIALIZATION_CONSTANT_TYPE_INT; - sconst.int_value = spec_constants[j]->default_value.int_bool_value; + sconst.int_value = spc->default_value.int_bool_value; } break; case SPV_REFLECT_SPECIALIZATION_CONSTANT_FLOAT: { sconst.type = PIPELINE_SPECIALIZATION_CONSTANT_TYPE_FLOAT; - sconst.float_value = spec_constants[j]->default_value.float_value; + sconst.float_value = spc->default_value.float_value; } break; } sconst.stage_flags = 1 << p_spirv[i].shader_stage; |