aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-05-05 14:31:41 -0700
committerJason Ekstrand <[email protected]>2017-05-09 15:08:07 -0700
commit037ce253b17e9133bec166283c4764d42915e05f (patch)
treea0b6ff63e184cd923ce08876f87bea5b82f91053
parent2e9916ea0410385534dc3ff45cd476143a4e2041 (diff)
i965/vec4: Delete the system value infastructure
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 <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/intel/compiler/brw_vec4.h5
-rw-r--r--src/intel/compiler/brw_vec4_gs_nir.cpp32
-rw-r--r--src/intel/compiler/brw_vec4_gs_visitor.cpp20
-rw-r--r--src/intel/compiler/brw_vec4_gs_visitor.h2
-rw-r--r--src/intel/compiler/brw_vec4_nir.cpp38
-rw-r--r--src/intel/compiler/brw_vec4_tcs.cpp12
-rw-r--r--src/intel/compiler/brw_vec4_tcs.h2
-rw-r--r--src/intel/compiler/brw_vec4_tes.cpp20
-rw-r--r--src/intel/compiler/brw_vec4_tes.h2
-rw-r--r--src/intel/compiler/brw_vec4_vs.h1
-rw-r--r--src/intel/compiler/brw_vec4_vs_visitor.cpp8
11 files changed, 5 insertions, 137 deletions
diff --git a/src/intel/compiler/brw_vec4.h b/src/intel/compiler/brw_vec4.h
index 0f92f343ce5..d828da02ea0 100644
--- a/src/intel/compiler/brw_vec4.h
+++ b/src/intel/compiler/brw_vec4.h
@@ -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();
diff --git a/src/intel/compiler/brw_vec4_gs_nir.cpp b/src/intel/compiler/brw_vec4_gs_nir.cpp
index 577f587f9b1..77b753a3e5d 100644
--- a/src/intel/compiler/brw_vec4_gs_nir.cpp
+++ b/src/intel/compiler/brw_vec4_gs_nir.cpp
@@ -31,28 +31,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)
{
dst_reg dest;
@@ -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;
}
diff --git a/src/intel/compiler/brw_vec4_gs_visitor.cpp b/src/intel/compiler/brw_vec4_gs_visitor.cpp
index b281bcf49f4..791ee7e1dff 100644
--- a/src/intel/compiler/brw_vec4_gs_visitor.cpp
+++ b/src/intel/compiler/brw_vec4_gs_visitor.cpp
@@ -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)
{
diff --git a/src/intel/compiler/brw_vec4_gs_visitor.h b/src/intel/compiler/brw_vec4_gs_visitor.h
index f57cdba8cf9..c6565594cf0 100644
--- a/src/intel/compiler/brw_vec4_gs_visitor.h
+++ b/src/intel/compiler/brw_vec4_gs_visitor.h
@@ -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();
diff --git a/src/intel/compiler/brw_vec4_nir.cpp b/src/intel/compiler/brw_vec4_nir.cpp
index 32297b1830d..66324e3bcd7 100644
--- a/src/intel/compiler/brw_vec4_nir.cpp
+++ b/src/intel/compiler/brw_vec4_nir.cpp
@@ -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);
@@ -48,42 +46,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()
{
uniforms = nir->num_uniforms / 16;
diff --git a/src/intel/compiler/brw_vec4_tcs.cpp b/src/intel/compiler/brw_vec4_tcs.cpp
index 733f152acc6..96597b8f2ad 100644
--- a/src/intel/compiler/brw_vec4_tcs.cpp
+++ b/src/intel/compiler/brw_vec4_tcs.cpp
@@ -50,18 +50,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()
{
int reg = 0;
diff --git a/src/intel/compiler/brw_vec4_tcs.h b/src/intel/compiler/brw_vec4_tcs.h
index 030eb5e6603..efa13ecc6cc 100644
--- a/src/intel/compiler/brw_vec4_tcs.h
+++ b/src/intel/compiler/brw_vec4_tcs.h
@@ -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();
diff --git a/src/intel/compiler/brw_vec4_tes.cpp b/src/intel/compiler/brw_vec4_tes.cpp
index bcf9a87eb01..35aff0f4b78 100644
--- a/src/intel/compiler/brw_vec4_tes.cpp
+++ b/src/intel/compiler/brw_vec4_tes.cpp
@@ -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()
{
diff --git a/src/intel/compiler/brw_vec4_tes.h b/src/intel/compiler/brw_vec4_tes.h
index 31a28f35974..7da3e5fa6cc 100644
--- a/src/intel/compiler/brw_vec4_tes.h
+++ b/src/intel/compiler/brw_vec4_tes.h
@@ -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();
diff --git a/src/intel/compiler/brw_vec4_vs.h b/src/intel/compiler/brw_vec4_vs.h
index 8c346d7636a..cd07e0e99de 100644
--- a/src/intel/compiler/brw_vec4_vs.h
+++ b/src/intel/compiler/brw_vec4_vs.h
@@ -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();
diff --git a/src/intel/compiler/brw_vec4_vs_visitor.cpp b/src/intel/compiler/brw_vec4_vs_visitor.cpp
index 7edf6ba1cc3..ad7f067ad60 100644
--- a/src/intel/compiler/brw_vec4_vs_visitor.cpp
+++ b/src/intel/compiler/brw_vec4_vs_visitor.cpp
@@ -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)
{