diff options
author | Chia-I Wu <[email protected]> | 2019-01-28 15:55:40 -0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2019-03-11 10:02:13 -0700 |
commit | 29f111000399821452e8538ca74ce2de7210ee47 (patch) | |
tree | 8a9ed9b5cbce3c3bf5adba64409c2f2bc2dca64d /src/freedreno/vulkan/tu_cs.h | |
parent | 0d81be3959234c3d877efd6ddee5280b01815433 (diff) |
turnip: never fail tu_cs_begin/tu_cs_end
Error checking tu_cs_begin/tu_cs_end is too tedious for the callers.
Move tu_cs_add_bo and tu_cs_reserve_entry to tu_cs_reserve_space
such that tu_cs_begin/tu_cs_end never fails.
Diffstat (limited to 'src/freedreno/vulkan/tu_cs.h')
-rw-r--r-- | src/freedreno/vulkan/tu_cs.h | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/src/freedreno/vulkan/tu_cs.h b/src/freedreno/vulkan/tu_cs.h index 4c184dac8f9..43835d147f6 100644 --- a/src/freedreno/vulkan/tu_cs.h +++ b/src/freedreno/vulkan/tu_cs.h @@ -29,39 +29,23 @@ void tu_cs_init(struct tu_cs *cs, uint32_t initial_size); + void tu_cs_finish(struct tu_device *dev, struct tu_cs *cs); -VkResult -tu_cs_begin(struct tu_device *dev, struct tu_cs *cs, uint32_t reserve_size); -VkResult -tu_cs_end(struct tu_cs *cs); -void -tu_cs_reset(struct tu_device *dev, struct tu_cs *cs); - -/** - * Reserve space from a command stream for \a size uint32_t values. - */ -static inline VkResult -tu_cs_reserve_space(struct tu_device *dev, struct tu_cs *cs, size_t size) -{ - if (cs->end - cs->cur >= size) { - cs->reserved_end = cs->cur + size; - return VK_SUCCESS; - } - VkResult result = tu_cs_end(cs); - if (result != VK_SUCCESS) - return result; +void +tu_cs_begin(struct tu_cs *cs); - result = tu_cs_begin(dev, cs, size); - if (result != VK_SUCCESS) - return result; +void +tu_cs_end(struct tu_cs *cs); - cs->reserved_end = cs->cur + size; - assert(cs->reserved_end <= cs->end); +VkResult +tu_cs_reserve_space(struct tu_device *dev, + struct tu_cs *cs, + uint32_t reserved_size); - return VK_SUCCESS; -} +void +tu_cs_reset(struct tu_device *dev, struct tu_cs *cs); /** * Assert that we did not exceed the reserved space. |