From 85c478e170a40bc471fa2e0dec377b237e0a69b3 Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Sun, 15 Jan 2023 16:07:59 +1100 Subject: Make screen texture and depth texture work in Multiview --- drivers/gles3/shaders/scene.glsl | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/gles3/shaders') diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 951155e287..ee7e9dd672 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; @@ -924,8 +930,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); -- cgit v1.2.3