summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2023-04-11 18:03:00 -0700
committerYuri Sizov <yuris@humnom.net>2023-04-24 16:28:28 +0200
commit95f50274534563dbcb27e6ed3fcfa25a77f366e9 (patch)
tree23ae630ef1cd972a618b8c34d2254cface511546 /scene/resources
parente071fb226374e027eedf5660294288a683b422a7 (diff)
Write out render_mode even when mode is set to default in VisualShaders
(cherry picked from commit 016946b552e16a43eef14b89c010d41dfc28d340)
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/visual_shader.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 3a6d40d22c..e46b643cd1 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -2183,11 +2183,17 @@ void VisualShader::_update_shader() const {
const String temp = String(info.name);
if (!info.options.is_empty()) {
+ if (!render_mode.is_empty()) {
+ render_mode += ", ";
+ }
+ // Always write out a render_mode for the enumerated modes as having no render mode is not always
+ // the same as the default. i.e. for depth_draw_opaque, the render mode has to be declared for it
+ // to work properly, no render mode is an invalid option.
if (modes.has(temp) && modes[temp] < info.options.size()) {
- if (!render_mode.is_empty()) {
- render_mode += ", ";
- }
render_mode += temp + "_" + info.options[modes[temp]];
+ } else {
+ // Use the default.
+ render_mode += temp + "_" + info.options[0];
}
} else if (flags.has(temp)) {
flag_names.push_back(temp);