summaryrefslogtreecommitdiff
path: root/drivers/gles3/shaders
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-26 01:11:02 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-26 01:11:02 +0100
commit4b0363312e9d13349cc7e1cfeff03168206a4da5 (patch)
tree85361177e993f9070bddc6d66e74adca6041f30f /drivers/gles3/shaders
parent9b66b07c317cf685901693e6d7fcc33ae74cdd27 (diff)
parent85c478e170a40bc471fa2e0dec377b237e0a69b3 (diff)
Merge pull request #71455 from BastiaanOlij/fix_stereo_screen_depth
Make screen texture and depth texture work in Multiview
Diffstat (limited to 'drivers/gles3/shaders')
-rw-r--r--drivers/gles3/shaders/scene.glsl10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 52ff70f746..f977c8ceaf 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -565,9 +565,15 @@ uniform highp samplerCubeShadow positional_shadow; // texunit:-4
#ifdef USE_MULTIVIEW
uniform highp sampler2DArray depth_buffer; // texunit:-6
uniform highp sampler2DArray color_buffer; // texunit:-5
+vec3 multiview_uv(vec2 uv) {
+ return vec3(uv, ViewIndex);
+}
#else
uniform highp sampler2D depth_buffer; // texunit:-6
uniform highp sampler2D color_buffer; // texunit:-5
+vec2 multiview_uv(vec2 uv) {
+ return uv;
+}
#endif
uniform highp mat4 world_transform;
@@ -925,8 +931,12 @@ void main() {
vec3 vertex = vertex_interp;
#ifdef USE_MULTIVIEW
vec3 view = -normalize(vertex_interp - multiview_data.eye_offset[ViewIndex].xyz);
+ mat4 projection_matrix = multiview_data.projection_matrix_view[ViewIndex];
+ mat4 inv_projection_matrix = multiview_data.inv_projection_matrix_view[ViewIndex];
#else
vec3 view = -normalize(vertex_interp);
+ mat4 projection_matrix = scene_data.projection_matrix;
+ mat4 inv_projection_matrix = scene_data.inv_projection_matrix;
#endif
highp mat4 model_matrix = world_transform;
vec3 albedo = vec3(1.0);