[Mesa-dev] [PATCH 13/38] main: Add entry point for CheckNamedFramebufferStatus.
Fredrik Höglund
fredrik at kde.org
Sun Apr 12 08:46:33 PDT 2015
On Wednesday 04 March 2015, Laura Ekstrand wrote:
> ---
> src/mapi/glapi/gen/ARB_direct_state_access.xml | 6 +++
> src/mesa/main/fbobject.c | 73 ++++++++++++++++++++------
> src/mesa/main/fbobject.h | 7 +++
> src/mesa/main/tests/dispatch_sanity.cpp | 1 +
> 4 files changed, 72 insertions(+), 15 deletions(-)
>
> diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
> index 19d029d..20c2e7b 100644
> --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
> +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
> @@ -140,6 +140,12 @@
> <param name="layer" type="GLint" />
> </function>
>
> + <function name="CheckNamedFramebufferStatus" offset="assign">
> + <return type="GLenum" />
> + <param name="framebuffer" type="GLuint" />
> + <param name="target" type="GLenum" />
> + </function>
> +
> <!-- Texture object functions -->
>
> <function name="CreateTextures" offset="assign">
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 1435576..6ed82d5 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -2351,24 +2351,12 @@ _mesa_CreateFramebuffers(GLsizei n, GLuint *framebuffers)
> }
>
>
> -GLenum GLAPIENTRY
> -_mesa_CheckFramebufferStatus(GLenum target)
> +GLenum
> +_mesa_check_framebuffer_status(struct gl_context *ctx,
> + struct gl_framebuffer *buffer)
> {
> - struct gl_framebuffer *buffer;
> - GET_CURRENT_CONTEXT(ctx);
> -
> ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
>
> - if (MESA_VERBOSE & VERBOSE_API)
> - _mesa_debug(ctx, "glCheckFramebufferStatus(%s)\n",
> - _mesa_lookup_enum_by_nr(target));
Do we want to retain this debugging code?
> - buffer = get_framebuffer_target(ctx, target);
> - if (!buffer) {
> - _mesa_error(ctx, GL_INVALID_ENUM, "glCheckFramebufferStatus(target)");
> - return 0;
> - }
> -
> if (_mesa_is_winsys_fbo(buffer)) {
> /* EGL_KHR_surfaceless_context allows the winsys FBO to be incomplete. */
> if (buffer != &IncompleteFramebuffer) {
> @@ -2387,6 +2375,61 @@ _mesa_CheckFramebufferStatus(GLenum target)
> return buffer->_Status;
> }
>
There should be two empty lines between these functions.
> +GLenum GLAPIENTRY
> +_mesa_CheckFramebufferStatus(GLenum target)
> +{
> + struct gl_framebuffer *fb;
> + GET_CURRENT_CONTEXT(ctx);
> +
> + fb = get_framebuffer_target(ctx, target);
> + if (!fb) {
> + _mesa_error(ctx, GL_INVALID_ENUM,
> + "glCheckFramebufferStatus(invalid target %s)",
> + _mesa_lookup_enum_by_nr(target));
> + return 0;
> + }
> +
> + return _mesa_check_framebuffer_status(ctx, fb);
> +}
> +
And these.
> +GLenum GLAPIENTRY
> +_mesa_CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target)
> +{
> + struct gl_framebuffer *fb;
> + GET_CURRENT_CONTEXT(ctx);
> +
> + /* Validate the target (for conformance's sake) and grab a reference to the
> + * default framebuffer in case framebuffer = 0.
> + * Section 9.4 Framebuffer Completeness of the OpenGL 4.5 core spec
> + * (30.10.2014, PDF page 336) says:
> + * "If framebuffer is zero, then the status of the default read or
> + * draw framebuffer (as determined by target) is returned."
> + */
> + switch (target) {
> + case GL_DRAW_FRAMEBUFFER:
> + case GL_FRAMEBUFFER:
> + fb = ctx->WinSysDrawBuffer;
> + break;
> + case GL_READ_FRAMEBUFFER:
> + fb = ctx->WinSysReadBuffer;
> + break;
> + default:
> + _mesa_error(ctx, GL_INVALID_ENUM,
> + "glCheckNamedFramebufferStatus(invalid target %s)",
> + _mesa_lookup_enum_by_nr(target));
> + return 0;
> + }
> +
> + if (framebuffer) {
> + fb = _mesa_lookup_framebuffer_err(ctx, framebuffer,
> + "glCheckNamedFramebufferStatus");
> + if (!fb)
> + return 0;
> + }
> +
> + return _mesa_check_framebuffer_status(ctx, fb);
> +}
> +
>
> /**
> * Replicate the src attachment point. Used by framebuffer_texture() when
> diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
> index 96d39a7..f078097 100644
> --- a/src/mesa/main/fbobject.h
> +++ b/src/mesa/main/fbobject.h
> @@ -122,6 +122,10 @@ _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb,
> GLint level, GLuint zoffset, bool layered,
> const char *caller);
>
> +extern GLenum
> +_mesa_check_framebuffer_status(struct gl_context *ctx,
> + struct gl_framebuffer *fb);
> +
>
> extern GLboolean GLAPIENTRY
> _mesa_IsRenderbuffer(GLuint renderbuffer);
> @@ -179,6 +183,9 @@ _mesa_CreateFramebuffers(GLsizei n, GLuint *framebuffers);
> extern GLenum GLAPIENTRY
> _mesa_CheckFramebufferStatus(GLenum target);
>
> +extern GLenum GLAPIENTRY
> +_mesa_CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target);
> +
> extern void GLAPIENTRY
> _mesa_FramebufferTexture1D(GLenum target, GLenum attachment,
> GLenum textarget, GLuint texture, GLint level);
> diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
> index d72a04c..4dfac5c 100644
> --- a/src/mesa/main/tests/dispatch_sanity.cpp
> +++ b/src/mesa/main/tests/dispatch_sanity.cpp
> @@ -974,6 +974,7 @@ const struct function gl_core_functions_possible[] = {
> { "glNamedFramebufferRenderbuffer", 45, -1 },
> { "glNamedFramebufferTexture", 45, -1 },
> { "glNamedFramebufferTextureLayer", 45, -1 },
> + { "glCheckNamedFramebufferStatus", 45, -1 },
> { "glCreateTextures", 45, -1 },
> { "glTextureStorage1D", 45, -1 },
> { "glTextureStorage2D", 45, -1 },
>
More information about the mesa-dev
mailing list