Changeset 87c8f1a in opengl-game for vulkan-game.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-game.cpp
r34bdf3a r87c8f1a 21 21 gui = nullptr; 22 22 window = nullptr; 23 24 currentFrame = 0; 25 framebufferResized = false; 23 26 } 24 27 … … 138 141 createUniformBuffers(); 139 142 140 graphicsPipelines.push_back(GraphicsPipeline_Vulkan(device, renderPass, 143 vector<Vertex> sceneVertices = { 144 {{-0.5f, -0.5f, -0.5f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 145 {{ 0.5f, -0.5f, -0.5f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, 146 {{ 0.5f, 0.5f, -0.5f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 147 {{-0.5f, 0.5f, -0.5f}, {1.0f, 1.0f, 1.0f}, {0.0f, 0.0f}}, 148 149 {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 150 {{ 0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, 151 {{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 152 {{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 0.0f}} 153 }; 154 vector<uint16_t> sceneIndices = { 155 0, 1, 2, 2, 3, 0, 156 4, 5, 6, 6, 7, 4 157 }; 158 159 graphicsPipelines.push_back(GraphicsPipeline_Vulkan(physicalDevice, device, renderPass, 141 160 { 0, 0, (int)swapChainExtent.width, (int)swapChainExtent.height }, sizeof(Vertex))); 161 162 graphicsPipelines.back().bindData(sceneVertices, sceneIndices, commandPool, graphicsQueue); 142 163 143 164 graphicsPipelines.back().addAttribute(VK_FORMAT_R32G32B32_SFLOAT, offset_of(&Vertex::pos)); … … 155 176 graphicsPipelines.back().createDescriptorSets(swapChainImages); 156 177 157 graphicsPipelines.push_back(GraphicsPipeline_Vulkan(device, renderPass, 178 vector<OverlayVertex> overlayVertices = { 179 {{-1.0f, 1.0f, 0.0f}, {0.0f, 1.0f}}, 180 {{ 1.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, 181 {{ 1.0f, -1.0f, 0.0f}, {1.0f, 0.0f}}, 182 {{-1.0f, -1.0f, 0.0f}, {0.0f, 0.0f}} 183 }; 184 vector<uint16_t> overlayIndices = { 185 0, 1, 2, 2, 3, 0 186 }; 187 188 graphicsPipelines.push_back(GraphicsPipeline_Vulkan(physicalDevice, device, renderPass, 158 189 { 0, 0, (int)swapChainExtent.width, (int)swapChainExtent.height }, sizeof(OverlayVertex))); 190 191 graphicsPipelines.back().bindData(overlayVertices, overlayIndices, commandPool, graphicsQueue); 159 192 160 193 graphicsPipelines.back().addAttribute(VK_FORMAT_R32G32B32_SFLOAT, offset_of(&OverlayVertex::pos)); … … 238 271 239 272 void VulkanGame::renderScene() { 273 vkWaitForFences(device, 1, &inFlightFences[currentFrame], VK_TRUE, numeric_limits<uint64_t>::max()); 274 275 uint32_t imageIndex; 276 277 currentFrame = (currentFrame + 1) % MAX_FRAMES_IN_FLIGHT; 278 currentFrame = (currentFrame + 1) % MAX_FRAMES_IN_FLIGHT; 240 279 } 241 280
Note:
See TracChangeset
for help on using the changeset viewer.