From 085a3662dd60fb1aa7efaa0bc368c7a54ab3a275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sun, 6 Feb 2022 01:21:07 +0100 Subject: [PATCH] GPUShaderCreateInfo: Add duplication error checking of dependency merging As of now we do not allow additional infos duplication. We could in the future but for now assert that this is not the case. --- source/blender/gpu/intern/gpu_shader_create_info.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.cc b/source/blender/gpu/intern/gpu_shader_create_info.cc index 4c306cf64ce..fe0304828c2 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.cc +++ b/source/blender/gpu/intern/gpu_shader_create_info.cc @@ -55,6 +55,8 @@ void ShaderCreateInfo::finalize() } finalized_ = true; + Set deps_merged; + for (auto &info_name : additional_infos_) { const ShaderCreateInfo &info = *reinterpret_cast( gpu_shader_create_info_get(info_name.c_str())); @@ -86,6 +88,10 @@ void ShaderCreateInfo::finalize() } }; + if (!deps_merged.add(info.name_)) { + assert_no_overlap(false, "additional info already merged via another info"); + } + if (info.compute_layout_.local_size_x != -1) { assert_no_overlap(compute_layout_.local_size_x == -1, "Compute layout already defined"); compute_layout_ = info.compute_layout_;