diff options
author | Ian Romanick <[email protected]> | 2012-07-26 17:41:43 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2012-08-23 10:15:30 -0700 |
commit | 3f7c8364cf1d763f04413aecfac66df5534aeb34 (patch) | |
tree | 56181277ffd58a8e81725faa4a597f3f434e6fc7 /src | |
parent | 530c9d764b84035728a28ee2db996fffe49125ce (diff) |
mesa: Filter glBindTexture targets based on supported features.
Fixed the piglit test arb_texture_buffer_object-negative-unsupported.
NOTE: This is a candidate for stable release branches.
v2: Add proper core-profile and GLES3 filtering.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/texobj.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 1d905b608c4..77cd4f9625f 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1118,27 +1118,39 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) * \return TEXTURE_x_INDEX or -1 if target is invalid */ static GLint -target_enum_to_index(GLenum target) +target_enum_to_index(struct gl_context *ctx, GLenum target) { switch (target) { case GL_TEXTURE_1D: - return TEXTURE_1D_INDEX; + return _mesa_is_desktop_gl(ctx) ? TEXTURE_1D_INDEX : -1; case GL_TEXTURE_2D: return TEXTURE_2D_INDEX; case GL_TEXTURE_3D: return TEXTURE_3D_INDEX; case GL_TEXTURE_CUBE_MAP_ARB: - return TEXTURE_CUBE_INDEX; + return ctx->Extensions.ARB_texture_cube_map + ? TEXTURE_CUBE_INDEX : -1; case GL_TEXTURE_RECTANGLE_NV: - return TEXTURE_RECT_INDEX; + return _mesa_is_desktop_gl(ctx) && ctx->Extensions.NV_texture_rectangle + ? TEXTURE_RECT_INDEX : -1; case GL_TEXTURE_1D_ARRAY_EXT: - return TEXTURE_1D_ARRAY_INDEX; + return _mesa_is_desktop_gl(ctx) + && (ctx->Extensions.EXT_texture_array + || ctx->Extensions.MESA_texture_array) + ? TEXTURE_1D_ARRAY_INDEX : -1; case GL_TEXTURE_2D_ARRAY_EXT: - return TEXTURE_2D_ARRAY_INDEX; + return (_mesa_is_desktop_gl(ctx) + && (ctx->Extensions.EXT_texture_array + || ctx->Extensions.MESA_texture_array)) + || _mesa_is_gles3(ctx) + ? TEXTURE_2D_ARRAY_INDEX : -1; case GL_TEXTURE_BUFFER_ARB: - return TEXTURE_BUFFER_INDEX; + return _mesa_is_desktop_gl(ctx) + && ctx->Extensions.ARB_texture_buffer_object + ? TEXTURE_BUFFER_INDEX : -1; case GL_TEXTURE_EXTERNAL_OES: - return TEXTURE_EXTERNAL_INDEX; + return _mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external + ? TEXTURE_EXTERNAL_INDEX : -1; default: return -1; } @@ -1173,7 +1185,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) _mesa_debug(ctx, "glBindTexture %s %d\n", _mesa_lookup_enum_by_nr(target), (GLint) texName); - targetIndex = target_enum_to_index(target); + targetIndex = target_enum_to_index(ctx, target); if (targetIndex < 0) { _mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)"); return; |