Changeset 87c8f1a in opengl-game for vulkan-ref.cpp
- Timestamp:
- Nov 1, 2019, 5:11:45 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- d2d9286
- Parents:
- 34bdf3a
- git-author:
- Dmitry Portnoy <dmitry.portnoy@…> (11/01/19 17:09:16)
- git-committer:
- Dmitry Portnoy <dmitry.portnoy@…> (11/01/19 17:11:45)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-ref.cpp
r34bdf3a r87c8f1a 72 72 glm::vec2 texCoord; 73 73 }; 74 /*** END OF REFACTORED CODE ***/75 74 76 75 struct UniformBufferObject { … … 80 79 }; 81 80 82 /*** START OF REFACTORED CODE ***/83 81 struct DescriptorInfo { 84 82 VkDescriptorType type; … … 88 86 VkDescriptorImageInfo* imageData; 89 87 }; 90 /*** END OF REFACTORED CODE ***/91 88 92 89 struct GraphicsPipelineInfo { 93 /*** START OF REFACTORED CODE ***/94 90 VkPipelineLayout pipelineLayout; 95 91 VkPipeline pipeline; … … 103 99 VkDescriptorSetLayout descriptorSetLayout; 104 100 vector<VkDescriptorSet> descriptorSets; 105 /*** END OF REFACTORED CODE ***/ 106 107 size_t numVertices; // Currently unused 101 102 size_t numVertices; 108 103 size_t vertexCapacity; 109 104 VkBuffer vertexBuffer; … … 116 111 }; 117 112 118 /*** START OF REFACTORED CODE ***/119 113 VkResult CreateDebugUtilsMessengerEXT(VkInstance instance, 120 114 const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo, … … 223 217 vector<VkSemaphore> renderFinishedSemaphores; 224 218 vector<VkFence> inFlightFences; 219 220 size_t currentFrame = 0; 225 221 /*** END OF REFACTORED CODE ***/ 226 227 size_t currentFrame = 0;228 222 229 223 size_t numPlanes = 0; // temp … … 340 334 overlayImageInfo.imageView = sdlOverlayImageView; 341 335 overlayImageInfo.sampler = textureSampler; 342 /*** END OF REFACTORED CODE ***/343 336 344 337 // SHADER-SPECIFIC STUFF STARTS HERE … … 364 357 sceneIndices.data(), sizeof(uint16_t), sceneIndices.size()); 365 358 366 /*** START OF REFACTORED CODE ***/367 359 addAttributeDescription(scenePipeline, VK_FORMAT_R32G32B32_SFLOAT, offset_of(&Vertex::pos)); 368 360 addAttributeDescription(scenePipeline, VK_FORMAT_R32G32B32_SFLOAT, offset_of(&Vertex::color)); … … 373 365 374 366 createDescriptorSetLayout(scenePipeline); 375 /*** END OF REFACTORED CODE ***/376 367 377 368 numPlanes = 2; … … 391 382 overlayIndices.data(), sizeof(uint16_t), overlayIndices.size()); 392 383 393 /*** START OF REFACTORED CODE ***/394 384 addAttributeDescription(overlayPipeline, VK_FORMAT_R32G32B32_SFLOAT, offset_of(&OverlayVertex::pos)); 395 385 addAttributeDescription(overlayPipeline, VK_FORMAT_R32G32_SFLOAT, offset_of(&OverlayVertex::texCoord)); … … 812 802 info.bindingDescription.stride = vertexSize; 813 803 info.bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; 814 /*** END OF REFACTORED CODE ***/815 804 816 805 info.numVertices = numVertices; … … 1393 1382 } 1394 1383 } 1395 /*** END OF REFACTORED CODE ***/1396 1384 1397 1385 void createVertexBuffer(GraphicsPipelineInfo& info, const void* vertexData, int vertexSize) { … … 1443 1431 } 1444 1432 1445 /*** START OF REFACTORED CODE ***/1446 1433 void createUniformBuffers() { 1447 1434 VkDeviceSize bufferSize = sizeof(UniformBufferObject); … … 1507 1494 } 1508 1495 1496 /*** START OF REFACTORED CODE ***/ 1509 1497 void copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize srcOffset, VkDeviceSize dstOffset, 1510 1498 VkDeviceSize size) { … … 1550 1538 } 1551 1539 1552 /*** START OF REFACTORED CODE ***/1553 1540 uint32_t findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties) { 1554 1541 VkPhysicalDeviceMemoryProperties memProperties; … … 1801 1788 1802 1789 void drawFrame() { 1790 vkWaitForFences(device, 1, &inFlightFences[currentFrame], VK_TRUE, numeric_limits<uint64_t>::max()); 1791 1792 uint32_t imageIndex; 1803 1793 /*** END OF REFACTORED CODE ***/ 1804 vkWaitForFences(device, 1, &inFlightFences[currentFrame], VK_TRUE, numeric_limits<uint64_t>::max());1805 1806 uint32_t imageIndex;1807 1794 1808 1795 VkResult result = vkAcquireNextImageKHR(device, swapChain, numeric_limits<uint64_t>::max(), … … 1861 1848 } 1862 1849 1850 /*** START OF REFACTORED CODE ***/ 1863 1851 currentFrame = (currentFrame + 1) % MAX_FRAMES_IN_FLIGHT; 1864 1852 currentFrame = (currentFrame + 1) % MAX_FRAMES_IN_FLIGHT; 1865 /*** START OF REFACTORED CODE ***/1866 1853 } 1867 1854 … … 2052 2039 void cleanupPipelineBuffers(GraphicsPipelineInfo& pipeline) { 2053 2040 vkDestroyDescriptorSetLayout(device, pipeline.descriptorSetLayout, nullptr); 2054 /*** END OF REFACTORED CODE ***/2055 2041 2056 2042 vkDestroyBuffer(device, pipeline.vertexBuffer, nullptr); … … 2059 2045 vkFreeMemory(device, pipeline.indexBufferMemory, nullptr); 2060 2046 } 2047 /*** END OF REFACTORED CODE ***/ 2061 2048 2062 2049 static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(
Note:
See TracChangeset
for help on using the changeset viewer.