diff options
author | marha <marha@users.sourceforge.net> | 2013-01-16 08:28:39 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-01-16 08:28:39 +0100 |
commit | 92bd40b3fc3830028340969f2cc5c6a0720c4450 (patch) | |
tree | 538a7f953afd9b5cf38e1a24e20b5be333053f92 /mesalib/src/mesa/main/glformats.c | |
parent | 2fe4d492f39a5a5b67c4444805f7b1eaa1e745a9 (diff) | |
download | vcxsrv-92bd40b3fc3830028340969f2cc5c6a0720c4450.tar.gz vcxsrv-92bd40b3fc3830028340969f2cc5c6a0720c4450.tar.bz2 vcxsrv-92bd40b3fc3830028340969f2cc5c6a0720c4450.zip |
libxtrans fontconfig glproto libX11 libXau libXext libXft libXinerama
libXmu libfontenc mesa xkeyboard-config
libxtrans: d9f3728ff74ceb956f6cf8dc24b38611f9a4868a
fontconfig: ec5ca08c807585a9230f83c95f7cca6b7065b142
glproto: 8e3407e02980d088e20041e79bdcdd3737e7827e
libX11: f57fd760cba92ad846917f21e94e73e9c846185f
libXau: 1a8a1b2c68967b48c07b56142799b1020f017027
libXext: 8eee1236041d46a21faba32e0d27c26985267d89
libXft: c5e760a239afc62a1c75e0509868e35957c8df52
libXinerama: 470b9356af961ff7d3968b164aa73872b49a5dcc
libXmu: 474d22468c90f99104873b4c5fd7b0f0d2cbf823
libfontenc: 0c3518df24192f18f15ce91c2868560a5973a3dc
mesa: 3c00a52f7e02007f40fa53a06fad517bed0328ff
xkeyboard-config: 8a117fbd4a029b952afcfe362931628dccf496e4
Diffstat (limited to 'mesalib/src/mesa/main/glformats.c')
-rw-r--r-- | mesalib/src/mesa/main/glformats.c | 459 |
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; +} |