mesa: Fix multiview attachment completeness check

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 <image> is a two-dimensional array and the attachment
  is multiview, all the selected layers, [<baseViewIndex>,
  <baseViewIndex> + <numViews>), are less than the layer count of the
  texture."

Fixes: 328c29d600 ("mesa,glsl,gallium: add GL_OVR_multiview")
Signed-off-by: James Hogan <james@albanarts.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33346>
(cherry picked from commit 39491da1b6)
This commit is contained in:
James Hogan 2025-01-24 18:42:51 +00:00 committed by Eric Engestrom
parent fdb7f38da0
commit def5f68269
2 changed files with 6 additions and 1 deletions

View file

@ -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

View file

@ -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) {