summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl27
1 files changed, 14 insertions, 13 deletions
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
index 9f27cea843..92c4fc3d67 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
@@ -384,14 +384,13 @@ void main() {
instance_index_interp = instance_index;
- SceneData scene_data = scene_data_block.data;
mat4 model_matrix = instances.data[instance_index].transform;
#if defined(MOTION_VECTORS)
vertex_shader(instance_index, is_multimesh, scene_data_block.prev_data, instances.data[instance_index].prev_transform, prev_screen_position);
- vertex_shader(instance_index, is_multimesh, scene_data, model_matrix, screen_position);
+ vertex_shader(instance_index, is_multimesh, scene_data_block.data, model_matrix, screen_position);
#else
vec4 screen_position;
- vertex_shader(instance_index, is_multimesh, scene_data, model_matrix, screen_position);
+ vertex_shader(instance_index, is_multimesh, scene_data_block.data, model_matrix, screen_position);
#endif
}
@@ -630,15 +629,7 @@ uint cluster_get_range_clip_mask(uint i, uint z_min, uint z_max) {
#endif //!MODE_RENDER DEPTH
-void main() {
-#ifdef MODE_DUAL_PARABOLOID
-
- if (dp_clip > 0.0)
- discard;
-#endif
-
- SceneData scene_data = scene_data_block.data;
- SceneData prev_scene_data = scene_data_block.prev_data;
+void fragment_shader(in SceneData scene_data) {
uint instance_index = instance_index_interp;
//lay out everything, whatever is unused is optimized away anyway
@@ -2048,7 +2039,7 @@ void main() {
#endif //MODE_RENDER_DEPTH
#ifdef MOTION_VECTORS
vec2 position_clip = (screen_position.xy / screen_position.w) - scene_data.taa_jitter;
- vec2 prev_position_clip = (prev_screen_position.xy / prev_screen_position.w) - prev_scene_data.taa_jitter;
+ vec2 prev_position_clip = (prev_screen_position.xy / prev_screen_position.w) - scene_data_block.prev_data.taa_jitter;
vec2 position_uv = position_clip * vec2(0.5, 0.5);
vec2 prev_position_uv = prev_position_clip * vec2(0.5, 0.5);
@@ -2056,3 +2047,13 @@ void main() {
motion_vector = position_uv - prev_position_uv;
#endif
}
+
+void main() {
+#ifdef MODE_DUAL_PARABOLOID
+
+ if (dp_clip > 0.0)
+ discard;
+#endif
+
+ fragment_shader(scene_data_block.data);
+}