diff options
author | 2016-05-18 07:01:16 -0700 | |
---|---|---|
committer | 2016-05-18 07:01:16 -0700 | |
commit | 2884e9c0bd2cc9634a4b932d4142840c67227a78 (patch) | |
tree | c8c04ea788dc277d59d022008533944a4716f986 /tools/viewer/sk_app/VulkanWindowContext.cpp | |
parent | 3949971e8d29345ee89461aec1ef25734ffc03f5 (diff) |
Revert of Add OpenGL context to Viewer. (patchset #7 id:120001 of https://codereview.chromium.org/1978573003/ )
Reason for revert:
sk_app/WindowContext.cpp is missing. Need to add file and resubmit.
Original issue's description:
> Add OpenGL context to Viewer.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1978573003
>
> Committed: https://skia.googlesource.com/skia/+/56a11e4d6f3d436a3c2497c9c9e71a117d78a93f
TBR=brianosman@google.com,bsalomon@google.com,djsollen@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review-Url: https://codereview.chromium.org/1990893002
Diffstat (limited to 'tools/viewer/sk_app/VulkanWindowContext.cpp')
-rw-r--r-- | tools/viewer/sk_app/VulkanWindowContext.cpp | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/tools/viewer/sk_app/VulkanWindowContext.cpp b/tools/viewer/sk_app/VulkanWindowContext.cpp index bc200de427..2570e826a3 100644 --- a/tools/viewer/sk_app/VulkanWindowContext.cpp +++ b/tools/viewer/sk_app/VulkanWindowContext.cpp @@ -7,7 +7,6 @@ */ #include "GrContext.h" -#include "GrRenderTarget.h" #include "SkSurface.h" #include "VulkanWindowContext.h" @@ -26,12 +25,8 @@ namespace sk_app { VulkanWindowContext::VulkanWindowContext(void* platformData, const DisplayParams& params) - : WindowContext() - , fSurface(VK_NULL_HANDLE) + : fSurface(VK_NULL_HANDLE) , fSwapchain(VK_NULL_HANDLE) - , fImages(nullptr) - , fImageLayouts(nullptr) - , fSurfaces(nullptr) , fCommandPool(VK_NULL_HANDLE) , fBackbuffers(nullptr) { @@ -255,7 +250,6 @@ void VulkanWindowContext::createBuffers(VkFormat format) { // set up initial image layouts and create surfaces fImageLayouts = new VkImageLayout[fImageCount]; - fRenderTargets = new sk_sp<GrRenderTarget>[fImageCount]; fSurfaces = new sk_sp<SkSurface>[fImageCount]; for (uint32_t i = 0; i < fImageCount; ++i) { fImageLayouts[i] = VK_IMAGE_LAYOUT_UNDEFINED; @@ -275,9 +269,10 @@ void VulkanWindowContext::createBuffers(VkFormat format) { desc.fSampleCnt = 0; desc.fStencilBits = 0; desc.fRenderTargetHandle = (GrBackendObject) &info; - fRenderTargets[i].reset(fContext->textureProvider()->wrapBackendRenderTarget(desc)); - - fSurfaces[i] = this->createRenderSurface(fRenderTargets[i], 24); + SkSurfaceProps props(GrPixelConfigIsSRGB(fPixelConfig) + ? SkSurfaceProps::kGammaCorrect_Flag : 0, + kUnknown_SkPixelGeometry); + fSurfaces[i] = SkSurface::MakeFromBackendRenderTarget(fContext, desc, &props); } // create the command pool for the command buffers @@ -366,11 +361,8 @@ void VulkanWindowContext::destroyBuffers() { delete[] fBackbuffers; fBackbuffers = nullptr; - // Does this actually free the surfaces? delete[] fSurfaces; fSurfaces = nullptr; - delete[] fRenderTargets; - fRenderTargets = nullptr; delete[] fImageLayouts; fImageLayouts = nullptr; delete[] fImages; @@ -406,8 +398,7 @@ void VulkanWindowContext::destroyContext() { fSurface = VK_NULL_HANDLE; } - fContext->abandonContext(); - fContext->unref(); + delete fContext; fBackendContext.reset(nullptr); } @@ -428,7 +419,7 @@ VulkanWindowContext::BackbufferInfo* VulkanWindowContext::getAvailableBackbuffer return backbuffer; } -sk_sp<SkSurface> VulkanWindowContext::getBackbufferSurface() { +SkSurface* VulkanWindowContext::getBackbufferSurface() { BackbufferInfo* backbuffer = this->getAvailableBackbuffer(); SkASSERT(backbuffer); @@ -519,16 +510,14 @@ sk_sp<SkSurface> VulkanWindowContext::getBackbufferSurface() { QueueSubmit(fBackendContext->fQueue, 1, &submitInfo, backbuffer->fUsageFences[0])); - return sk_ref_sp(fSurfaces[backbuffer->fImageIndex].get()); + return fSurfaces[backbuffer->fImageIndex].get(); } + void VulkanWindowContext::swapBuffers() { BackbufferInfo* backbuffer = fBackbuffers + fCurrentBackbufferIndex; - this->presentRenderSurface(fSurfaces[backbuffer->fImageIndex], - fRenderTargets[backbuffer->fImageIndex], 24); - VkImageLayout layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; VkPipelineStageFlags srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; |