From 7819d322c4dd0cc83046b94e6271e5cbf22712a4 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Sun, 12 Jan 2025 10:10:25 +0000 Subject: [PATCH] mesa: Handle GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR The OVR_multiview spec adds the following condition for framebuffer completeness: "The number of views is the same for all populated attachments. { FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR }" So add a condition to _mesa_test_framebuffer_completeness to check that all attachments have identical NumViews. This avoids an infinite recursion between zink_clear() and zink_clear_depth_stencil() in the event of an incomplete FBO. Fixes: 328c29d6007 ("mesa,glsl,gallium: add GL_OVR_multiview") Reviewed-By: Mike Blumenkrantz Signed-off-by: James Hogan Part-of: --- src/mesa/main/fbobject.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 6272bff8eba..064c275cbde 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1286,6 +1286,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, GLenum layer_tex_target = 0; bool has_depth_attachment = false; bool has_stencil_attachment = false; + GLsizei num_views = 0; assert(_mesa_is_user_fbo(fb)); @@ -1553,6 +1554,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, } if (!layer_info_valid) { is_layered = att->Layered; + num_views = att->NumViews; max_layer_count = att_layer_count; layer_info_valid = true; } else if (max_layer_count > 0 && layer_tex_target && @@ -1566,6 +1568,12 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, "framebuffer attachment layer mode is inconsistent", i); return; + } else if (num_views != att->NumViews) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR; + fbo_incomplete(ctx, + "framebuffer attachment view count is inconsistent", + i); + return; } else if (att_layer_count > max_layer_count) { max_layer_count = att_layer_count; }