Changeset 2d87297 in opengl-game for vulkan-game.cpp


Ignore:
Timestamp:
Feb 16, 2020, 8:22:40 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
d25381b
Parents:
5a1ace0
Message:

In VulkanGame, add an ssbo field to SceneObject to hold per-object ssbo info, and add a new SSBOType template parameter to SceneObject and GraphicsPipeline_Vulkan

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    r5a1ace0 r2d87297  
    202202      uniformBuffers_scenePipeline, uniformBuffersMemory_scenePipeline, uniformBufferInfoList_scenePipeline);
    203203   // TODO: Calculate the size of this buffer (and all the other SSBOs) based on the number of objects
    204    createBufferSet(10 * sizeof(SBO_SceneObject), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
     204   createBufferSet(10 * sizeof(SSBO_ModelObject), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
    205205      storageBuffers_scenePipeline, storageBuffersMemory_scenePipeline, storageBufferInfoList_scenePipeline);
    206206
     
    221221      }), {
    222222         0, 1, 2, 2, 3, 0
     223      }, {
     224         mat4(1.0f)
    223225      });
    224226
     
    231233      }), {
    232234         0, 1, 2, 2, 3, 0
     235      }, {
     236         mat4(1.0f)
    233237      });
    234238
     
    252256      }, {
    253257         0, 1, 2, 2, 3, 0
    254       });
     258      }, {});
    255259
    256260   overlayPipeline.createDescriptorSetLayout();
     
    266270   createBufferSet(sizeof(UBO_VP_mats), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
    267271      uniformBuffers_shipPipeline, uniformBuffersMemory_shipPipeline, uniformBufferInfoList_shipPipeline);
    268    createBufferSet(10 * sizeof(SBO_SceneObject), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
     272   createBufferSet(10 * sizeof(SSBO_ModelObject), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
    269273      storageBuffers_shipPipeline, storageBuffersMemory_shipPipeline, storageBufferInfoList_shipPipeline);
    270274
     
    506510         132, 133, 134,
    507511         135, 136, 137,
     512      }, {
     513         mat4(1.0f)
    508514      });
    509515
     
    520526   createBufferSet(sizeof(UBO_VP_mats), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
    521527      uniformBuffers_asteroidPipeline, uniformBuffersMemory_asteroidPipeline, uniformBufferInfoList_asteroidPipeline);
    522    createBufferSet(10 * sizeof(SBO_Asteroid), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
     528   createBufferSet(10 * sizeof(SSBO_Asteroid), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
    523529      storageBuffers_asteroidPipeline, storageBuffersMemory_asteroidPipeline, storageBufferInfoList_asteroidPipeline);
    524530
     
    587593         24, 25, 26, 27, 28, 29,
    588594         30, 31, 32, 33, 34, 35,
     595      }, {
     596         mat4(1.0f),
     597         10.0f,
     598         0
    589599      });
    590600
     
    620630
    621631void VulkanGame::initGraphicsPipelines() {
    622    modelPipeline = GraphicsPipeline_Vulkan<ModelVertex>(physicalDevice, device, renderPass,
     632   overlayPipeline = GraphicsPipeline_Vulkan<OverlayVertex, void*>(physicalDevice, device, renderPass,
     633      { 0, 0, (int)swapChainExtent.width, (int)swapChainExtent.height }, 4, 6);
     634
     635   modelPipeline = GraphicsPipeline_Vulkan<ModelVertex, SSBO_ModelObject>(physicalDevice, device, renderPass,
    623636      { 0, 0, (int)swapChainExtent.width, (int)swapChainExtent.height }, 16, 24);
    624637
    625    overlayPipeline = GraphicsPipeline_Vulkan<OverlayVertex>(physicalDevice, device, renderPass,
    626       { 0, 0, (int)swapChainExtent.width, (int)swapChainExtent.height }, 4, 6);
    627 
    628    shipPipeline = GraphicsPipeline_Vulkan<ShipVertex>(physicalDevice, device, renderPass,
     638   shipPipeline = GraphicsPipeline_Vulkan<ShipVertex, SSBO_ModelObject>(physicalDevice, device, renderPass,
    629639      { 0, 0, (int)swapChainExtent.width, (int)swapChainExtent.height }, 138, 138);
    630640
    631    asteroidPipeline = GraphicsPipeline_Vulkan<AsteroidVertex>(physicalDevice, device, renderPass,
     641   asteroidPipeline = GraphicsPipeline_Vulkan<AsteroidVertex, SSBO_Asteroid>(physicalDevice, device, renderPass,
    632642      { 0, 0, (int)swapChainExtent.width, (int)swapChainExtent.height }, 24, 36);
    633643}
     
    707717                     }), {
    708718                        0, 1, 2, 2, 3, 0
     719                     }, {
     720                        mat4(1.0f)
    709721                     });
    710722
     
    14491461   createBufferSet(sizeof(UBO_VP_mats), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
    14501462      uniformBuffers_scenePipeline, uniformBuffersMemory_scenePipeline, uniformBufferInfoList_scenePipeline);
    1451    createBufferSet(10 * sizeof(SBO_SceneObject), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
     1463   createBufferSet(10 * sizeof(SSBO_ModelObject), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
    14521464      storageBuffers_scenePipeline, storageBuffersMemory_scenePipeline, storageBufferInfoList_scenePipeline);
    14531465
     
    14641476   createBufferSet(sizeof(UBO_VP_mats), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
    14651477      uniformBuffers_shipPipeline, uniformBuffersMemory_shipPipeline, uniformBufferInfoList_shipPipeline);
    1466    createBufferSet(10 * sizeof(SBO_SceneObject), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
     1478   createBufferSet(10 * sizeof(SSBO_ModelObject), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
    14671479      storageBuffers_shipPipeline, storageBuffersMemory_shipPipeline, storageBufferInfoList_shipPipeline);
    14681480
     
    14741486   createBufferSet(sizeof(UBO_VP_mats), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
    14751487      uniformBuffers_asteroidPipeline, uniformBuffersMemory_asteroidPipeline, uniformBufferInfoList_asteroidPipeline);
    1476    createBufferSet(10 * sizeof(SBO_Asteroid), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
     1488   createBufferSet(10 * sizeof(SSBO_Asteroid), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
    14771489      storageBuffers_asteroidPipeline, storageBuffersMemory_asteroidPipeline, storageBufferInfoList_asteroidPipeline);
    14781490
Note: See TracChangeset for help on using the changeset viewer.