summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-06-12 00:49:15 +0200
committerMarek Olšák <[email protected]>2017-06-22 01:51:02 +0200
commitc0ed52f6146c7e24e1275451773bd47c1eda3145 (patch)
tree88fcb696e8a33eed7379330461849383ce26f48b
parentcaf39d6df9de145060d7def72c20ca45e41b1e9c (diff)
mesa: simplify _mesa_is_image_unit_valid for buffers
Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/mesa/main/shaderimage.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index 5e31d4e8220..c722b327de2 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -477,6 +477,13 @@ _mesa_is_image_unit_valid(struct gl_context *ctx, struct gl_image_unit *u)
if (!t)
return GL_FALSE;
+ /* The GL 4.5 Core spec doesn't say anything about buffers. In practice,
+ * the image buffer format is always compatible with the underlying
+ * buffer storage.
+ */
+ if (t->Target == GL_TEXTURE_BUFFER)
+ return GL_TRUE;
+
if (!t->_BaseComplete && !t->_MipmapComplete)
_mesa_test_texobj_completeness(ctx, t);
@@ -490,20 +497,14 @@ _mesa_is_image_unit_valid(struct gl_context *ctx, struct gl_image_unit *u)
u->_Layer >= _mesa_get_texture_layers(t, u->Level))
return GL_FALSE;
- if (t->Target == GL_TEXTURE_BUFFER) {
- tex_format = _mesa_get_shader_image_format(t->BufferObjectFormat);
-
- } else {
- struct gl_texture_image *img = (t->Target == GL_TEXTURE_CUBE_MAP ?
- t->Image[u->_Layer][u->Level] :
- t->Image[0][u->Level]);
-
- if (!img || img->Border || img->NumSamples > ctx->Const.MaxImageSamples)
- return GL_FALSE;
+ struct gl_texture_image *img = (t->Target == GL_TEXTURE_CUBE_MAP ?
+ t->Image[u->_Layer][u->Level] :
+ t->Image[0][u->Level]);
- tex_format = _mesa_get_shader_image_format(img->InternalFormat);
- }
+ if (!img || img->Border || img->NumSamples > ctx->Const.MaxImageSamples)
+ return GL_FALSE;
+ tex_format = _mesa_get_shader_image_format(img->InternalFormat);
if (!tex_format)
return GL_FALSE;