diff options
Diffstat (limited to 'mesalib/src/mesa/main/fbobject.c')
-rw-r--r-- | mesalib/src/mesa/main/fbobject.c | 85 |
1 files changed, 78 insertions, 7 deletions
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index fd371aba8..757115584 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -78,7 +78,7 @@ static struct gl_renderbuffer DummyRenderbuffer; static struct gl_framebuffer IncompleteFramebuffer; -static INLINE GLboolean +static inline GLboolean is_cube_face(GLenum target) { return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && @@ -89,7 +89,7 @@ is_cube_face(GLenum target) /** * Is the given FBO a user-created FBO? */ -static INLINE GLboolean +static inline GLboolean is_user_fbo(const struct gl_framebuffer *fb) { return fb->Name != 0; @@ -99,7 +99,7 @@ is_user_fbo(const struct gl_framebuffer *fb) /** * Is the given FBO a window system FBO (like an X window)? */ -static INLINE GLboolean +static inline GLboolean is_winsys_fbo(const struct gl_framebuffer *fb) { return fb->Name == 0; @@ -194,9 +194,11 @@ get_framebuffer_target(struct gl_context *ctx, GLenum target) { switch (target) { case GL_DRAW_FRAMEBUFFER: - return ctx->Extensions.EXT_framebuffer_blit ? ctx->DrawBuffer : NULL; + return ctx->Extensions.EXT_framebuffer_blit && ctx->API == API_OPENGL + ? ctx->DrawBuffer : NULL; case GL_READ_FRAMEBUFFER: - return ctx->Extensions.EXT_framebuffer_blit ? ctx->ReadBuffer : NULL; + return ctx->Extensions.EXT_framebuffer_blit && ctx->API == API_OPENGL + ? ctx->ReadBuffer : NULL; case GL_FRAMEBUFFER_EXT: return ctx->DrawBuffer; default: @@ -238,18 +240,27 @@ _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, case GL_COLOR_ATTACHMENT13_EXT: case GL_COLOR_ATTACHMENT14_EXT: case GL_COLOR_ATTACHMENT15_EXT: + /* Only OpenGL ES 1.x forbids color attachments other than + * GL_COLOR_ATTACHMENT0. For all other APIs the limit set by the + * hardware is used. + */ i = attachment - GL_COLOR_ATTACHMENT0_EXT; - if (i >= ctx->Const.MaxColorAttachments) { + if (i >= ctx->Const.MaxColorAttachments + || (i > 0 && ctx->API == API_OPENGLES)) { return NULL; } return &fb->Attachment[BUFFER_COLOR0 + i]; case GL_DEPTH_STENCIL_ATTACHMENT: + if (ctx->API != API_OPENGL) + return NULL; /* fall-through */ case GL_DEPTH_BUFFER: /* fall-through / new in GL 3.0 */ case GL_DEPTH_ATTACHMENT_EXT: return &fb->Attachment[BUFFER_DEPTH]; case GL_STENCIL_BUFFER: + if (ctx->API != API_OPENGL) + return NULL; /* fall-through / new in GL 3.0 */ case GL_STENCIL_ATTACHMENT_EXT: return &fb->Attachment[BUFFER_STENCIL]; @@ -1220,7 +1231,67 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) return ctx->Extensions.EXT_texture_shared_exponent ? GL_RGB : 0; case GL_R11F_G11F_B10F: return ctx->Extensions.EXT_packed_float ? GL_RGB : 0; - /* XXX add integer formats eventually */ + + case GL_RGBA8UI_EXT: + case GL_RGBA16UI_EXT: + case GL_RGBA32UI_EXT: + case GL_RGBA8I_EXT: + case GL_RGBA16I_EXT: + case GL_RGBA32I_EXT: + return ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0; + + case GL_RGB8UI_EXT: + case GL_RGB16UI_EXT: + case GL_RGB32UI_EXT: + case GL_RGB8I_EXT: + case GL_RGB16I_EXT: + case GL_RGB32I_EXT: + return ctx->Extensions.EXT_texture_integer ? GL_RGB : 0; + + case GL_R8UI: + case GL_R8I: + case GL_R16UI: + case GL_R16I: + case GL_R32UI: + case GL_R32I: + return ctx->Extensions.ARB_texture_rg && + ctx->Extensions.EXT_texture_integer ? GL_RED : 0; + + case GL_RG8UI: + case GL_RG8I: + case GL_RG16UI: + case GL_RG16I: + case GL_RG32UI: + case GL_RG32I: + return ctx->Extensions.ARB_texture_rg && + ctx->Extensions.EXT_texture_integer ? GL_RG : 0; + + case GL_INTENSITY8I_EXT: + case GL_INTENSITY8UI_EXT: + case GL_INTENSITY16I_EXT: + case GL_INTENSITY16UI_EXT: + case GL_INTENSITY32I_EXT: + case GL_INTENSITY32UI_EXT: + return ctx->Extensions.EXT_texture_integer && + ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0; + + case GL_LUMINANCE8I_EXT: + case GL_LUMINANCE8UI_EXT: + case GL_LUMINANCE16I_EXT: + case GL_LUMINANCE16UI_EXT: + case GL_LUMINANCE32I_EXT: + case GL_LUMINANCE32UI_EXT: + return ctx->Extensions.EXT_texture_integer && + ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0; + + case GL_LUMINANCE_ALPHA8I_EXT: + case GL_LUMINANCE_ALPHA8UI_EXT: + case GL_LUMINANCE_ALPHA16I_EXT: + case GL_LUMINANCE_ALPHA16UI_EXT: + case GL_LUMINANCE_ALPHA32I_EXT: + case GL_LUMINANCE_ALPHA32UI_EXT: + return ctx->Extensions.EXT_texture_integer && + ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0; default: return 0; } |