7 + /* copy */
(4 + desc->element_dw_size) * util_bitcount(desc->dirty_mask) + /* update */
4; /* pointer update */
+#if HAVE_LLVM >= 0x0305
+ if (desc->shader_userdata_reg >= R_00B130_SPI_SHADER_USER_DATA_VS_0 &&
+ desc->shader_userdata_reg < R_00B230_SPI_SHADER_USER_DATA_GS_0)
+ desc->atom.num_dw += 4; /* second pointer update */
+#endif
desc->atom.dirty = true;
/* The descriptors are read with the K cache. */
sctx->b.flags |= R600_CONTEXT_INV_CONST_CACHE;
radeon_emit(cs, (desc->shader_userdata_reg - SI_SH_REG_OFFSET) >> 2);
radeon_emit(cs, va);
radeon_emit(cs, va >> 32);
+
+#if HAVE_LLVM >= 0x0305
+ if (desc->shader_userdata_reg >= R_00B130_SPI_SHADER_USER_DATA_VS_0 &&
+ desc->shader_userdata_reg < R_00B230_SPI_SHADER_USER_DATA_GS_0) {
+ radeon_emit(cs, PKT3(PKT3_SET_SH_REG, 2, 0));
+ radeon_emit(cs, (desc->shader_userdata_reg +
+ (R_00B330_SPI_SHADER_USER_DATA_ES_0 -
+ R_00B130_SPI_SHADER_USER_DATA_VS_0) -
+ SI_SH_REG_OFFSET) >> 2);
+ radeon_emit(cs, va);
+ radeon_emit(cs, va >> 32);
+ }
+#endif
}
static void si_emit_descriptors(struct si_context *sctx,
static unsigned si_get_shader_user_data_base(unsigned shader)
{
switch (shader) {
- case SI_SHADER_EXPORT:
- return R_00B330_SPI_SHADER_USER_DATA_ES_0;
case PIPE_SHADER_VERTEX:
return R_00B130_SPI_SHADER_USER_DATA_VS_0;
case PIPE_SHADER_GEOMETRY:
/* The stride field in the resource descriptor has 14 bits */
assert(stride < (1 << 14));
- slot += NUM_PIPE_CONST_BUFFERS + 1;
assert(slot < buffers->num_buffers);
pipe_resource_reference(&buffers->buffers[slot], NULL);
#define SI_NUM_ATOMS(sctx) (sizeof((sctx)->atoms)/sizeof((sctx)->atoms.array[0]))
-#define SI_SHADER_EXPORT (PIPE_SHADER_GEOMETRY+1)
-#define SI_NUM_SHADERS (SI_SHADER_EXPORT+1)
+#define SI_NUM_SHADERS (PIPE_SHADER_GEOMETRY+1)
struct si_context {
struct r600_common_context b;
/* Load the ESGS ring resource descriptor */
t_list_ptr = LLVMGetParam(si_shader_ctx->radeon_bld.main_fn, SI_PARAM_CONST);
t_list = build_indexed_load(si_shader_ctx, t_list_ptr,
- lp_build_const_int32(gallivm,
- NUM_PIPE_CONST_BUFFERS + 1));
+ lp_build_const_int32(gallivm, SI_RING_ESGS));
args[0] = t_list;
args[1] = vtx_offset;
/* Load the ESGS ring resource descriptor */
t_list_ptr = LLVMGetParam(si_shader_ctx->radeon_bld.main_fn, SI_PARAM_CONST);
t_list = build_indexed_load(si_shader_ctx, t_list_ptr,
- lp_build_const_int32(gallivm,
- NUM_PIPE_CONST_BUFFERS + 1));
+ lp_build_const_int32(gallivm, SI_RING_ESGS));
for (i = 0; i < es->noutput; i++) {
LLVMValueRef *out_ptr =
/* Load the GSVS ring resource descriptor */
t_list_ptr = LLVMGetParam(si_shader_ctx->radeon_bld.main_fn, SI_PARAM_CONST);
t_list = build_indexed_load(si_shader_ctx, t_list_ptr,
- lp_build_const_int32(gallivm,
- NUM_PIPE_CONST_BUFFERS + 2));
+ lp_build_const_int32(gallivm, SI_RING_GSVS));
if (shader->noutput == 0) {
struct tgsi_parse_context *parse = &si_shader_ctx->parse;
/* Load the GSVS ring resource descriptor */
t_list_ptr = LLVMGetParam(si_shader_ctx->radeon_bld.main_fn, SI_PARAM_CONST);
t_list = build_indexed_load(si_shader_ctx, t_list_ptr,
- lp_build_const_int32(gallivm,
- NUM_PIPE_CONST_BUFFERS + 1));
+ lp_build_const_int32(gallivm, SI_RING_GSVS));
args[0] = t_list;
args[1] = lp_build_mul_imm(uint,
sctx->b.flags |= R600_CONTEXT_INV_TEX_CACHE;
}
-static struct si_pm4_state *si_set_sampler_states(struct si_context *sctx, unsigned count,
- void **states,
- struct si_textures_info *samplers,
- unsigned user_data_reg)
+static void si_set_sampler_states(struct si_context *sctx,
+ struct si_pm4_state *pm4,
+ unsigned count, void **states,
+ struct si_textures_info *samplers,
+ unsigned user_data_reg)
{
struct si_pipe_sampler_state **rstates = (struct si_pipe_sampler_state **)states;
- struct si_pm4_state *pm4 = si_pm4_alloc_state(sctx);
uint32_t *border_color_table = NULL;
int i, j;
out:
samplers->n_samplers = count;
- return pm4;
}
static void si_bind_vs_sampler_states(struct pipe_context *ctx, unsigned count, void **states)
{
struct si_context *sctx = (struct si_context *)ctx;
- struct si_pm4_state *pm4;
+ struct si_pm4_state *pm4 = si_pm4_alloc_state(sctx);
- pm4 = si_set_sampler_states(sctx, count, states, &sctx->samplers[PIPE_SHADER_VERTEX],
+ si_set_sampler_states(sctx, pm4, count, states,
+ &sctx->samplers[PIPE_SHADER_VERTEX],
R_00B130_SPI_SHADER_USER_DATA_VS_0);
+#if HAVE_LLVM >= 0x0305
+ si_set_sampler_states(sctx, pm4, count, states,
+ &sctx->samplers[PIPE_SHADER_VERTEX],
+ R_00B330_SPI_SHADER_USER_DATA_ES_0);
+#endif
si_pm4_set_state(sctx, vs_sampler, pm4);
}
static void si_bind_gs_sampler_states(struct pipe_context *ctx, unsigned count, void **states)
{
struct si_context *sctx = (struct si_context *)ctx;
- struct si_pm4_state *pm4;
+ struct si_pm4_state *pm4 = si_pm4_alloc_state(sctx);
- pm4 = si_set_sampler_states(sctx, count, states, &sctx->samplers[PIPE_SHADER_GEOMETRY],
+ si_set_sampler_states(sctx, pm4, count, states,
+ &sctx->samplers[PIPE_SHADER_GEOMETRY],
R_00B230_SPI_SHADER_USER_DATA_GS_0);
si_pm4_set_state(sctx, gs_sampler, pm4);
}
static void si_bind_ps_sampler_states(struct pipe_context *ctx, unsigned count, void **states)
{
struct si_context *sctx = (struct si_context *)ctx;
- struct si_pm4_state *pm4;
+ struct si_pm4_state *pm4 = si_pm4_alloc_state(sctx);
- pm4 = si_set_sampler_states(sctx, count, states, &sctx->samplers[PIPE_SHADER_FRAGMENT],
+ si_set_sampler_states(sctx, pm4, count, states,
+ &sctx->samplers[PIPE_SHADER_FRAGMENT],
R_00B030_SPI_SHADER_USER_DATA_PS_0);
si_pm4_set_state(sctx, ps_sampler, pm4);
}
#define NUM_SAMPLER_VIEWS (FMASK_TEX_OFFSET+NUM_TEX_UNITS)
#define NUM_SAMPLER_STATES NUM_TEX_UNITS
-#define NUM_PIPE_CONST_BUFFERS 16
-#define NUM_CONST_BUFFERS 19
+#define NUM_PIPE_CONST_BUFFERS 16
+#define SI_RING_ESGS 17
+#define SI_RING_GSVS 18
+#define NUM_CONST_BUFFERS (SI_RING_GSVS + 1)
+
/* This represents resource descriptors in memory, such as buffer resources,
* image resources, and sampler states.
sctx->gsvs_ring.buffer_size / 256);
}
- si_set_ring_buffer(&sctx->b.b, SI_SHADER_EXPORT, 0, &sctx->esgs_ring,
- 0, sctx->esgs_ring.buffer_size, true, true, 4, 64);
- si_set_ring_buffer(&sctx->b.b, PIPE_SHADER_GEOMETRY, 0, &sctx->esgs_ring,
- 0, sctx->esgs_ring.buffer_size, false, false, 0, 0);
- si_set_ring_buffer(&sctx->b.b, PIPE_SHADER_VERTEX, 0, &sctx->gsvs_ring,
- 0, sctx->gsvs_ring.buffer_size, false, false, 0, 0);
+ si_set_ring_buffer(&sctx->b.b, PIPE_SHADER_VERTEX, SI_RING_ESGS,
+ &sctx->esgs_ring, 0, sctx->esgs_ring.buffer_size,
+ true, true, 4, 64);
+ si_set_ring_buffer(&sctx->b.b, PIPE_SHADER_GEOMETRY, SI_RING_ESGS,
+ &sctx->esgs_ring, 0, sctx->esgs_ring.buffer_size,
+ false, false, 0, 0);
+ si_set_ring_buffer(&sctx->b.b, PIPE_SHADER_VERTEX, SI_RING_GSVS,
+ &sctx->gsvs_ring, 0, sctx->gsvs_ring.buffer_size,
+ false, false, 0, 0);
}
static void si_update_derived_state(struct si_context *sctx)
sctx->b.flags |= R600_CONTEXT_VGT_FLUSH;
si_pm4_bind_state(sctx, gs_rings, sctx->gs_rings);
- si_set_ring_buffer(ctx, PIPE_SHADER_GEOMETRY, 1, &sctx->gsvs_ring,
+ si_set_ring_buffer(ctx, PIPE_SHADER_GEOMETRY, SI_RING_GSVS,
+ &sctx->gsvs_ring,
sctx->gs_shader->current->shader.gs_max_out_vertices *
sctx->gs_shader->current->shader.noutput * 16,
64, true, true, 4, 16);