Changeset 90880fb in opengl-game for sdl-game.cpp
- Timestamp:
- Jun 17, 2021, 11:59:14 PM (4 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- 2f4ff8c
- Parents:
- 5ea0a37
- git-author:
- Dmitry Portnoy <dportnoy@…> (06/13/21 23:57:17)
- git-committer:
- Dmitry Portnoy <dportnoy@…> (06/17/21 23:59:14)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sdl-game.cpp
r5ea0a37 r90880fb 70 70 , gui(nullptr) 71 71 , window(nullptr) 72 , vp_mats_modelPipeline() 72 73 , objects_modelPipeline() 73 74 , score(0) … … 91 92 VkPhysicalDeviceProperties deviceProperties; 92 93 vkGetPhysicalDeviceProperties(physicalDevice, &deviceProperties); 94 95 vp_mats_modelPipeline = VulkanBuffer<UBO_VP_mats>(1, deviceProperties.limits.maxUniformBufferRange, 96 deviceProperties.limits.minUniformBufferOffsetAlignment); 93 97 94 98 objects_modelPipeline = VulkanBuffer<SSBO_ModelObject>(10, deviceProperties.limits.maxStorageBufferRange, … … 110 114 modelPipeline.addAttribute(VK_FORMAT_R32_UINT, offset_of(&ModelVertex::objIndex)); 111 115 112 createBufferSet( sizeof(UBO_VP_mats),116 createBufferSet(vp_mats_modelPipeline.memorySize(), 113 117 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 114 118 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 115 119 uniformBuffers_modelPipeline); 116 120 117 createBufferSet(objects_modelPipeline. capacity * sizeof(SSBO_ModelObject),121 createBufferSet(objects_modelPipeline.memorySize(), 118 122 VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT 119 123 | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, … … 289 293 projMat = perspective(radians(FOV_ANGLE), (float)swapChainExtent.width / (float)swapChainExtent.height, NEAR_CLIP, FAR_CLIP); 290 294 projMat[1][1] *= -1; // flip the y-axis so that +y is up 291 292 object_VP_mats.view = viewMat;293 object_VP_mats.proj = projMat;294 295 } 295 296 … … 444 445 445 446 void VulkanGame::updateScene() { 446 // TODO: Probably move the resizing to the VulkanBuffer class 447 vp_mats_modelPipeline.data()->view = viewMat; 448 vp_mats_modelPipeline.data()->proj = projMat; 449 450 // TODO: Probably move the resizing to the VulkanBuffer class's add() method 451 // Remember that we want to avoid resizing the actuall ssbo or ubo more than once per frame 452 // TODO: Figure out a way to make updateDescriptorInfo easier to use, maybe store the binding index in the buffer set 453 447 454 if (objects_modelPipeline.resized) { 448 455 resizeBufferSet(storageBuffers_modelPipeline, objects_modelPipeline.memorySize(), resourceCommandPool, … … 467 474 } 468 475 476 VulkanUtils::copyDataToMemory(device, vp_mats_modelPipeline.data(), uniformBuffers_modelPipeline.memory[imageIndex], 477 0, vp_mats_modelPipeline.memorySize(), false); 478 469 479 VulkanUtils::copyDataToMemory(device, objects_modelPipeline.data(), storageBuffers_modelPipeline.memory[imageIndex], 470 480 0, objects_modelPipeline.memorySize(), false); 471 472 VulkanUtils::copyDataToMemory(device, &object_VP_mats, uniformBuffers_modelPipeline.memory[imageIndex], 0,473 sizeof(object_VP_mats), false);474 481 } 475 482 … … 1275 1282 createSyncObjects(); 1276 1283 1277 createBufferSet( sizeof(UBO_VP_mats),1284 createBufferSet(vp_mats_modelPipeline.memorySize(), 1278 1285 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 1279 1286 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
Note:
See TracChangeset
for help on using the changeset viewer.