VkBuffer buffer;
VkBufferCreateInfo createInfo;
BUFFER_STATE(VkBuffer buff, const VkBufferCreateInfo *pCreateInfo) : buffer(buff), createInfo(*pCreateInfo) {
+ if (createInfo.queueFamilyIndexCount > 0) {
+ uint32_t *pQueueFamilyIndices = new uint32_t[createInfo.queueFamilyIndexCount];
+ for (uint32_t i = 0; i < createInfo.queueFamilyIndexCount; i++) {
+ pQueueFamilyIndices[i] = pCreateInfo->pQueueFamilyIndices[i];
+ }
+ createInfo.pQueueFamilyIndices = pQueueFamilyIndices;
+ }
+
if (createInfo.flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) {
sparse = true;
}
};
BUFFER_STATE(BUFFER_STATE const &rh_obj) = delete;
+
+ ~BUFFER_STATE() {
+ if (createInfo.queueFamilyIndexCount > 0) {
+ delete createInfo.pQueueFamilyIndices;
+ createInfo.pQueueFamilyIndices = nullptr;
+ }
+ };
};
class BUFFER_VIEW_STATE : public BASE_NODE {
bool acquired; // If this is a swapchain image, has it been acquired by the app.
IMAGE_STATE(VkImage img, const VkImageCreateInfo *pCreateInfo)
: image(img), createInfo(*pCreateInfo), valid(false), acquired(false) {
+ if (createInfo.queueFamilyIndexCount > 0) {
+ uint32_t *pQueueFamilyIndices = new uint32_t[createInfo.queueFamilyIndexCount];
+ for (uint32_t i = 0; i < createInfo.queueFamilyIndexCount; i++) {
+ pQueueFamilyIndices[i] = pCreateInfo->pQueueFamilyIndices[i];
+ }
+ createInfo.pQueueFamilyIndices = pQueueFamilyIndices;
+ }
+
if (createInfo.flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) {
sparse = true;
}
};
IMAGE_STATE(IMAGE_STATE const &rh_obj) = delete;
+
+ ~IMAGE_STATE() {
+ if (createInfo.queueFamilyIndexCount > 0) {
+ delete createInfo.pQueueFamilyIndices;
+ createInfo.pQueueFamilyIndices = nullptr;
+ }
+ };
};
class IMAGE_VIEW_STATE : public BASE_NODE {