summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2022-08-02 09:55:53 -0400
committerclayjohn <claynjohn@gmail.com>2022-08-02 09:55:53 -0400
commit2640e9ee2239e2c5f636430cc644bae075974efc (patch)
tree5e969e76f41a2a6876c1d9a916f950ac1a690d9e /servers/rendering/renderer_rd
parent4b80cb4aa3a351cd58a82dd5996bedf672f370ba (diff)
Disable multiview shader versions when xr is disabled
Diffstat (limited to 'servers/rendering/renderer_rd')
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
index 0faf2e2463..75b861fae6 100644
--- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
@@ -345,6 +345,11 @@ void SceneShaderForwardClustered::ShaderData::set_code(const String &p_code) {
}
int variant = shader_version + shader_flags;
+
+ if (!static_cast<SceneShaderForwardClustered *>(singleton)->shader.is_variant_enabled(variant)) {
+ continue;
+ }
+
RID shader_variant = shader_singleton->shader.version_get_shader(version, variant);
color_pipelines[i][j][l].setup(shader_variant, primitive_rd, raster_state, multisample_state, depth_stencil, blend_state, 0, singleton->default_specialization_constants);
}
@@ -577,7 +582,14 @@ void SceneShaderForwardClustered::init(const String p_defines) {
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_MULTIVIEW, false);
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_MULTIVIEW, false);
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI_MULTIVIEW, false);
- // TODO Add a way to enable/disable color pass flags
+
+ // Disable Color Passes
+ for (int i = 0; i < SHADER_COLOR_PASS_FLAG_COUNT; i++) {
+ // Selectively disable any shader pass that includes Multiview.
+ if ((i & SHADER_COLOR_PASS_FLAG_MULTIVIEW)) {
+ shader.set_variant_enabled(i + SHADER_VERSION_COLOR_PASS, false);
+ }
+ }
}
}