Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: tools/viewer/sk_app/VulkanWindowContext.cpp

Issue 1990893002: Revert of Add OpenGL context to Viewer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/viewer/sk_app/VulkanWindowContext.h ('k') | tools/viewer/sk_app/Window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/viewer/sk_app/VulkanWindowContext.cpp
diff --git a/tools/viewer/sk_app/VulkanWindowContext.cpp b/tools/viewer/sk_app/VulkanWindowContext.cpp
index bc200de42704a57ece5760bf082b1bbdf5490a02..2570e826a387c873afa3529bc95bb968814a4173 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 @@
// 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 @@
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 @@
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 @@
fSurface = VK_NULL_HANDLE;
}
- fContext->abandonContext();
- fContext->unref();
+ delete fContext;
fBackendContext.reset(nullptr);
}
@@ -428,7 +419,7 @@
return backbuffer;
}
-sk_sp<SkSurface> VulkanWindowContext::getBackbufferSurface() {
+SkSurface* VulkanWindowContext::getBackbufferSurface() {
BackbufferInfo* backbuffer = this->getAvailableBackbuffer();
SkASSERT(backbuffer);
@@ -519,15 +510,13 @@
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;
« no previous file with comments | « tools/viewer/sk_app/VulkanWindowContext.h ('k') | tools/viewer/sk_app/Window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698