aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-11-11 13:28:32 +0800
committerChia-I Wu <[email protected]>2014-11-11 13:52:26 +0800
commit239dca78b13d8c033d75d1898b1d5e3d784c30d4 (patch)
treea919e4a498ec1724abe4d7282b3838a723b6d2e1
parenteab595d573ff7719a1960bdf819eda75a1aa4c26 (diff)
ilo: clean up gen7_3DSTATE_STREAMOUT()
Render stream and render enable are independent from so enable. Having a single return point makes it easier to see that. Signed-off-by: Chia-I Wu <[email protected]>
-rw-r--r--src/gallium/drivers/ilo/ilo_builder_3d_top.h73
-rw-r--r--src/gallium/drivers/ilo/ilo_render_gen7.c7
2 files changed, 35 insertions, 45 deletions
diff --git a/src/gallium/drivers/ilo/ilo_builder_3d_top.h b/src/gallium/drivers/ilo/ilo_builder_3d_top.h
index ce2debec6f0..4a6d0443b7a 100644
--- a/src/gallium/drivers/ilo/ilo_builder_3d_top.h
+++ b/src/gallium/drivers/ilo/ilo_builder_3d_top.h
@@ -804,61 +804,50 @@ gen7_disable_3DSTATE_GS(struct ilo_builder *builder)
static inline void
gen7_3DSTATE_STREAMOUT(struct ilo_builder *builder,
+ int render_stream,
+ bool render_disable,
unsigned buffer_mask,
- int vertex_attrib_count,
- bool rasterizer_discard)
+ int vertex_attrib_count)
{
const uint8_t cmd_len = 3;
- const bool enable = (buffer_mask != 0);
- const uint32_t dw0 = GEN7_RENDER_CMD(3D, 3DSTATE_STREAMOUT) |
- (cmd_len - 2);
uint32_t dw1, dw2, *dw;
- int read_len;
ILO_DEV_ASSERT(builder->dev, 7, 7.5);
- if (!enable) {
- dw1 = 0 << GEN7_SO_DW1_RENDER_STREAM_SELECT__SHIFT;
- if (rasterizer_discard)
- dw1 |= GEN7_SO_DW1_RENDER_DISABLE;
-
- dw2 = 0;
-
- ilo_builder_batch_pointer(builder, cmd_len, &dw);
- dw[0] = dw0;
- dw[1] = dw1;
- dw[2] = dw2;
- return;
- }
-
- read_len = (vertex_attrib_count + 1) / 2;
- if (!read_len)
- read_len = 1;
-
- dw1 = GEN7_SO_DW1_SO_ENABLE |
- 0 << GEN7_SO_DW1_RENDER_STREAM_SELECT__SHIFT |
- GEN7_SO_DW1_STATISTICS |
- buffer_mask << 8;
-
- if (rasterizer_discard)
+ dw1 = render_stream << GEN7_SO_DW1_RENDER_STREAM_SELECT__SHIFT;
+ if (render_disable)
dw1 |= GEN7_SO_DW1_RENDER_DISABLE;
- /* API_OPENGL */
- if (true)
- dw1 |= GEN7_SO_DW1_REORDER_TRAILING;
+ dw2 = 0;
- dw2 = 0 << GEN7_SO_DW2_STREAM3_READ_OFFSET__SHIFT |
- 0 << GEN7_SO_DW2_STREAM3_READ_LEN__SHIFT |
- 0 << GEN7_SO_DW2_STREAM2_READ_OFFSET__SHIFT |
- 0 << GEN7_SO_DW2_STREAM2_READ_LEN__SHIFT |
- 0 << GEN7_SO_DW2_STREAM1_READ_OFFSET__SHIFT |
- 0 << GEN7_SO_DW2_STREAM1_READ_LEN__SHIFT |
- 0 << GEN7_SO_DW2_STREAM0_READ_OFFSET__SHIFT |
- (read_len - 1) << GEN7_SO_DW2_STREAM0_READ_LEN__SHIFT;
+ if (buffer_mask) {
+ int read_len;
+
+ read_len = (vertex_attrib_count + 1) / 2;
+ if (!read_len)
+ read_len = 1;
+
+ dw1 |= GEN7_SO_DW1_SO_ENABLE |
+ GEN7_SO_DW1_STATISTICS |
+ buffer_mask << GEN7_SO_DW1_BUFFER_ENABLES__SHIFT;
+
+ /* API_OPENGL */
+ if (true)
+ dw1 |= GEN7_SO_DW1_REORDER_TRAILING;
+
+ dw2 = 0 << GEN7_SO_DW2_STREAM3_READ_OFFSET__SHIFT |
+ (read_len - 1) << GEN7_SO_DW2_STREAM3_READ_LEN__SHIFT |
+ 0 << GEN7_SO_DW2_STREAM2_READ_OFFSET__SHIFT |
+ (read_len - 1) << GEN7_SO_DW2_STREAM2_READ_LEN__SHIFT |
+ 0 << GEN7_SO_DW2_STREAM1_READ_OFFSET__SHIFT |
+ (read_len - 1) << GEN7_SO_DW2_STREAM1_READ_LEN__SHIFT |
+ 0 << GEN7_SO_DW2_STREAM0_READ_OFFSET__SHIFT |
+ (read_len - 1) << GEN7_SO_DW2_STREAM0_READ_LEN__SHIFT;
+ }
ilo_builder_batch_pointer(builder, cmd_len, &dw);
- dw[0] = dw0;
+ dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_STREAMOUT) | (cmd_len - 2);
dw[1] = dw1;
dw[2] = dw2;
}
diff --git a/src/gallium/drivers/ilo/ilo_render_gen7.c b/src/gallium/drivers/ilo/ilo_render_gen7.c
index 2051f1254bb..08190e8cc4a 100644
--- a/src/gallium/drivers/ilo/ilo_render_gen7.c
+++ b/src/gallium/drivers/ilo/ilo_render_gen7.c
@@ -476,8 +476,9 @@ gen7_draw_sol(struct ilo_render *r,
const int output_count = ilo_shader_get_kernel_param(shader,
ILO_KERNEL_OUTPUT_COUNT);
- gen7_3DSTATE_STREAMOUT(r->builder, buffer_mask, output_count,
- vec->rasterizer->state.rasterizer_discard);
+ gen7_3DSTATE_STREAMOUT(r->builder, 0,
+ vec->rasterizer->state.rasterizer_discard,
+ buffer_mask, output_count);
}
}
@@ -732,7 +733,7 @@ gen7_rectlist_vs_to_sf(struct ilo_render *r,
gen7_3DSTATE_CONSTANT_GS(r->builder, NULL, NULL, 0);
gen7_disable_3DSTATE_GS(r->builder);
- gen7_3DSTATE_STREAMOUT(r->builder, 0x0, 0, false);
+ gen7_3DSTATE_STREAMOUT(r->builder, 0, false, 0x0, 0);
gen6_disable_3DSTATE_CLIP(r->builder);