vk: Roll back GLSL parser support for vulkan
authorKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Fri, 25 Sep 2015 17:42:07 +0000 (10:42 -0700)
committerKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Fri, 25 Sep 2015 17:42:07 +0000 (10:42 -0700)
In the interest of reducing our delta to mesa master, let's undo these
changes now that we only support SPIR-V.

src/glsl/ast.h
src/glsl/ast_to_hir.cpp
src/glsl/ast_type.cpp
src/glsl/glsl_parser.yy
src/glsl/ir.h
src/glsl/link_uniform_block_active_visitor.cpp
src/glsl/link_uniform_block_active_visitor.h
src/glsl/link_uniform_blocks.cpp
src/glsl/nir/glsl_to_nir.cpp

index eb6d84616711b2a71438ec4afd8a155e7b32ab9c..d8c6cea7832574bc11d3badf544e42f12cf3dab9 100644 (file)
@@ -527,9 +527,6 @@ struct ast_type_qualifier {
          unsigned explicit_stream:1; /**< stream value assigned explicitly by shader code */
          /** \} */
 
-         /** \name Vulkan qualifiers */
-         unsigned vk_set:1;
-
         /** \name Layout qualifiers for GL_ARB_tessellation_shader */
         /** \{ */
         /* tess eval input layout */
@@ -642,11 +639,6 @@ struct ast_type_qualifier {
     */
    glsl_base_type image_base_type;
 
-   /**
-    * Vulkan descriptor set
-    */
-   int set;
-
    /**
     * Return true if and only if an interpolation qualifier is present.
     */
index 981438de59706a70eded72e4cdd154e139175c17..81b44bd6786c8c8f427650159bf3953da9d26dfe 100644 (file)
@@ -2777,16 +2777,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
          state->fs_redeclares_gl_fragcoord_with_no_layout_qualifiers;
    }
 
-   if (qual->flags.q.vk_set) {
-      if (!qual->flags.q.explicit_binding)
-         _mesa_glsl_error(loc, state,
-                          "Vulkan descriptor set layout requires both set "
-                          "and binding qualifiers");
-
-      var->data.vk_set = true;
-      var->data.set = qual->set;
-      var->data.binding = qual->binding;
-   } else if (qual->flags.q.explicit_location) {
+   if (qual->flags.q.explicit_location) {
       validate_explicit_location(qual, var, state, loc);
    } else if (qual->flags.q.explicit_index) {
       _mesa_glsl_error(loc, state, "explicit index requires explicit location");
@@ -6280,10 +6271,6 @@ ast_interface_block::hir(exec_list *instructions,
          var->data.explicit_binding = this->layout.flags.q.explicit_binding;
          var->data.binding = this->layout.binding;
 
-         var->data.vk_set = this->layout.flags.q.vk_set;
-         var->data.set = this->layout.set;
-         var->data.binding = this->layout.binding;
-
          state->symbols->add_variable(var);
          instructions->push_tail(var);
       }
@@ -6357,10 +6344,6 @@ ast_interface_block::hir(exec_list *instructions,
          var->data.explicit_binding = this->layout.flags.q.explicit_binding;
          var->data.binding = this->layout.binding;
 
-         var->data.vk_set = this->layout.flags.q.vk_set;
-         var->data.set = this->layout.set;
-         var->data.binding = this->layout.binding;
-
          state->symbols->add_variable(var);
          instructions->push_tail(var);
       }
index 892122af03d04050bd24aa3dcb0275f5847c77a8..a4671e203e28f0128468959685da00885a538380 100644 (file)
@@ -297,11 +297,6 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
       this->image_base_type = q.image_base_type;
    }
 
-   if (q.flags.q.vk_set) {
-      this->set = q.set;
-      this->binding = q.binding;
-   }
-
    return true;
 }
 
index e1b390844d39223f8aacec93cc18282728bdeb99..59e4527b23811ac801e2297725aa166c320e6279 100644 (file)
@@ -1468,16 +1468,14 @@ layout_qualifier_id:
          }
       }
 
-      if (match_layout_qualifier("binding", $1, state) == 0) {
+      if ((state->has_420pack() ||
+           state->has_atomic_counters() ||
+           state->has_shader_storage_buffer_objects()) &&
+          match_layout_qualifier("binding", $1, state) == 0) {
          $$.flags.q.explicit_binding = 1;
          $$.binding = $3;
       }
 
-      if (match_layout_qualifier("set", $1, state) == 0) {
-         $$.flags.q.vk_set = 1;
-         $$.set = $3;
-      }
-
       if (state->has_atomic_counters() &&
           match_layout_qualifier("offset", $1, state) == 0) {
          $$.flags.q.explicit_offset = 1;
index 7aac9af9001e220aea855cde117df7362fe4548e..ede8caa6e47b8b05fbb1368908102bec65aa1464 100644 (file)
@@ -688,11 +688,6 @@ public:
       unsigned explicit_location:1;
       unsigned explicit_index:1;
 
-      /**
-       * Do we have a Vulkan (group, index) qualifier for this variable?
-       */
-      unsigned vk_set:1;
-
       /**
        * Was an initial binding explicitly set in the shader?
        *
@@ -762,10 +757,8 @@ public:
        * \note
        * The GLSL spec only allows the values 0 or 1 for the index in \b dual
        * source blending.
-       *
-       * This is now also used for the Vulkan descriptor set index.
        */
-      int16_t index;
+      unsigned index:1;
 
       /**
        * \brief Layout qualifier for gl_FragDepth.
@@ -813,11 +806,6 @@ public:
        */
       int16_t binding;
 
-      /**
-       * Vulkan descriptor set for the resource.
-       */
-      int16_t set;
-
       /**
        * Storage location of the base of this variable
        *
index 981c1f755718e4a047ca50cde299ed347b14226a..510294783a0009d35371646d4a6e62db90ca7528 100644 (file)
@@ -54,11 +54,6 @@ process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var)
          b->binding = 0;
       }
 
-      if (var->data.vk_set) {
-         b->set = var->data.set;
-         b->index = var->data.index;
-      }
-
       _mesa_hash_table_insert(ht, var->get_interface_type()->name, (void *) b);
       return b;
    } else {
index d8aefd69991404862eac6f13bba1f82d9914277a..b663a884db49299f74fdb3a0ce6af0a7868d962a 100644 (file)
@@ -35,8 +35,6 @@ struct link_uniform_block_active {
    unsigned num_array_elements;
 
    unsigned binding;
-   unsigned set;
-   unsigned index;
 
    bool has_instance_name;
    bool has_binding;
index b80e5736f6b54a2c96b680547b260520bd62d918..4df39e200d5aa06d018cf911cf388ed0805ad748 100644 (file)
@@ -293,8 +293,6 @@ link_uniform_blocks(void *mem_ctx,
             blocks[i].NumUniforms =
                (unsigned)(ptrdiff_t)(&variables[parcel.index] - blocks[i].Uniforms);
 
-            blocks[i].Set = b->set;
-            blocks[i].Binding = b->binding;
             blocks[i].IsShaderStorage = b->is_shader_storage;
 
             i++;
@@ -315,8 +313,6 @@ link_uniform_blocks(void *mem_ctx,
          blocks[i].NumUniforms =
             (unsigned)(ptrdiff_t)(&variables[parcel.index] - blocks[i].Uniforms);
 
-         blocks[i].Set = b->set;
-         blocks[i].Binding = b->binding;
          blocks[i].IsShaderStorage = b->is_shader_storage;
 
          i++;
index af97da9cc21fc1a667080cc085bfd9c05f072afc..e3597e57e7331c5dfda9ca4d440217598bc56657 100644 (file)
@@ -327,7 +327,7 @@ nir_visitor::visit(ir_variable *ir)
    }
 
    var->data.index = ir->data.index;
-   var->data.descriptor_set = ir->data.set;
+   var->data.descriptor_set = 0;
    var->data.binding = ir->data.binding;
    /* XXX Get rid of buffer_index */
    var->data.atomic.buffer_index = ir->data.binding;
@@ -1003,20 +1003,11 @@ nir_visitor::visit(ir_expression *ir)
          op = nir_intrinsic_load_ubo_indirect;
       }
 
-      ir_constant *const_block = ir->operands[0]->as_constant();
-      assert(const_block && "can't figure out descriptor set index");
-      unsigned index = const_block->value.u[0];
-      unsigned set = sh->UniformBlocks[index].Set;
-      unsigned binding = sh->UniformBlocks[index].Binding;
-
       nir_intrinsic_instr *load = nir_intrinsic_instr_create(this->shader, op);
       load->num_components = ir->type->vector_elements;
-      load->const_index[0] = set;
-      load->const_index[1] = const_index ? const_index->value.u[0] : 0; /* base offset */
-      nir_load_const_instr *load_binding = nir_load_const_instr_create(shader, 1);
-      load_binding->value.u[0] = binding;
-      nir_instr_insert_after_cf_list(this->cf_node_list, &load_binding->instr);
-      load->src[0] = nir_src_for_ssa(&load_binding->def);
+      load->const_index[0] = const_index ? const_index->value.u[0] : 0; /* base offset */
+      load->const_index[1] = 1; /* number of vec4's */
+      load->src[0] = evaluate_rvalue(ir->operands[0]);
       if (!const_index)
          load->src[1] = evaluate_rvalue(ir->operands[1]);
       add_instr(&load->instr, ir->type->vector_elements);