diff options
author | Marek Olšák <[email protected]> | 2017-04-06 22:55:06 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-04-28 21:47:35 +0200 |
commit | b1ed3ffc56ce40e03d3bb76ddb28a3a4255901c6 (patch) | |
tree | 4d2f025645de00e613acc53726c3d04aa269909d /src/gallium/drivers/radeonsi/si_state_shaders.c | |
parent | e4542f00ce809c216888b9d36ab71e2560f1e243 (diff) |
radeonsi: separate out VS prolog key generation
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state_shaders.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 06ea99c05c3..0be8252af5f 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -965,6 +965,24 @@ static unsigned si_get_alpha_test_func(struct si_context *sctx) return PIPE_FUNC_ALWAYS; } +static void si_shader_selector_key_vs(struct si_context *sctx, + struct si_shader_selector *vs, + struct si_shader_key *key, + struct si_vs_prolog_bits *prolog_key) +{ + if (!sctx->vertex_elements) + return; + + unsigned count = MIN2(vs->info.num_inputs, + sctx->vertex_elements->count); + for (unsigned i = 0; i < count; ++i) { + prolog_key->instance_divisors[i] = + sctx->vertex_elements->elements[i].instance_divisor; + } + + memcpy(key->mono.vs_fix_fetch, sctx->vertex_elements->fix_fetch, count); +} + static void si_shader_selector_key_hw_vs(struct si_context *sctx, struct si_shader_selector *vs, struct si_shader_key *key) @@ -1023,22 +1041,13 @@ static inline void si_shader_selector_key(struct pipe_context *ctx, struct si_shader_key *key) { struct si_context *sctx = (struct si_context *)ctx; - unsigned i; memset(key, 0, sizeof(*key)); switch (sel->type) { case PIPE_SHADER_VERTEX: - if (sctx->vertex_elements) { - unsigned count = MIN2(sel->info.num_inputs, - sctx->vertex_elements->count); - for (i = 0; i < count; ++i) - key->part.vs.prolog.instance_divisors[i] = - sctx->vertex_elements->elements[i].instance_divisor; - - memcpy(key->mono.vs_fix_fetch, - sctx->vertex_elements->fix_fetch, count); - } + si_shader_selector_key_vs(sctx, sel, key, &key->part.vs.prolog); + if (sctx->tes_shader.cso) key->as_ls = 1; else if (sctx->gs_shader.cso) |