diff options
author | Kenneth Graunke <[email protected]> | 2018-07-14 22:15:39 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-21 10:26:07 -0800 |
commit | 44ba48eba7f06272c14caa733c473e3dd2f914c4 (patch) | |
tree | 8e95cbedae270984d1bcafc774dcbb0b06008bf5 | |
parent | b03067129891f3bba979d3c67fcca5a78987ab59 (diff) |
iris: draw indirect support?
-rw-r--r-- | src/gallium/drivers/iris/iris_state.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index f6497ffbe7b..e0d68cab98c 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -3139,7 +3139,52 @@ iris_upload_render_state(struct iris_context *ice, // XXX: Gen8 - PMA fix - assert(!draw->indirect); // XXX: indirect support +#define _3DPRIM_END_OFFSET 0x2420 +#define _3DPRIM_START_VERTEX 0x2430 +#define _3DPRIM_VERTEX_COUNT 0x2434 +#define _3DPRIM_INSTANCE_COUNT 0x2438 +#define _3DPRIM_START_INSTANCE 0x243C +#define _3DPRIM_BASE_VERTEX 0x2440 + + if (draw->indirect) { + /* We don't support this MultidrawIndirect. */ + assert(!draw->indirect->indirect_draw_count); + + struct iris_bo *bo = iris_resource_bo(draw->indirect->buffer); + assert(bo); + + iris_emit_cmd(batch, GENX(MI_LOAD_REGISTER_MEM), lrm) { + lrm.RegisterAddress = _3DPRIM_VERTEX_COUNT; + lrm.MemoryAddress = ro_bo(bo, draw->indirect->offset + 0); + } + iris_emit_cmd(batch, GENX(MI_LOAD_REGISTER_MEM), lrm) { + lrm.RegisterAddress = _3DPRIM_INSTANCE_COUNT; + lrm.MemoryAddress = ro_bo(bo, draw->indirect->offset + 4); + } + iris_emit_cmd(batch, GENX(MI_LOAD_REGISTER_MEM), lrm) { + lrm.RegisterAddress = _3DPRIM_START_VERTEX; + lrm.MemoryAddress = ro_bo(bo, draw->indirect->offset + 8); + } + if (draw->index_size) { + iris_emit_cmd(batch, GENX(MI_LOAD_REGISTER_MEM), lrm) { + lrm.RegisterAddress = _3DPRIM_BASE_VERTEX; + lrm.MemoryAddress = ro_bo(bo, draw->indirect->offset + 12); + } + iris_emit_cmd(batch, GENX(MI_LOAD_REGISTER_MEM), lrm) { + lrm.RegisterAddress = _3DPRIM_START_INSTANCE; + lrm.MemoryAddress = ro_bo(bo, draw->indirect->offset + 16); + } + } else { + iris_emit_cmd(batch, GENX(MI_LOAD_REGISTER_MEM), lrm) { + lrm.RegisterAddress = _3DPRIM_START_INSTANCE; + lrm.MemoryAddress = ro_bo(bo, draw->indirect->offset + 12); + } + iris_emit_cmd(batch, GENX(MI_LOAD_REGISTER_IMM), lri) { + lri.RegisterOffset = _3DPRIM_BASE_VERTEX; + lri.DataDWord = 0; + } + } + } iris_emit_cmd(batch, GENX(3DPRIMITIVE), prim) { prim.StartInstanceLocation = draw->start_instance; @@ -3150,6 +3195,8 @@ iris_upload_render_state(struct iris_context *ice, // XXX: this is probably bonkers. prim.StartVertexLocation = draw->start; + prim.IndirectParameterEnable = draw->indirect != NULL; + if (draw->index_size) { prim.BaseVertexLocation += draw->index_bias; } else { |