Changeset 996dd3e in opengl-game for sdl-game.hpp
- Timestamp:
- May 14, 2021, 1:09:34 AM (4 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- a3cefaa
- Parents:
- 9d21aac
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sdl-game.hpp
r9d21aac r996dd3e 72 72 alignas(16) mat4 view; 73 73 alignas(16) mat4 proj; 74 }; 75 76 // TODO: Use this struct for uniform buffers as well and probably combine it with the VulkanBuffer class 77 // Also, probably better to make this a vector of structs where each struct 78 // has a VkBuffer, VkDeviceMemory, and VkDescriptorBufferInfo 79 struct StorageBufferSet { 80 vector<VkBuffer> buffers; 81 vector<VkDeviceMemory> memory; 82 vector<VkDescriptorBufferInfo> infoSet; 74 83 }; 75 84 … … 208 217 // wouldn't work since the whole pipeline couldn't have a common set of descriptors for the textures 209 218 GraphicsPipeline_Vulkan<ModelVertex> modelPipeline; 219 220 StorageBufferSet storageBuffers_modelPipeline; 210 221 211 222 // TODO: Maybe make the ubo objects part of the pipeline class since there's only one ubo … … 297 308 GraphicsPipeline_Vulkan<VertexType>& pipeline, 298 309 const vector<VertexType>& vertices, vector<uint16_t> indices, 299 SSBOType ssbo, bool pipelinesCreated); 310 SSBOType ssbo, StorageBufferSet& storageBuffers, 311 bool pipelinesCreated); 300 312 301 313 template<class VertexType> … … 381 393 GraphicsPipeline_Vulkan<VertexType>& pipeline, 382 394 const vector<VertexType>& vertices, vector<uint16_t> indices, 383 SSBOType ssbo, bool pipelinesCreated) { 395 SSBOType ssbo, StorageBufferSet& storageBuffers, 396 bool pipelinesCreated) { 384 397 // TODO: Use the model field of ssbo to set the object's model_base 385 398 // currently, the passed in model is useless since it gets overridden in updateObject() anyway … … 403 416 pipeline.addObject(obj.vertices, obj.indices, resourceCommandPool, graphicsQueue); 404 417 418 // TODO: Probably move the resizing to the VulkanBuffer class 419 // First, try moving this out of addObject 405 420 bool resizeStorageBuffer = pipeline.numObjects == pipeline.objectCapacity; 406 421 407 422 if (resizeStorageBuffer) { 408 resizeStorageBufferSet<VertexType, SSBOType>( pipeline.storageBufferSet, resourceCommandPool, graphicsQueue, pipeline);423 resizeStorageBufferSet<VertexType, SSBOType>(storageBuffers, resourceCommandPool, graphicsQueue, pipeline); 409 424 pipeline.cleanup(); 410 425 411 426 // Assume the SSBO is always the 2nd binding 412 pipeline.updateDescriptorInfo(1, &pipeline.storageBufferSet.infoSet); 427 // TODO: Figure out a way to make this more flexible 428 pipeline.updateDescriptorInfo(1, &storageBuffers.infoSet); 413 429 } 414 430 415 431 pipeline.numObjects++; 416 417 updateStorageBuffer(pipeline.storageBufferSet, pipeline.numObjects - 1, obj.ssbo);418 432 419 433 // TODO: Figure out why I am destroying and recreating the ubos when the swap chain is recreated, … … 421 435 422 436 if (pipelinesCreated) { 437 // TODO: See if I can avoid doing this when recreating the pipeline 423 438 vkDeviceWaitIdle(device); 424 439 … … 531 546 obj.center = vec3(obj.ssbo.model * vec4(0.0f, 0.0f, 0.0f, 1.0f)); 532 547 533 updateStorageBuffer(pipeline.storageBufferSet, index, obj.ssbo);534 535 548 obj.modified = false; 536 549 }
Note:
See TracChangeset
for help on using the changeset viewer.