glsl: reject size1x8 for image variable with floating-point data types
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 19 Jun 2020 16:29:19 +0000 (18:29 +0200)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 9 Jul 2020 07:58:01 +0000 (09:58 +0200)
Fixes: 8d07d66180b ("glsl,nir: Switch the enum representing shader image formats to PIPE_FORMAT.")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5688>

src/compiler/glsl/ast_to_hir.cpp

index 101269bcb56858d665fec262527b32c8927b4cfe..c406ae28ec2e32b9fa906a90e13937f41b7c31ab 100644 (file)
@@ -4983,12 +4983,14 @@ ast_declarator_list::hir(exec_list *instructions,
       if (strncmp(this->type->specifier->type_name, "image", strlen("image")) == 0) {
          switch (this->type->qualifier.image_format) {
          case PIPE_FORMAT_R8_SINT:
-            /* No valid qualifier in this case, driver will need to look at
-             * the underlying image's format (just like no qualifier being
-             * present).
+            /* The GL_EXT_shader_image_load_store spec says:
+             *    A layout of "size1x8" is illegal for image variables associated
+             *    with floating-point data types.
              */
-            this->type->qualifier.image_format = PIPE_FORMAT_NONE;
-            break;
+            _mesa_glsl_error(& loc, state,
+                             "size1x8 is illegal for image variables "
+                             "with floating-point data types.");
+            return NULL;
          case PIPE_FORMAT_R16_SINT:
             this->type->qualifier.image_format = PIPE_FORMAT_R16_FLOAT;
             break;