Fix 4444 on Vulkan devices who don't support RGBA_4444
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2238563002
Committed: https://skia.googlesource.com/skia/+/637b3bf2b9c10398d823bd015a722842d4f2f971
Review-Url: https://codereview.chromium.org/2238563002
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index cf9f4f0..9027f68 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -137,7 +137,16 @@
glslCaps->fConfigTextureSwizzle[i] = GrSwizzle::RRRR();
glslCaps->fConfigOutputSwizzle[i] = GrSwizzle::AAAA();
} else {
- glslCaps->fConfigTextureSwizzle[i] = GrSwizzle::RGBA();
+ if (kRGBA_4444_GrPixelConfig == config) {
+ // The vulkan spec does not require R4G4B4A4 to be supported for texturing so we
+ // store the data in a B4G4R4A4 texture and then swizzle it when doing texture reads
+ // or writing to outputs. Since we're not actually changing the data at all, the
+ // only extra work is the swizzle in the shader for all operations.
+ glslCaps->fConfigTextureSwizzle[i] = GrSwizzle::BGRA();
+ glslCaps->fConfigOutputSwizzle[i] = GrSwizzle::BGRA();
+ } else {
+ glslCaps->fConfigTextureSwizzle[i] = GrSwizzle::RGBA();
+ }
}
}