[Piglit] [PATCH] arb_shader_image_load_store: Create complete textures.

Dorian Apanel dorian.apanel at gmail.com
Wed Apr 5 07:55:43 UTC 2017


From: Dorian Apanel <dorian.apanel+piglit at gmail.com>

Textures created by image load/store tests are not complete (max level defaults to 1000).
Load/Store on incomplete textures should return zeros/change nothing.
This fix sets proper base and max level of textures.

Signed-off-by: Dorian Apanel <dorian.apanel at gmail.com>
---
 tests/spec/arb_shader_image_load_store/common.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/spec/arb_shader_image_load_store/common.c b/tests/spec/arb_shader_image_load_store/common.c
index cbeaac7..fdc2ef3 100644
--- a/tests/spec/arb_shader_image_load_store/common.c
+++ b/tests/spec/arb_shader_image_load_store/common.c
@@ -141,6 +141,11 @@ upload_image_levels(const struct image_info img, unsigned num_levels,
         glGenTextures(1, &textures[unit]);
         glBindTexture(img.target->target, textures[unit]);
 
+        if (img.target->target != GL_TEXTURE_BUFFER) {
+            glTexParameteri(img.target->target, GL_TEXTURE_BASE_LEVEL, 0);
+            glTexParameteri(img.target->target, GL_TEXTURE_MAX_LEVEL, num_levels - 1);
+        }
+
         switch (img.target->target) {
         case GL_TEXTURE_1D:
                 for (l = 0; l < num_levels; ++l) {
@@ -301,6 +306,8 @@ upload_image_levels(const struct image_info img, unsigned num_levels,
 
                 glGenTextures(1, &tmp_tex);
                 glBindTexture(GL_TEXTURE_2D, tmp_tex);
+                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
 
                 if (img.target->target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
                         glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
@@ -462,6 +469,8 @@ download_image_levels(const struct image_info img, unsigned num_levels,
 
                 glGenTextures(1, &tmp_tex);
                 glBindTexture(GL_TEXTURE_2D, tmp_tex);
+                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
 
                 glTexImage2D(GL_TEXTURE_2D, 0, img.format->format,
                              grid.size.x, grid.size.y, 0,
-- 
2.10.2.windows.1



More information about the Piglit mailing list