Mesa (master): nir/spirv: Split up Uniform and UniformConstant storage classes

Jason Ekstrand jekstrand at kemper.freedesktop.org
Wed Jul 5 22:27:09 UTC 2017


Module: Mesa
Branch: master
Commit: 4e0280d37d1cdbe72199801f8e857bd8c88d1de5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e0280d37d1cdbe72199801f8e857bd8c88d1de5

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Thu Jun 29 10:33:26 2017 -0700

nir/spirv: Split up Uniform and UniformConstant storage classes

We were originally handling them together because I was rather unclear
on the distinction.  However, keeping them combined keeps the confusion.
Split them up so that it's more clear from the code how we expect the
two storage classes to be used.

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

---

 src/compiler/spirv/vtn_variables.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index bb41e89a33..754320afff 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1298,21 +1298,25 @@ vtn_storage_class_to_mode(SpvStorageClass class,
    nir_variable_mode nir_mode;
    switch (class) {
    case SpvStorageClassUniform:
-   case SpvStorageClassUniformConstant:
       if (interface_type->block) {
          mode = vtn_variable_mode_ubo;
          nir_mode = 0;
       } else if (interface_type->buffer_block) {
          mode = vtn_variable_mode_ssbo;
          nir_mode = 0;
-      } else if (glsl_type_is_image(interface_type->type)) {
+      } else {
+         assert(!"Invalid uniform variable type");
+      }
+      break;
+   case SpvStorageClassUniformConstant:
+      if (glsl_type_is_image(interface_type->type)) {
          mode = vtn_variable_mode_image;
          nir_mode = nir_var_uniform;
       } else if (glsl_type_is_sampler(interface_type->type)) {
          mode = vtn_variable_mode_sampler;
          nir_mode = nir_var_uniform;
       } else {
-         assert(!"Invalid uniform variable type");
+         assert(!"Invalid uniform constant variable type");
       }
       break;
    case SpvStorageClassPushConstant:




More information about the mesa-commit mailing list