On 03/20/2014 02:18 AM, Kenneth Graunke wrote: > If the number of layers is invalid, we're supposed to return > INVALID_VALUE. _mesa_legal_texture_dimensions detects some of these > cases (i.e. number of layers not being divisible by 6 for cubes), but > results in an INVALID_OPERATION error (which appears to be correct for > more general dimension problems). > > Fixes oglconform's texture_view/negative.apiErrors test. > > Signed-off-by: Kenneth Graunke <kenn...@whitecape.org> > Cc: Chris Forbes <chr...@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.roman...@intel.com> > --- > src/mesa/main/textureview.c | 42 +++++++++++++++++++++--------------------- > 1 file changed, 21 insertions(+), 21 deletions(-) > > Applies to the 'texture_view_ext' branch of: > git://github.com/chrisforbes/mesa.git > > diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c > index 99ccafd..c7756f5 100644 > --- a/src/mesa/main/textureview.c > +++ b/src/mesa/main/textureview.c > @@ -560,27 +560,6 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint > origtexture, > break; > } > > - /* If the dimensions of the original texture are larger than the maximum > - * supported dimensions of the new target, the error INVALID_OPERATION is > - * generated. For example, if the original texture has a TEXTURE_2D_ARRAY > - * target and its width is greater than MAX_CUBE_MAP_TEXTURE_SIZE, an > error > - * will be generated if TextureView is called to create a TEXTURE_CUBE_MAP > - * view. > - */ > - dimensionsOK = _mesa_legal_texture_dimensions(ctx, target, 0, > - width, height, depth, 0); > - if (!dimensionsOK) { > - _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureView(invalid width or > height or depth)"); > - return; > - } > - > - sizeOK = ctx->Driver.TestProxyTexImage(ctx, target, 0, texFormat, > - width, height, depth, 0); > - if (!sizeOK) { > - _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureView(invalid texture > size)"); > - return; > - } > - > /* If <target> is TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_RECTANGLE, > * or TEXTURE_2D_MULTISAMPLE and <numlayers> does not equal 1, the error > * INVALID_VALUE is generated. > @@ -623,6 +602,27 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint > origtexture, > break; > } > > + /* If the dimensions of the original texture are larger than the maximum > + * supported dimensions of the new target, the error INVALID_OPERATION is > + * generated. For example, if the original texture has a TEXTURE_2D_ARRAY > + * target and its width is greater than MAX_CUBE_MAP_TEXTURE_SIZE, an > error > + * will be generated if TextureView is called to create a TEXTURE_CUBE_MAP > + * view. > + */ > + dimensionsOK = _mesa_legal_texture_dimensions(ctx, target, 0, > + width, height, depth, 0); > + if (!dimensionsOK) { > + _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureView(invalid width or > height or depth)"); > + return; > + } > + > + sizeOK = ctx->Driver.TestProxyTexImage(ctx, target, 0, texFormat, > + width, height, depth, 0); > + if (!sizeOK) { > + _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureView(invalid texture > size)"); > + return; > + } > + > /* If the new texture's target is TEXTURE_CUBE_MAP or > * TEXTURE_CUBE_MAP_ARRAY, the width and height of the original texture's > * levels must be equal otherwise the error INVALID_OPERATION is > generated. > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev