mesa: OVR_multiview framebuffer attachment parameters

Implement the OVR_multiview framebuffer attachment parameters in
get_framebuffer_attachment_parameter():
- GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR: This reads the
  attachment's NumViews.
- GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR: This reads the
  attachment's Zoffset, but only if NumViews is non-zero.

This allows apitrace (PR 937[1]) to show the correct layers for
multiview framebuffer attachment surfaces, as well as to show this
information in the framebuffer attachments state.

[1]: https://github.com/apitrace/apitrace/pull/937

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>
(cherry picked from commit a282a130fb)
This commit is contained in:
James Hogan 2025-01-12 10:35:17 +00:00 committed by Eric Engestrom
parent 280d2fee72
commit d24eac8915
2 changed files with 25 additions and 1 deletions

View file

@ -934,7 +934,7 @@
"description": "mesa: OVR_multiview framebuffer attachment parameters",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "328c29d6007ed7677d5c5307bd6997d84a32104a",
"notes": null

View file

@ -5057,6 +5057,30 @@ get_framebuffer_attachment_parameter(struct gl_context *ctx,
goto invalid_pname_enum;
}
return;
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR:
if (!ctx->Extensions.OVR_multiview) {
goto invalid_pname_enum;
} else if (att->Type == GL_TEXTURE) {
*params = att->NumViews;
} else if (att->Type == GL_NONE) {
_mesa_error(ctx, err, "%s(invalid pname %s)", caller,
_mesa_enum_to_string(pname));
} else {
goto invalid_pname_enum;
}
return;
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR:
if (!ctx->Extensions.OVR_multiview) {
goto invalid_pname_enum;
} else if (att->Type == GL_TEXTURE) {
*params = att->NumViews > 0 ? att->Zoffset : 0;
} else if (att->Type == GL_NONE) {
_mesa_error(ctx, err, "%s(invalid pname %s)", caller,
_mesa_enum_to_string(pname));
} else {
goto invalid_pname_enum;
}
return;
default:
goto invalid_pname_enum;
}