aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/glformats.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-16 08:45:43 +0100
committermarha <marha@users.sourceforge.net>2013-01-16 08:45:43 +0100
commitb8219a4680768e14b7fe4930adf86e9be261b31f (patch)
tree193855ef8d48765d67cc11153a15e3c1e2568e50 /mesalib/src/mesa/main/glformats.c
parent15cdb95b194cb051a5d469cc9eb73eb0eed4db41 (diff)
parent811d1bcf6d61ea49551abdd7f2294c5af2776913 (diff)
downloadvcxsrv-b8219a4680768e14b7fe4930adf86e9be261b31f.tar.gz
vcxsrv-b8219a4680768e14b7fe4930adf86e9be261b31f.tar.bz2
vcxsrv-b8219a4680768e14b7fe4930adf86e9be261b31f.zip
Merge remote-tracking branch 'origin/released'
* origin/released: Switched to xcalc-1.0.5 Switched to bdftopcf-1.0.4 libxtrans fontconfig glproto libX11 libXau libXext libXft libXinerama libXmu libfontenc mesa xkeyboard-config
Diffstat (limited to 'mesalib/src/mesa/main/glformats.c')
-rw-r--r--mesalib/src/mesa/main/glformats.c459
1 files changed, 458 insertions, 1 deletions
diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c
index ff56ffad0..7969f77a4 100644
--- a/mesalib/src/mesa/main/glformats.c
+++ b/mesalib/src/mesa/main/glformats.c
@@ -1289,6 +1289,10 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
ctx->Extensions.ARB_texture_rgb10_a2ui) {
break; /* OK */
}
+ if (type == GL_UNSIGNED_INT_2_10_10_10_REV && format == GL_RGB &&
+ ctx->API == API_OPENGLES2) {
+ break; /* OK by GL_EXT_texture_type_2_10_10_10_REV */
+ }
return GL_INVALID_OPERATION;
case GL_UNSIGNED_INT_24_8:
@@ -1402,6 +1406,10 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
return GL_NO_ERROR;
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ /* OK by GL_EXT_texture_type_2_10_10_10_REV */
+ return (ctx->API == API_OPENGLES2)
+ ? GL_NO_ERROR : GL_INVALID_ENUM;
case GL_HALF_FLOAT:
return ctx->Extensions.ARB_half_float_pixel
? GL_NO_ERROR : GL_INVALID_ENUM;
@@ -1478,8 +1486,18 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
else if (ctx->Extensions.ARB_depth_buffer_float &&
type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV)
return GL_NO_ERROR;
- else
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ return GL_INVALID_OPERATION;
+ default:
return GL_INVALID_ENUM;
+ }
case GL_DUDV_ATI:
case GL_DU8DV8_ATI:
@@ -1670,3 +1688,442 @@ _mesa_es_error_check_format_and_type(GLenum format, GLenum type,
return type_valid ? GL_NO_ERROR : GL_INVALID_OPERATION;
}
+
+
+/**
+ * Do error checking of format/type combinations for OpenGL ES 3
+ * glTex[Sub]Image.
+ * \return error code, or GL_NO_ERROR.
+ */
+GLenum
+_mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
+ GLenum internalFormat,
+ unsigned dimensions)
+{
+ GLboolean type_valid = GL_TRUE;
+
+ switch (format) {
+ case GL_RGBA:
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ switch (internalFormat) {
+ case GL_RGBA:
+ case GL_RGBA8:
+ case GL_RGB5_A1:
+ case GL_RGBA4:
+ case GL_SRGB8_ALPHA8_EXT:
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_BYTE:
+ if (internalFormat != GL_RGBA8_SNORM)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ switch (internalFormat) {
+ case GL_RGBA:
+ case GL_RGBA4:
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ switch (internalFormat) {
+ case GL_RGBA:
+ case GL_RGB5_A1:
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ switch (internalFormat) {
+ case GL_RGBA: /* GL_EXT_texture_type_2_10_10_10_REV */
+ case GL_RGB10_A2:
+ case GL_RGB5_A1:
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_HALF_FLOAT:
+ if (internalFormat != GL_RGBA16F)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_FLOAT:
+ switch (internalFormat) {
+ case GL_RGBA16F:
+ case GL_RGBA32F:
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_RGBA_INTEGER:
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ if (internalFormat != GL_RGBA8UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_BYTE:
+ if (internalFormat != GL_RGBA8I)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_SHORT:
+ if (internalFormat != GL_RGBA16UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_SHORT:
+ if (internalFormat != GL_RGBA16I)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_INT:
+ if (internalFormat != GL_RGBA32UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_INT:
+ if (internalFormat != GL_RGBA32I)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ if (internalFormat != GL_RGB10_A2UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_RGB:
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ switch (internalFormat) {
+ case GL_RGB:
+ case GL_RGB8:
+ case GL_RGB565:
+ case GL_SRGB8:
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_BYTE:
+ if (internalFormat != GL_RGB8_SNORM)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_SHORT_5_6_5:
+ switch (internalFormat) {
+ case GL_RGB:
+ case GL_RGB565:
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ if (internalFormat != GL_R11F_G11F_B10F)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ if (internalFormat != GL_RGB9_E5)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_HALF_FLOAT:
+ switch (internalFormat) {
+ case GL_RGB16F:
+ case GL_R11F_G11F_B10F:
+ case GL_RGB9_E5:
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_FLOAT:
+ switch (internalFormat) {
+ case GL_RGB16F:
+ case GL_RGB32F:
+ case GL_R11F_G11F_B10F:
+ case GL_RGB9_E5:
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ switch (internalFormat) {
+ case GL_RGB: /* GL_EXT_texture_type_2_10_10_10_REV */
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_RGB_INTEGER:
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ if (internalFormat != GL_RGB8UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_BYTE:
+ if (internalFormat != GL_RGB8I)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_SHORT:
+ if (internalFormat != GL_RGB16UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_SHORT:
+ if (internalFormat != GL_RGB16I)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_INT:
+ if (internalFormat != GL_RGB32UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_INT:
+ if (internalFormat != GL_RGB32I)
+ return GL_INVALID_OPERATION;
+ break;
+
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_RG:
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ if (internalFormat != GL_RG8)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_BYTE:
+ if (internalFormat != GL_RG8_SNORM)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_HALF_FLOAT:
+ if (internalFormat != GL_RG16F)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_FLOAT:
+ switch (internalFormat) {
+ case GL_RG16F:
+ case GL_RG32F:
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_RG_INTEGER:
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ if (internalFormat != GL_RG8UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_BYTE:
+ if (internalFormat != GL_RG8I)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_SHORT:
+ if (internalFormat != GL_RG16UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_SHORT:
+ if (internalFormat != GL_RG16I)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_INT:
+ if (internalFormat != GL_RG32UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_INT:
+ if (internalFormat != GL_RG32I)
+ return GL_INVALID_OPERATION;
+ break;
+
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_RED:
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ if (internalFormat != GL_R8)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_BYTE:
+ if (internalFormat != GL_R8_SNORM)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_HALF_FLOAT:
+ if (internalFormat != GL_R16F)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_FLOAT:
+ switch (internalFormat) {
+ case GL_R16F:
+ case GL_R32F:
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_RED_INTEGER:
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ if (internalFormat != GL_R8UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_BYTE:
+ if (internalFormat != GL_R8I)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_SHORT:
+ if (internalFormat != GL_R16UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_SHORT:
+ if (internalFormat != GL_R16I)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_INT:
+ if (internalFormat != GL_R32UI)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_INT:
+ if (internalFormat != GL_R32I)
+ return GL_INVALID_OPERATION;
+ break;
+
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_DEPTH_COMPONENT:
+ if (dimensions != 2) {
+ return GL_INVALID_OPERATION;
+ }
+ switch (type) {
+ case GL_UNSIGNED_SHORT:
+ if (internalFormat != GL_DEPTH_COMPONENT16)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_UNSIGNED_INT:
+ switch (internalFormat) {
+ case GL_DEPTH_COMPONENT16:
+ case GL_DEPTH_COMPONENT24:
+ break;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_FLOAT:
+ if (internalFormat != GL_DEPTH_COMPONENT32F)
+ return GL_INVALID_OPERATION;
+ break;
+
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_DEPTH_STENCIL:
+ if (dimensions != 2) {
+ return GL_INVALID_OPERATION;
+ }
+ switch (type) {
+ case GL_UNSIGNED_INT_24_8:
+ if (internalFormat != GL_DEPTH24_STENCIL8)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ if (internalFormat != GL_DEPTH32F_STENCIL8)
+ return GL_INVALID_OPERATION;
+ break;
+
+ default:
+ return GL_INVALID_OPERATION;
+ }
+ break;
+
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ if (type != GL_UNSIGNED_BYTE || format != internalFormat)
+ return GL_INVALID_OPERATION;
+ break;
+ }
+
+ return type_valid ? GL_NO_ERROR : GL_INVALID_OPERATION;
+}