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>
This commit is contained in:
James Hogan 2025-01-12 10:35:17 +00:00 committed by Marge Bot
parent 60509e187f
commit a282a130fb

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;
}