diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-02-06 03:21:07 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-02-06 03:25:46 +0300 |
commit | 085a3662dd60fb1aa7efaa0bc368c7a54ab3a275 (patch) | |
tree | a47f76297dc6aafdb7602ade6c915b86850de7b9 /source/blender/gpu/intern/gpu_shader_create_info.cc | |
parent | 153f2c20b22ae2ee5741e9ec5b662c5d280fc558 (diff) |
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.
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader_create_info.cc')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader_create_info.cc | 6 |
1 files changed, 6 insertions, 0 deletions
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<StringRefNull> deps_merged; + for (auto &info_name : additional_infos_) { const ShaderCreateInfo &info = *reinterpret_cast<const ShaderCreateInfo *>( 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_; |