Changes in vulkan-utils.hpp [e8445f0:5049354] in opengl-game


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-utils.hpp

    re8445f0 r5049354  
    3939
    4040      static VkResult createDebugUtilsMessengerEXT(VkInstance instance,
    41                                                    const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo,
    42                                                    const VkAllocationCallbacks* pAllocator,
    43                                                    VkDebugUtilsMessengerEXT* pDebugMessenger);
     41            const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo,
     42            const VkAllocationCallbacks* pAllocator,
     43            VkDebugUtilsMessengerEXT* pDebugMessenger);
    4444
    4545      static void destroyDebugUtilsMessengerEXT(VkInstance instance,
    46                                                 VkDebugUtilsMessengerEXT debugMessenger,
    47                                                 const VkAllocationCallbacks* pAllocator);
     46            VkDebugUtilsMessengerEXT debugMessenger,
     47            const VkAllocationCallbacks* pAllocator);
    4848
    4949      static QueueFamilyIndices findQueueFamilies(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface);
    5050      static bool checkDeviceExtensionSupport(VkPhysicalDevice physicalDevice,
    51                                               const vector<const char*>& deviceExtensions);
     51            const vector<const char*>& deviceExtensions);
    5252      static VkSurfaceCapabilitiesKHR querySwapChainCapabilities(VkPhysicalDevice physicalDevice,
    53                                                                  VkSurfaceKHR surface);
     53         VkSurfaceKHR surface);
    5454      static vector<VkSurfaceFormatKHR> querySwapChainFormats(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface);
    5555      static vector<VkPresentModeKHR> querySwapChainPresentModes(VkPhysicalDevice physicalDevice,
    56                                                                  VkSurfaceKHR surface);
     56         VkSurfaceKHR surface);
    5757      static VkSurfaceFormatKHR chooseSwapSurfaceFormat(const vector<VkSurfaceFormatKHR>& availableFormats,
    58                                                         const vector<VkFormat>& requestedFormats, VkColorSpaceKHR requestedColorSpace);
     58         const vector<VkFormat>& requestedFormats, VkColorSpaceKHR requestedColorSpace);
    5959      static VkPresentModeKHR chooseSwapPresentMode(const vector<VkPresentModeKHR>& availablePresentModes,
    60                                                     const vector<VkPresentModeKHR>& requestedPresentModes);
     60         const vector<VkPresentModeKHR>& requestedPresentModes);
    6161      static VkExtent2D chooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, int width, int height);
    6262      static VkImageView createImageView(VkDevice device, VkImage image, VkFormat format,
    63                                          VkImageAspectFlags aspectFlags);
     63            VkImageAspectFlags aspectFlags);
    6464      static VkFormat findSupportedFormat(VkPhysicalDevice physicalDevice, const vector<VkFormat>& candidates,
    65                                           VkImageTiling tiling, VkFormatFeatureFlags features);
     65            VkImageTiling tiling, VkFormatFeatureFlags features);
    6666      static void createBuffer(VkDevice device, VkPhysicalDevice physicalDevice, VkDeviceSize size,
    67                                VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer& buffer,
    68                                VkDeviceMemory& bufferMemory);
     67            VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer& buffer,
     68            VkDeviceMemory& bufferMemory);
    6969      static uint32_t findMemoryType(VkPhysicalDevice physicalDevice, uint32_t typeFilter,
    70                                      VkMemoryPropertyFlags properties);
     70            VkMemoryPropertyFlags properties);
    7171
    7272      static void createVulkanImageFromFile(VkDevice device, VkPhysicalDevice physicalDevice,
    73                                             VkCommandPool commandPool, string filename, VulkanImage& image,
    74                                             VkQueue graphicsQueue);
     73            VkCommandPool commandPool, string filename, VulkanImage& image, VkQueue graphicsQueue);
    7574      static void createVulkanImageFromSDLTexture(VkDevice device, VkPhysicalDevice physicalDevice,
    76                                                   SDL_Texture* texture, VulkanImage& image);
     75            SDL_Texture* texture, VulkanImage& image);
    7776      static void populateVulkanImageFromSDLTexture(VkDevice device, VkPhysicalDevice physicalDevice,
    78                                                     VkCommandPool commandPool, SDL_Texture* texture,
    79                                                     SDL_Renderer* renderer, VulkanImage& image, VkQueue graphicsQueue);
     77            VkCommandPool commandPool, SDL_Texture* texture, SDL_Renderer* renderer, VulkanImage& image,
     78            VkQueue graphicsQueue);
    8079      static void createDepthImage(VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool,
    81                                    VkFormat depthFormat, VkExtent2D extent, VulkanImage& image, VkQueue graphicsQueue);
     80            VkFormat depthFormat, VkExtent2D extent, VulkanImage& image, VkQueue graphicsQueue);
    8281      static void createImage(VkDevice device, VkPhysicalDevice physicalDevice, uint32_t width, uint32_t height,
    83                               VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage,
    84                               VkMemoryPropertyFlags properties, VulkanImage& image);
     82            VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties,
     83            VulkanImage& image);
    8584
    8685      static void transitionImageLayout(VkDevice device, VkCommandPool commandPool, VkImage image,
    87                                         VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout,
    88                                         VkQueue graphicsQueue);
     86            VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout, VkQueue graphicsQueue);
    8987      static VkCommandBuffer beginSingleTimeCommands(VkDevice device, VkCommandPool commandPool);
    9088      static void endSingleTimeCommands(VkDevice device, VkCommandPool commandPool,
    91                                         VkCommandBuffer commandBuffer, VkQueue graphicsQueue);
     89            VkCommandBuffer commandBuffer, VkQueue graphicsQueue);
    9290      static void copyBufferToImage(VkDevice device, VkCommandPool commandPool, VkBuffer buffer, VkImage image,
    93                                     uint32_t width, uint32_t height, VkQueue graphicsQueue);
     91            uint32_t width, uint32_t height, VkQueue graphicsQueue);
    9492
    9593      template<class DataType>
    9694      static void copyDataToBuffer(VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool,
    97                                    const vector<DataType>& srcData, VkBuffer dstBuffer, size_t dstVertexOffset,
    98                                    VkQueue graphicsQueue);
     95            const vector<DataType>& srcData, VkBuffer dstBuffer, size_t dstVertexOffset, VkQueue graphicsQueue);
    9996
    10097      static void copyBuffer(VkDevice device, VkCommandPool commandPool, VkBuffer srcBuffer, VkBuffer dstBuffer,
    101                              VkDeviceSize srcOffset, VkDeviceSize dstOffset, VkDeviceSize size,
    102                              VkQueue graphicsQueue);
     98            VkDeviceSize srcOffset, VkDeviceSize dstOffset, VkDeviceSize size, VkQueue graphicsQueue);
    10399
    104100      template<class DataType>
    105       static void copyDataToMemory(VkDevice device, const DataType& srcData, VkDeviceMemory bufferMemory,
    106                                    VkDeviceSize offset);
    107 
    108       template<class DataType>
    109       static void copyDataToMemory(VkDevice device, const DataType& srcData, VkDeviceMemory bufferMemory,
    110                                    VkDeviceSize offset, VkDeviceSize size);
     101      static void copyDataToMemory(VkDevice device, VkDeviceMemory bufferMemory, VkDeviceSize offset,
     102            const DataType& srcData);
    111103
    112104      static bool hasStencilComponent(VkFormat format);
     
    139131
    140132template<class DataType>
    141 void VulkanUtils::copyDataToMemory(VkDevice device, const DataType& srcData, VkDeviceMemory bufferMemory,
    142    VkDeviceSize offset) {
    143    copyDataToMemory(device, srcData, bufferMemory, offset, sizeof(DataType));
    144 }
    145 
    146 template<class DataType>
    147 void VulkanUtils::copyDataToMemory(VkDevice device, const DataType& srcData, VkDeviceMemory bufferMemory,
    148                                    VkDeviceSize offset, VkDeviceSize size) {
     133void VulkanUtils::copyDataToMemory(VkDevice device, VkDeviceMemory bufferMemory, VkDeviceSize offset,
     134      const DataType& srcData) {
    149135   void* data;
    150136
    151    vkMapMemory(device, bufferMemory, offset, size, 0, &data);
    152    memcpy(data, &srcData, size);
     137   vkMapMemory(device, bufferMemory, offset, sizeof(DataType), 0, &data);
     138   memcpy(data, &srcData, sizeof(DataType));
    153139   vkUnmapMemory(device, bufferMemory);
    154140}
    155141
    156 // TODO: Use this in vulkan-utils itself as well
    157142#define VKUTIL_CHECK_RESULT(f, msg) {                                                                                      \
    158143   VkResult res = (f);                                                                                                     \
Note: See TracChangeset for help on using the changeset viewer.