Skip to content

Commit b75de54

Browse files
committed
Merge pull request godotengine#109891 from stuartcarnie/apple_forward_mobile_multiview
Metal: Read `gl_ViewIndex` in tonemapper.glsl for multi-view subpasses
2 parents 6c7f042 + 90c9134 commit b75de54

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

servers/rendering/renderer_rd/shaders/effects/tonemap.glsl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,11 @@ vec3 screen_space_dither(vec2 frag_coord, float bit_alignment_diviser) {
834834
void main() {
835835
#ifdef SUBPASS
836836
// SUBPASS and USE_MULTIVIEW can be combined but in that case we're already reading from the correct layer
837+
#ifdef USE_MULTIVIEW
838+
// In order to ensure the `SpvCapabilityMultiView` is included in the SPIR-V capabilities, gl_ViewIndex must
839+
// be read in the shader. Without this, transpilation to Metal fails to include the multi-view variant.
840+
uint vi = ViewIndex;
841+
#endif
837842
vec4 color = subpassLoad(input_color);
838843
#elif defined(USE_MULTIVIEW)
839844
vec4 color = textureLod(source_color, vec3(uv_interp, ViewIndex), 0.0f);

0 commit comments

Comments
 (0)