}
static void
-framebuffer_renderbuffer(struct gl_context *ctx,
- struct gl_framebuffer *fb,
- GLenum attachment,
- struct gl_renderbuffer *rb,
- const char *func)
+framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
+ GLenum attachment, GLenum renderbuffertarget,
+ GLuint renderbuffer, const char *func)
{
struct gl_renderbuffer_attachment *att;
+ struct gl_renderbuffer *rb;
bool is_color_attachment;
+ if (renderbuffertarget != GL_RENDERBUFFER) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "%s(renderbuffertarget is not GL_RENDERBUFFER)", func);
+ return;
+ }
+
+ if (renderbuffer) {
+ rb = _mesa_lookup_renderbuffer_err(ctx, renderbuffer, func);
+ if (!rb)
+ return;
+ } else {
+ /* remove renderbuffer attachment */
+ rb = NULL;
+ }
+
if (_mesa_is_winsys_fbo(fb)) {
/* Can't attach new renderbuffers to a window system framebuffer */
_mesa_error(ctx, GL_INVALID_OPERATION,
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;
- }
-
- if (renderbuffer) {
- rb = _mesa_lookup_renderbuffer_err(ctx, renderbuffer,
- "glFramebufferRenderbuffer");
- if (!rb)
- return;
- }
- else {
- /* remove renderbuffer attachment */
- rb = NULL;
- }
-
- framebuffer_renderbuffer(ctx, fb, attachment, rb,
- "glFramebufferRenderbuffer");
+ framebuffer_renderbuffer(ctx, fb, attachment, renderbuffertarget,
+ renderbuffer, "glFramebufferRenderbuffer");
}
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(ctx, fb, attachment, renderbuffertarget,
+ renderbuffer, "glNamedFramebufferRenderbuffer");
}