aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2018-07-03 16:38:32 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-03 16:38:45 +0000
commit34aa059c1502d67c9a5f4db449667a8709b69fb9 (patch)
tree0fc7a5e33d505ae119b56cc58b4fd55f96654073 /src/gpu/vk
parentb6307340e8a6a9d3a7517def7f5eaaadffd07d14 (diff)
Revert "Remove setting/use of GrPixelConfig in GrBackendTex/RT ctors."
This reverts commit ff2181e62e79ffd2ce628fc8c05b5457d4f54163. Reason for revert: suspect it's behind Chrome roll failure Original change's description: > Remove setting/use of GrPixelConfig in GrBackendTex/RT ctors. > > Bug: skia: > Change-Id: I1466668e3502cd1e6e1f6aed4105e0f626d293dd > Reviewed-on: https://skia-review.googlesource.com/138987 > Commit-Queue: Greg Daniel <egdaniel@google.com> > Reviewed-by: Robert Phillips <robertphillips@google.com> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com Change-Id: I4cba44858aafffbadc45e18349b93c741d7cfc66 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/139220 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/gpu/vk')
-rw-r--r--src/gpu/vk/GrVkGpu.cpp12
-rw-r--r--src/gpu/vk/GrVkUtil.cpp34
-rw-r--r--src/gpu/vk/GrVkUtil.h5
3 files changed, 41 insertions, 10 deletions
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index ed45c55758..ba1f7caf2d 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1359,11 +1359,7 @@ GrBackendTexture GrVkGpu::createTestingOnlyBackendTexture(const void* srcData, i
&info)) {
return {};
}
- GrBackendTexture beTex = GrBackendTexture(w, h, info);
- // Lots of tests don't go through Skia's public interface which will set the config so for
- // testing we make sure we set a config here.
- beTex.setPixelConfig(config);
- return beTex;
+ return GrBackendTexture(w, h, info);
}
bool GrVkGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
@@ -1413,11 +1409,7 @@ GrBackendRenderTarget GrVkGpu::createTestingOnlyBackendRenderTarget(int w, int h
&info)) {
return {};
}
- GrBackendRenderTarget beRT = GrBackendRenderTarget(w, h, 1, 0, info);
- // Lots of tests don't go through Skia's public interface which will set the config so for
- // testing we make sure we set a config here.
- beRT.setPixelConfig(config);
- return beRT;
+ return {w, h, 1, 0, info};
}
void GrVkGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget& rt) {
diff --git a/src/gpu/vk/GrVkUtil.cpp b/src/gpu/vk/GrVkUtil.cpp
index b0aa3d4c14..2b0bba732d 100644
--- a/src/gpu/vk/GrVkUtil.cpp
+++ b/src/gpu/vk/GrVkUtil.cpp
@@ -75,6 +75,40 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) {
return false;
}
+GrPixelConfig GrVkFormatToPixelConfig(VkFormat format) {
+ switch (format) {
+ case VK_FORMAT_R8G8B8A8_UNORM:
+ return kRGBA_8888_GrPixelConfig;
+ case VK_FORMAT_B8G8R8A8_UNORM:
+ return kBGRA_8888_GrPixelConfig;
+ case VK_FORMAT_R8G8B8A8_SRGB:
+ return kSRGBA_8888_GrPixelConfig;
+ case VK_FORMAT_B8G8R8A8_SRGB:
+ return kSBGRA_8888_GrPixelConfig;
+ case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+ return kRGBA_1010102_GrPixelConfig;
+ case VK_FORMAT_R5G6B5_UNORM_PACK16:
+ return kRGB_565_GrPixelConfig;
+ break;
+ case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
+ // R4G4B4A4 is not required to be supported so we actually
+ // store RGBA_4444 data as B4G4R4A4.
+ return kRGBA_4444_GrPixelConfig;
+ case VK_FORMAT_R8_UNORM:
+ return kAlpha_8_GrPixelConfig;
+ case VK_FORMAT_R32G32B32A32_SFLOAT:
+ return kRGBA_float_GrPixelConfig;
+ case VK_FORMAT_R32G32_SFLOAT:
+ return kRG_float_GrPixelConfig;
+ case VK_FORMAT_R16G16B16A16_SFLOAT:
+ return kRGBA_half_GrPixelConfig;
+ case VK_FORMAT_R16_SFLOAT:
+ return kAlpha_half_GrPixelConfig;
+ default:
+ return kUnknown_GrPixelConfig;
+ }
+}
+
bool GrVkFormatPixelConfigPairIsValid(VkFormat format, GrPixelConfig config) {
switch (format) {
case VK_FORMAT_R8G8B8A8_UNORM:
diff --git a/src/gpu/vk/GrVkUtil.h b/src/gpu/vk/GrVkUtil.h
index 7c56c6941f..71cc5d4e6a 100644
--- a/src/gpu/vk/GrVkUtil.h
+++ b/src/gpu/vk/GrVkUtil.h
@@ -33,6 +33,11 @@ class GrVkGpu;
*/
bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format);
+/**
+* Returns the GrPixelConfig for the given vulkan texture format
+*/
+GrPixelConfig GrVkFormatToPixelConfig(VkFormat format);
+
bool GrVkFormatIsSupported(VkFormat);
/**