summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlejandro PiƱeiro <[email protected]>2015-06-16 17:01:29 +0200
committerJason Ekstrand <[email protected]>2015-08-03 09:40:47 -0700
commit01c5617c8edc2f392363e9f8861d62a9fc9aa973 (patch)
tree73d1ac26eec50ce9a43acb1ede54a17e6b1ad84a /src
parent195156e571e851273c135847f91ed73b3bfc1914 (diff)
i965/vec4: Redefine make_reg_for_system_value() to allow reuse in NIR->vec4 pass
The new virtual method is more flexible, it has a signature: dst_reg *make_reg_for_system_value(int location, const glsl_type *type); v2 (Jason Ekstrand): Use the new version in unit tests so make check passes again Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.h4
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp7
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h3
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp5
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.h3
-rw-r--r--src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp3
-rw-r--r--src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp3
8 files changed, 19 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 98bfb7ce847..d429310563f 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -410,6 +410,9 @@ public:
virtual void nir_emit_jump(nir_jump_instr *instr);
virtual void nir_emit_texture(nir_tex_instr *instr);
+ virtual dst_reg *make_reg_for_system_value(int location,
+ const glsl_type *type) = 0;
+
src_reg *nir_inputs;
unsigned *nir_uniform_driver_location;
@@ -419,7 +422,6 @@ protected:
bool interleaved);
void setup_payload_interference(struct ra_graph *g, int first_payload_node,
int reg_node_count);
- virtual dst_reg *make_reg_for_system_value(ir_variable *ir) = 0;
virtual void assign_binding_table_offsets();
virtual void setup_payload() = 0;
virtual void emit_prolog() = 0;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index d6b350bea3f..704644e7429 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -51,11 +51,12 @@ vec4_gs_visitor::vec4_gs_visitor(const struct brw_compiler *compiler,
dst_reg *
-vec4_gs_visitor::make_reg_for_system_value(ir_variable *ir)
+vec4_gs_visitor::make_reg_for_system_value(int location,
+ const glsl_type *type)
{
- dst_reg *reg = new(mem_ctx) dst_reg(this, ir->type);
+ dst_reg *reg = new(mem_ctx) dst_reg(this, type);
- switch (ir->data.location) {
+ switch (location) {
case SYSTEM_VALUE_INVOCATION_ID:
this->current_annotation = "initialize gl_InvocationID";
emit(GS_OPCODE_GET_INSTANCE_ID, *reg);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
index e51399d620d..54cd2a1ff34 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
@@ -76,7 +76,8 @@ public:
int shader_time_index);
protected:
- virtual dst_reg *make_reg_for_system_value(ir_variable *ir);
+ virtual dst_reg *make_reg_for_system_value(int location,
+ const glsl_type *type);
virtual void setup_payload();
virtual void emit_prolog();
virtual void emit_program_code();
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index aeb31fdc0e2..17604cdaecc 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1094,7 +1094,7 @@ vec4_visitor::visit(ir_variable *ir)
break;
case ir_var_system_value:
- reg = make_reg_for_system_value(ir);
+ reg = make_reg_for_system_value(ir->data.location, ir->type);
break;
default:
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
index b7ec8b9c169..620f652d6dc 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
@@ -143,7 +143,8 @@ vec4_vs_visitor::emit_prolog()
dst_reg *
-vec4_vs_visitor::make_reg_for_system_value(ir_variable *ir)
+vec4_vs_visitor::make_reg_for_system_value(int location,
+ const glsl_type *type)
{
/* VertexID is stored by the VF as the last vertex element, but
* we don't represent it with a flag in inputs_read, so we call
@@ -151,7 +152,7 @@ vec4_vs_visitor::make_reg_for_system_value(ir_variable *ir)
*/
dst_reg *reg = new(mem_ctx) dst_reg(ATTR, VERT_ATTRIB_MAX);
- switch (ir->data.location) {
+ switch (location) {
case SYSTEM_VALUE_BASE_VERTEX:
reg->writemask = WRITEMASK_X;
vs_prog_data->uses_vertexid = true;
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
index 88927eeb3eb..1d9bee11c56 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -95,7 +95,8 @@ public:
bool use_legacy_snorm_formula);
protected:
- virtual dst_reg *make_reg_for_system_value(ir_variable *ir);
+ virtual dst_reg *make_reg_for_system_value(int location,
+ const glsl_type *type);
virtual void setup_payload();
virtual void emit_prolog();
virtual void emit_program_code();
diff --git a/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp
index 84e43fa75cd..fbd9fa8f19b 100644
--- a/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp
@@ -53,7 +53,8 @@ public:
}
protected:
- virtual dst_reg *make_reg_for_system_value(ir_variable *ir)
+ virtual dst_reg *make_reg_for_system_value(int location,
+ const glsl_type *type)
{
unreachable("Not reached");
}
diff --git a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
index de2afd39cfe..a3055fcc851 100644
--- a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
+++ b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
@@ -56,7 +56,8 @@ public:
}
protected:
- virtual dst_reg *make_reg_for_system_value(ir_variable *ir)
+ virtual dst_reg *make_reg_for_system_value(int location,
+ const glsl_type *type)
{
unreachable("Not reached");
}