On Tue, May 1, 2012 at 2:07 PM, Brian Paul <bri...@vmware.com> wrote:
> When glTexImage or glCopyTexImage is called with internalFormat being a > generic compressed format (like GL_COMPRESSED_RGB) we need to do the same > error checks as for specific compressed formats. In particular, check if > the texture target is compatible with the format. None of the texture > compression formats we support so far work with GL_TEXTURE_1D, for example. > > See also https://bugs.freedesktop.org/show_bug.cgi?id=49124 Brian, generic texture compression formats with GL_TEXTURE_1D seem to work fine on i965 drivers. I verified this by allowing generic texture compression formats for GL_TEXTURE_1D in piglit copyteximage test case and reverting the changes due to this patch on mesa. Is this an issue only on swrast? Returning GL_INVALID_ENUM error for generic texture compression formats in glTexImage1D() and glCopyTexImage1D() doesn't seem to follow the OpenGL specification. Spec does allow GL_INVALID_ENUM error for a similar scenario in case of glCompressedTexImage1D(). Please correct me if I'm missing something. > > NOTE: This is a candidate for the 8.0 branch. > --- > src/mesa/main/teximage.c | 32 ++++++++++++++++++++++++++++++-- > 1 files changed, 30 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c > index 50095d2..694f6fa 100644 > --- a/src/mesa/main/teximage.c > +++ b/src/mesa/main/teximage.c > @@ -531,6 +531,32 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint > internalFormat ) > > > /** > + * Is the given texture format a generic compressed format? > + */ > +static GLboolean > +is_generic_compressed_format(GLenum format) > +{ > + switch (format) { > + case GL_COMPRESSED_RED: > + case GL_COMPRESSED_RG: > + case GL_COMPRESSED_RGB: > + case GL_COMPRESSED_RGBA: > + case GL_COMPRESSED_ALPHA: > + case GL_COMPRESSED_LUMINANCE: > + case GL_COMPRESSED_LUMINANCE_ALPHA: > + case GL_COMPRESSED_INTENSITY: > + case GL_COMPRESSED_SRGB: > + case GL_COMPRESSED_SRGB_ALPHA: > + case GL_COMPRESSED_SLUMINANCE: > + case GL_COMPRESSED_SLUMINANCE_ALPHA: > + return GL_TRUE; > + default: > + return GL_FALSE; > + } > +} > + > + > +/** > * For cube map faces, return a face index in [0,5]. > * For other targets return 0; > */ > @@ -1705,7 +1731,8 @@ texture_error_check( struct gl_context *ctx, > } > > /* additional checks for compressed textures */ > - if (_mesa_is_compressed_format(ctx, internalFormat)) { > + if (_mesa_is_compressed_format(ctx, internalFormat) || > + is_generic_compressed_format(internalFormat)) { > if (!target_can_be_compressed(ctx, target, internalFormat)) { > if (!isProxy) > _mesa_error(ctx, GL_INVALID_ENUM, > @@ -2036,7 +2063,8 @@ copytexture_error_check( struct gl_context *ctx, > GLuint dimensions, > return GL_TRUE; > } > > - if (_mesa_is_compressed_format(ctx, internalFormat)) { > + if (_mesa_is_compressed_format(ctx, internalFormat) || > + is_generic_compressed_format(internalFormat)) { > if (!target_can_be_compressed(ctx, target, internalFormat)) { > _mesa_error(ctx, GL_INVALID_ENUM, > "glCopyTexImage%dD(target)", dimensions); > -- > 1.7.3.4 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev