aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/image.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/image.c')
-rw-r--r--mesalib/src/mesa/main/image.c91
1 files changed, 91 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c
index ca31e53a8..9b9e83802 100644
--- a/mesalib/src/mesa/main/image.c
+++ b/mesalib/src/mesa/main/image.c
@@ -243,12 +243,14 @@ _mesa_components_in_format( GLenum format )
case GL_RGB:
case GL_BGR:
case GL_RGB_INTEGER_EXT:
+ case GL_BGR_INTEGER_EXT:
return 3;
case GL_RGBA:
case GL_BGRA:
case GL_ABGR_EXT:
case GL_RGBA_INTEGER_EXT:
+ case GL_BGRA_INTEGER_EXT:
return 4;
default:
@@ -814,6 +816,7 @@ _mesa_is_color_format(GLenum format)
case GL_INTENSITY16_SNORM:
case GL_RGB9_E5:
case GL_R11F_G11F_B10F:
+ case GL_RGB10_A2UI:
return GL_TRUE;
case GL_YCBCR_MESA: /* not considered to be RGB */
/* fall-through */
@@ -1000,6 +1003,7 @@ _mesa_is_integer_format(GLenum format)
case GL_INTENSITY8I_EXT:
case GL_LUMINANCE8I_EXT:
case GL_LUMINANCE_ALPHA8I_EXT:
+ case GL_RGB10_A2UI:
return GL_TRUE;
default:
return GL_FALSE;
@@ -1067,6 +1071,93 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
/**
+ * Does the given base texture/renderbuffer format have the channel
+ * named by 'pname'?
+ */
+GLboolean
+_mesa_base_format_has_channel(GLenum base_format, GLenum pname)
+{
+ switch (pname) {
+ case GL_TEXTURE_RED_SIZE:
+ case GL_TEXTURE_RED_TYPE:
+ case GL_RENDERBUFFER_RED_SIZE_EXT:
+ case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+ if (base_format == GL_RED ||
+ base_format == GL_RG ||
+ base_format == GL_RGB ||
+ base_format == GL_RGBA) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_TEXTURE_GREEN_SIZE:
+ case GL_TEXTURE_GREEN_TYPE:
+ case GL_RENDERBUFFER_GREEN_SIZE_EXT:
+ case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+ if (base_format == GL_RG ||
+ base_format == GL_RGB ||
+ base_format == GL_RGBA) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_TEXTURE_BLUE_SIZE:
+ case GL_TEXTURE_BLUE_TYPE:
+ case GL_RENDERBUFFER_BLUE_SIZE_EXT:
+ case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+ if (base_format == GL_RGB ||
+ base_format == GL_RGBA) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_TEXTURE_ALPHA_SIZE:
+ case GL_TEXTURE_ALPHA_TYPE:
+ case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
+ case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+ if (base_format == GL_RGBA ||
+ base_format == GL_ALPHA ||
+ base_format == GL_LUMINANCE_ALPHA) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_TEXTURE_LUMINANCE_SIZE:
+ case GL_TEXTURE_LUMINANCE_TYPE:
+ if (base_format == GL_LUMINANCE ||
+ base_format == GL_LUMINANCE_ALPHA) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_TEXTURE_INTENSITY_SIZE:
+ case GL_TEXTURE_INTENSITY_TYPE:
+ if (base_format == GL_INTENSITY) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_TEXTURE_DEPTH_SIZE:
+ case GL_TEXTURE_DEPTH_TYPE:
+ case GL_RENDERBUFFER_DEPTH_SIZE_EXT:
+ case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+ if (base_format == GL_DEPTH_STENCIL ||
+ base_format == GL_DEPTH_COMPONENT) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ case GL_RENDERBUFFER_STENCIL_SIZE_EXT:
+ case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+ if (base_format == GL_DEPTH_STENCIL ||
+ base_format == GL_STENCIL_INDEX) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+ default:
+ _mesa_warning(NULL, "%s: Unexpected channel token 0x%x\n",
+ __FUNCTION__, pname);
+ return GL_FALSE;
+ }
+
+ return GL_FALSE;
+}
+
+
+/**
* Return the address of a specific pixel in an image (1D, 2D or 3D).
*
* Pixel unpacking/packing parameters are observed according to \p packing.