summaryrefslogtreecommitdiff
path: root/servers/rendering
diff options
context:
space:
mode:
authorChristopheClaustre <christophe.claustre.31@gmail.com>2021-10-16 21:18:27 +0200
committerChristopheClaustre <christophe.claustre.31@gmail.com>2021-11-09 22:53:30 +0100
commitcc39ba5509263346f33894be3a2c84580c1168a9 (patch)
tree6e42cd1f5c32c69be0c8fb4131705d5e69c33ace /servers/rendering
parent06a33e590f029d4d96e32df62f3c3961e1c33e4e (diff)
rendering_device: if one compiles with at least on stage without sources, it was always returning an unusable bytecode (because errored)
Diffstat (limited to 'servers/rendering')
-rw-r--r--servers/rendering/rendering_device.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp
index dcbc5f5c8e..5602bb197b 100644
--- a/servers/rendering/rendering_device.cpp
+++ b/servers/rendering/rendering_device.cpp
@@ -185,9 +185,13 @@ Ref<RDShaderSPIRV> RenderingDevice::_shader_compile_spirv_from_source(const Ref<
String error;
ShaderStage stage = ShaderStage(i);
- Vector<uint8_t> spirv = shader_compile_spirv_from_source(stage, p_source->get_stage_source(stage), p_source->get_language(), &error, p_allow_cache);
- bytecode->set_stage_bytecode(stage, spirv);
- bytecode->set_stage_compile_error(stage, error);
+ String source = p_source->get_stage_source(stage);
+
+ if (!source.is_empty()) {
+ Vector<uint8_t> spirv = shader_compile_spirv_from_source(stage, source, p_source->get_language(), &error, p_allow_cache);
+ bytecode->set_stage_bytecode(stage, spirv);
+ bytecode->set_stage_compile_error(stage, error);
+ }
}
return bytecode;
}