Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-05-18 22:43:21 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-05-19 00:01:08 +0300
commit4fa743af85ecb95cc875d8d8150028719335da0b (patch)
tree336317a7123f3911815e90de12f8236dca37ff9a /source/blender
parent683570c7fe0916acfbfc38964a5ed236e4be0ea5 (diff)
GPUSource: Add error message on source not found
Without this, we could have crashes during static compilation of shaders without knowing where it would come from.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/gpu/intern/gpu_shader_dependency.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_shader_dependency.cc b/source/blender/gpu/intern/gpu_shader_dependency.cc
index aa2033b9154..842914f5bed 100644
--- a/source/blender/gpu/intern/gpu_shader_dependency.cc
+++ b/source/blender/gpu/intern/gpu_shader_dependency.cc
@@ -670,14 +670,20 @@ Vector<const char *> gpu_shader_dependency_get_resolved_source(
const StringRefNull shader_source_name)
{
Vector<const char *> result;
- GPUSource *source = g_sources->lookup(shader_source_name);
- source->build(result);
+ GPUSource *src = g_sources->lookup_default(shader_source_name, nullptr);
+ if (src == nullptr) {
+ std::cout << "Error source not found : " << shader_source_name << std::endl;
+ }
+ src->build(result);
return result;
}
StringRefNull gpu_shader_dependency_get_source(const StringRefNull shader_source_name)
{
- GPUSource *src = g_sources->lookup(shader_source_name);
+ GPUSource *src = g_sources->lookup_default(shader_source_name, nullptr);
+ if (src == nullptr) {
+ std::cout << "Error source not found : " << shader_source_name << std::endl;
+ }
return src->source;
}