mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
turnip: more/better asserts for tu_cs
Asserting (cur < end) in tu_cs_emit catches much less programming errors comparing to asserting (cur < reserved_end). We should never write more commands than what we have reserved. Assert IB is non-empty and sane in tu_cs_emit_ib.
This commit is contained in:
parent
aa7dd6cb7f
commit
10c5013442
1 changed files with 4 additions and 2 deletions
|
|
@ -87,7 +87,7 @@ tu_cs_sanity_check(const struct tu_cs *cs)
|
|||
static inline void
|
||||
tu_cs_emit(struct tu_cs *cs, uint32_t value)
|
||||
{
|
||||
assert(cs->cur < cs->end);
|
||||
assert(cs->cur < cs->reserved_end);
|
||||
*cs->cur = value;
|
||||
++cs->cur;
|
||||
}
|
||||
|
|
@ -153,8 +153,10 @@ tu_cs_emit_write_reg(struct tu_cs *cs, uint16_t reg, uint32_t value)
|
|||
static inline void
|
||||
tu_cs_emit_ib(struct tu_cs *cs, const struct tu_cs_entry *entry)
|
||||
{
|
||||
assert(entry->offset % sizeof(uint32_t) == 0);
|
||||
assert(entry->bo);
|
||||
assert(entry->size && entry->offset + entry->size <= entry->bo->size);
|
||||
assert(entry->size % sizeof(uint32_t) == 0);
|
||||
assert(entry->offset % sizeof(uint32_t) == 0);
|
||||
|
||||
tu_cs_emit_pkt7(cs, CP_INDIRECT_BUFFER, 3);
|
||||
tu_cs_emit_qw(cs, entry->bo->iova + entry->offset);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue