diff options
author | Chia-I Wu <[email protected]> | 2014-11-11 11:21:01 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2014-11-11 13:52:25 +0800 |
commit | c637075ea29811194d12611ec79b3ba4858d1e37 (patch) | |
tree | d0143a8247ee4512af887c54858f8da8432e4daf /src | |
parent | 2ff88ce4be7f81403818e8c4662300abf68b09ea (diff) |
ilo: add 3DSTATE_SO_BUFFER variants
Add gen7_disable_3DSTATE_SO_BUFFER() to disable SO buffers.
Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_builder_3d_top.h | 43 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render_gen7.c | 6 |
2 files changed, 25 insertions, 24 deletions
diff --git a/src/gallium/drivers/ilo/ilo_builder_3d_top.h b/src/gallium/drivers/ilo/ilo_builder_3d_top.h index 8f2a25a6a49..5f758a1ccbd 100644 --- a/src/gallium/drivers/ilo/ilo_builder_3d_top.h +++ b/src/gallium/drivers/ilo/ilo_builder_3d_top.h @@ -956,53 +956,56 @@ gen7_3DSTATE_SO_DECL_LIST(struct ilo_builder *builder, } static inline void -gen7_3DSTATE_SO_BUFFER(struct ilo_builder *builder, - int index, int base, int stride, +gen7_3DSTATE_SO_BUFFER(struct ilo_builder *builder, int index, int stride, const struct pipe_stream_output_target *so_target) { const uint8_t cmd_len = 4; - const uint32_t dw0 = GEN7_RENDER_CMD(3D, 3DSTATE_SO_BUFFER) | - (cmd_len - 2); struct ilo_buffer *buf; - int end; + int start, end; uint32_t *dw; unsigned pos; ILO_DEV_ASSERT(builder->dev, 7, 7.5); - if (!so_target || !so_target->buffer) { - ilo_builder_batch_pointer(builder, cmd_len, &dw); - dw[0] = dw0; - dw[1] = index << GEN7_SO_BUF_DW1_INDEX__SHIFT; - dw[2] = 0; - dw[3] = 0; - - return; - } - buf = ilo_buffer(so_target->buffer); /* DWord-aligned */ - assert(stride % 4 == 0 && base % 4 == 0); + assert(stride % 4 == 0); assert(so_target->buffer_offset % 4 == 0); stride &= ~3; - base = (base + so_target->buffer_offset) & ~3; - end = (base + so_target->buffer_size) & ~3; + start = so_target->buffer_offset & ~3; + end = (start + so_target->buffer_size) & ~3; pos = ilo_builder_batch_pointer(builder, cmd_len, &dw); - dw[0] = dw0; + dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_SO_BUFFER) | (cmd_len - 2); dw[1] = index << GEN7_SO_BUF_DW1_INDEX__SHIFT | stride; ilo_builder_batch_reloc(builder, pos + 2, - buf->bo, base, INTEL_RELOC_WRITE); + buf->bo, start, INTEL_RELOC_WRITE); ilo_builder_batch_reloc(builder, pos + 3, buf->bo, end, INTEL_RELOC_WRITE); } static inline void +gen7_disable_3DSTATE_SO_BUFFER(struct ilo_builder *builder, int index) +{ + const uint8_t cmd_len = 4; + uint32_t *dw; + + ILO_DEV_ASSERT(builder->dev, 7, 7.5); + + ilo_builder_batch_pointer(builder, cmd_len, &dw); + + dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_SO_BUFFER) | (cmd_len - 2); + dw[1] = index << GEN7_SO_BUF_DW1_INDEX__SHIFT; + dw[2] = 0; + dw[3] = 0; +} + +static inline void gen6_3DSTATE_BINDING_TABLE_POINTERS(struct ilo_builder *builder, uint32_t vs_binding_table, uint32_t gs_binding_table, diff --git a/src/gallium/drivers/ilo/ilo_render_gen7.c b/src/gallium/drivers/ilo/ilo_render_gen7.c index 8830db4e852..2051f1254bb 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen7.c +++ b/src/gallium/drivers/ilo/ilo_render_gen7.c @@ -458,14 +458,12 @@ gen7_draw_sol(struct ilo_render *r, for (i = 0; i < vec->so.count; i++) { const int stride = so_info->stride[i] * 4; /* in bytes */ - int base = 0; - gen7_3DSTATE_SO_BUFFER(r->builder, i, base, stride, - vec->so.states[i]); + gen7_3DSTATE_SO_BUFFER(r->builder, i, stride, vec->so.states[i]); } for (; i < 4; i++) - gen7_3DSTATE_SO_BUFFER(r->builder, i, 0, 0, NULL); + gen7_disable_3DSTATE_SO_BUFFER(r->builder, i); } /* 3DSTATE_SO_DECL_LIST */ |