ntt: Extend ntt_compile::addr_declared and ntt_compile::addr_reg
This was identified by Coverity.4bb9c0a28a
added uses of a third address register, but the arrays for tracking address registers only have two slots. Add back a version of the assertion from before4bb9c0a28a
to help prevent future problems. I don't think any drivers that would hit this path use NIR-to-TGSI yet, so it may be moot. Reviewed-by: Matt Turner <mattst88@gmail.com> CID: 1496942 CID: 1496944 Fixes:4bb9c0a28a
("nir_to_tgsi: Use the same address reg mappings as GLSL-to-TGSI did.") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14487>
This commit is contained in:
parent
495debebad
commit
926d78a645
|
@ -44,8 +44,8 @@ struct ntt_compile {
|
||||||
bool native_integers;
|
bool native_integers;
|
||||||
bool has_txf_lz;
|
bool has_txf_lz;
|
||||||
|
|
||||||
bool addr_declared[2];
|
bool addr_declared[3];
|
||||||
struct ureg_dst addr_reg[2];
|
struct ureg_dst addr_reg[3];
|
||||||
|
|
||||||
/* if condition set up at the end of a block, for ntt_emit_if(). */
|
/* if condition set up at the end of a block, for ntt_emit_if(). */
|
||||||
struct ureg_src if_cond;
|
struct ureg_src if_cond;
|
||||||
|
@ -631,6 +631,8 @@ ntt_get_load_const_src(struct ntt_compile *c, nir_load_const_instr *instr)
|
||||||
static struct ureg_src
|
static struct ureg_src
|
||||||
ntt_reladdr(struct ntt_compile *c, struct ureg_src addr, int addr_index)
|
ntt_reladdr(struct ntt_compile *c, struct ureg_src addr, int addr_index)
|
||||||
{
|
{
|
||||||
|
assert(addr_index < ARRAY_SIZE(c->addr_reg));
|
||||||
|
|
||||||
for (int i = 0; i <= addr_index; i++) {
|
for (int i = 0; i <= addr_index; i++) {
|
||||||
if (!c->addr_declared[i]) {
|
if (!c->addr_declared[i]) {
|
||||||
c->addr_reg[i] = ureg_writemask(ureg_DECL_address(c->ureg),
|
c->addr_reg[i] = ureg_writemask(ureg_DECL_address(c->ureg),
|
||||||
|
|
Loading…
Reference in New Issue