[Mesa-dev] [PATCH 5/7] i965/gs: Use NIR instead of the brw_geometry_program for GS metadata
Jason Ekstrand
jason at jlekstrand.net
Tue Oct 20 18:10:20 PDT 2015
With this, we can remove the geometry program from brw_gs_compile.
---
src/mesa/drivers/dri/i965/brw_compiler.h | 2 --
src/mesa/drivers/dri/i965/brw_gs.c | 1 -
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 6 +++---
src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp | 12 ++++++------
4 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h
index 8c10495..4a87b29 100644
--- a/src/mesa/drivers/dri/i965/brw_compiler.h
+++ b/src/mesa/drivers/dri/i965/brw_compiler.h
@@ -602,8 +602,6 @@ struct brw_gs_compile
struct brw_gs_prog_data prog_data;
struct brw_vue_map input_vue_map;
- struct brw_geometry_program *gp;
-
unsigned control_data_bits_per_vertex;
unsigned control_data_header_size_bits;
};
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index ae7f242..effd5bf 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -62,7 +62,6 @@ brw_codegen_gs_prog(struct brw_context *brw,
struct brw_gs_compile c;
memset(&c, 0, sizeof(c));
c.key = *key;
- c.gp = gp;
c.prog_data.include_primitive_id =
(gp->program.Base.InputsRead & VARYING_BIT_PRIMITIVE_ID) != 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 47f2dd8..0a62485 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -78,7 +78,7 @@ vec4_gs_visitor::setup_varying_inputs(int payload_reg, int *attribute_map,
* so the total number of input slots that will be delivered to the GS (and
* thus the stride of the input arrays) is urb_read_length * 2.
*/
- const unsigned num_input_vertices = c->gp->program.VerticesIn;
+ const unsigned num_input_vertices = nir->info.gs.vertices_in;
assert(num_input_vertices <= MAX_GS_INPUT_VERTICES);
unsigned input_array_stride = c->prog_data.base.urb_read_length * 2;
@@ -182,9 +182,9 @@ vec4_gs_visitor::emit_prolog()
* to account for the fact that the vertex shader stored it in the w
* component of VARYING_SLOT_PSIZ.
*/
- if (c->gp->program.Base.InputsRead & VARYING_BIT_PSIZ) {
+ if (nir->info.inputs_read & VARYING_BIT_PSIZ) {
this->current_annotation = "swizzle gl_PointSize input";
- for (int vertex = 0; vertex < c->gp->program.VerticesIn; vertex++) {
+ for (int vertex = 0; vertex < (int)nir->info.gs.vertices_in; vertex++) {
dst_reg dst(ATTR,
BRW_VARYING_SLOT_COUNT * vertex + VARYING_SLOT_PSIZ);
dst.type = BRW_REGISTER_TYPE_F;
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp b/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
index 671a535..31cdc96 100644
--- a/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
@@ -63,7 +63,7 @@ gen6_gs_visitor::emit_prolog()
this->vertex_output = src_reg(this,
glsl_type::uint_type,
(prog_data->vue_map.num_slots + 1) *
- c->gp->program.VerticesOut);
+ nir->info.gs.vertices_out);
this->vertex_output_offset = src_reg(this, glsl_type::uint_type);
emit(MOV(dst_reg(this->vertex_output_offset), src_reg(0u)));
@@ -177,7 +177,7 @@ gen6_gs_visitor::gs_emit_vertex(int stream_id)
dst_reg dst(this->vertex_output);
dst.reladdr = ralloc(mem_ctx, src_reg);
memcpy(dst.reladdr, &this->vertex_output_offset, sizeof(src_reg));
- if (c->gp->program.OutputType == GL_POINTS) {
+ if (nir->info.gs.output_primitive == GL_POINTS) {
/* If we are outputting points, then every vertex has PrimStart and
* PrimEnd set.
*/
@@ -205,7 +205,7 @@ gen6_gs_visitor::gs_end_primitive()
/* Calling EndPrimitive() is optional for point output. In this case we set
* the PrimEnd flag when we process EmitVertex().
*/
- if (c->gp->program.OutputType == GL_POINTS)
+ if (nir->info.gs.output_primitive == GL_POINTS)
return;
/* Otherwise we know that the last vertex we have processed was the last
@@ -217,7 +217,7 @@ gen6_gs_visitor::gs_end_primitive()
* comparison below (hence the num_output_vertices + 1 in the comparison
* below).
*/
- unsigned num_output_vertices = c->gp->program.VerticesOut;
+ unsigned num_output_vertices = nir->info.gs.vertices_out;
emit(CMP(dst_null_d(), this->vertex_count, src_reg(num_output_vertices + 1),
BRW_CONDITIONAL_L));
vec4_instruction *inst = emit(CMP(dst_null_d(),
@@ -320,7 +320,7 @@ gen6_gs_visitor::emit_thread_end()
* first_vertex is not zero. This is only relevant for outputs other than
* points because in the point case we set PrimEnd on all vertices.
*/
- if (c->gp->program.OutputType != GL_POINTS) {
+ if (nir->info.gs.output_primitive != GL_POINTS) {
emit(CMP(dst_null_d(), this->first_vertex, 0u, BRW_CONDITIONAL_Z));
emit(IF(BRW_PREDICATE_NORMAL));
gs_end_primitive();
@@ -627,7 +627,7 @@ gen6_gs_visitor::xfb_write()
emit(BRW_OPCODE_ENDIF);
/* Write transform feedback data for all processed vertices. */
- for (int i = 0; i < c->gp->program.VerticesOut; i++) {
+ for (int i = 0; i < (int)nir->info.gs.vertices_out; i++) {
emit(MOV(dst_reg(sol_temp), i));
emit(CMP(dst_null_d(), sol_temp, this->vertex_count,
BRW_CONDITIONAL_L));
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list