From def5f682696813d3dba4ff86a32074d09230b1b0 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Fri, 24 Jan 2025 18:42:51 +0000 Subject: [PATCH] mesa: Fix multiview attachment completeness check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the FBO attachment completeness test to ensure that multiview attachments have all views referring to layers in range of the underlying texture. The OVR_multiview spec states: Add the following to the list of conditions required for framebuffer attachment completeness in section 9.4.1 (Framebuffer Attachment Completeness): "If is a two-dimensional array and the attachment is multiview, all the selected layers, [, + ), are less than the layer count of the texture." Fixes: 328c29d6007 ("mesa,glsl,gallium: add GL_OVR_multiview") Signed-off-by: James Hogan Reviewed-By: Mike Blumenkrantz Reviewed-by: Zoltán Böszörményi Part-of: (cherry picked from commit 39491da1b6358efebd6d48da6f5454c73409db67) --- .pick_status.json | 2 +- src/mesa/main/fbobject.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 5487f0e5dc5..a21e207019c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -74,7 +74,7 @@ "description": "mesa: Fix multiview attachment completeness check", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "328c29d6007ed7677d5c5307bd6997d84a32104a", "notes": null diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 4665e4dfe97..4b549cfa7c0 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1000,6 +1000,11 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format, att->Complete = GL_FALSE; return; } + if (att->Zoffset + att->NumViews > texImage->Depth) { + att_incomplete("bad 2D-array view range"); + att->Complete = GL_FALSE; + return; + } break; case GL_TEXTURE_CUBE_MAP_ARRAY: if (att->Zoffset >= texImage->Depth) {