X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Ftexobj.c;h=17c78ce3e6382200548bd3c141928da31d1e0fb4;hb=9ec5050898877baa6120fd9a04464651c7cb28ad;hp=a8c0b8ee8b958283e5c597953b8e61ab5346f98a;hpb=414e183ed7345828ce3ca572ddab1ad6317ec175;p=mesa.git diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index a8c0b8ee8b9..17c78ce3e63 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -107,6 +107,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, target == GL_TEXTURE_RECTANGLE_NV || target == GL_TEXTURE_1D_ARRAY_EXT || target == GL_TEXTURE_2D_ARRAY_EXT || + target == GL_TEXTURE_EXTERNAL_OES || target == GL_TEXTURE_BUFFER); memset(obj, 0, sizeof(*obj)); @@ -119,8 +120,12 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj->BaseLevel = 0; obj->MaxLevel = 1000; + /* must be one; no support for (YUV) planes in separate buffers */ + obj->RequiredTextureImageUnits = 1; + /* sampler state */ - if (target == GL_TEXTURE_RECTANGLE_NV) { + if (target == GL_TEXTURE_RECTANGLE_NV || + target == GL_TEXTURE_EXTERNAL_OES) { obj->Sampler.WrapS = GL_CLAMP_TO_EDGE; obj->Sampler.WrapT = GL_CLAMP_TO_EDGE; obj->Sampler.WrapR = GL_CLAMP_TO_EDGE; @@ -161,7 +166,8 @@ finish_texture_init(struct gl_context *ctx, GLenum target, { assert(obj->Target == 0); - if (target == GL_TEXTURE_RECTANGLE_NV) { + if (target == GL_TEXTURE_RECTANGLE_NV || + target == GL_TEXTURE_EXTERNAL_OES) { /* have to init wrap and filter state here - kind of klunky */ obj->Sampler.WrapS = GL_CLAMP_TO_EDGE; obj->Sampler.WrapT = GL_CLAMP_TO_EDGE; @@ -259,6 +265,8 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, dest->_Complete = src->_Complete; COPY_4V(dest->Swizzle, src->Swizzle); dest->_Swizzle = src->_Swizzle; + + dest->RequiredTextureImageUnits = src->RequiredTextureImageUnits; } @@ -306,6 +314,7 @@ valid_texture_object(const struct gl_texture_object *tex) case GL_TEXTURE_1D_ARRAY_EXT: case GL_TEXTURE_2D_ARRAY_EXT: case GL_TEXTURE_BUFFER: + case GL_TEXTURE_EXTERNAL_OES: return GL_TRUE; case 0x99: _mesa_problem(NULL, "invalid reference to a deleted texture object"); @@ -406,10 +415,6 @@ incomplete(struct gl_texture_object *t, const char *fmt, ...) * The gl_texture_object::Complete flag will be set to GL_TRUE or GL_FALSE * accordingly. * - * XXX TODO: For immutable textures (GL_ARB_texture_storage) we can skip - * many of the checks below since we know the mipmap images will have - * consistent sizes. - * * \param ctx GL context. * \param t texture object. * @@ -470,7 +475,8 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, t->Image[0][baseLevel]->HeightLog2); maxLevels = ctx->Const.MaxCubeTextureLevels; } - else if (t->Target == GL_TEXTURE_RECTANGLE_NV) { + else if (t->Target == GL_TEXTURE_RECTANGLE_NV || + t->Target == GL_TEXTURE_EXTERNAL_OES) { maxLog2 = 0; /* not applicable */ maxLevels = 1; /* no mipmapping */ } @@ -494,6 +500,15 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, /* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */ t->_MaxLambda = (GLfloat) (t->_MaxLevel - t->BaseLevel); + if (t->Immutable) { + /* This texture object was created with glTexStorage1/2/3D() so we + * know that all the mipmap levels are the right size and all cube + * map faces are the same size. + * We don't need to do any of the additional checks below. + */ + return; + } + if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { /* make sure that all six cube map level 0 images are the same size */ const GLuint w = t->Image[0][baseLevel]->Width2; @@ -1005,6 +1020,8 @@ target_enum_to_index(GLenum target) return TEXTURE_2D_ARRAY_INDEX; case GL_TEXTURE_BUFFER_ARB: return TEXTURE_BUFFER_INDEX; + case GL_TEXTURE_EXTERNAL_OES: + return TEXTURE_EXTERNAL_INDEX; default: return -1; }