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

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

Issue 1718693002: Add vulkan files into skia repo. (Closed) Base URL: https://skia.googlesource.com/skia.git@merge
Patch Set: fix path Created 4 years, 10 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/GrVkUtil.h ('k') | src/gpu/vk/GrVkVaryingHandler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkUtil.cpp
diff --git a/src/gpu/vk/GrVkUtil.cpp b/src/gpu/vk/GrVkUtil.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ec3ec234d40981056508c80052e283aa8ddeaeb6
--- /dev/null
+++ b/src/gpu/vk/GrVkUtil.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrVkUtil.h"
+
+bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) {
+ VkFormat dontCare;
+ if (!format) {
+ format = &dontCare;
+ }
+
+ switch (config) {
+ case kRGBA_8888_GrPixelConfig:
+ *format = VK_FORMAT_R8G8B8A8_UNORM;
+ break;
+ case kBGRA_8888_GrPixelConfig:
+ *format = VK_FORMAT_B8G8R8A8_UNORM;
+ break;
+ case kSRGBA_8888_GrPixelConfig:
+ *format = VK_FORMAT_R8G8B8A8_SRGB;
+ break;
+ case kRGB_565_GrPixelConfig:
+ *format = VK_FORMAT_R5G6B5_UNORM_PACK16;
+ break;
+ case kRGBA_4444_GrPixelConfig:
+ *format = VK_FORMAT_R4G4B4A4_UNORM_PACK16;
+ break;
+ case kIndex_8_GrPixelConfig:
+ // No current rad support for this config
+ return false;
+ case kAlpha_8_GrPixelConfig:
+ *format = VK_FORMAT_R8_UNORM;
+ break;
+ case kETC1_GrPixelConfig:
+ // converting to ETC2 which is a superset of ETC1
+ *format = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;
+ break;
+ case kLATC_GrPixelConfig:
+ // No current rad support for this config
+ return false;
+ case kR11_EAC_GrPixelConfig:
+ *format = VK_FORMAT_EAC_R11_UNORM_BLOCK;
+ break;
+ case kASTC_12x12_GrPixelConfig:
+ *format = VK_FORMAT_ASTC_12x12_UNORM_BLOCK;
+ break;
+ case kRGBA_float_GrPixelConfig:
+ *format = VK_FORMAT_R32G32B32A32_SFLOAT;
+ break;
+ case kRGBA_half_GrPixelConfig:
+ *format = VK_FORMAT_R16G16B16A16_SFLOAT;
+ break;
+ case kAlpha_half_GrPixelConfig:
+ *format = VK_FORMAT_R16_SFLOAT;
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+bool GrSampleCountToVkSampleCount(uint32_t samples, VkSampleCountFlagBits* vkSamples) {
+ switch (samples) {
+ case 0: // fall through
+ case 1:
+ *vkSamples = VK_SAMPLE_COUNT_1_BIT;
+ return true;
+ case 2:
+ *vkSamples = VK_SAMPLE_COUNT_2_BIT;
+ return true;
+ case 4:
+ *vkSamples = VK_SAMPLE_COUNT_2_BIT;
+ return true;
+ case 8:
+ *vkSamples = VK_SAMPLE_COUNT_2_BIT;
+ return true;
+ case 16:
+ *vkSamples = VK_SAMPLE_COUNT_2_BIT;
+ return true;
+ case 32:
+ *vkSamples = VK_SAMPLE_COUNT_2_BIT;
+ return true;
+ case 64:
+ *vkSamples = VK_SAMPLE_COUNT_2_BIT;
+ return true;
+ default:
+ return false;
+ }
+}
+
« no previous file with comments | « src/gpu/vk/GrVkUtil.h ('k') | src/gpu/vk/GrVkVaryingHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698