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.
This commit is contained in:
Clément Foucault
2022-05-18 21:43:21 +02:00
parent 683570c7fe
commit 4fa743af85

View File

@@ -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;
}