summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/textureview.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-05-03 15:20:48 +1000
committerDave Airlie <airlied@redhat.com>2016-05-03 20:12:52 +1000
commit30823f997b96e3568bc94827253e3a2b08e86598 (patch)
treefda53d9544db4c0d9bfa666b23d8630bc40b43a6 /src/mesa/main/textureview.c
parent5541e11b9a1a4aa3b785d5d426276f9eb4795b61 (diff)
downloadexternal_mesa3d-30823f997b96e3568bc94827253e3a2b08e86598.zip
external_mesa3d-30823f997b96e3568bc94827253e3a2b08e86598.tar.gz
external_mesa3d-30823f997b96e3568bc94827253e3a2b08e86598.tar.bz2
mesa/textureview: move error checks up higher
GL43-CTS.texture_view.errors checks for GL_INVALID_VALUE here but we catch these problems in the dimensionsOK check and return the wrong error value. This fixes: GL43-CTS.texture_view.errors. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/mesa/main/textureview.c')
-rw-r--r--src/mesa/main/textureview.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index 4b3b324..ef4d7bb 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -639,15 +639,40 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint origtexture,
case GL_TEXTURE_2D:
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_RECTANGLE:
+ depth = 1;
+ break;
case GL_TEXTURE_CUBE_MAP:
+ /* If the new texture's target is TEXTURE_CUBE_MAP, the clamped
+ * <numlayers> must be equal to 6.
+ */
+ if (newViewNumLayers != 6) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTextureView(clamped numlayers %d != 6)",
+ newViewNumLayers);
+ return;
+ }
depth = 1;
break;
case GL_TEXTURE_2D_ARRAY:
- case GL_TEXTURE_CUBE_MAP_ARRAY:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
depth = newViewNumLayers;
break;
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ /* If the new texture's target is TEXTURE_CUBE_MAP_ARRAY,
+ * then <numlayers> counts layer-faces rather than layers,
+ * and the clamped <numlayers> must be a multiple of 6.
+ * Otherwise, the error INVALID_VALUE is generated.
+ */
+ if ((newViewNumLayers % 6) != 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTextureView(clamped numlayers %d is not"
+ " a multiple of 6)",
+ newViewNumLayers);
+ return;
+ }
+ depth = newViewNumLayers;
+ break;
}
/* If the dimensions of the original texture are larger than the maximum
@@ -689,32 +714,9 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint origtexture,
return;
}
break;
-
case GL_TEXTURE_CUBE_MAP:
- /* If the new texture's target is TEXTURE_CUBE_MAP, the clamped
- * <numlayers> must be equal to 6.
- */
- if (newViewNumLayers != 6) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTextureView(clamped numlayers %d != 6)",
- newViewNumLayers);
- return;
- }
break;
-
case GL_TEXTURE_CUBE_MAP_ARRAY:
- /* If the new texture's target is TEXTURE_CUBE_MAP_ARRAY,
- * then <numlayers> counts layer-faces rather than layers,
- * and the clamped <numlayers> must be a multiple of 6.
- * Otherwise, the error INVALID_VALUE is generated.
- */
- if ((newViewNumLayers % 6) != 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTextureView(clamped numlayers %d is not"
- " a multiple of 6)",
- newViewNumLayers);
- return;
- }
break;
}