aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-11-15 14:22:10 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-15 20:02:43 +0000
commit33d17cbb003975fff895954435183756f9893c17 (patch)
tree1317eec2ffe56bd384a592e749511abf3cbc6bf1 /src/gpu/vk
parentd8d984ecc99d8b7fc37a742e22acbe831f315142 (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.cpp5
-rw-r--r--src/gpu/vk/GrVkUtil.cpp10
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;