aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_state_draw.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-08-06 06:42:22 +0200
committerMarek Olšák <[email protected]>2013-08-17 01:48:25 +0200
commitc8e70e64accc914c58533b8336873e0995e901e7 (patch)
treeac049b7317a7fb4c33fa6a977b349a2b18165158 /src/gallium/drivers/radeonsi/si_state_draw.c
parent764502b481e2288cb5e751de739253fdee886e3e (diff)
radeonsi: add flexible shader descriptor management and use it for sampler views
It moves all sampler view descriptors to a buffer. It supports partial resource updates and it can also unbind resources (required for FMASK texturing). The buffer contains all sampler view descriptors for one shader stage, represented as an array. On top of that, there are N arrays in the buffer, which are used to emulate context registers as implemented by the previous ASICs (each array is a context). This uses the RCU synchronization approach to avoid read-after-write hazards as discussed in the thread: "radeonsi: add FMASK texture binding slots and resource setup" CP DMA is used to clear the descriptors at context initialization and to copy the descriptors from one context to the next. v2: - use PKT3_DMA_DATA on CIK (I'll test CIK later) - turn the bool CP DMA parameters into self-explanatory flags - add a nice simple API for packet emission to radeon_winsys.h - use 256 contexts, 128 causes texture corruption in openarena
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state_draw.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 47e64d8634e..f03b34f4039 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -412,11 +412,10 @@ static void si_update_derived_state(struct r600_context *rctx)
if (!rctx->blitter->running) {
/* Flush depth textures which need to be flushed. */
- if (rctx->vs_samplers.depth_texture_mask) {
- si_flush_depth_textures(rctx, &rctx->vs_samplers);
- }
- if (rctx->ps_samplers.depth_texture_mask) {
- si_flush_depth_textures(rctx, &rctx->ps_samplers);
+ for (int i = 0; i < SI_NUM_SHADERS; i++) {
+ if (rctx->samplers[i].depth_texture_mask) {
+ si_flush_depth_textures(rctx, &rctx->samplers[i]);
+ }
}
}
@@ -651,7 +650,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
{
struct r600_context *rctx = (struct r600_context *)ctx;
struct pipe_index_buffer ib = {};
- uint32_t cp_coher_cntl;
+ uint32_t cp_coher_cntl, i;
if (!info->count && (info->indexed || !info->count_from_stream_output))
return;
@@ -704,6 +703,13 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
si_need_cs_space(rctx, 0, TRUE);
+ for (i = 0; i < SI_NUM_ATOMS(rctx); i++) {
+ if (rctx->atoms.array[i]->dirty) {
+ rctx->atoms.array[i]->emit(rctx, rctx->atoms.array[i]);
+ rctx->atoms.array[i]->dirty = false;
+ }
+ }
+
si_pm4_emit_dirty(rctx);
rctx->pm4_dirty_cdwords = 0;