Changeset 8e02b6b in opengl-game for vulkan-utils.hpp


Ignore:
Timestamp:
Nov 22, 2019, 6:27:13 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
f97c5e7
Parents:
683dd55
git-author:
Dmitry Portnoy <dmitry.portnoy@…> (11/22/19 18:26:59)
git-committer:
Dmitry Portnoy <dmitry.portnoy@…> (11/22/19 18:27:13)
Message:

To move to a more generic way of updating the scene, rename updateUniformBuffers() to updateScene() in VulkanGame and move the code to copy the data into a new copyDataToMemory() function in VulkanUtils.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-utils.hpp

    r683dd55 r8e02b6b  
    9494            VkDeviceSize srcOffset, VkDeviceSize dstOffset, VkDeviceSize size, VkQueue graphicsQueue);
    9595
     96      template<class DataType>
     97      static void copyDataToMemory(VkDevice device, VkDeviceMemory bufferMemory, const DataType& srcData);
     98
    9699      static bool hasStencilComponent(VkFormat format);
    97100
     
    122125}
    123126
     127template<class DataType>
     128void VulkanUtils::copyDataToMemory(VkDevice device, VkDeviceMemory bufferMemory, const DataType& srcData) {
     129   void* data;
     130   vkMapMemory(device, bufferMemory, 0, sizeof(DataType), 0, &data);
     131   memcpy(data, &srcData, sizeof(DataType));
     132   vkUnmapMemory(device, bufferMemory);
     133}
     134
    124135#endif // _VULKAN_UTILS_H
Note: See TracChangeset for help on using the changeset viewer.