diff options
author | marha <marha@users.sourceforge.net> | 2011-11-04 08:57:20 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-11-04 08:57:20 +0100 |
commit | 02f377d5e2dd18537d0807ad63675a0970b5a37d (patch) | |
tree | 1814c826db4d95a30ad71431d9c84b8d2611ec18 /mesalib/src/mesa/main/teximage.c | |
parent | 6f4feafd4d22beaabfb0202e66b0dea9047ee084 (diff) | |
download | vcxsrv-02f377d5e2dd18537d0807ad63675a0970b5a37d.tar.gz vcxsrv-02f377d5e2dd18537d0807ad63675a0970b5a37d.tar.bz2 vcxsrv-02f377d5e2dd18537d0807ad63675a0970b5a37d.zip |
xserver pixman mesa git update 4 nov 2011
Diffstat (limited to 'mesalib/src/mesa/main/teximage.c')
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 60 |
1 files changed, 49 insertions, 11 deletions
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index acf7187fd..a84d6873d 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -549,7 +549,8 @@ _mesa_set_tex_image(struct gl_texture_object *tObj, ASSERT(tObj); ASSERT(texImage); - ASSERT(target != GL_TEXTURE_RECTANGLE_NV || level == 0); + if (target == GL_TEXTURE_RECTANGLE_NV || target == GL_TEXTURE_EXTERNAL_OES) + assert(level == 0); tObj->Image[face][level] = texImage; @@ -607,10 +608,11 @@ _mesa_delete_texture_image(struct gl_context *ctx, GLboolean _mesa_is_proxy_texture(GLenum target) { - /* NUM_TEXTURE_TARGETS should match number of terms below, - * except there's no proxy for GL_TEXTURE_BUFFER. + /* + * NUM_TEXTURE_TARGETS should match number of terms below, except there's no + * proxy for GL_TEXTURE_BUFFER and GL_TEXTURE_EXTERNAL_OES. */ - assert(NUM_TEXTURE_TARGETS == 8); + assert(NUM_TEXTURE_TARGETS == 7 + 2); return (target == GL_PROXY_TEXTURE_1D || target == GL_PROXY_TEXTURE_2D || @@ -723,6 +725,9 @@ _mesa_select_tex_object(struct gl_context *ctx, case GL_TEXTURE_BUFFER: return ctx->Extensions.ARB_texture_buffer_object ? texUnit->CurrentTex[TEXTURE_BUFFER_INDEX] : NULL; + case GL_TEXTURE_EXTERNAL_OES: + return ctx->Extensions.OES_EGL_image_external + ? texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX] : NULL; default: _mesa_problem(NULL, "bad target in _mesa_select_tex_object()"); return NULL; @@ -911,6 +916,7 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target) ctx->Extensions.EXT_texture_array) ? ctx->Const.MaxTextureLevels : 0; case GL_TEXTURE_BUFFER: + case GL_TEXTURE_EXTERNAL_OES: /* fall-through */ default: return 0; /* bad target */ @@ -942,6 +948,7 @@ _mesa_get_texture_dimensions(GLenum target) case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: case GL_TEXTURE_1D_ARRAY: case GL_PROXY_TEXTURE_1D_ARRAY: + case GL_TEXTURE_EXTERNAL_OES: return 2; case GL_TEXTURE_3D: case GL_PROXY_TEXTURE_3D: @@ -1433,6 +1440,23 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target) /** + * Helper function to determine if a texture object is mutable (in terms + * of GL_ARB_texture_storage). + */ +static GLboolean +mutable_tex_object(struct gl_context *ctx, GLenum target) +{ + if (ctx->Extensions.ARB_texture_storage) { + struct gl_texture_object *texObj = + _mesa_get_current_tex_object(ctx, target); + return !texObj->Immutable; + } + return GL_TRUE; +} + + + +/** * Test the glTexImage[123]D() parameters for errors. * * \param ctx GL context. @@ -1643,6 +1667,12 @@ texture_error_check( struct gl_context *ctx, return GL_TRUE; } + if (!mutable_tex_object(ctx, target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%dD(immutable texture)", dimensions); + return GL_TRUE; + } + /* if we get here, the parameters are OK */ return GL_FALSE; } @@ -1906,6 +1936,12 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, } } + if (!mutable_tex_object(ctx, target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexImage%dD(immutable texture)", dimensions); + return GL_TRUE; + } + /* if we get here, the parameters are OK */ return GL_FALSE; } @@ -2504,13 +2540,10 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (!ctx->Extensions.OES_EGL_image) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glEGLImageTargetTexture2DOES(unsupported)"); - return; - } - - if (target != GL_TEXTURE_2D) { + if ((target == GL_TEXTURE_2D && + !ctx->Extensions.OES_EGL_image) || + (target == GL_TEXTURE_EXTERNAL_OES && + !ctx->Extensions.OES_EGL_image_external)) { _mesa_error(ctx, GL_INVALID_ENUM, "glEGLImageTargetTexture2D(target=%d)", target); return; @@ -3107,6 +3140,11 @@ compressed_texture_error_check(struct gl_context *ctx, GLint dimensions, return GL_INVALID_VALUE; } + if (!mutable_tex_object(ctx, target)) { + *reason = "immutable texture"; + return GL_INVALID_OPERATION; + } + return GL_NO_ERROR; } |