diff options
Diffstat (limited to 'src/gpu/vk')
-rw-r--r-- | src/gpu/vk/GrVkGpu.cpp | 10 | ||||
-rw-r--r-- | src/gpu/vk/GrVkRenderTarget.cpp | 12 | ||||
-rw-r--r-- | src/gpu/vk/GrVkTexture.cpp | 9 | ||||
-rw-r--r-- | src/gpu/vk/GrVkUtil.cpp | 34 | ||||
-rw-r--r-- | src/gpu/vk/GrVkUtil.h | 5 |
5 files changed, 25 insertions, 45 deletions
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index 5e6473e3a4..a7daf39790 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -1422,7 +1422,6 @@ bool GrVkGpu::createTestingOnlyVkImage(GrPixelConfig config, int w, int h, bool barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.image = image; barrier.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, mipLevels, 0, 1}; - initialLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; VK_CALL(CmdPipelineBarrier(cmdBuffer, GrVkMemory::LayoutToPipelineStageFlags(initialLayout), VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, @@ -1430,6 +1429,7 @@ bool GrVkGpu::createTestingOnlyVkImage(GrPixelConfig config, int w, int h, bool 0, nullptr, 0, nullptr, 1, &barrier)); + initialLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; } // End CommandBuffer @@ -1498,7 +1498,9 @@ GrBackendTexture GrVkGpu::createTestingOnlyBackendTexture(const void* srcData, i &info)) { return {}; } - return GrBackendTexture(w, h, info); + GrBackendTexture beTex = GrBackendTexture(w, h, info); + beTex.setPixelConfig(config); + return beTex; } bool GrVkGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { @@ -1541,7 +1543,9 @@ GrBackendRenderTarget GrVkGpu::createTestingOnlyBackendRenderTarget(int w, int h &info)) { return {}; } - return {w, h, 1, 0, info}; + GrBackendRenderTarget beRT = {w, h, 1, 0, info}; + beRT.setPixelConfig(config); + return beRT; } void GrVkGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget& rt) { diff --git a/src/gpu/vk/GrVkRenderTarget.cpp b/src/gpu/vk/GrVkRenderTarget.cpp index 99b6b7632c..9c57ec01bd 100644 --- a/src/gpu/vk/GrVkRenderTarget.cpp +++ b/src/gpu/vk/GrVkRenderTarget.cpp @@ -352,8 +352,16 @@ GrBackendRenderTarget GrVkRenderTarget::getBackendRenderTarget() const { if (GrStencilAttachment* stencil = this->renderTargetPriv().getStencilAttachment()) { numStencilBits = stencil->bits(); } - return GrBackendRenderTarget(this->width(), this->height(), this->numColorSamples(), - numStencilBits, fInfo); + GrBackendRenderTarget beRT = GrBackendRenderTarget(this->width(), this->height(), + this->numColorSamples(), numStencilBits, + fInfo); +#if GR_TEST_UTILS + // We shouldn't have to set this since the client can't access it and we will handle the config + // correctly if we go through our public SkSurface APIs. However, some of our tests bypass the + // public APIs so we need to set this manually here. + beRT.setPixelConfig(this->config()); +#endif + return beRT; } const GrVkResource* GrVkRenderTarget::stencilImageResource() const { diff --git a/src/gpu/vk/GrVkTexture.cpp b/src/gpu/vk/GrVkTexture.cpp index 109b10638d..6668b8f4c1 100644 --- a/src/gpu/vk/GrVkTexture.cpp +++ b/src/gpu/vk/GrVkTexture.cpp @@ -162,7 +162,14 @@ GrBackendObject GrVkTexture::getTextureHandle() const { } GrBackendTexture GrVkTexture::getBackendTexture() const { - return GrBackendTexture(this->width(), this->height(), fInfo); + GrBackendTexture beTex = GrBackendTexture(this->width(), this->height(), fInfo); +#if GR_TEST_UTILS + // We shouldn't have to set this since the client can't access it and we will handle the config + // correctly if we go through our public SkSurface and SkImage APIs. However, some of our tests + // bypass the public APIs so we need to set this manually here. + beTex.setPixelConfig(this->config()); +#endif + return beTex; } GrVkGpu* GrVkTexture::getVkGpu() const { diff --git a/src/gpu/vk/GrVkUtil.cpp b/src/gpu/vk/GrVkUtil.cpp index 4f0acdb8f4..5edb2e3818 100644 --- a/src/gpu/vk/GrVkUtil.cpp +++ b/src/gpu/vk/GrVkUtil.cpp @@ -72,40 +72,6 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) { return false; } -GrPixelConfig GrVkFormatToPixelConfig(VkFormat format) { - switch (format) { - case VK_FORMAT_R8G8B8A8_UNORM: - return kRGBA_8888_GrPixelConfig; - case VK_FORMAT_B8G8R8A8_UNORM: - return kBGRA_8888_GrPixelConfig; - case VK_FORMAT_R8G8B8A8_SRGB: - return kSRGBA_8888_GrPixelConfig; - case VK_FORMAT_B8G8R8A8_SRGB: - return kSBGRA_8888_GrPixelConfig; - case VK_FORMAT_A2B10G10R10_UNORM_PACK32: - return kRGBA_1010102_GrPixelConfig; - case VK_FORMAT_R5G6B5_UNORM_PACK16: - return kRGB_565_GrPixelConfig; - break; - case VK_FORMAT_B4G4R4A4_UNORM_PACK16: - // R4G4B4A4 is not required to be supported so we actually - // store RGBA_4444 data as B4G4R4A4. - return kRGBA_4444_GrPixelConfig; - case VK_FORMAT_R8_UNORM: - return kAlpha_8_GrPixelConfig; - case VK_FORMAT_R32G32B32A32_SFLOAT: - return kRGBA_float_GrPixelConfig; - case VK_FORMAT_R32G32_SFLOAT: - return kRG_float_GrPixelConfig; - case VK_FORMAT_R16G16B16A16_SFLOAT: - return kRGBA_half_GrPixelConfig; - case VK_FORMAT_R16_SFLOAT: - return kAlpha_half_GrPixelConfig; - default: - return kUnknown_GrPixelConfig; - } -} - bool GrVkFormatPixelConfigPairIsValid(VkFormat format, GrPixelConfig config) { switch (format) { case VK_FORMAT_R8G8B8A8_UNORM: diff --git a/src/gpu/vk/GrVkUtil.h b/src/gpu/vk/GrVkUtil.h index 01688c8486..b0d118adb5 100644 --- a/src/gpu/vk/GrVkUtil.h +++ b/src/gpu/vk/GrVkUtil.h @@ -32,11 +32,6 @@ class GrVkGpu; */ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format); -/** -* Returns the GrPixelConfig for the given vulkan texture format -*/ -GrPixelConfig GrVkFormatToPixelConfig(VkFormat format); - bool GrVkFormatIsSupported(VkFormat); /** |