From ae29a098eaaa9f061cc82a28b8e258e44f03902b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 13 Jan 2014 10:19:00 +1000 Subject: [PATCH] r600g/bc: add support for indexed memory writes. It looks like we need these for geom shaders in the future. Signed-off-by: Dave Airlie Reviewed-by: Alex Deucher --- src/gallium/drivers/r600/eg_asm.c | 6 ++++-- src/gallium/drivers/r600/r600_asm.c | 9 +++++++-- src/gallium/drivers/r600/r600_asm.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r600/eg_asm.c b/src/gallium/drivers/r600/eg_asm.c index 42e78c0f069..5ad3d771974 100644 --- a/src/gallium/drivers/r600/eg_asm.c +++ b/src/gallium/drivers/r600/eg_asm.c @@ -79,7 +79,8 @@ int eg_bytecode_cf_build(struct r600_bytecode *bc, struct r600_bytecode_cf *cf) bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(cf->output.gpr) | S_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(cf->output.elem_size) | S_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(cf->output.array_base) | - S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(cf->output.type); + S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(cf->output.type) | + S_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(cf->output.index_gpr); bc->bytecode[id] = S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(cf->output.burst_count - 1) | S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(cf->output.swizzle_x) | @@ -97,7 +98,8 @@ int eg_bytecode_cf_build(struct r600_bytecode *bc, struct r600_bytecode_cf *cf) bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(cf->output.gpr) | S_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(cf->output.elem_size) | S_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(cf->output.array_base) | - S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(cf->output.type); + S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(cf->output.type) | + S_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(cf->output.index_gpr); bc->bytecode[id] = S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(cf->output.burst_count - 1) | S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(cf->barrier) | S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(opcode) | diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index e062fcb6be8..14ee2c210b5 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -1525,7 +1525,8 @@ static int r600_bytecode_cf_build(struct r600_bytecode *bc, struct r600_bytecode bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(cf->output.gpr) | S_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(cf->output.elem_size) | S_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(cf->output.array_base) | - S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(cf->output.type); + S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(cf->output.type) | + S_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(cf->output.index_gpr); bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(cf->output.burst_count - 1) | S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(cf->output.swizzle_x) | S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(cf->output.swizzle_y) | @@ -1538,7 +1539,8 @@ static int r600_bytecode_cf_build(struct r600_bytecode *bc, struct r600_bytecode bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(cf->output.gpr) | S_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(cf->output.elem_size) | S_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(cf->output.array_base) | - S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(cf->output.type); + S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(cf->output.type) | + S_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(cf->output.index_gpr); bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(cf->output.burst_count - 1) | S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(cf->barrier) | S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(opcode) | @@ -1963,6 +1965,9 @@ void r600_bytecode_disasm(struct r600_bytecode *bc) o += print_swizzle(7); } + if (cf->output.type == V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE_IND) + o += fprintf(stderr, " R%d", cf->output.index_gpr); + o += print_indent(o, 67); fprintf(stderr, " ES:%i ", cf->output.elem_size); diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index 3bfbcb282a3..4fb0ef06956 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -125,6 +125,7 @@ struct r600_bytecode_output { unsigned swizzle_z; unsigned swizzle_w; unsigned burst_count; + unsigned index_gpr; }; struct r600_bytecode_kcache { -- 2.30.2