/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
}
}
else if (format == GL_DEPTH) {
- if (texImage->TexFormat->BaseFormat != GL_DEPTH_COMPONENT) {
+ if (texImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT) {
+ /* OK */
+ }
+ else if (ctx->Extensions.EXT_packed_depth_stencil &&
+ att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
+ /* OK */
+ }
+ else {
att->Complete = GL_FALSE;
return;
}
}
}
else if (format == GL_DEPTH) {
- if (att->Renderbuffer->_BaseFormat != GL_DEPTH_COMPONENT) {
+ if (att->Renderbuffer->_BaseFormat == GL_DEPTH_COMPONENT) {
+ /* OK */
+ }
+ else if (ctx->Extensions.EXT_packed_depth_stencil &&
+ att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
+ /* OK */
+ }
+ else {
att->Complete = GL_FALSE;
return;
}
}
else {
assert(format == GL_STENCIL);
- if (att->Renderbuffer->_BaseFormat != GL_STENCIL_INDEX) {
+ if (att->Renderbuffer->_BaseFormat == GL_STENCIL_INDEX) {
+ /* OK */
+ }
+ else if (ctx->Extensions.EXT_packed_depth_stencil &&
+ att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
+ /* OK */
+ }
+ else {
att->Complete = GL_FALSE;
return;
}
GLuint w = 0, h = 0;
GLint i;
+ assert(fb->Name != 0);
+
numImages = 0;
fb->Width = 0;
fb->Height = 0;
h = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Height;
f = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Format;
numImages++;
+ if (f != GL_RGB && f != GL_RGBA && f != GL_DEPTH_COMPONENT) {
+ /* XXX need GL_DEPTH_STENCIL_EXT test? */
+ fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
+ return;
+ }
}
else if (att->Type == GL_RENDERBUFFER_EXT) {
w = att->Renderbuffer->Width;
}
}
+ /* Check if any renderbuffer is attached more than once.
+ * Note that there's one exception: a GL_DEPTH_STENCIL renderbuffer can be
+ * bound to both the stencil and depth attachment points at the same time.
+ */
+ for (i = 0; i < BUFFER_COUNT - 1; i++) {
+ struct gl_renderbuffer *rb_i = fb->Attachment[i].Renderbuffer;
+ if (rb_i) {
+ GLint j;
+ for (j = i + 1; j < BUFFER_COUNT; j++) {
+ struct gl_renderbuffer *rb_j = fb->Attachment[j].Renderbuffer;
+ if (rb_i == rb_j && rb_i->_BaseFormat != GL_DEPTH_STENCIL_EXT) {
+ fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT;
+ return;
+ }
+ }
+ }
+ }
+
+
if (numImages == 0) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
return;
* Given an internal format token for a render buffer, return the
* corresponding base format.
* \return one of GL_RGB, GL_RGBA, GL_STENCIL_INDEX, GL_DEPTH_COMPONENT
- * or zero if error.
+ * GL_DEPTH_STENCIL_EXT or zero if error.
*/
static GLenum
base_internal_format(GLcontext *ctx, GLenum internalFormat)
case GL_DEPTH_COMPONENT24:
case GL_DEPTH_COMPONENT32:
return GL_DEPTH_COMPONENT;
+ case GL_DEPTH_STENCIL_EXT:
+ case GL_DEPTH24_STENCIL8_EXT:
+ if (ctx->Extensions.EXT_packed_depth_stencil)
+ return GL_DEPTH_STENCIL_EXT;
+ else
+ return 0;
/* XXX add floating point formats eventually */
default:
return 0;
case GL_RENDERBUFFER_INTERNAL_FORMAT_EXT:
*params = ctx->CurrentRenderbuffer->InternalFormat;
return;
+ case GL_RENDERBUFFER_RED_SIZE_EXT:
+ if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB ||
+ ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) {
+ *params = ctx->CurrentRenderbuffer->RedBits;
+ }
+ else {
+ *params = 0;
+ }
+ break;
+ case GL_RENDERBUFFER_GREEN_SIZE_EXT:
+ if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB ||
+ ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) {
+ *params = ctx->CurrentRenderbuffer->GreenBits;
+ }
+ else {
+ *params = 0;
+ }
+ break;
+ case GL_RENDERBUFFER_BLUE_SIZE_EXT:
+ if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB ||
+ ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) {
+ *params = ctx->CurrentRenderbuffer->BlueBits;
+ }
+ else {
+ *params = 0;
+ }
+ break;
+ case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
+ if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB ||
+ ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) {
+ *params = ctx->CurrentRenderbuffer->AlphaBits;
+ }
+ else {
+ *params = 0;
+ }
+ break;
+ case GL_RENDERBUFFER_DEPTH_SIZE_EXT:
+ if (ctx->CurrentRenderbuffer->_BaseFormat == GL_DEPTH_COMPONENT ||
+ ctx->CurrentRenderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
+ *params = ctx->CurrentRenderbuffer->DepthBits;
+ }
+ else {
+ *params = 0;
+ }
+ break;
+ case GL_RENDERBUFFER_STENCIL_SIZE_EXT:
+ if (ctx->CurrentRenderbuffer->_BaseFormat == GL_STENCIL_INDEX ||
+ ctx->CurrentRenderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
+ *params = ctx->CurrentRenderbuffer->StencilBits;
+ }
+ else {
+ *params = 0;
+ }
+ break;
+
default:
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetRenderbufferParameterivEXT(target)");
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
if (target != GL_FRAMEBUFFER_EXT) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glBindFramebufferEXT(target)");
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBindFramebufferEXT(target)");
return;
}
}
if (ctx->DrawBuffer->Name == 0) {
+ /* Can't attach new renderbuffers to a window system framebuffer */
_mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferRenderbufferEXT");
return;
}
case GL_TEXTURE_2D:
case GL_TEXTURE_3D:
case GL_TEXTURE_CUBE_MAP:
+ /* OK, legal value */
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGenerateMipmapEXT(target)");