unsigned *num_patches)
{
struct radeon_winsys_cs *cs = sctx->b.rings.gfx.cs;
- struct si_shader_selector *ls = sctx->vs_shader;
+ struct si_shader_ctx_state *ls = &sctx->vs_shader;
/* The TES pointer will only be used for sctx->last_tcs.
* It would be wrong to think that TCS = TES. */
struct si_shader_selector *tcs =
- sctx->tcs_shader ? sctx->tcs_shader : sctx->tes_shader;
+ sctx->tcs_shader.cso ? sctx->tcs_shader.cso : sctx->tes_shader.cso;
unsigned tes_sh_base = sctx->shader_userdata.sh_base[PIPE_SHADER_TESS_EVAL];
unsigned num_tcs_input_cp = info->vertices_per_patch;
unsigned num_tcs_output_cp, num_tcs_inputs, num_tcs_outputs;
/* This calculates how shader inputs and outputs among VS, TCS, and TES
* are laid out in LDS. */
- num_tcs_inputs = util_last_bit64(ls->outputs_written);
+ num_tcs_inputs = util_last_bit64(ls->cso->outputs_written);
- if (sctx->tcs_shader) {
+ if (sctx->tcs_shader.cso) {
num_tcs_outputs = util_last_bit64(tcs->outputs_written);
num_tcs_output_cp = tcs->info.properties[TGSI_PROPERTY_TCS_VERTICES_OUT];
num_tcs_patch_outputs = util_last_bit64(tcs->patch_outputs_written);
pervertex_output_patch_size = num_tcs_output_cp * output_vertex_size;
output_patch_size = pervertex_output_patch_size + num_tcs_patch_outputs * 16;
- output_patch0_offset = sctx->tcs_shader ? input_patch_size * *num_patches : 0;
+ output_patch0_offset = sctx->tcs_shader.cso ? input_patch_size * *num_patches : 0;
perpatch_output_offset = output_patch0_offset + pervertex_output_patch_size;
lds_size = output_patch0_offset + output_patch_size * *num_patches;
bool partial_vs_wave = false;
bool partial_es_wave = false;
- if (sctx->gs_shader)
+ if (sctx->gs_shader.cso)
primgroup_size = 64; /* recommended with a GS */
- if (sctx->tes_shader) {
+ if (sctx->tes_shader.cso) {
unsigned num_cp_out =
- sctx->tcs_shader ?
- sctx->tcs_shader->info.properties[TGSI_PROPERTY_TCS_VERTICES_OUT] :
+ sctx->tcs_shader.cso ?
+ sctx->tcs_shader.cso->info.properties[TGSI_PROPERTY_TCS_VERTICES_OUT] :
info->vertices_per_patch;
unsigned max_size = 256 / MAX2(info->vertices_per_patch, num_cp_out);
/* SWITCH_ON_EOI must be set if PrimID is used.
* If SWITCH_ON_EOI is set, PARTIAL_ES_WAVE must be set too. */
- if ((sctx->tcs_shader && sctx->tcs_shader->info.uses_primid) ||
- sctx->tes_shader->info.uses_primid) {
+ if ((sctx->tcs_shader.cso && sctx->tcs_shader.cso->info.uses_primid) ||
+ sctx->tes_shader.cso->info.uses_primid) {
ia_switch_on_eoi = true;
partial_es_wave = true;
}
if ((sctx->b.family == CHIP_TAHITI ||
sctx->b.family == CHIP_PITCAIRN ||
sctx->b.family == CHIP_BONAIRE) &&
- sctx->gs_shader)
+ sctx->gs_shader.cso)
partial_vs_wave = true;
}
{
unsigned num_output_cp;
- if (!sctx->tes_shader)
+ if (!sctx->tes_shader.cso)
return 0;
- num_output_cp = sctx->tcs_shader ?
- sctx->tcs_shader->info.properties[TGSI_PROPERTY_TCS_VERTICES_OUT] :
+ num_output_cp = sctx->tcs_shader.cso ?
+ sctx->tcs_shader.cso->info.properties[TGSI_PROPERTY_TCS_VERTICES_OUT] :
info->vertices_per_patch;
return S_028B58_NUM_PATCHES(num_patches) |
unsigned gs_out_prim = si_conv_prim_to_gs_out(sctx->current_rast_prim);
unsigned ia_multi_vgt_param, ls_hs_config, num_patches = 0;
- if (sctx->tes_shader)
+ if (sctx->tes_shader.cso)
si_emit_derived_tess_state(sctx, info, &num_patches);
ia_multi_vgt_param = si_get_ia_multi_vgt_param(sctx, info, num_patches);
(info->indexed || !info->count_from_stream_output))
return;
- if (!sctx->ps_shader || !sctx->vs_shader) {
+ if (!sctx->ps_shader.cso || !sctx->vs_shader.cso) {
assert(0);
return;
}
- if (!!sctx->tes_shader != (info->mode == PIPE_PRIM_PATCHES)) {
+ if (!!sctx->tes_shader.cso != (info->mode == PIPE_PRIM_PATCHES)) {
assert(0);
return;
}
* This must be done after si_decompress_textures, which can call
* draw_vbo recursively, and before si_update_shaders, which uses
* current_rast_prim for this draw_vbo call. */
- if (sctx->gs_shader)
- sctx->current_rast_prim = sctx->gs_shader->gs_output_prim;
- else if (sctx->tes_shader)
+ if (sctx->gs_shader.cso)
+ sctx->current_rast_prim = sctx->gs_shader.cso->gs_output_prim;
+ else if (sctx->tes_shader.cso)
sctx->current_rast_prim =
- sctx->tes_shader->info.properties[TGSI_PROPERTY_TES_PRIM_MODE];
+ sctx->tes_shader.cso->info.properties[TGSI_PROPERTY_TES_PRIM_MODE];
else
sctx->current_rast_prim = info->mode;
key->vs.instance_divisors[i] =
sctx->vertex_elements->elements[i].instance_divisor;
- if (sctx->tes_shader)
+ if (sctx->tes_shader.cso)
key->vs.as_ls = 1;
- else if (sctx->gs_shader) {
+ else if (sctx->gs_shader.cso) {
key->vs.as_es = 1;
- key->vs.es_enabled_outputs = sctx->gs_shader->inputs_read;
+ key->vs.es_enabled_outputs = sctx->gs_shader.cso->inputs_read;
}
- if (!sctx->gs_shader && sctx->ps_shader &&
- sctx->ps_shader->info.uses_primid)
+ if (!sctx->gs_shader.cso && sctx->ps_shader.cso &&
+ sctx->ps_shader.cso->info.uses_primid)
key->vs.export_prim_id = 1;
break;
case PIPE_SHADER_TESS_CTRL:
key->tcs.prim_mode =
- sctx->tes_shader->info.properties[TGSI_PROPERTY_TES_PRIM_MODE];
+ sctx->tes_shader.cso->info.properties[TGSI_PROPERTY_TES_PRIM_MODE];
break;
case PIPE_SHADER_TESS_EVAL:
- if (sctx->gs_shader) {
+ if (sctx->gs_shader.cso) {
key->tes.as_es = 1;
- key->tes.es_enabled_outputs = sctx->gs_shader->inputs_read;
- } else if (sctx->ps_shader && sctx->ps_shader->info.uses_primid)
+ key->tes.es_enabled_outputs = sctx->gs_shader.cso->inputs_read;
+ } else if (sctx->ps_shader.cso && sctx->ps_shader.cso->info.uses_primid)
key->tes.export_prim_id = 1;
break;
case PIPE_SHADER_GEOMETRY:
/* Select the hw shader variant depending on the current state. */
static int si_shader_select(struct pipe_context *ctx,
- struct si_shader_selector *sel)
+ struct si_shader_ctx_state *state)
{
struct si_context *sctx = (struct si_context *)ctx;
+ struct si_shader_selector *sel = state->cso;
+ struct si_shader *current = state->current;
union si_shader_key key;
- struct si_shader * shader = NULL;
+ struct si_shader *iter, *shader = NULL;
int r;
si_shader_selector_key(ctx, sel, &key);
* This path is also used for most shaders that don't need multiple
* variants, it will cost just a computation of the key and this
* test. */
- if (likely(sel->current && memcmp(&sel->current->key, &key, sizeof(key)) == 0)) {
+ if (likely(current && memcmp(¤t->key, &key, sizeof(key)) == 0))
return 0;
- }
- /* lookup if we have other variants in the list */
- if (sel->num_shaders > 1) {
- struct si_shader *p = sel->current, *c = p->next_variant;
+ pipe_mutex_lock(sel->mutex);
- while (c && memcmp(&c->key, &key, sizeof(key)) != 0) {
- p = c;
- c = c->next_variant;
+ /* Find the shader variant. */
+ for (iter = sel->first_variant; iter; iter = iter->next_variant) {
+ /* Don't check the "current" shader. We checked it above. */
+ if (current != iter &&
+ memcmp(&iter->key, &key, sizeof(key)) == 0) {
+ state->current = iter;
+ pipe_mutex_unlock(sel->mutex);
+ return 0;
}
+ }
- if (c) {
- p->next_variant = c->next_variant;
- shader = c;
- }
+ /* Build a new shader. */
+ shader = CALLOC_STRUCT(si_shader);
+ if (!shader) {
+ pipe_mutex_unlock(sel->mutex);
+ return -ENOMEM;
}
+ shader->selector = sel;
+ shader->key = key;
+
+ r = si_shader_create(sctx->screen, sctx->tm, shader);
+ if (unlikely(r)) {
+ R600_ERR("Failed to build shader variant (type=%u) %d\n",
+ sel->type, r);
+ FREE(shader);
+ pipe_mutex_unlock(sel->mutex);
+ return r;
+ }
+ si_shader_init_pm4_state(shader);
- if (shader) {
- shader->next_variant = sel->current;
- sel->current = shader;
+ if (!sel->last_variant) {
+ sel->first_variant = shader;
+ sel->last_variant = shader;
} else {
- shader = CALLOC(1, sizeof(struct si_shader));
- shader->selector = sel;
- shader->key = key;
-
- shader->next_variant = sel->current;
- sel->current = shader;
- r = si_shader_create((struct si_screen*)ctx->screen, sctx->tm,
- shader);
- if (unlikely(r)) {
- R600_ERR("Failed to build shader variant (type=%u) %d\n",
- sel->type, r);
- sel->current = NULL;
- FREE(shader);
- return r;
- }
- si_shader_init_pm4_state(shader);
- sel->num_shaders++;
- p_atomic_inc(&sctx->screen->b.num_compilations);
+ sel->last_variant->next_variant = shader;
+ sel->last_variant = shader;
}
-
+ state->current = shader;
+ p_atomic_inc(&sctx->screen->b.num_compilations);
+ pipe_mutex_unlock(sel->mutex);
return 0;
}
break;
}
- if (sscreen->b.debug_flags & DBG_PRECOMPILE)
- if (si_shader_select(ctx, sel)) {
+ if (sscreen->b.debug_flags & DBG_PRECOMPILE) {
+ struct si_shader_ctx_state state = {sel};
+
+ if (si_shader_select(ctx, &state)) {
fprintf(stderr, "radeonsi: can't create a shader\n");
tgsi_free_tokens(sel->tokens);
FREE(sel);
return NULL;
}
+ }
+ pipe_mutex_init(sel->mutex);
return sel;
}
struct si_context *sctx = (struct si_context *)ctx;
struct si_shader_selector *sel = state;
- if (sctx->vs_shader == sel || !sel)
+ if (sctx->vs_shader.cso == sel || !sel)
return;
- sctx->vs_shader = sel;
+ sctx->vs_shader.cso = sel;
+ sctx->vs_shader.current = sel->first_variant;
si_mark_atom_dirty(sctx, &sctx->clip_regs);
si_update_viewports_and_scissors(sctx);
}
{
struct si_context *sctx = (struct si_context *)ctx;
struct si_shader_selector *sel = state;
- bool enable_changed = !!sctx->gs_shader != !!sel;
+ bool enable_changed = !!sctx->gs_shader.cso != !!sel;
- if (sctx->gs_shader == sel)
+ if (sctx->gs_shader.cso == sel)
return;
- sctx->gs_shader = sel;
+ sctx->gs_shader.cso = sel;
+ sctx->gs_shader.current = sel ? sel->first_variant : NULL;
si_mark_atom_dirty(sctx, &sctx->clip_regs);
sctx->last_rast_prim = -1; /* reset this so that it gets updated */
{
struct si_context *sctx = (struct si_context *)ctx;
struct si_shader_selector *sel = state;
- bool enable_changed = !!sctx->tcs_shader != !!sel;
+ bool enable_changed = !!sctx->tcs_shader.cso != !!sel;
- if (sctx->tcs_shader == sel)
+ if (sctx->tcs_shader.cso == sel)
return;
- sctx->tcs_shader = sel;
+ sctx->tcs_shader.cso = sel;
+ sctx->tcs_shader.current = sel ? sel->first_variant : NULL;
if (enable_changed)
sctx->last_tcs = NULL; /* invalidate derived tess state */
{
struct si_context *sctx = (struct si_context *)ctx;
struct si_shader_selector *sel = state;
- bool enable_changed = !!sctx->tes_shader != !!sel;
+ bool enable_changed = !!sctx->tes_shader.cso != !!sel;
- if (sctx->tes_shader == sel)
+ if (sctx->tes_shader.cso == sel)
return;
- sctx->tes_shader = sel;
+ sctx->tes_shader.cso = sel;
+ sctx->tes_shader.current = sel ? sel->first_variant : NULL;
si_mark_atom_dirty(sctx, &sctx->clip_regs);
sctx->last_rast_prim = -1; /* reset this so that it gets updated */
struct si_shader_selector *sel = state;
/* skip if supplied shader is one already in use */
- if (sctx->ps_shader == sel)
+ if (sctx->ps_shader.cso == sel)
return;
/* use a dummy shader if binding a NULL shader */
sel = sctx->dummy_pixel_shader;
}
- sctx->ps_shader = sel;
+ sctx->ps_shader.cso = sel;
+ sctx->ps_shader.current = sel->first_variant;
si_mark_atom_dirty(sctx, &sctx->cb_target_mask);
}
{
struct si_context *sctx = (struct si_context *)ctx;
struct si_shader_selector *sel = (struct si_shader_selector *)state;
- struct si_shader *p = sel->current, *c;
- struct si_shader_selector **current_shader[SI_NUM_SHADERS] = {
+ struct si_shader *p = sel->first_variant, *c;
+ struct si_shader_ctx_state *current_shader[SI_NUM_SHADERS] = {
[PIPE_SHADER_VERTEX] = &sctx->vs_shader,
[PIPE_SHADER_TESS_CTRL] = &sctx->tcs_shader,
[PIPE_SHADER_TESS_EVAL] = &sctx->tes_shader,
[PIPE_SHADER_FRAGMENT] = &sctx->ps_shader,
};
- if (*current_shader[sel->type] == sel)
- *current_shader[sel->type] = NULL;
+ if (current_shader[sel->type]->cso == sel) {
+ current_shader[sel->type]->cso = NULL;
+ current_shader[sel->type]->current = NULL;
+ }
while (p) {
c = p->next_variant;
p = c;
}
+ pipe_mutex_destroy(sel->mutex);
free(sel->tokens);
free(sel);
}
static void si_emit_spi_map(struct si_context *sctx, struct r600_atom *atom)
{
struct radeon_winsys_cs *cs = sctx->b.rings.gfx.cs;
- struct si_shader *ps = sctx->ps_shader->current;
+ struct si_shader *ps = sctx->ps_shader.current;
struct si_shader *vs = si_get_vs_state(sctx);
struct tgsi_shader_info *psinfo = &ps->selector->info;
struct tgsi_shader_info *vsinfo = &vs->selector->info;
static void si_emit_spi_ps_input(struct si_context *sctx, struct r600_atom *atom)
{
struct radeon_winsys_cs *cs = sctx->b.rings.gfx.cs;
- struct si_shader *ps = sctx->ps_shader->current;
+ struct si_shader *ps = sctx->ps_shader.current;
unsigned input_ena = ps->spi_ps_input_ena;
/* we need to enable at least one of them, otherwise we hang the GPU */
static void si_update_gs_rings(struct si_context *sctx)
{
- unsigned gsvs_itemsize = sctx->gs_shader->gsvs_itemsize;
+ unsigned gsvs_itemsize = sctx->gs_shader.cso->gsvs_itemsize;
uint64_t offset;
if (gsvs_itemsize == sctx->last_gsvs_itemsize)
* < 0 if there was a failure
*/
static int si_update_scratch_buffer(struct si_context *sctx,
- struct si_shader_selector *sel)
+ struct si_shader *shader)
{
- struct si_shader *shader;
uint64_t scratch_va = sctx->scratch_buffer->gpu_address;
int r;
- if (!sel)
+ if (!shader)
return 0;
- shader = sel->current;
-
/* This shader doesn't need a scratch buffer */
if (shader->scratch_bytes_per_wave == 0)
return 0;
return sctx->scratch_buffer ? sctx->scratch_buffer->b.b.width0 : 0;
}
-static unsigned si_get_scratch_buffer_bytes_per_wave(struct si_shader_selector *sel)
+static unsigned si_get_scratch_buffer_bytes_per_wave(struct si_shader *shader)
{
- return sel ? sel->current->scratch_bytes_per_wave : 0;
+ return shader ? shader->scratch_bytes_per_wave : 0;
}
static unsigned si_get_max_scratch_bytes_per_wave(struct si_context *sctx)
{
unsigned bytes = 0;
- bytes = MAX2(bytes, si_get_scratch_buffer_bytes_per_wave(sctx->ps_shader));
- bytes = MAX2(bytes, si_get_scratch_buffer_bytes_per_wave(sctx->gs_shader));
- bytes = MAX2(bytes, si_get_scratch_buffer_bytes_per_wave(sctx->vs_shader));
- bytes = MAX2(bytes, si_get_scratch_buffer_bytes_per_wave(sctx->tcs_shader));
- bytes = MAX2(bytes, si_get_scratch_buffer_bytes_per_wave(sctx->tes_shader));
+ bytes = MAX2(bytes, si_get_scratch_buffer_bytes_per_wave(sctx->ps_shader.current));
+ bytes = MAX2(bytes, si_get_scratch_buffer_bytes_per_wave(sctx->gs_shader.current));
+ bytes = MAX2(bytes, si_get_scratch_buffer_bytes_per_wave(sctx->vs_shader.current));
+ bytes = MAX2(bytes, si_get_scratch_buffer_bytes_per_wave(sctx->tcs_shader.current));
+ bytes = MAX2(bytes, si_get_scratch_buffer_bytes_per_wave(sctx->tes_shader.current));
return bytes;
}
* last used, so we still need to try to update them, even if
* they require scratch buffers smaller than the current size.
*/
- r = si_update_scratch_buffer(sctx, sctx->ps_shader);
+ r = si_update_scratch_buffer(sctx, sctx->ps_shader.current);
if (r < 0)
return false;
if (r == 1)
- si_pm4_bind_state(sctx, ps, sctx->ps_shader->current->pm4);
+ si_pm4_bind_state(sctx, ps, sctx->ps_shader.current->pm4);
- r = si_update_scratch_buffer(sctx, sctx->gs_shader);
+ r = si_update_scratch_buffer(sctx, sctx->gs_shader.current);
if (r < 0)
return false;
if (r == 1)
- si_pm4_bind_state(sctx, gs, sctx->gs_shader->current->pm4);
+ si_pm4_bind_state(sctx, gs, sctx->gs_shader.current->pm4);
- r = si_update_scratch_buffer(sctx, sctx->tcs_shader);
+ r = si_update_scratch_buffer(sctx, sctx->tcs_shader.current);
if (r < 0)
return false;
if (r == 1)
- si_pm4_bind_state(sctx, hs, sctx->tcs_shader->current->pm4);
+ si_pm4_bind_state(sctx, hs, sctx->tcs_shader.current->pm4);
/* VS can be bound as LS, ES, or VS. */
- r = si_update_scratch_buffer(sctx, sctx->vs_shader);
+ r = si_update_scratch_buffer(sctx, sctx->vs_shader.current);
if (r < 0)
return false;
if (r == 1) {
- if (sctx->tes_shader)
- si_pm4_bind_state(sctx, ls, sctx->vs_shader->current->pm4);
- else if (sctx->gs_shader)
- si_pm4_bind_state(sctx, es, sctx->vs_shader->current->pm4);
+ if (sctx->tes_shader.current)
+ si_pm4_bind_state(sctx, ls, sctx->vs_shader.current->pm4);
+ else if (sctx->gs_shader.current)
+ si_pm4_bind_state(sctx, es, sctx->vs_shader.current->pm4);
else
- si_pm4_bind_state(sctx, vs, sctx->vs_shader->current->pm4);
+ si_pm4_bind_state(sctx, vs, sctx->vs_shader.current->pm4);
}
/* TES can be bound as ES or VS. */
- r = si_update_scratch_buffer(sctx, sctx->tes_shader);
+ r = si_update_scratch_buffer(sctx, sctx->tes_shader.current);
if (r < 0)
return false;
if (r == 1) {
- if (sctx->gs_shader)
- si_pm4_bind_state(sctx, es, sctx->tes_shader->current->pm4);
+ if (sctx->gs_shader.current)
+ si_pm4_bind_state(sctx, es, sctx->tes_shader.current->pm4);
else
- si_pm4_bind_state(sctx, vs, sctx->tes_shader->current->pm4);
+ si_pm4_bind_state(sctx, vs, sctx->tes_shader.current->pm4);
}
}
if (!ureg)
return; /* if we get here, we're screwed */
- assert(!sctx->fixed_func_tcs_shader);
+ assert(!sctx->fixed_func_tcs_shader.cso);
ureg_DECL_constant2D(ureg, 0, 1, SI_DRIVER_STATE_CONST_BUF);
const0 = ureg_src_dimension(ureg_src_register(TGSI_FILE_CONSTANT, 0),
ureg_MOV(ureg, tessinner, const1);
ureg_END(ureg);
- sctx->fixed_func_tcs_shader =
+ sctx->fixed_func_tcs_shader.cso =
ureg_create_shader_and_destroy(ureg, &sctx->b.b);
}
{
/* Calculate the index of the config.
* 0 = VS, 1 = VS+GS, 2 = VS+Tess, 3 = VS+Tess+GS */
- unsigned index = 2*!!sctx->tes_shader + !!sctx->gs_shader;
+ unsigned index = 2*!!sctx->tes_shader.cso + !!sctx->gs_shader.cso;
struct si_pm4_state **pm4 = &sctx->vgt_shader_config[index];
if (!*pm4) {
*pm4 = CALLOC_STRUCT(si_pm4_state);
- if (sctx->tes_shader) {
+ if (sctx->tes_shader.cso) {
stages |= S_028B54_LS_EN(V_028B54_LS_STAGE_ON) |
S_028B54_HS_EN(1);
- if (sctx->gs_shader)
+ if (sctx->gs_shader.cso)
stages |= S_028B54_ES_EN(V_028B54_ES_STAGE_DS) |
S_028B54_GS_EN(1) |
S_028B54_VS_EN(V_028B54_VS_STAGE_COPY_SHADER);
else
stages |= S_028B54_VS_EN(V_028B54_VS_STAGE_DS);
- } else if (sctx->gs_shader) {
+ } else if (sctx->gs_shader.cso) {
stages |= S_028B54_ES_EN(V_028B54_ES_STAGE_REAL) |
S_028B54_GS_EN(1) |
S_028B54_VS_EN(V_028B54_VS_STAGE_COPY_SHADER);
int r;
/* Update stages before GS. */
- if (sctx->tes_shader) {
+ if (sctx->tes_shader.cso) {
if (!sctx->tf_ring) {
si_init_tess_factor_ring(sctx);
if (!sctx->tf_ring)
}
/* VS as LS */
- r = si_shader_select(ctx, sctx->vs_shader);
+ r = si_shader_select(ctx, &sctx->vs_shader);
if (r)
return false;
- si_pm4_bind_state(sctx, ls, sctx->vs_shader->current->pm4);
+ si_pm4_bind_state(sctx, ls, sctx->vs_shader.current->pm4);
- if (sctx->tcs_shader) {
- r = si_shader_select(ctx, sctx->tcs_shader);
+ if (sctx->tcs_shader.cso) {
+ r = si_shader_select(ctx, &sctx->tcs_shader);
if (r)
return false;
- si_pm4_bind_state(sctx, hs, sctx->tcs_shader->current->pm4);
+ si_pm4_bind_state(sctx, hs, sctx->tcs_shader.current->pm4);
} else {
- if (!sctx->fixed_func_tcs_shader) {
+ if (!sctx->fixed_func_tcs_shader.cso) {
si_generate_fixed_func_tcs(sctx);
- if (!sctx->fixed_func_tcs_shader)
+ if (!sctx->fixed_func_tcs_shader.cso)
return false;
}
- r = si_shader_select(ctx, sctx->fixed_func_tcs_shader);
+ r = si_shader_select(ctx, &sctx->fixed_func_tcs_shader);
if (r)
return false;
si_pm4_bind_state(sctx, hs,
- sctx->fixed_func_tcs_shader->current->pm4);
+ sctx->fixed_func_tcs_shader.current->pm4);
}
- r = si_shader_select(ctx, sctx->tes_shader);
+ r = si_shader_select(ctx, &sctx->tes_shader);
if (r)
return false;
- if (sctx->gs_shader) {
+ if (sctx->gs_shader.cso) {
/* TES as ES */
- si_pm4_bind_state(sctx, es, sctx->tes_shader->current->pm4);
+ si_pm4_bind_state(sctx, es, sctx->tes_shader.current->pm4);
} else {
/* TES as VS */
- si_pm4_bind_state(sctx, vs, sctx->tes_shader->current->pm4);
- si_update_so(sctx, sctx->tes_shader);
+ si_pm4_bind_state(sctx, vs, sctx->tes_shader.current->pm4);
+ si_update_so(sctx, sctx->tes_shader.cso);
}
- } else if (sctx->gs_shader) {
+ } else if (sctx->gs_shader.cso) {
/* VS as ES */
- r = si_shader_select(ctx, sctx->vs_shader);
+ r = si_shader_select(ctx, &sctx->vs_shader);
if (r)
return false;
- si_pm4_bind_state(sctx, es, sctx->vs_shader->current->pm4);
+ si_pm4_bind_state(sctx, es, sctx->vs_shader.current->pm4);
} else {
/* VS as VS */
- r = si_shader_select(ctx, sctx->vs_shader);
+ r = si_shader_select(ctx, &sctx->vs_shader);
if (r)
return false;
- si_pm4_bind_state(sctx, vs, sctx->vs_shader->current->pm4);
- si_update_so(sctx, sctx->vs_shader);
+ si_pm4_bind_state(sctx, vs, sctx->vs_shader.current->pm4);
+ si_update_so(sctx, sctx->vs_shader.cso);
}
/* Update GS. */
- if (sctx->gs_shader) {
- r = si_shader_select(ctx, sctx->gs_shader);
+ if (sctx->gs_shader.cso) {
+ r = si_shader_select(ctx, &sctx->gs_shader);
if (r)
return false;
- si_pm4_bind_state(sctx, gs, sctx->gs_shader->current->pm4);
- si_pm4_bind_state(sctx, vs, sctx->gs_shader->current->gs_copy_shader->pm4);
- si_update_so(sctx, sctx->gs_shader);
+ si_pm4_bind_state(sctx, gs, sctx->gs_shader.current->pm4);
+ si_pm4_bind_state(sctx, vs, sctx->gs_shader.current->gs_copy_shader->pm4);
+ si_update_so(sctx, sctx->gs_shader.cso);
if (!sctx->gsvs_ring) {
si_init_gs_rings(sctx);
si_update_vgt_shader_config(sctx);
- r = si_shader_select(ctx, sctx->ps_shader);
+ r = si_shader_select(ctx, &sctx->ps_shader);
if (r)
return false;
- si_pm4_bind_state(sctx, ps, sctx->ps_shader->current->pm4);
+ si_pm4_bind_state(sctx, ps, sctx->ps_shader.current->pm4);
if (si_pm4_state_changed(sctx, ps) || si_pm4_state_changed(sctx, vs) ||
sctx->sprite_coord_enable != rs->sprite_coord_enable ||
return false;
}
- if (sctx->ps_db_shader_control != sctx->ps_shader->current->db_shader_control) {
- sctx->ps_db_shader_control = sctx->ps_shader->current->db_shader_control;
+ if (sctx->ps_db_shader_control != sctx->ps_shader.current->db_shader_control) {
+ sctx->ps_db_shader_control = sctx->ps_shader.current->db_shader_control;
si_mark_atom_dirty(sctx, &sctx->db_render_state);
}
- if (sctx->smoothing_enabled != sctx->ps_shader->current->key.ps.poly_line_smoothing) {
- sctx->smoothing_enabled = sctx->ps_shader->current->key.ps.poly_line_smoothing;
+ if (sctx->smoothing_enabled != sctx->ps_shader.current->key.ps.poly_line_smoothing) {
+ sctx->smoothing_enabled = sctx->ps_shader.current->key.ps.poly_line_smoothing;
si_mark_atom_dirty(sctx, &sctx->msaa_config);
if (sctx->b.chip_class == SI)