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: 328c29d600 ("mesa,glsl,gallium: add GL_OVR_multiview")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: James Hogan <james@albanarts.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32992>
This commit is contained in:
James Hogan
2025-01-12 10:10:25 +00:00
committed by Marge Bot
parent 65f18c4787
commit 7819d322c4
+8
View File
@@ -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;
}