Merge pull request #87460 from BastiaanOlij/stereo_ivec

Add ivec variants to multiview_uv for stereo rendering
This commit is contained in:
Yuri Sizov 2024-01-25 16:27:10 +01:00
commit 1b83e8ae81
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) { vec3 multiview_uv(vec2 uv) {
return vec3(uv, ViewIndex); return vec3(uv, ViewIndex);
} }
ivec3 multiview_uv(ivec2 uv) {
return ivec3(uv, int(ViewIndex));
}
#else #else
uniform highp sampler2D depth_buffer; // texunit:-6 uniform highp sampler2D depth_buffer; // texunit:-6
uniform highp sampler2D color_buffer; // texunit:-5 uniform highp sampler2D color_buffer; // texunit:-5
vec2 multiview_uv(vec2 uv) { vec2 multiview_uv(vec2 uv) {
return uv; return uv;
} }
ivec2 multiview_uv(ivec2 uv) {
return uv;
}
#endif #endif
uniform highp mat4 world_transform; 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) { vec3 multiview_uv(vec2 uv) {
return vec3(uv, ViewIndex); return vec3(uv, ViewIndex);
} }
ivec3 multiview_uv(ivec2 uv) {
return ivec3(uv, int(ViewIndex));
}
layout(location = 11) out vec4 combined_projected; layout(location = 11) out vec4 combined_projected;
#else // USE_MULTIVIEW #else // USE_MULTIVIEW
// Set to zero, not supported in non stereo // Set to zero, not supported in non stereo
@ -147,6 +150,9 @@ layout(location = 11) out vec4 combined_projected;
vec2 multiview_uv(vec2 uv) { vec2 multiview_uv(vec2 uv) {
return uv; return uv;
} }
ivec2 multiview_uv(ivec2 uv) {
return uv;
}
#endif //USE_MULTIVIEW #endif //USE_MULTIVIEW
invariant gl_Position; invariant gl_Position;
@ -704,6 +710,9 @@ layout(location = 10) in flat uint instance_index_interp;
vec3 multiview_uv(vec2 uv) { vec3 multiview_uv(vec2 uv) {
return vec3(uv, ViewIndex); return vec3(uv, ViewIndex);
} }
ivec3 multiview_uv(ivec2 uv) {
return ivec3(uv, int(ViewIndex));
}
layout(location = 11) in vec4 combined_projected; layout(location = 11) in vec4 combined_projected;
#else // USE_MULTIVIEW #else // USE_MULTIVIEW
// Set to zero, not supported in non stereo // Set to zero, not supported in non stereo
@ -711,6 +720,9 @@ layout(location = 11) in vec4 combined_projected;
vec2 multiview_uv(vec2 uv) { vec2 multiview_uv(vec2 uv) {
return uv; return uv;
} }
ivec2 multiview_uv(ivec2 uv) {
return uv;
}
#endif //USE_MULTIVIEW #endif //USE_MULTIVIEW
//defines to keep compatibility with vertex //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) { vec3 multiview_uv(vec2 uv) {
return vec3(uv, ViewIndex); return vec3(uv, ViewIndex);
} }
ivec3 multiview_uv(ivec2 uv) {
return ivec3(uv, int(ViewIndex));
}
#else #else
// Set to zero, not supported in non stereo // Set to zero, not supported in non stereo
#define ViewIndex 0 #define ViewIndex 0
vec2 multiview_uv(vec2 uv) { vec2 multiview_uv(vec2 uv) {
return uv; return uv;
} }
ivec2 multiview_uv(ivec2 uv) {
return uv;
}
#endif //USE_MULTIVIEW #endif //USE_MULTIVIEW
invariant gl_Position; invariant gl_Position;
@ -568,12 +574,18 @@ layout(location = 9) highp in float dp_clip;
vec3 multiview_uv(vec2 uv) { vec3 multiview_uv(vec2 uv) {
return vec3(uv, ViewIndex); return vec3(uv, ViewIndex);
} }
ivec3 multiview_uv(ivec2 uv) {
return ivec3(uv, int(ViewIndex));
}
#else #else
// Set to zero, not supported in non stereo // Set to zero, not supported in non stereo
#define ViewIndex 0 #define ViewIndex 0
vec2 multiview_uv(vec2 uv) { vec2 multiview_uv(vec2 uv) {
return uv; return uv;
} }
ivec2 multiview_uv(ivec2 uv) {
return uv;
}
#endif //USE_MULTIVIEW #endif //USE_MULTIVIEW
//defines to keep compatibility with vertex //defines to keep compatibility with vertex