diff options
author | Greg Daniel <egdaniel@google.com> | 2017-11-15 14:22:10 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-15 20:02:43 +0000 |
commit | 33d17cbb003975fff895954435183756f9893c17 (patch) | |
tree | 1317eec2ffe56bd384a592e749511abf3cbc6bf1 /src/gpu/vk | |
parent | d8d984ecc99d8b7fc37a742e22acbe831f315142 (diff) |
Add private grpixelconfigs for alpha_8 and alpha_half
Bug: skia:
Change-Id: I5191b6e045aea2a5af2b305b5972ad1e638a7ace
Reviewed-on: https://skia-review.googlesource.com/71763
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/vk')
-rw-r--r-- | src/gpu/vk/GrVkCaps.cpp | 5 | ||||
-rw-r--r-- | src/gpu/vk/GrVkUtil.cpp | 10 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp index 2b24205af8..6804aeb22f 100644 --- a/src/gpu/vk/GrVkCaps.cpp +++ b/src/gpu/vk/GrVkCaps.cpp @@ -208,7 +208,10 @@ void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties, uint // fConfigOutputSwizzle will default to RGBA so we only need to set it for alpha only config. for (int i = 0; i < kGrPixelConfigCnt; ++i) { GrPixelConfig config = static_cast<GrPixelConfig>(i); - if (GrPixelConfigIsAlphaOnly(config)) { + // Vulkan doesn't support a single channel format stored in alpha. + if (GrPixelConfigIsAlphaOnly(config) && + kAlpha_8_as_Alpha_GrPixelConfig != config && + kAlpha_half_as_Alpha_GrPixelConfig != config) { shaderCaps->fConfigTextureSwizzle[i] = GrSwizzle::RRRR(); shaderCaps->fConfigOutputSwizzle[i] = GrSwizzle::AAAA(); } else { diff --git a/src/gpu/vk/GrVkUtil.cpp b/src/gpu/vk/GrVkUtil.cpp index 0ce47cb962..729804bd32 100644 --- a/src/gpu/vk/GrVkUtil.cpp +++ b/src/gpu/vk/GrVkUtil.cpp @@ -42,9 +42,12 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) { // store the data is if it was B4G4R4A4 and swizzle in shaders *format = VK_FORMAT_B4G4R4A4_UNORM_PACK16; return true; - case kAlpha_8_GrPixelConfig: + case kAlpha_8_GrPixelConfig: // fall through + case kAlpha_8_as_Red_GrPixelConfig: *format = VK_FORMAT_R8_UNORM; return true; + case kAlpha_8_as_Alpha_GrPixelConfig: + return false; case kGray_8_GrPixelConfig: *format = VK_FORMAT_R8_UNORM; return true; @@ -57,9 +60,12 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) { case kRGBA_half_GrPixelConfig: *format = VK_FORMAT_R16G16B16A16_SFLOAT; return true; - case kAlpha_half_GrPixelConfig: + case kAlpha_half_GrPixelConfig: // fall through + case kAlpha_half_as_Red_GrPixelConfig: *format = VK_FORMAT_R16_SFLOAT; return true; + case kAlpha_half_as_Alpha_GrPixelConfig: + return false; } SK_ABORT("Unexpected config"); return false; |