diff options
-rw-r--r-- | src/gpu/vk/GrVkGpu.cpp | 9 | ||||
-rw-r--r-- | tools/viewer/sk_app/VulkanWindowContext.cpp | 21 |
2 files changed, 17 insertions, 13 deletions
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index 12d98769cf..3d30e3585b 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -822,6 +822,13 @@ sk_sp<GrTexture> GrVkGpu::onWrapBackendTexture(const GrBackendTexture& backendTe } sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDesc& wrapDesc){ + // Currently the Vulkan backend does not support wrapping of msaa render targets directly. In + // general this is not an issue since swapchain images in vulkan are never multisampled. Thus if + // you want a multisampled RT it is best to wrap the swapchain images and then let Skia handle + // creating and owning the MSAA images. + if (wrapDesc.fSampleCnt) { + return nullptr; + } const GrVkImageInfo* info = reinterpret_cast<const GrVkImageInfo*>(wrapDesc.fRenderTargetHandle); @@ -834,7 +841,7 @@ sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTa desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag; desc.fWidth = wrapDesc.fWidth; desc.fHeight = wrapDesc.fHeight; - desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount()); + desc.fSampleCnt = 0; desc.fOrigin = resolve_origin(wrapDesc.fOrigin); diff --git a/tools/viewer/sk_app/VulkanWindowContext.cpp b/tools/viewer/sk_app/VulkanWindowContext.cpp index 07499789c3..831c7ae0c2 100644 --- a/tools/viewer/sk_app/VulkanWindowContext.cpp +++ b/tools/viewer/sk_app/VulkanWindowContext.cpp @@ -6,6 +6,7 @@ * found in the LICENSE file. */ +#include "GrBackendSurface.h" #include "GrContext.h" #include "GrRenderTarget.h" #include "SkAutoMalloc.h" @@ -264,7 +265,6 @@ void VulkanWindowContext::createBuffers(VkFormat format) { for (uint32_t i = 0; i < fImageCount; ++i) { fImageLayouts[i] = VK_IMAGE_LAYOUT_UNDEFINED; - GrBackendRenderTargetDesc desc; GrVkImageInfo info; info.fImage = fImages[i]; info.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 }; @@ -272,17 +272,14 @@ void VulkanWindowContext::createBuffers(VkFormat format) { info.fImageTiling = VK_IMAGE_TILING_OPTIMAL; info.fFormat = format; info.fLevelCount = 1; - desc.fWidth = fWidth; - desc.fHeight = fHeight; - desc.fConfig = fPixelConfig; - desc.fOrigin = kTopLeft_GrSurfaceOrigin; - desc.fSampleCnt = fSampleCount; - desc.fStencilBits = fStencilBits; - desc.fRenderTargetHandle = (GrBackendObject) &info; - - fSurfaces[i] = SkSurface::MakeFromBackendRenderTarget(fContext, desc, - fDisplayParams.fColorSpace, - &fSurfaceProps); + + GrBackendTexture backendTex(fWidth, fHeight, &info); + + fSurfaces[i] = SkSurface::MakeFromBackendTextureAsRenderTarget(fContext, backendTex, + kTopLeft_GrSurfaceOrigin, + fSampleCount, + fDisplayParams.fColorSpace, + &fSurfaceProps); } // create the command pool for the command buffers |