summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2015-11-26 10:32:57 -0500
committerEmil Velikov <[email protected]>2015-11-30 00:13:23 +0000
commit97d4954f3f699c64ecdf2ad03bc0af9595d5bbe1 (patch)
tree930b990f65be1a29a55df9a4cbaca5b95e0b421f
parent3d525c86506feb80597a180675c66754809dfcf8 (diff)
mesa: support GL_RED/GL_RG in ES2 contexts when driver support exists
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93126 Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]> Cc: "11.0 11.1" <[email protected]> (cherry picked from commit 0396eaaf80c5d7955d7926c4e448f006c7682d2e)
-rw-r--r--src/mesa/main/glformats.c8
-rw-r--r--src/mesa/main/glformats.h3
-rw-r--r--src/mesa/main/readpix.c2
-rw-r--r--src/mesa/main/teximage.c2
4 files changed, 11 insertions, 4 deletions
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 2ed42eaffdd..f5284447b6e 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -2077,12 +2077,18 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
* \return error code, or GL_NO_ERROR.
*/
GLenum
-_mesa_es_error_check_format_and_type(GLenum format, GLenum type,
+_mesa_es_error_check_format_and_type(const struct gl_context *ctx,
+ GLenum format, GLenum type,
unsigned dimensions)
{
GLboolean type_valid = GL_TRUE;
switch (format) {
+ case GL_RED:
+ case GL_RG:
+ if (ctx->API == API_OPENGLES || !ctx->Extensions.ARB_texture_rg)
+ return GL_INVALID_VALUE;
+ /* fallthrough */
case GL_ALPHA:
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index 92f4bc6864e..b3668556da2 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -127,7 +127,8 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
GLenum format, GLenum type);
extern GLenum
-_mesa_es_error_check_format_and_type(GLenum format, GLenum type,
+_mesa_es_error_check_format_and_type(const struct gl_context *ctx,
+ GLenum format, GLenum type,
unsigned dimensions);
extern GLenum
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 81bb912beb6..8cdc9fe1cb2 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -1043,7 +1043,7 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
_mesa_get_color_read_type(ctx) == type) {
err = GL_NO_ERROR;
} else if (ctx->Version < 30) {
- err = _mesa_es_error_check_format_and_type(format, type, 2);
+ err = _mesa_es_error_check_format_and_type(ctx, format, type, 2);
if (err == GL_NO_ERROR) {
if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) {
err = GL_INVALID_OPERATION;
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d9453e3a281..87c8939fa92 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1712,7 +1712,7 @@ texture_format_error_check_gles(struct gl_context *ctx, GLenum format,
}
}
else {
- err = _mesa_es_error_check_format_and_type(format, type, dimensions);
+ err = _mesa_es_error_check_format_and_type(ctx, format, type, dimensions);
if (err != GL_NO_ERROR) {
_mesa_error(ctx, err, "%s(format = %s, type = %s)",
callerName, _mesa_enum_to_string(format),