radeonsi: simplify checking for monolithic compilation

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
Marek Olšák 2016-11-13 19:21:46 +01:00
parent e6aee45db4
commit fee71fec25
4 changed files with 9 additions and 8 deletions

View file

@ -126,6 +126,7 @@ static void *si_create_compute_state(
p_atomic_inc(&sscreen->b.num_shaders_created);
program->shader.selector = &sel;
program->shader.is_monolithic = true;
if (si_shader_create(sscreen, sctx->tm, &program->shader,
&sctx->b.debug)) {

View file

@ -8139,14 +8139,7 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
* Vertex shaders are compiled on demand when a vertex fetch
* workaround must be applied.
*/
if (!mainp ||
shader->key.as_es != mainp->key.as_es ||
shader->key.as_ls != mainp->key.as_ls ||
(sel->type == PIPE_SHADER_VERTEX &&
shader->key.mono.vs.fix_fetch) ||
(sel->type == PIPE_SHADER_TESS_CTRL &&
shader->key.mono.tcs.inputs_to_copy) ||
sel->type == PIPE_SHADER_COMPUTE) {
if (shader->is_monolithic) {
/* Monolithic shader (compiled as a whole, has many variants,
* may take a long time to compile).
*/

View file

@ -484,6 +484,7 @@ struct si_shader {
struct r600_resource *bo;
struct r600_resource *scratch_bo;
struct si_shader_key key;
bool is_monolithic;
bool is_binary_shared;
bool is_gs_copy_shader;

View file

@ -1024,6 +1024,7 @@ static int si_shader_select_with_key(struct si_screen *sscreen,
bool wait,
bool is_debug_context)
{
static const struct si_shader_key zeroed;
struct si_shader_selector *sel = state->cso;
struct si_shader *current = state->current;
struct si_shader *iter, *shader = NULL;
@ -1064,6 +1065,11 @@ static int si_shader_select_with_key(struct si_screen *sscreen,
}
shader->selector = sel;
shader->key = *key;
shader->is_monolithic =
!sel->main_shader_part ||
sel->main_shader_part->key.as_ls != key->as_ls ||
sel->main_shader_part->key.as_es != key->as_es ||
memcmp(&key->mono, &zeroed.mono, sizeof(key->mono)) != 0;
r = si_shader_create(sscreen, tm, shader, debug);
if (unlikely(r)) {