main: Add utility function _mesa_lookup_framebuffer_err.
[Fredrik: Generate an error for non-existent framebuffers] Reviewed-by: Fredrik Höglund <fredrik@kde.org> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Signed-off-by: Fredrik Höglund <fredrik@kde.org>
This commit is contained in:
committed by
Fredrik Höglund
parent
adcf8f8a13
commit
6d8eff4af7
@@ -137,6 +137,27 @@ _mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A convenience function for direct state access that throws
|
||||
* GL_INVALID_OPERATION if the framebuffer doesn't exist.
|
||||
*/
|
||||
struct gl_framebuffer *
|
||||
_mesa_lookup_framebuffer_err(struct gl_context *ctx, GLuint id,
|
||||
const char *func)
|
||||
{
|
||||
struct gl_framebuffer *fb;
|
||||
|
||||
fb = _mesa_lookup_framebuffer(ctx, id);
|
||||
if (!fb || fb == &DummyFramebuffer) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"%s(non-existent framebuffer %u)", func, id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return fb;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark the given framebuffer as invalid. This will force the
|
||||
* test for framebuffer completeness to be done before the framebuffer
|
||||
|
||||
@@ -67,6 +67,10 @@ _mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id);
|
||||
extern struct gl_framebuffer *
|
||||
_mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id);
|
||||
|
||||
extern struct gl_framebuffer *
|
||||
_mesa_lookup_framebuffer_err(struct gl_context *ctx, GLuint id,
|
||||
const char *func);
|
||||
|
||||
|
||||
void
|
||||
_mesa_update_texture_renderbuffer(struct gl_context *ctx,
|
||||
|
||||
Reference in New Issue
Block a user