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

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

Issue 1848833005: First pass at VulkanViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments, plus add GM rendering Created 4 years, 8 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
Index: src/gpu/vk/GrVkUtil.cpp
diff --git a/src/gpu/vk/GrVkUtil.cpp b/src/gpu/vk/GrVkUtil.cpp
index 5ab7966d1a2b0fdb721385f40ffccda69005f076..a6a9d4c1a1df29072efb33b1d2650c6cbf98fe7a 100644
--- a/src/gpu/vk/GrVkUtil.cpp
+++ b/src/gpu/vk/GrVkUtil.cpp
@@ -23,6 +23,9 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) {
case kSRGBA_8888_GrPixelConfig:
*format = VK_FORMAT_R8G8B8A8_SRGB;
break;
+ case kSBGRA_8888_GrPixelConfig:
+ *format = VK_FORMAT_B8G8R8A8_SRGB;
+ break;
case kRGB_565_GrPixelConfig:
*format = VK_FORMAT_R5G6B5_UNORM_PACK16;
break;
@@ -30,7 +33,7 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) {
*format = VK_FORMAT_R4G4B4A4_UNORM_PACK16;
break;
case kIndex_8_GrPixelConfig:
- // No current rad support for this config
+ // No current vulkan support for this config
return false;
case kAlpha_8_GrPixelConfig:
*format = VK_FORMAT_R8_UNORM;
@@ -40,7 +43,7 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) {
*format = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;
break;
case kLATC_GrPixelConfig:
- // No current rad support for this config
+ // No current vulkan support for this config
return false;
case kR11_EAC_GrPixelConfig:
*format = VK_FORMAT_EAC_R11_UNORM_BLOCK;
@@ -63,6 +66,58 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) {
return true;
}
+bool GrVkFormatToPixelConfig(VkFormat format, GrPixelConfig* config) {
+ GrPixelConfig dontCare;
+ if (!config) {
+ config = &dontCare;
+ }
+
+ switch (format) {
+ case VK_FORMAT_R8G8B8A8_UNORM:
+ *config = kRGBA_8888_GrPixelConfig;
+ break;
+ case VK_FORMAT_B8G8R8A8_UNORM:
+ *config = kBGRA_8888_GrPixelConfig;
+ break;
+ case VK_FORMAT_R8G8B8A8_SRGB:
+ *config = kSRGBA_8888_GrPixelConfig;
+ break;
+ case VK_FORMAT_B8G8R8A8_SRGB:
+ *config = kSBGRA_8888_GrPixelConfig;
+ break;
+ case VK_FORMAT_R5G6B5_UNORM_PACK16:
+ *config = kRGB_565_GrPixelConfig;
+ break;
+ case VK_FORMAT_R4G4B4A4_UNORM_PACK16:
+ *config = kRGBA_4444_GrPixelConfig;
+ break;
+ case VK_FORMAT_R8_UNORM:
+ *config = kAlpha_8_GrPixelConfig;
+ break;
+ case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
+ *config = kETC1_GrPixelConfig;
+ break;
+ case VK_FORMAT_EAC_R11_UNORM_BLOCK:
+ *config = kR11_EAC_GrPixelConfig;
+ break;
+ case VK_FORMAT_ASTC_12x12_UNORM_BLOCK:
+ *config = kASTC_12x12_GrPixelConfig;
+ break;
+ case VK_FORMAT_R32G32B32A32_SFLOAT:
+ *config = kRGBA_float_GrPixelConfig;
+ break;
+ case VK_FORMAT_R16G16B16A16_SFLOAT:
+ *config = kRGBA_half_GrPixelConfig;
+ break;
+ case VK_FORMAT_R16_SFLOAT:
+ *config = kAlpha_half_GrPixelConfig;
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
bool GrSampleCountToVkSampleCount(uint32_t samples, VkSampleCountFlagBits* vkSamples) {
switch (samples) {
case 0: // fall through
« gyp/vulkanviewer.gyp ('K') | « src/gpu/vk/GrVkUtil.h ('k') | tools/vulkan/Application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698