[Mesa-stable] [Mesa-dev] [PATCH 6/7] mesa: Validate the layer selection of an array texture too
Marek Olšák
maraeo at gmail.com
Wed Jul 31 15:07:03 PDT 2013
I think we should also validate the layer for GL_TEXTURE_CUBE_MAP_ARRAY.
Marek
On Wed, Jul 31, 2013 at 10:29 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Previously only the slice of a 3D texture was validated in the FBO
> completeness check. This fixes the failure in the 'invalid layer of an
> array texture' subtest of piglit's fbo-incomplete test.
>
> v2: 1D_ARRAY textures have Depth == 1. Instead, compare against Height.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
> Cc: mesa-stable at lists.freedesktop.org
> ---
> src/mesa/main/fbobject.c | 27 +++++++++++++++++++++++----
> 1 file changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 1225fea..bed7a68 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -729,10 +729,29 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
> att->Complete = GL_FALSE;
> return;
> }
> - if (texObj->Target == GL_TEXTURE_3D && att->Zoffset >= texImage->Depth) {
> - att_incomplete("bad z offset");
> - att->Complete = GL_FALSE;
> - return;
> +
> + switch (texObj->Target) {
> + case GL_TEXTURE_3D:
> + if (att->Zoffset >= texImage->Depth) {
> + att_incomplete("bad z offset");
> + att->Complete = GL_FALSE;
> + return;
> + }
> + break;
> + case GL_TEXTURE_1D_ARRAY:
> + if (att->Zoffset >= texImage->Height) {
> + att_incomplete("bad 1D-array layer");
> + att->Complete = GL_FALSE;
> + return;
> + }
> + break;
> + case GL_TEXTURE_2D_ARRAY:
> + if (att->Zoffset >= texImage->Depth) {
> + att_incomplete("bad 2D-array layer");
> + att->Complete = GL_FALSE;
> + return;
> + }
> + break;
> }
>
> baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
> --
> 1.8.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-stable
mailing list