summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2015-06-29 13:37:31 +0200
committerJason Ekstrand <[email protected]>2015-08-03 09:40:50 -0700
commit7ade42755f8900aaf67073214c073419f734e7a8 (patch)
tree4afab31b9fcd564f5acbdccf09feb180d3d91f65 /src/mesa/drivers/dri/i965
parent38fc4a91cd5c04fdd5921b8776f8e203513ab517 (diff)
i965/gs: Refactor ir_emit_vertex and ir_end_primitive
So the implementation is independent of GLSL IR and the visit methods of the vec4 visitor. This way we will be able to reuse that implementation directly from the NIR vec4 backend. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp20
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp13
4 files changed, 33 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 3ddfe88ad38..985886d7024 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -463,6 +463,8 @@ protected:
virtual void emit_urb_write_header(int mrf) = 0;
virtual vec4_instruction *emit_urb_write_opcode(bool complete) = 0;
virtual int compute_array_stride(ir_dereference_array *ir);
+ virtual void gs_emit_vertex(int stream_id);
+ virtual void gs_end_primitive();
private:
/**
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 704644e7429..019efecac66 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -467,7 +467,7 @@ vec4_gs_visitor::set_stream_control_data_bits(unsigned stream_id)
}
void
-vec4_gs_visitor::visit(ir_emit_vertex *ir)
+vec4_gs_visitor::gs_emit_vertex(int stream_id)
{
this->current_annotation = "emit vertex: safety check";
@@ -481,7 +481,7 @@ vec4_gs_visitor::visit(ir_emit_vertex *ir)
* be recorded by transform feedback, we can simply discard all geometry
* bound to these streams when transform feedback is disabled.
*/
- if (ir->stream_id() > 0 && shader_prog->TransformFeedback.NumVarying == 0)
+ if (stream_id > 0 && shader_prog->TransformFeedback.NumVarying == 0)
return;
/* To ensure that we don't output more vertices than the shader specified
@@ -560,7 +560,7 @@ vec4_gs_visitor::visit(ir_emit_vertex *ir)
c->prog_data.control_data_format ==
GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_SID) {
this->current_annotation = "emit vertex: Stream control data bits";
- set_stream_control_data_bits(ir->stream_id());
+ set_stream_control_data_bits(stream_id);
}
this->current_annotation = "emit vertex: increment vertex count";
@@ -573,7 +573,13 @@ vec4_gs_visitor::visit(ir_emit_vertex *ir)
}
void
-vec4_gs_visitor::visit(ir_end_primitive *)
+vec4_gs_visitor::visit(ir_emit_vertex *ir)
+{
+ gs_emit_vertex(ir->stream_id());
+}
+
+void
+vec4_gs_visitor::gs_end_primitive()
{
/* We can only do EndPrimitive() functionality when the control data
* consists of cut bits. Fortunately, the only time it isn't is when the
@@ -623,6 +629,12 @@ vec4_gs_visitor::visit(ir_end_primitive *)
emit(OR(dst_reg(this->control_data_bits), this->control_data_bits, mask));
}
+void
+vec4_gs_visitor::visit(ir_end_primitive *)
+{
+ gs_end_primitive();
+}
+
static const unsigned *
generate_assembly(struct brw_context *brw,
struct gl_shader_program *shader_prog,
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 54cd2a1ff34..8cad570b85d 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
@@ -87,6 +87,8 @@ protected:
virtual int compute_array_stride(ir_dereference_array *ir);
virtual void visit(ir_emit_vertex *);
virtual void visit(ir_end_primitive *);
+ virtual void gs_emit_vertex(int stream_id);
+ virtual void gs_end_primitive();
protected:
int setup_varying_inputs(int payload_reg, int *attribute_map,
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index f6155a3a3b5..c5c0d2c73e0 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2994,12 +2994,25 @@ vec4_visitor::visit(ir_if *ir)
}
void
+vec4_visitor::gs_emit_vertex(int stream_id)
+{
+ unreachable("not reached");
+}
+
+void
vec4_visitor::visit(ir_emit_vertex *)
{
unreachable("not reached");
}
void
+vec4_visitor::gs_end_primitive()
+{
+ unreachable("not reached");
+}
+
+
+void
vec4_visitor::visit(ir_end_primitive *)
{
unreachable("not reached");