diff options
author | Ian Romanick <[email protected]> | 2012-07-26 10:39:45 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2012-08-23 10:15:30 -0700 |
commit | 530c9d764b84035728a28ee2db996fffe49125ce (patch) | |
tree | d0aa30f5a9b4b6fd8f902d3d9df2777c2c8533bc /src/mesa/main/teximage.c | |
parent | ea9b212fca78eada7cc7c4449de3f31d2ceea1c3 (diff) |
mesa/es: Validate tex image targets in Mesa code rather than the ES wrapper
This should take care of all the TexImage, TexSubImage, CopyTexImage,
CompressedTexImage3DOES, and CopyTexSubImage type paths.
v2: Add proper core-profile and GLES3 filtering.
v3: Squash the CompressedTexImage3DOES patch per review comment from
Ken.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r-- | src/mesa/main/teximage.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 095db4ff9c1..8efa179724a 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1426,16 +1426,19 @@ legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target) switch (target) { case GL_TEXTURE_1D: case GL_PROXY_TEXTURE_1D: - return GL_TRUE; + return _mesa_is_desktop_gl(ctx); default: return GL_FALSE; } case 2: switch (target) { case GL_TEXTURE_2D: - case GL_PROXY_TEXTURE_2D: return GL_TRUE; + case GL_PROXY_TEXTURE_2D: + return _mesa_is_desktop_gl(ctx); case GL_PROXY_TEXTURE_CUBE_MAP: + return _mesa_is_desktop_gl(ctx) + && ctx->Extensions.ARB_texture_cube_map; case GL_TEXTURE_CUBE_MAP_POSITIVE_X: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: @@ -1445,23 +1448,31 @@ legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target) return ctx->Extensions.ARB_texture_cube_map; case GL_TEXTURE_RECTANGLE_NV: case GL_PROXY_TEXTURE_RECTANGLE_NV: - return ctx->Extensions.NV_texture_rectangle; + return _mesa_is_desktop_gl(ctx) + && ctx->Extensions.NV_texture_rectangle; case GL_TEXTURE_1D_ARRAY_EXT: case GL_PROXY_TEXTURE_1D_ARRAY_EXT: - return (ctx->Extensions.MESA_texture_array || - ctx->Extensions.EXT_texture_array); + return _mesa_is_desktop_gl(ctx) + && (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array); default: return GL_FALSE; } case 3: switch (target) { case GL_TEXTURE_3D: - case GL_PROXY_TEXTURE_3D: return GL_TRUE; + case GL_PROXY_TEXTURE_3D: + return _mesa_is_desktop_gl(ctx); case GL_TEXTURE_2D_ARRAY_EXT: + return (_mesa_is_desktop_gl(ctx) + && (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array)) + || _mesa_is_gles3(ctx); case GL_PROXY_TEXTURE_2D_ARRAY_EXT: - return (ctx->Extensions.MESA_texture_array || - ctx->Extensions.EXT_texture_array); + return _mesa_is_desktop_gl(ctx) + && (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array); default: return GL_FALSE; } @@ -1483,7 +1494,7 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target) { switch (dims) { case 1: - return target == GL_TEXTURE_1D; + return _mesa_is_desktop_gl(ctx) && target == GL_TEXTURE_1D; case 2: switch (target) { case GL_TEXTURE_2D: @@ -1496,10 +1507,12 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target) case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: return ctx->Extensions.ARB_texture_cube_map; case GL_TEXTURE_RECTANGLE_NV: - return ctx->Extensions.NV_texture_rectangle; + return _mesa_is_desktop_gl(ctx) + && ctx->Extensions.NV_texture_rectangle; case GL_TEXTURE_1D_ARRAY_EXT: - return (ctx->Extensions.MESA_texture_array || - ctx->Extensions.EXT_texture_array); + return _mesa_is_desktop_gl(ctx) + && (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array); default: return GL_FALSE; } @@ -1508,8 +1521,10 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target) case GL_TEXTURE_3D: return GL_TRUE; case GL_TEXTURE_2D_ARRAY_EXT: - return (ctx->Extensions.MESA_texture_array || - ctx->Extensions.EXT_texture_array); + return (_mesa_is_desktop_gl(ctx) + && (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array)) + || _mesa_is_gles3(ctx); default: return GL_FALSE; } |