15 #include <vsg/vk/DeviceMemory.h>
16 #include <vsg/vk/vk_buffer.h>
34 VkImage
vk(uint32_t deviceID)
const {
return _vulkanData[deviceID].image; }
38 VkImageCreateFlags flags = 0;
39 VkImageType imageType = VK_IMAGE_TYPE_2D;
40 VkFormat format = VK_FORMAT_UNDEFINED;
41 VkExtent3D extent = {0, 0, 0};
42 uint32_t mipLevels = 0;
43 uint32_t arrayLayers = 0;
44 VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT;
45 VkImageTiling tiling = VK_IMAGE_TILING_OPTIMAL;
46 VkImageUsageFlags usage = 0;
47 VkSharingMode sharingMode = VK_SHARING_MODE_EXCLUSIVE;
48 std::vector<uint32_t> queueFamilyIndices;
49 VkImageLayout initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
53 DeviceMemory* getDeviceMemory(uint32_t deviceID) {
return _vulkanData[deviceID].deviceMemory; }
54 const DeviceMemory* getDeviceMemory(uint32_t deviceID)
const {
return _vulkanData[deviceID].deviceMemory; }
56 VkDeviceSize getMemoryOffset(uint32_t deviceID)
const {
return _vulkanData[deviceID].memoryOffset; }
58 VkMemoryRequirements getMemoryRequirements(uint32_t deviceID)
const;
60 VkResult allocateAndBindMemory(Device* device, VkMemoryPropertyFlags memoryProperties = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
void* pNextAllocInfo =
nullptr);
62 VkResult bind(DeviceMemory* deviceMemory, VkDeviceSize memoryOffset);
65 bool requiresCopy(uint32_t deviceID)
const {
return data && data->differentModifiedCount(_vulkanData[deviceID].copiedModifiedCount); }
68 bool syncModifiedCount(uint32_t deviceID) {
return data && data->getModifiedCount(_vulkanData[deviceID].copiedModifiedCount); }
70 virtual void compile(
Device* device);
71 virtual void compile(
Context& context);
78 VkImage image = VK_NULL_HANDLE;
80 VkDeviceSize memoryOffset = 0;
81 VkDeviceSize size = 0;
83 bool requiresDataCopy =
false;
Definition: DeviceMemory.h:28
Device encapsulates VkDevice, a logical handle to the PhysicalDevice with capabilities specified duri...
Definition: Device.h:37
Image class encapsulates VkImage and VkImageCreateInfo settings used to set it up.
Definition: Image.h:25
Image(VkImage image, Device *device)
create a vsg::Image wrapper for specified VkImage
VkImage vk(uint32_t deviceID) const
Vulkan VkImage handle.
Definition: Image.h:34
bool requiresCopy(uint32_t deviceID) const
return true if the Image's data has been modified and should be copied to the buffer.
Definition: Image.h:65
ref_ptr< Data > data
VkImageCreateInfo settings.
Definition: Image.h:37
int compare(const Object &rhs_object) const override
compare two objects, return -1 if this object is less than rhs, return 0 if it's equal,...
bool syncModifiedCount(uint32_t deviceID)
return true if the Image's data has been modified and should be copied to the buffer,...
Definition: Image.h:68
Image(ref_ptr< Data > in_data={})
create a vsg::Image, optional Data is used to initialize createInfo, delay VkImage creation to compil...
ModifiedCount provides a count value to keep track of modifications to data.
Definition: Data.h:29
vk_buffer that manages a single logical device supported.
Definition: vk_buffer.h:28