diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gpu/GrTest.cpp | 25 | ||||
-rw-r--r-- | tools/gpu/GrTest.h | 4 | ||||
-rw-r--r-- | tools/sk_app/VulkanWindowContext.cpp | 20 |
3 files changed, 11 insertions, 38 deletions
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index cff99a11e2..3c6046712d 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -53,31 +53,6 @@ void SetupAlwaysEvictAtlas(GrContext* context, int dim) { context->contextPriv().setTextContextAtlasSizes_ForTesting(configs); } -GrBackendTexture CreateBackendTexture(GrBackend backend, int width, int height, - GrPixelConfig config, GrMipMapped mipMapped, - GrBackendObject handle) { - switch (backend) { -#ifdef SK_VULKAN - case kVulkan_GrBackend: { - GrVkImageInfo* vkInfo = (GrVkImageInfo*)(handle); - SkASSERT((GrMipMapped::kYes == mipMapped) == (vkInfo->fLevelCount > 1)); - return GrBackendTexture(width, height, *vkInfo); - } -#endif - case kOpenGL_GrBackend: { - GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle); - SkASSERT(glInfo->fFormat); - return GrBackendTexture(width, height, mipMapped, *glInfo); - } - case kMock_GrBackend: { - GrMockTextureInfo* mockInfo = (GrMockTextureInfo*)(handle); - return GrBackendTexture(width, height, mipMapped, *mockInfo); - } - default: - return GrBackendTexture(); - } -} - } // namespace GrTest bool GrSurfaceProxy::isWrapped_ForTesting() const { diff --git a/tools/gpu/GrTest.h b/tools/gpu/GrTest.h index 6666ab1a20..9bf4344e6d 100644 --- a/tools/gpu/GrTest.h +++ b/tools/gpu/GrTest.h @@ -18,10 +18,6 @@ namespace GrTest { * constantly be evicting entries */ void SetupAlwaysEvictAtlas(GrContext*, int dim = GrDrawOpAtlas::kGlyphMaxDim); - - // TODO: remove this. It is only used in the SurfaceSemaphores Test. - GrBackendTexture CreateBackendTexture(GrBackend, int width, int height, - GrPixelConfig, GrMipMapped, GrBackendObject); }; #endif diff --git a/tools/sk_app/VulkanWindowContext.cpp b/tools/sk_app/VulkanWindowContext.cpp index b39c564eca..ecf6d80b2c 100644 --- a/tools/sk_app/VulkanWindowContext.cpp +++ b/tools/sk_app/VulkanWindowContext.cpp @@ -543,11 +543,11 @@ sk_sp<SkSurface> VulkanWindowContext::getBackbufferSurface() { QueueSubmit(fBackendContext->fQueue, 1, &submitInfo, backbuffer->fUsageFences[0])); - GrVkImageInfo* imageInfo; SkSurface* surface = fSurfaces[backbuffer->fImageIndex].get(); - surface->getRenderTargetHandle((GrBackendObject*)&imageInfo, - SkSurface::kFlushRead_BackendHandleAccess); - imageInfo->updateImageLayout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); + GrBackendRenderTarget backendRT = surface->getBackendRenderTarget( + SkSurface::kFlushRead_BackendHandleAccess); + backendRT.setVkImageLayout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); + return sk_ref_sp(surface); } @@ -555,14 +555,16 @@ sk_sp<SkSurface> VulkanWindowContext::getBackbufferSurface() { void VulkanWindowContext::swapBuffers() { BackbufferInfo* backbuffer = fBackbuffers + fCurrentBackbufferIndex; - GrVkImageInfo* imageInfo; SkSurface* surface = fSurfaces[backbuffer->fImageIndex].get(); - surface->getRenderTargetHandle((GrBackendObject*)&imageInfo, - SkSurface::kFlushRead_BackendHandleAccess); + + GrBackendRenderTarget backendRT = surface->getBackendRenderTarget( + SkSurface::kFlushRead_BackendHandleAccess); + GrVkImageInfo imageInfo; + SkAssertResult(backendRT.getVkImageInfo(&imageInfo)); // Check to make sure we never change the actually wrapped image - SkASSERT(imageInfo->fImage == fImages[backbuffer->fImageIndex]); + SkASSERT(imageInfo.fImage == fImages[backbuffer->fImageIndex]); - VkImageLayout layout = imageInfo->fImageLayout; + VkImageLayout layout = imageInfo.fImageLayout; VkPipelineStageFlags srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(layout); VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(layout); |