Skip to content

Commit

Permalink
Merge pull request #75957 from clayjohn/VS-default-modes
Browse files Browse the repository at this point in the history
Write out render_mode even when mode is set to default in VisualShaders
  • Loading branch information
akien-mga committed Apr 12, 2023
2 parents 11798fa + 016946b commit d4dad2b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions scene/resources/visual_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d4dad2b

Please sign in to comment.