summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-01 07:58:32 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-01 07:58:32 +0100
commit7990b76ad81359fe9273b0ecd7eaa32ef9c1d574 (patch)
treeb89179b0add25d66f4b0b02b938ec1a82817bc5e /servers/rendering/renderer_rd
parent7fb1b1181876e7da970a6fc7aab0a9c2cac44871 (diff)
parent2640e9ee2239e2c5f636430cc644bae075974efc (diff)
Merge pull request #63829 from clayjohn/VULKAN-disable-multiview
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 d8e77366de..3b3979b198 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
@@ -353,6 +353,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);
}
@@ -503,7 +508,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);
+ }
+ }
}
}