Skip to content

Commit

Permalink
Add ivec variants to multiview_uv for stereo rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
BastiaanOlij committed Jan 23, 2024
1 parent 0bcc0e9 commit 1066f01
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/gles3/shaders/scene.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -867,12 +867,18 @@ uniform highp sampler2DArray color_buffer; // texunit:-5
vec3 multiview_uv(vec2 uv) {
return vec3(uv, ViewIndex);
}
ivec3 multiview_uv(ivec2 uv) {
return ivec3(uv, int(ViewIndex));
}
#else
uniform highp sampler2D depth_buffer; // texunit:-6
uniform highp sampler2D color_buffer; // texunit:-5
vec2 multiview_uv(vec2 uv) {
return uv;
}
ivec2 multiview_uv(ivec2 uv) {
return uv;
}
#endif

uniform highp mat4 world_transform;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,19 @@ layout(location = 10) out flat uint instance_index_interp;
vec3 multiview_uv(vec2 uv) {
return vec3(uv, ViewIndex);
}
ivec3 multiview_uv(ivec2 uv) {
return ivec3(uv, int(ViewIndex));
}
layout(location = 11) out vec4 combined_projected;
#else // USE_MULTIVIEW
// Set to zero, not supported in non stereo
#define ViewIndex 0
vec2 multiview_uv(vec2 uv) {
return uv;
}
ivec2 multiview_uv(ivec2 uv) {
return uv;
}
#endif //USE_MULTIVIEW

invariant gl_Position;
Expand Down Expand Up @@ -704,13 +710,19 @@ layout(location = 10) in flat uint instance_index_interp;
vec3 multiview_uv(vec2 uv) {
return vec3(uv, ViewIndex);
}
ivec3 multiview_uv(ivec2 uv) {
return ivec3(uv, int(ViewIndex));
}
layout(location = 11) in vec4 combined_projected;
#else // USE_MULTIVIEW
// Set to zero, not supported in non stereo
#define ViewIndex 0
vec2 multiview_uv(vec2 uv) {
return uv;
}
ivec2 multiview_uv(ivec2 uv) {
return uv;
}
#endif //USE_MULTIVIEW

//defines to keep compatibility with vertex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,18 @@ layout(location = 9) out highp float dp_clip;
vec3 multiview_uv(vec2 uv) {
return vec3(uv, ViewIndex);
}
ivec3 multiview_uv(ivec2 uv) {
return ivec3(uv, int(ViewIndex));
}
#else
// Set to zero, not supported in non stereo
#define ViewIndex 0
vec2 multiview_uv(vec2 uv) {
return uv;
}
ivec2 multiview_uv(ivec2 uv) {
return uv;
}
#endif //USE_MULTIVIEW

invariant gl_Position;
Expand Down Expand Up @@ -568,12 +574,18 @@ layout(location = 9) highp in float dp_clip;
vec3 multiview_uv(vec2 uv) {
return vec3(uv, ViewIndex);
}
ivec3 multiview_uv(ivec2 uv) {
return ivec3(uv, int(ViewIndex));
}
#else
// Set to zero, not supported in non stereo
#define ViewIndex 0
vec2 multiview_uv(vec2 uv) {
return uv;
}
ivec2 multiview_uv(ivec2 uv) {
return uv;
}
#endif //USE_MULTIVIEW

//defines to keep compatibility with vertex
Expand Down

0 comments on commit 1066f01

Please sign in to comment.