diff options
author | Connor Abbott <[email protected]> | 2020-06-24 12:03:59 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-26 09:34:33 +0000 |
commit | 9edff0cfd4f567a9db5bc02be519e7d48299228a (patch) | |
tree | a6bece830b232ce8fcf495251feb94de8a029690 /src/freedreno/ir3/ir3_shader.h | |
parent | 4554b946c387ac38acade14d006b2b599a08f446 (diff) |
ir3: Support variants with different constlen's
This provides the mechanism for compiling variants with a reduced
constlen. The next patch provides the policy for choosing which to
reduce.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5607>
Diffstat (limited to 'src/freedreno/ir3/ir3_shader.h')
-rw-r--r-- | src/freedreno/ir3/ir3_shader.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/freedreno/ir3/ir3_shader.h b/src/freedreno/ir3/ir3_shader.h index 353ce22b243..b2dbc64ce2e 100644 --- a/src/freedreno/ir3/ir3_shader.h +++ b/src/freedreno/ir3/ir3_shader.h @@ -299,6 +299,12 @@ struct ir3_shader_key { unsigned tessellation : 2; unsigned has_gs : 1; + + /* Whether this variant sticks to the "safe" maximum constlen, + * which guarantees that the combined stages will never go over + * the limit: + */ + unsigned safe_constlen : 1; }; uint32_t global; }; @@ -369,6 +375,9 @@ ir3_shader_key_changes_fs(struct ir3_shader_key *key, struct ir3_shader_key *las if (last_key->ucp_enables != key->ucp_enables) return true; + if (last_key->safe_constlen != key->safe_constlen) + return true; + return false; } @@ -391,6 +400,9 @@ ir3_shader_key_changes_vs(struct ir3_shader_key *key, struct ir3_shader_key *las if (last_key->ucp_enables != key->ucp_enables) return true; + if (last_key->safe_constlen != key->safe_constlen) + return true; + return false; } @@ -668,6 +680,25 @@ ir3_const_state(const struct ir3_shader_variant *v) return v->const_state; } +/* Given a variant, calculate the maximum constlen it can have. + */ + +static inline unsigned +ir3_max_const(const struct ir3_shader_variant *v) +{ + const struct ir3_compiler *compiler = v->shader->compiler; + + if (v->shader->type == MESA_SHADER_COMPUTE) { + return compiler->max_const_compute; + } else if (v->key.safe_constlen) { + return compiler->max_const_safe; + } else if (v->shader->type == MESA_SHADER_FRAGMENT) { + return compiler->max_const_frag; + } else { + return compiler->max_const_geom; + } +} + void * ir3_shader_assemble(struct ir3_shader_variant *v); struct ir3_shader_variant * ir3_shader_get_variant(struct ir3_shader *shader, const struct ir3_shader_key *key, bool binning_pass, bool *created); |