summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-10-03 16:37:25 -0700
committerKenneth Graunke <[email protected]>2016-10-04 21:10:05 -0700
commitaecdb21be8f4cd4963d20fa42c2c7291ece874e6 (patch)
treef48726fd5bc7cf62fe642a7a06a304a06b712f97
parent53b8f6374f6bb12fd783ab90694a752c7cfc7b3a (diff)
mesa: Reorganize check_textarget().
Having one top-level switch statement covering all known texture targets will make the next change easier to implement. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/mesa/main/fbobject.c80
1 files changed, 37 insertions, 43 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 09da6b70d87..f8899e6dfb9 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2991,54 +2991,48 @@ check_textarget(struct gl_context *ctx, int dims, GLenum target,
{
bool err = false;
- switch (dims) {
- case 1:
- switch (textarget) {
- case GL_TEXTURE_1D:
- break;
- case GL_TEXTURE_1D_ARRAY:
- err = !ctx->Extensions.EXT_texture_array;
- break;
- default:
- err = true;
- }
+ switch (textarget) {
+ case GL_TEXTURE_1D:
+ err = dims != 1;
break;
- case 2:
- switch (textarget) {
- case GL_TEXTURE_2D:
- break;
- case GL_TEXTURE_RECTANGLE:
- err = _mesa_is_gles(ctx)
- || !ctx->Extensions.NV_texture_rectangle;
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- err = !ctx->Extensions.ARB_texture_cube_map;
- break;
- case GL_TEXTURE_2D_ARRAY:
- err = (_mesa_is_gles(ctx) && ctx->Version < 30)
- || !ctx->Extensions.EXT_texture_array;
- break;
- case GL_TEXTURE_2D_MULTISAMPLE:
- case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
- err = (_mesa_is_gles(ctx) ||
- !ctx->Extensions.ARB_texture_multisample) &&
- !_mesa_is_gles31(ctx);
- break;
- default:
- err = true;
- }
+ case GL_TEXTURE_1D_ARRAY:
+ err = dims != 1 || !ctx->Extensions.EXT_texture_array;
break;
- case 3:
- if (textarget != GL_TEXTURE_3D)
- err = true;
+ case GL_TEXTURE_2D:
+ err = dims != 2;
+ break;
+ case GL_TEXTURE_2D_ARRAY:
+ err = dims != 2 || !ctx->Extensions.EXT_texture_array ||
+ (_mesa_is_gles(ctx) && ctx->Version < 30);
+ break;
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ err = dims != 2 ||
+ !ctx->Extensions.ARB_texture_multisample ||
+ (_mesa_is_gles(ctx) && ctx->Version < 31);
+ break;
+ case GL_TEXTURE_RECTANGLE:
+ err = dims != 2 || _mesa_is_gles(ctx) ||
+ !ctx->Extensions.NV_texture_rectangle;
+ break;
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ err = true;
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ err = dims != 2 || !ctx->Extensions.ARB_texture_cube_map;
+ break;
+ case GL_TEXTURE_3D:
+ err = dims != 3;
break;
default:
err = true;
+ break;
}
if (err) {