i965/vec4: Delete the system value infastructure
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 5 May 2017 21:31:41 +0000 (14:31 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 9 May 2017 22:08:07 +0000 (15:08 -0700)
The only thing still using it is INVOCATION_ID for geometry shaders.
That's easily enough inlined into the nir_intrinsic_load_invocation_id
handling code.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_vec4.h
src/intel/compiler/brw_vec4_gs_nir.cpp
src/intel/compiler/brw_vec4_gs_visitor.cpp
src/intel/compiler/brw_vec4_gs_visitor.h
src/intel/compiler/brw_vec4_nir.cpp
src/intel/compiler/brw_vec4_tcs.cpp
src/intel/compiler/brw_vec4_tcs.h
src/intel/compiler/brw_vec4_tes.cpp
src/intel/compiler/brw_vec4_tes.h
src/intel/compiler/brw_vec4_vs.h
src/intel/compiler/brw_vec4_vs_visitor.cpp

index 0f92f343ce5f2ce5f17102c714c304f67944ffae..d828da02ea0f38492393f838508ad5bd83ac0419 100644 (file)
@@ -332,8 +332,6 @@ public:
 
    virtual void emit_nir_code();
    virtual void nir_setup_uniforms();
-   virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
-   virtual void nir_setup_system_values();
    virtual void nir_emit_impl(nir_function_impl *impl);
    virtual void nir_emit_cf_list(exec_list *list);
    virtual void nir_emit_if(nir_if *if_stmt);
@@ -359,11 +357,8 @@ public:
                        unsigned num_components = 4);
    src_reg get_indirect_offset(nir_intrinsic_instr *instr);
 
-   virtual dst_reg *make_reg_for_system_value(int location) = 0;
-
    dst_reg *nir_locals;
    dst_reg *nir_ssa_values;
-   dst_reg *nir_system_values;
 
 protected:
    void emit_vertex();
index 577f587f9b103e0b5191547fc7df24b296693fe7..77b753a3e5dea3d44872cb44fb86a0c0d844a592 100644 (file)
@@ -30,28 +30,6 @@ vec4_gs_visitor::nir_setup_inputs()
 {
 }
 
-void
-vec4_gs_visitor::nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr)
-{
-   dst_reg *reg;
-
-   switch (instr->intrinsic) {
-   case nir_intrinsic_load_primitive_id:
-      /* We'll just read g1 directly; don't create a temporary. */
-      break;
-
-   case nir_intrinsic_load_invocation_id:
-      reg = &this->nir_system_values[SYSTEM_VALUE_INVOCATION_ID];
-      if (reg->file == BAD_FILE)
-         *reg = *this->make_reg_for_system_value(SYSTEM_VALUE_INVOCATION_ID);
-      break;
-
-   default:
-      vec4_visitor::nir_setup_system_value_intrinsic(instr);
-   }
-
-}
-
 void
 vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
 {
@@ -128,11 +106,11 @@ vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
       break;
 
    case nir_intrinsic_load_invocation_id: {
-      src_reg invocation_id =
-         src_reg(nir_system_values[SYSTEM_VALUE_INVOCATION_ID]);
-      assert(invocation_id.file != BAD_FILE);
-      dest = get_nir_dest(instr->dest, invocation_id.type);
-      emit(MOV(dest, invocation_id));
+      dest = get_nir_dest(instr->dest, BRW_REGISTER_TYPE_D);
+      if (gs_prog_data->invocations > 1)
+         emit(GS_OPCODE_GET_INSTANCE_ID, dest);
+      else
+         emit(MOV(dest, brw_imm_ud(0)));
       break;
    }
 
index b281bcf49f41718d20ce6b289508b083b19a4988..791ee7e1dfff60e8db4c6d651712ac3caf7d59e9 100644 (file)
@@ -53,26 +53,6 @@ vec4_gs_visitor::vec4_gs_visitor(const struct brw_compiler *compiler,
 }
 
 
-dst_reg *
-vec4_gs_visitor::make_reg_for_system_value(int location)
-{
-   dst_reg *reg = new(mem_ctx) dst_reg(this, glsl_type::int_type);
-
-   switch (location) {
-   case SYSTEM_VALUE_INVOCATION_ID:
-      this->current_annotation = "initialize gl_InvocationID";
-      if (gs_prog_data->invocations > 1)
-         emit(GS_OPCODE_GET_INSTANCE_ID, *reg);
-      else
-         emit(MOV(*reg, brw_imm_ud(0)));
-      break;
-   default:
-      unreachable("not reached");
-   }
-
-   return reg;
-}
-
 static inline struct brw_reg
 attribute_to_hw_reg(int attr, brw_reg_type type, bool interleaved)
 {
index f57cdba8cf90d3fc104ffc141c3c498cba45259f..c6565594cf07dfa177ae1a15ce75f6cd56899e9b 100644 (file)
@@ -50,10 +50,8 @@ public:
                    int shader_time_index);
 
    virtual void nir_setup_inputs();
-   virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
 
 protected:
-   virtual dst_reg *make_reg_for_system_value(int location);
    virtual void setup_payload();
    virtual void emit_prolog();
    virtual void emit_thread_end();
index 32297b1830dfc0c10833331e9c49e1b85f7f9594..66324e3bcd7ff0a5877b719019c58ee701e71e9e 100644 (file)
@@ -37,8 +37,6 @@ vec4_visitor::emit_nir_code()
    if (nir->num_uniforms > 0)
       nir_setup_uniforms();
 
-   nir_setup_system_values();
-
    /* get the main function and emit it */
    nir_foreach_function(function, nir) {
       assert(strcmp(function->name, "main") == 0);
@@ -47,42 +45,6 @@ vec4_visitor::emit_nir_code()
    }
 }
 
-void
-vec4_visitor::nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr)
-{
-}
-
-static bool
-setup_system_values_block(nir_block *block, vec4_visitor *v)
-{
-   nir_foreach_instr(instr, block) {
-      if (instr->type != nir_instr_type_intrinsic)
-         continue;
-
-      nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
-      v->nir_setup_system_value_intrinsic(intrin);
-   }
-
-   return true;
-}
-
-void
-vec4_visitor::nir_setup_system_values()
-{
-   nir_system_values = ralloc_array(mem_ctx, dst_reg, SYSTEM_VALUE_MAX);
-   for (unsigned i = 0; i < SYSTEM_VALUE_MAX; i++) {
-      nir_system_values[i] = dst_reg();
-   }
-
-   nir_foreach_function(function, nir) {
-      assert(strcmp(function->name, "main") == 0);
-      assert(function->impl);
-      nir_foreach_block(block, function->impl) {
-         setup_system_values_block(block, this);
-      }
-   }
-}
-
 void
 vec4_visitor::nir_setup_uniforms()
 {
index 733f152acc6af54ea47bc0320bb62ca995bfbc04..96597b8f2ad011f9475c75238b5e9e1e66dd5380 100644 (file)
@@ -49,18 +49,6 @@ vec4_tcs_visitor::vec4_tcs_visitor(const struct brw_compiler *compiler,
 }
 
 
-void
-vec4_tcs_visitor::nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr)
-{
-}
-
-dst_reg *
-vec4_tcs_visitor::make_reg_for_system_value(int location)
-{
-   return NULL;
-}
-
-
 void
 vec4_tcs_visitor::setup_payload()
 {
index 030eb5e6603a9d9fc52f72992a8fbf0a67b95ae2..efa13ecc6cc16c2eace09fab0faf02ae0b1ae44f 100644 (file)
@@ -49,8 +49,6 @@ public:
                     const struct brw_vue_map *input_vue_map);
 
 protected:
-   virtual dst_reg *make_reg_for_system_value(int location);
-   virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
    virtual void setup_payload();
    virtual void emit_prolog();
    virtual void emit_thread_end();
index bcf9a87eb01a5fc5dd588042f1afdb42ae8af3a4..35aff0f4b78f7e1b2f39bc0af37218ccde238012 100644 (file)
@@ -45,26 +45,6 @@ vec4_tes_visitor::vec4_tes_visitor(const struct brw_compiler *compiler,
 {
 }
 
-
-dst_reg *
-vec4_tes_visitor::make_reg_for_system_value(int location)
-{
-   return NULL;
-}
-
-void
-vec4_tes_visitor::nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr)
-{
-   switch (instr->intrinsic) {
-   case nir_intrinsic_load_tess_level_outer:
-   case nir_intrinsic_load_tess_level_inner:
-      break;
-   default:
-      vec4_visitor::nir_setup_system_value_intrinsic(instr);
-   }
-}
-
-
 void
 vec4_tes_visitor::setup_payload()
 {
index 31a28f359742bbeed004b9bcb3f675960f947ab9..7da3e5fa6cc1dd01b17cb4eaad98d4fbd51fab4d 100644 (file)
@@ -47,8 +47,6 @@ public:
                    int shader_time_index);
 
 protected:
-   virtual dst_reg *make_reg_for_system_value(int location);
-   virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
    virtual void nir_emit_intrinsic(nir_intrinsic_instr *instr);
 
    virtual void setup_payload();
index 8c346d7636a1c5046922e8ff6778cb3576e62d04..cd07e0e99de4d4d1eb962d236830a30965026b64 100644 (file)
@@ -42,7 +42,6 @@ public:
                    bool use_legacy_snorm_formula);
 
 protected:
-   virtual dst_reg *make_reg_for_system_value(int location);
    virtual void setup_payload();
    virtual void emit_prolog();
    virtual void emit_thread_end();
index 7edf6ba1cc39ce448367c32400aad5f34feed6dd..ad7f067ad60afc6a6f0207d29c0a390a339bc4ab 100644 (file)
@@ -33,14 +33,6 @@ vec4_vs_visitor::emit_prolog()
 }
 
 
-dst_reg *
-vec4_vs_visitor::make_reg_for_system_value(int location)
-{
-   unreachable("not reached");
-   return NULL;
-}
-
-
 void
 vec4_vs_visitor::emit_urb_write_header(int mrf)
 {