GLuint first;
GLint i;
- if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(n<0)", func);
- return;
- }
-
if (!renderbuffers)
return;
}
+static void
+create_render_buffers_err(struct gl_context *ctx, GLsizei n,
+ GLuint *renderbuffers, bool dsa)
+{
+ const char *func = dsa ? "glCreateRenderbuffers" : "glGenRenderbuffers";
+
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(n<0)", func);
+ return;
+ }
+
+ create_render_buffers(ctx, n, renderbuffers, dsa);
+}
+
+
void GLAPIENTRY
-_mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
+_mesa_GenRenderbuffers_no_error(GLsizei n, GLuint *renderbuffers)
{
GET_CURRENT_CONTEXT(ctx);
create_render_buffers(ctx, n, renderbuffers, false);
void GLAPIENTRY
-_mesa_CreateRenderbuffers(GLsizei n, GLuint *renderbuffers)
+_mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ create_render_buffers_err(ctx, n, renderbuffers, false);
+}
+
+
+void GLAPIENTRY
+_mesa_CreateRenderbuffers_no_error(GLsizei n, GLuint *renderbuffers)
{
GET_CURRENT_CONTEXT(ctx);
create_render_buffers(ctx, n, renderbuffers, true);
}
+void GLAPIENTRY
+_mesa_CreateRenderbuffers(GLsizei n, GLuint *renderbuffers)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ create_render_buffers_err(ctx, n, renderbuffers, true);
+}
+
+
/**
* Given an internal format token for a render buffer, return the
* corresponding base format (one of GL_RGB, GL_RGBA, GL_STENCIL_INDEX,
}
+GLenum GLAPIENTRY
+_mesa_CheckFramebufferStatus_no_error(GLenum target)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ struct gl_framebuffer *fb = get_framebuffer_target(ctx, target);
+ return _mesa_check_framebuffer_status(ctx, fb);
+}
+
+
GLenum GLAPIENTRY
_mesa_CheckFramebufferStatus(GLenum target)
{
"glFramebufferTexture", false, false, true);
}
+void GLAPIENTRY
+_mesa_NamedFramebufferTexture_no_error(GLuint framebuffer, GLenum attachment,
+ GLuint texture, GLint level)
+{
+ frame_buffer_texture(framebuffer, 0, attachment, texture, level, 0,
+ "glNamedFramebufferTexture", true, true, true);
+}
+
void GLAPIENTRY
_mesa_NamedFramebufferTexture(GLuint framebuffer, GLenum attachment,
_mesa_update_framebuffer_visual(ctx, fb);
}
-static void
-framebuffer_renderbuffer(struct gl_context *ctx,
- struct gl_framebuffer *fb,
- GLenum attachment,
- struct gl_renderbuffer *rb,
- const char *func)
+static ALWAYS_INLINE void
+framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
+ GLenum attachment, GLenum renderbuffertarget,
+ GLuint renderbuffer, const char *func, bool no_error)
{
struct gl_renderbuffer_attachment *att;
+ struct gl_renderbuffer *rb;
bool is_color_attachment;
- if (_mesa_is_winsys_fbo(fb)) {
- /* Can't attach new renderbuffers to a window system framebuffer */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(window-system framebuffer)", func);
+ if (!no_error && renderbuffertarget != GL_RENDERBUFFER) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "%s(renderbuffertarget is not GL_RENDERBUFFER)", func);
return;
}
- att = get_attachment(ctx, fb, attachment, &is_color_attachment);
- if (att == NULL) {
- /*
- * From OpenGL 4.5 spec, section 9.2.7 "Attaching Renderbuffer Images to
- * a Framebuffer":
- *
- * "An INVALID_OPERATION error is generated if attachment is COLOR_-
- * ATTACHMENTm where m is greater than or equal to the value of
- * MAX_COLOR_- ATTACHMENTS ."
- *
- * If we are at this point, is because the attachment is not valid, so
- * if is_color_attachment is true, is because of the previous reason.
- */
- if (is_color_attachment) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(invalid color attachment %s)", func,
- _mesa_enum_to_string(attachment));
+ if (renderbuffer) {
+ if (!no_error) {
+ rb = _mesa_lookup_renderbuffer_err(ctx, renderbuffer, func);
+ if (!rb)
+ return;
} else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "%s(invalid attachment %s)", func,
- _mesa_enum_to_string(attachment));
+ rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
}
-
- return;
+ } else {
+ /* remove renderbuffer attachment */
+ rb = NULL;
}
- if (attachment == GL_DEPTH_STENCIL_ATTACHMENT &&
- rb && rb->Format != MESA_FORMAT_NONE) {
- /* make sure the renderbuffer is a depth/stencil format */
- const GLenum baseFormat = _mesa_get_format_base_format(rb->Format);
- if (baseFormat != GL_DEPTH_STENCIL) {
+ if (!no_error) {
+ if (_mesa_is_winsys_fbo(fb)) {
+ /* Can't attach new renderbuffers to a window system framebuffer */
_mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(renderbuffer is not DEPTH_STENCIL format)", func);
+ "%s(window-system framebuffer)", func);
return;
}
+
+ att = get_attachment(ctx, fb, attachment, &is_color_attachment);
+ if (att == NULL) {
+ /*
+ * From OpenGL 4.5 spec, section 9.2.7 "Attaching Renderbuffer Images
+ * to a Framebuffer":
+ *
+ * "An INVALID_OPERATION error is generated if attachment is
+ * COLOR_- ATTACHMENTm where m is greater than or equal to the
+ * value of MAX_COLOR_- ATTACHMENTS ."
+ *
+ * If we are at this point, is because the attachment is not valid, so
+ * if is_color_attachment is true, is because of the previous reason.
+ */
+ if (is_color_attachment) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(invalid color attachment %s)", func,
+ _mesa_enum_to_string(attachment));
+ } else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "%s(invalid attachment %s)", func,
+ _mesa_enum_to_string(attachment));
+ }
+
+ return;
+ }
+
+ if (attachment == GL_DEPTH_STENCIL_ATTACHMENT &&
+ rb && rb->Format != MESA_FORMAT_NONE) {
+ /* make sure the renderbuffer is a depth/stencil format */
+ const GLenum baseFormat = _mesa_get_format_base_format(rb->Format);
+ if (baseFormat != GL_DEPTH_STENCIL) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(renderbuffer is not DEPTH_STENCIL format)", func);
+ return;
+ }
+ }
}
_mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb);
}
+static void
+framebuffer_renderbuffer_error(struct gl_context *ctx,
+ struct gl_framebuffer *fb, GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer, const char *func)
+{
+ framebuffer_renderbuffer(ctx, fb, attachment, renderbuffertarget,
+ renderbuffer, func, false);
+}
+
+static void
+framebuffer_renderbuffer_no_error(struct gl_context *ctx,
+ struct gl_framebuffer *fb, GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer, const char *func)
+{
+ framebuffer_renderbuffer(ctx, fb, attachment, renderbuffertarget,
+ renderbuffer, func, true);
+}
+
+void GLAPIENTRY
+_mesa_FramebufferRenderbuffer_no_error(GLenum target, GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ struct gl_framebuffer *fb = get_framebuffer_target(ctx, target);
+ framebuffer_renderbuffer_no_error(ctx, fb, attachment, renderbuffertarget,
+ renderbuffer, "glFramebufferRenderbuffer");
+}
+
void GLAPIENTRY
_mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment,
GLenum renderbuffertarget,
GLuint renderbuffer)
{
struct gl_framebuffer *fb;
- struct gl_renderbuffer *rb;
GET_CURRENT_CONTEXT(ctx);
fb = get_framebuffer_target(ctx, target);
return;
}
- if (renderbuffertarget != GL_RENDERBUFFER) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glFramebufferRenderbuffer(renderbuffertarget is not "
- "GL_RENDERBUFFER)");
- return;
- }
+ framebuffer_renderbuffer_error(ctx, fb, attachment, renderbuffertarget,
+ renderbuffer, "glFramebufferRenderbuffer");
+}
- if (renderbuffer) {
- rb = _mesa_lookup_renderbuffer_err(ctx, renderbuffer,
- "glFramebufferRenderbuffer");
- if (!rb)
- return;
- }
- else {
- /* remove renderbuffer attachment */
- rb = NULL;
- }
+void GLAPIENTRY
+_mesa_NamedFramebufferRenderbuffer_no_error(GLuint framebuffer,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ GET_CURRENT_CONTEXT(ctx);
- framebuffer_renderbuffer(ctx, fb, attachment, rb,
- "glFramebufferRenderbuffer");
+ struct gl_framebuffer *fb = _mesa_lookup_framebuffer(ctx, framebuffer);
+ framebuffer_renderbuffer_no_error(ctx, fb, attachment, renderbuffertarget,
+ renderbuffer,
+ "glNamedFramebufferRenderbuffer");
}
-
void GLAPIENTRY
_mesa_NamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment,
GLenum renderbuffertarget,
GLuint renderbuffer)
{
struct gl_framebuffer *fb;
- struct gl_renderbuffer *rb;
GET_CURRENT_CONTEXT(ctx);
fb = _mesa_lookup_framebuffer_err(ctx, framebuffer,
if (!fb)
return;
- if (renderbuffertarget != GL_RENDERBUFFER) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glNamedFramebufferRenderbuffer(renderbuffertarget is not "
- "GL_RENDERBUFFER)");
- return;
- }
-
- if (renderbuffer) {
- rb = _mesa_lookup_renderbuffer_err(ctx, renderbuffer,
- "glNamedFramebufferRenderbuffer");
- if (!rb)
- return;
- }
- else {
- /* remove renderbuffer attachment */
- rb = NULL;
- }
-
- framebuffer_renderbuffer(ctx, fb, attachment, rb,
- "glNamedFramebufferRenderbuffer");
+ framebuffer_renderbuffer_error(ctx, fb, attachment, renderbuffertarget,
+ renderbuffer,
+ "glNamedFramebufferRenderbuffer");
}
}
+void GLAPIENTRY
+_mesa_InvalidateSubFramebuffer_no_error(GLenum target, GLsizei numAttachments,
+ const GLenum *attachments, GLint x,
+ GLint y, GLsizei width, GLsizei height)
+{
+ /* no-op */
+}
+
+
void GLAPIENTRY
_mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments,
const GLenum *attachments, GLint x, GLint y,
}
+void GLAPIENTRY
+_mesa_InvalidateFramebuffer_no_error(GLenum target, GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ /* no-op */
+}
+
+
void GLAPIENTRY
_mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
const GLenum *attachments)