Changeset 3b84bb6 in opengl-game for graphics-pipeline_vulkan.hpp


Ignore:
Timestamp:
Feb 25, 2020, 6:51:02 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
44f23af
Parents:
2da64ef
Message:

In VulkanGame, call centerObject() on all objects when they are created and move that call inside VulkanGame::addObject(), rename GraphicsPipeline_Vulkan::addVertices() to addObject, add start adding generic support for objects to be added after pipeline creation is complete

File:
1 edited

Legend:

Unmodified
Added
Removed
  • graphics-pipeline_vulkan.hpp

    r2da64ef r3b84bb6  
    7171      void createRenderCommands(VkCommandBuffer& commandBuffer, uint32_t currentImage);
    7272
    73       void addVertices(const vector<VertexType>& vertices, vector<uint16_t> indices, VkCommandPool commandPool,
    74          VkQueue graphicsQueue);
     73      bool addObject(const vector<VertexType>& vertices, vector<uint16_t> indices, SSBOType& ssbo,
     74         VkCommandPool commandPool, VkQueue graphicsQueue);
    7575
    7676      void updateObject(size_t objIndex, SSBOType& ssbo);
     
    125125
    126126// TODO: Verify that vertex capacity and index capacity are both > 0
     127// TODO: See if it would be feasible to move code in the createPipeline method
     128// into the constructor. That way, I can also put relevant cleanup code into the destructor
    127129template<class VertexType, class SSBOType>
    128130GraphicsPipeline_Vulkan<VertexType, SSBOType>::GraphicsPipeline_Vulkan(
     
    473475
    474476template<class VertexType, class SSBOType>
    475 void GraphicsPipeline_Vulkan<VertexType, SSBOType>::addVertices(const vector<VertexType>& vertices, vector<uint16_t> indices,
    476       VkCommandPool commandPool, VkQueue graphicsQueue) {
     477bool GraphicsPipeline_Vulkan<VertexType, SSBOType>::addObject(
     478      const vector<VertexType>& vertices, vector<uint16_t> indices,
     479      SSBOType& ssbo, VkCommandPool commandPool, VkQueue graphicsQueue) {
     480
     481   // TODO: When resizing the vertex or index buffer, take deleted objects into account.
     482   // Remove their data from the buffer and determine the new size of the bufer based on # of remining objects
     483
     484   // If # non-deleted objects > currentCapacity / 2
     485   //    - resize and double capacity
     486   // else If # non-deleted objects < currentCapacity / 4
     487   //    - resize amd halve capacity
     488   // else
     489   //    - don't resize, but rewrite data in the buffer to only have non-deleted objects
    477490
    478491   if (numVertices + vertices.size() > vertexCapacity) {
     
    490503      graphicsQueue);
    491504   numIndices += indices.size();
     505
     506   bool resizedStorageBuffer = false;
     507
     508   return resizedStorageBuffer;
    492509}
    493510
Note: See TracChangeset for help on using the changeset viewer.