Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Unified Diff: src/gpu/vk/GrVkCaps.cpp

Issue 2238563002: Fix 4444 on Vulkan devices who don't support RGBA_4444 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update comment Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkCaps.h ('k') | src/gpu/vk/GrVkUtil.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkCaps.cpp
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index cf9f4f025e0a2a8d4b53a25a3a5f9ba711256803..9027f6881557467384dd261df228250553a464ee 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -137,7 +137,16 @@ void GrVkCaps::initGLSLCaps(const VkPhysicalDeviceProperties& properties,
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();
+ }
}
}
« no previous file with comments | « src/gpu/vk/GrVkCaps.h ('k') | src/gpu/vk/GrVkUtil.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698