turnip: Promote tu_cs_get_size/is_empty to header
These will be used in tu_cmd_buffer.c. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3988>
This commit is contained in:
parent
bdf20d324b
commit
5715a61fa9
|
@ -80,26 +80,6 @@ tu_cs_get_offset(const struct tu_cs *cs)
|
||||||
return cs->start - (uint32_t *) cs->bos[cs->bo_count - 1]->map;
|
return cs->start - (uint32_t *) cs->bos[cs->bo_count - 1]->map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the size of the command packets emitted since the last call to
|
|
||||||
* tu_cs_add_entry.
|
|
||||||
*/
|
|
||||||
static uint32_t
|
|
||||||
tu_cs_get_size(const struct tu_cs *cs)
|
|
||||||
{
|
|
||||||
return cs->cur - cs->start;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if there is no command packet emitted since the last call to
|
|
||||||
* tu_cs_add_entry.
|
|
||||||
*/
|
|
||||||
static uint32_t
|
|
||||||
tu_cs_is_empty(const struct tu_cs *cs)
|
|
||||||
{
|
|
||||||
return tu_cs_get_size(cs) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate and add a BO to a command stream. Following command packets will
|
* Allocate and add a BO to a command stream. Following command packets will
|
||||||
* be emitted to the new BO.
|
* be emitted to the new BO.
|
||||||
|
|
|
@ -66,6 +66,26 @@ tu_cs_reset(struct tu_cs *cs);
|
||||||
VkResult
|
VkResult
|
||||||
tu_cs_add_entries(struct tu_cs *cs, struct tu_cs *target);
|
tu_cs_add_entries(struct tu_cs *cs, struct tu_cs *target);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the size of the command packets emitted since the last call to
|
||||||
|
* tu_cs_add_entry.
|
||||||
|
*/
|
||||||
|
static inline uint32_t
|
||||||
|
tu_cs_get_size(const struct tu_cs *cs)
|
||||||
|
{
|
||||||
|
return cs->cur - cs->start;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if there is no command packet emitted since the last call to
|
||||||
|
* tu_cs_add_entry.
|
||||||
|
*/
|
||||||
|
static inline uint32_t
|
||||||
|
tu_cs_is_empty(const struct tu_cs *cs)
|
||||||
|
{
|
||||||
|
return tu_cs_get_size(cs) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discard all entries. This allows \a cs to be reused while keeping the
|
* Discard all entries. This allows \a cs to be reused while keeping the
|
||||||
* existing BOs and command packets intact.
|
* existing BOs and command packets intact.
|
||||||
|
|
Loading…
Reference in New Issue