Changeset 567fa88 in opengl-game


Ignore:
Timestamp:
Jun 7, 2021, 11:59:27 PM (3 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
c074f81
Parents:
58453c3
Message:

Change createRenderCommands() to support dynamic offsets

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • graphics-pipeline_vulkan.hpp

    r58453c3 r567fa88  
    6363      void createDescriptorSets(uint32_t size);
    6464
    65       void createRenderCommands(VkCommandBuffer& commandBuffer, uint32_t currentImage);
     65      void createRenderCommands(VkCommandBuffer& commandBuffer, uint32_t currentImage,
     66                                const vector<uint32_t>& dynamicOffsets);
    6667
    6768      void addObject(const vector<VertexType>& vertices, vector<uint16_t> indices, VkCommandPool commandPool,
     
    473474
    474475template<class VertexType>
    475 void GraphicsPipeline_Vulkan<VertexType>::createRenderCommands(VkCommandBuffer& commandBuffer, uint32_t currentImage) {
     476void GraphicsPipeline_Vulkan<VertexType>::createRenderCommands(VkCommandBuffer& commandBuffer, uint32_t currentImage,
     477                                                               const vector<uint32_t>& dynamicOffsets) {
    476478   vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
    477479
     480   // If more dynamic UBOs are added, this needs to become an array of offsets
    478481   vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1,
    479       &descriptorSets[currentImage], 0, nullptr);
     482      &descriptorSets[currentImage], dynamicOffsets.size(), dynamicOffsets.data());
    480483
    481484   VkBuffer vertexBuffers[] = { vertexBuffer };
  • sdl-game.cpp

    r58453c3 r567fa88  
    11771177   // TODO: Find a more elegant, per-screen solution for this
    11781178   if (currentRenderScreenFn == &VulkanGame::renderGameScreen) {
    1179       modelPipeline.createRenderCommands(commandBuffers[imageIndex], imageIndex);
     1179      modelPipeline.createRenderCommands(commandBuffers[imageIndex], imageIndex, {});
    11801180
    11811181
  • vulkan-game.cpp

    r58453c3 r567fa88  
    17901790   // TODO: Find a more elegant, per-screen solution for this
    17911791   if (currentRenderScreenFn == &VulkanGame::renderGameScreen) {
    1792       modelPipeline.createRenderCommands(commandBuffers[imageIndex], imageIndex);
    1793       shipPipeline.createRenderCommands(commandBuffers[imageIndex], imageIndex);
    1794       asteroidPipeline.createRenderCommands(commandBuffers[imageIndex], imageIndex);
    1795       laserPipeline.createRenderCommands(commandBuffers[imageIndex], imageIndex);
    1796       explosionPipeline.createRenderCommands(commandBuffers[imageIndex], imageIndex);
     1792      modelPipeline.createRenderCommands(commandBuffers[imageIndex], imageIndex, {});
     1793      shipPipeline.createRenderCommands(commandBuffers[imageIndex], imageIndex, {});
     1794      asteroidPipeline.createRenderCommands(commandBuffers[imageIndex], imageIndex, {});
     1795      laserPipeline.createRenderCommands(commandBuffers[imageIndex], imageIndex, {});
     1796      explosionPipeline.createRenderCommands(commandBuffers[imageIndex], imageIndex, {});
    17971797   }
    17981798
Note: See TracChangeset for help on using the changeset viewer.