Add ivec variants to multiview_uv for stereo rendering

This commit is contained in:
Bastiaan Olij 2024-01-22 13:53:38 +11:00
parent 0bcc0e92b3
commit 1066f01607
3 changed files with 30 additions and 0 deletions

View File

@ -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;

View File

@ -140,6 +140,9 @@ 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
@ -147,6 +150,9 @@ layout(location = 11) out vec4 combined_projected;
vec2 multiview_uv(vec2 uv) {
return uv;
}
ivec2 multiview_uv(ivec2 uv) {
return uv;
}
#endif //USE_MULTIVIEW
invariant gl_Position;
@ -704,6 +710,9 @@ 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
@ -711,6 +720,9 @@ layout(location = 11) in vec4 combined_projected;
vec2 multiview_uv(vec2 uv) {
return uv;
}
ivec2 multiview_uv(ivec2 uv) {
return uv;
}
#endif //USE_MULTIVIEW
//defines to keep compatibility with vertex

View File

@ -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;
@ -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