diff options
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; |