Module: Mesa
Branch: master
Commit: cf76edd300b3e58a906d07404e7d7533a6d54a41
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf76edd300b3e58a906d07404e7d7533a6d54a41

Author: Christian König <[email protected]>
Date:   Sun Aug 12 19:42:38 2012 +0200

radeonsi: move ps sampler state into PM4 stream

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>

---

 src/gallium/drivers/radeonsi/si_state.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index bbbf203..3bd1500 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2004,33 +2004,23 @@ static void si_bind_ps_sampler(struct pipe_context 
*ctx, unsigned count, void **
        struct r600_context *rctx = (struct r600_context *)ctx;
        struct si_pipe_sampler_state **rstates = (struct si_pipe_sampler_state 
**)states;
        struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
-       struct si_resource *bo;
-       uint64_t va;
-       char *ptr;
-       int i;
+       int i, j;
 
        if (!count)
                goto out;
 
        si_pm4_inval_texture_cache(pm4);
 
-       bo = si_resource_create_custom(ctx->screen, PIPE_USAGE_IMMUTABLE,
-                                      count * sizeof(rstates[0]->val));
-       ptr = rctx->ws->buffer_map(bo->cs_buf, rctx->cs, PIPE_TRANSFER_WRITE);
-
-       for (i = 0; i < count; i++, ptr += sizeof(rstates[0]->val)) {
-               memcpy(ptr, rstates[i]->val, sizeof(rstates[0]->val));
+       si_pm4_sh_data_begin(pm4);
+       for (i = 0; i < count; i++) {
+               for (j = 0; j < Elements(rstates[i]->val); ++j) {
+                       si_pm4_sh_data_add(pm4, rstates[i]->val[j]);
+               }
        }
-
-       rctx->ws->buffer_unmap(bo->cs_buf);
+       si_pm4_sh_data_end(pm4, R_00B038_SPI_SHADER_USER_DATA_PS_2);
 
        memcpy(rctx->ps_samplers.samplers, states, sizeof(void*) * count);
 
-       va = r600_resource_va(ctx->screen, (void *)bo);
-       si_pm4_add_bo(pm4, bo, RADEON_USAGE_READ);
-       si_pm4_set_reg(pm4, R_00B038_SPI_SHADER_USER_DATA_PS_2, va);
-       si_pm4_set_reg(pm4, R_00B03C_SPI_SHADER_USER_DATA_PS_3, va >> 32);
-
 out:
        si_pm4_set_state(rctx, ps_sampler, pm4);
        rctx->ps_samplers.n_samplers = count;

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to