Changeset 5a1ace0 in opengl-game for vulkan-utils.hpp


Ignore:
Timestamp:
Feb 16, 2020, 8:18:50 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
2d87297
Parents:
4ece3bf
git-author:
Dmitry Portnoy <dmitry.portnoy@…> (02/14/20 20:41:35)
git-committer:
Dmitry Portnoy <dmitry.portnoy@…> (02/16/20 20:18:50)
Message:

In VulkanGame, add objIndex to scene objects, use it in the scene shader to index into the ssbo, and change the code that copies data to the ssbo to do so for each scene object, not just the first one

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-utils.hpp

    r4ece3bf r5a1ace0  
    9595
    9696      template<class DataType>
    97       static void copyDataToMemory(VkDevice device, VkDeviceMemory bufferMemory, const DataType& srcData);
     97      static void copyDataToMemory(VkDevice device, VkDeviceMemory bufferMemory, VkDeviceSize offset,
     98            const DataType& srcData);
    9899
    99100      static bool hasStencilComponent(VkFormat format);
     
    125126}
    126127
    127 // TODO: Change copyDataToMemory so it can accept offsets for the data source and destination
    128128template<class DataType>
    129 void VulkanUtils::copyDataToMemory(VkDevice device, VkDeviceMemory bufferMemory, const DataType& srcData) {
     129void VulkanUtils::copyDataToMemory(VkDevice device, VkDeviceMemory bufferMemory, VkDeviceSize offset,
     130      const DataType& srcData) {
    130131   void* data;
    131    vkMapMemory(device, bufferMemory, 0, sizeof(DataType), 0, &data);
     132
     133   vkMapMemory(device, bufferMemory, offset * sizeof(DataType), sizeof(DataType), 0, &data);
    132134   memcpy(data, &srcData, sizeof(DataType));
    133135   vkUnmapMemory(device, bufferMemory);
Note: See TracChangeset for help on using the changeset viewer.