diff options
author | bsalomon <bsalomon@google.com> | 2016-03-02 10:58:23 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-02 10:58:23 -0800 |
commit | a1e6b3be8124cef85f2e39e3cb85000ad9526d48 (patch) | |
tree | 489ea2e801fabe8d6e64d0fcf6f8e0d3f2c6fd07 /src/gpu/vk | |
parent | 05a5647efed7fcbcc5bd1efa445a6a3ab445a6c3 (diff) |
Get Vk compiling post-MIP map changes
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1761473002
NOTRY=true
Review URL: https://codereview.chromium.org/1761473002
Diffstat (limited to 'src/gpu/vk')
-rw-r--r-- | src/gpu/vk/GrVkGpu.cpp | 21 | ||||
-rw-r--r-- | src/gpu/vk/GrVkGpu.h | 6 | ||||
-rw-r--r-- | src/gpu/vk/GrVkTexture.cpp | 4 |
3 files changed, 17 insertions, 14 deletions
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index 9528efc8e0..6b36cdb7c8 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -259,13 +259,15 @@ bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, bool GrVkGpu::onWritePixels(GrSurface* surface, int left, int top, int width, int height, - GrPixelConfig config, const void* buffer, - size_t rowBytes) { + GrPixelConfig config, + const SkTArray<GrMipLevel>& texels) { GrVkTexture* vkTex = static_cast<GrVkTexture*>(surface->asTexture()); if (!vkTex) { return false; } + // TODO: We're ignoring MIP levels here. + // We assume Vulkan doesn't do sRGB <-> linear conversions when reading and writing pixels. if (GrPixelConfigIsSRGB(surface->config()) != GrPixelConfigIsSRGB(config)) { return false; @@ -299,7 +301,7 @@ bool GrVkGpu::onWritePixels(GrSurface* surface, false); } success = this->uploadTexData(vkTex, left, top, width, height, config, - buffer, rowBytes); + texels.begin()->fPixels, texels.begin()->fRowBytes); } if (success) { @@ -464,7 +466,7 @@ bool GrVkGpu::uploadTexData(GrVkTexture* tex, //////////////////////////////////////////////////////////////////////////////// GrTexture* GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCycle lifeCycle, - const void* srcData, size_t rowBytes) { + const SkTArray<GrMipLevel>& texels) { bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag); VkFormat pixelFormat; @@ -499,8 +501,8 @@ GrTexture* GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::Li // texture. usageFlags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; - VkFlags memProps = (srcData && linearTiling) ? VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT : - VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; + VkFlags memProps = (!texels.empty() && linearTiling) ? VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT : + VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; // This ImageDesc refers to the texture that will be read by the client. Thus even if msaa is // requested, this ImageDesc describes the resolved texutre. Therefore we always have samples set @@ -534,9 +536,10 @@ GrTexture* GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::Li return nullptr; } - if (srcData) { - if (!this->uploadTexData(tex, 0, 0, desc.fWidth, desc.fHeight, desc.fConfig, srcData, - rowBytes)) { + // TODO: We're ignoring MIP levels here. + if (!texels.empty()) { + if (!this->uploadTexData(tex, 0, 0, desc.fWidth, desc.fHeight, desc.fConfig, + texels.begin()->fPixels, texels.begin()->fRowBytes)) { tex->unref(); return nullptr; } diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h index 701eeb7ff0..344f81c16c 100644 --- a/src/gpu/vk/GrVkGpu.h +++ b/src/gpu/vk/GrVkGpu.h @@ -123,10 +123,10 @@ private: } GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCycle, - const void* srcData, size_t rowBytes) override; + const SkTArray<GrMipLevel>&) override; GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCycle, - const void* srcData) override { + const SkTArray<GrMipLevel>&) override { SkDebugf("onCreateCompressedTexture not yet implemented for Vulkan\n"); return NULL; } @@ -159,7 +159,7 @@ private: bool onWritePixels(GrSurface* surface, int left, int top, int width, int height, - GrPixelConfig config, const void* buffer, size_t rowBytes) override; + GrPixelConfig config, const SkTArray<GrMipLevel>&) override; bool onTransferPixels(GrSurface*, int left, int top, int width, int height, diff --git a/src/gpu/vk/GrVkTexture.cpp b/src/gpu/vk/GrVkTexture.cpp index 24157be6f6..c8247ca2f6 100644 --- a/src/gpu/vk/GrVkTexture.cpp +++ b/src/gpu/vk/GrVkTexture.cpp @@ -20,7 +20,7 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu, const GrVkImageView* view) : GrSurface(gpu, lifeCycle, desc) , GrVkImage(imageResource) - , INHERITED(gpu, lifeCycle, desc) + , INHERITED(gpu, lifeCycle, desc, false) // false because we don't upload MIP data in Vk yet , fTextureView(view) { this->registerWithCache(); } @@ -34,7 +34,7 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu, Derived) : GrSurface(gpu, lifeCycle, desc) , GrVkImage(imageResource) - , INHERITED(gpu, lifeCycle, desc) + , INHERITED(gpu, lifeCycle, desc, false) // false because we don't upload MIP data in Vk yet , fTextureView(view) {} |