[Mesa-dev] [PATCH] main/shaderimage: image unit invalid if texture is incomplete, independently of the level

Alejandro PiƱeiro apinheiro at igalia.com
Thu Jul 14 17:50:52 UTC 2016


Without this commit, a image is considered valid if the level of the
texture bound to the image is complete, something we can check as mesa
save independently if it is "base incomplete" of "mipmap incomplete".

But, from the OpenGL 4.3 Core Specification, section 8.25 ("Texture
Image Loads and Stores"):

  "An access is considered invalid if:
    the texture bound to the selected image unit is incomplete;"

This implies that the access to the image unit is invalid if the
texture is incomplete, no mattering details about the specific texture
level bound to the image.

This fixes:
GL44-CTS.shader_image_load_store.incomplete_textures
---

Current piglit test is not testing what this commit tries to fix. I
will send a patch to piglit in short.

 src/mesa/main/shaderimage.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index 90643c4..d20cd90 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -469,10 +469,18 @@ _mesa_is_image_unit_valid(struct gl_context *ctx, struct gl_image_unit *u)
    if (!t->_BaseComplete && !t->_MipmapComplete)
        _mesa_test_texobj_completeness(ctx, t);
 
+   /* From the OpenGL 4.3 Core Specification, Chapter 8.25, Texture Image
+    * Loads and Stores:
+    *
+    *  "An access is considered invalid if:
+    *    the texture bound to the selected image unit is incomplete;"
+    */
+   if (!t->_BaseComplete ||
+       !t->_MipmapComplete)
+      return GL_FALSE;
+
    if (u->Level < t->BaseLevel ||
-       u->Level > t->_MaxLevel ||
-       (u->Level == t->BaseLevel && !t->_BaseComplete) ||
-       (u->Level != t->BaseLevel && !t->_MipmapComplete))
+       u->Level > t->_MaxLevel)
       return GL_FALSE;
 
    if (_mesa_tex_target_is_layered(t->Target) &&
-- 
2.7.4



More information about the mesa-dev mailing list