diff options
author | Marek Olšák <[email protected]> | 2013-08-26 18:17:09 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-09-13 01:04:44 +0200 |
commit | 9d16e70b3f95ea632a0442458c0d5027a8b42d36 (patch) | |
tree | 0b63c08c8b4ece5c1f75370c8400b29bdcda37f7 | |
parent | 6cf29c7daba52f666c64ddc0efd20fbc566f2a3a (diff) |
radeonsi: implement glDrawTransformFeedback functionality
Reviewed-by: Michel Dänzer <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_draw.c | 23 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/sid.h | 6 |
3 files changed, 30 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 650db4fc101..e1b4e32b6d5 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -3241,6 +3241,7 @@ void si_init_config(struct r600_context *rctx) si_pm4_set_reg(pm4, R_028A40_VGT_GS_MODE, 0x0); si_pm4_set_reg(pm4, R_028A84_VGT_PRIMITIVEID_EN, 0x0); si_pm4_set_reg(pm4, R_028A8C_VGT_PRIMITIVEID_RESET, 0x0); + si_pm4_set_reg(pm4, R_028B28_VGT_STRMOUT_DRAW_OPAQUE_OFFSET, 0); si_pm4_set_reg(pm4, R_028B94_VGT_STRMOUT_CONFIG, 0x0); si_pm4_set_reg(pm4, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0x0); si_pm4_set_reg(pm4, R_028AA8_IA_MULTI_VGT_PARAM, diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index e65b0cfa3e7..687410c169b 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -557,6 +557,29 @@ static void si_state_draw(struct r600_context *rctx, S_02800C_NOOP_CULL_DISABLE(1)); } + if (info->count_from_stream_output) { + struct r600_so_target *t = + (struct r600_so_target*)info->count_from_stream_output; + uint64_t va = r600_resource_va(&rctx->screen->b.b, + &t->buf_filled_size->b.b); + va += t->buf_filled_size_offset; + + si_pm4_set_reg(pm4, R_028B30_VGT_STRMOUT_DRAW_OPAQUE_VERTEX_STRIDE, + t->stride_in_dw); + + si_pm4_cmd_begin(pm4, PKT3_COPY_DATA); + si_pm4_cmd_add(pm4, + COPY_DATA_SRC_SEL(COPY_DATA_MEM) | + COPY_DATA_DST_SEL(COPY_DATA_REG) | + COPY_DATA_WR_CONFIRM); + si_pm4_cmd_add(pm4, va); /* src address lo */ + si_pm4_cmd_add(pm4, va >> 32UL); /* src address hi */ + si_pm4_cmd_add(pm4, R_028B2C_VGT_STRMOUT_DRAW_OPAQUE_BUFFER_FILLED_SIZE >> 2); + si_pm4_cmd_add(pm4, 0); /* unused */ + si_pm4_add_bo(pm4, t->buf_filled_size, RADEON_USAGE_READ); + si_pm4_cmd_end(pm4, true); + } + /* draw packet */ si_pm4_cmd_begin(pm4, PKT3_INDEX_TYPE); if (ib->index_size == 4) { diff --git a/src/gallium/drivers/radeonsi/sid.h b/src/gallium/drivers/radeonsi/sid.h index c6688b37abc..021f4ebee35 100644 --- a/src/gallium/drivers/radeonsi/sid.h +++ b/src/gallium/drivers/radeonsi/sid.h @@ -103,6 +103,12 @@ #define WAIT_REG_MEM_EQUAL 3 #define PKT3_MEM_WRITE 0x3D /* not on CIK */ #define PKT3_INDIRECT_BUFFER 0x32 +#define PKT3_COPY_DATA 0x40 +#define COPY_DATA_SRC_SEL(x) ((x) & 0xf) +#define COPY_DATA_REG 0 +#define COPY_DATA_MEM 1 +#define COPY_DATA_DST_SEL(x) (((x) & 0xf) << 8) +#define COPY_DATA_WR_CONFIRM (1 << 20) #define PKT3_SURFACE_SYNC 0x43 /* deprecated on CIK, use ACQUIRE_MEM */ #define PKT3_ME_INITIALIZE 0x44 /* not on CIK */ #define PKT3_COND_WRITE 0x45 |