| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrContext.h" | 9 #include "GrContext.h" |
| 10 #include "GrRenderTarget.h" | 10 #include "GrRenderTarget.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 void VulkanWindowContext::createBuffers(VkFormat format) { | 247 void VulkanWindowContext::createBuffers(VkFormat format) { |
| 248 GrVkFormatToPixelConfig(format, &fPixelConfig); | 248 GrVkFormatToPixelConfig(format, &fPixelConfig); |
| 249 | 249 |
| 250 fGetSwapchainImagesKHR(fBackendContext->fDevice, fSwapchain, &fImageCount, n
ullptr); | 250 fGetSwapchainImagesKHR(fBackendContext->fDevice, fSwapchain, &fImageCount, n
ullptr); |
| 251 SkASSERT(fImageCount); | 251 SkASSERT(fImageCount); |
| 252 fImages = new VkImage[fImageCount]; | 252 fImages = new VkImage[fImageCount]; |
| 253 fGetSwapchainImagesKHR(fBackendContext->fDevice, fSwapchain, &fImageCount, f
Images); | 253 fGetSwapchainImagesKHR(fBackendContext->fDevice, fSwapchain, &fImageCount, f
Images); |
| 254 | 254 |
| 255 // set up initial image layouts and create surfaces | 255 // set up initial image layouts and create surfaces |
| 256 fImageLayouts = new VkImageLayout[fImageCount]; | 256 fImageLayouts = new VkImageLayout[fImageCount]; |
| 257 fRenderTargets = new sk_sp<GrRenderTarget>[fImageCount]; | |
| 258 fSurfaces = new sk_sp<SkSurface>[fImageCount]; | 257 fSurfaces = new sk_sp<SkSurface>[fImageCount]; |
| 259 for (uint32_t i = 0; i < fImageCount; ++i) { | 258 for (uint32_t i = 0; i < fImageCount; ++i) { |
| 260 fImageLayouts[i] = VK_IMAGE_LAYOUT_UNDEFINED; | 259 fImageLayouts[i] = VK_IMAGE_LAYOUT_UNDEFINED; |
| 261 | 260 |
| 262 GrBackendRenderTargetDesc desc; | 261 GrBackendRenderTargetDesc desc; |
| 263 GrVkImageInfo info; | 262 GrVkImageInfo info; |
| 264 info.fImage = fImages[i]; | 263 info.fImage = fImages[i]; |
| 265 info.fAlloc = { VK_NULL_HANDLE, 0, 0 }; | 264 info.fAlloc = { VK_NULL_HANDLE, 0, 0 }; |
| 266 info.fImageLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; | 265 info.fImageLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; |
| 267 info.fImageTiling = VK_IMAGE_TILING_OPTIMAL; | 266 info.fImageTiling = VK_IMAGE_TILING_OPTIMAL; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 DestroyFence(fBackendContext->fDevice, fBackbuffers[i].fU
sageFences[1], 0)); | 359 DestroyFence(fBackendContext->fDevice, fBackbuffers[i].fU
sageFences[1], 0)); |
| 361 } | 360 } |
| 362 } | 361 } |
| 363 | 362 |
| 364 delete[] fBackbuffers; | 363 delete[] fBackbuffers; |
| 365 fBackbuffers = nullptr; | 364 fBackbuffers = nullptr; |
| 366 | 365 |
| 367 // Does this actually free the surfaces? | 366 // Does this actually free the surfaces? |
| 368 delete[] fSurfaces; | 367 delete[] fSurfaces; |
| 369 fSurfaces = nullptr; | 368 fSurfaces = nullptr; |
| 370 delete[] fRenderTargets; | |
| 371 fRenderTargets = nullptr; | |
| 372 delete[] fImageLayouts; | 369 delete[] fImageLayouts; |
| 373 fImageLayouts = nullptr; | 370 fImageLayouts = nullptr; |
| 374 delete[] fImages; | 371 delete[] fImages; |
| 375 fImages = nullptr; | 372 fImages = nullptr; |
| 376 } | 373 } |
| 377 | 374 |
| 378 VulkanWindowContext::~VulkanWindowContext() { | 375 VulkanWindowContext::~VulkanWindowContext() { |
| 379 this->destroyContext(); | 376 this->destroyContext(); |
| 380 } | 377 } |
| 381 | 378 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 &fSwapchain, // pSwapchains | 584 &fSwapchain, // pSwapchains |
| 588 &backbuffer->fImageIndex, // pImageIndices | 585 &backbuffer->fImageIndex, // pImageIndices |
| 589 NULL // pResults | 586 NULL // pResults |
| 590 }; | 587 }; |
| 591 | 588 |
| 592 fQueuePresentKHR(fPresentQueue, &presentInfo); | 589 fQueuePresentKHR(fPresentQueue, &presentInfo); |
| 593 | 590 |
| 594 } | 591 } |
| 595 | 592 |
| 596 } //namespace sk_app | 593 } //namespace sk_app |
| OLD | NEW |