Revert "Revert "Add integer texture support.""
This reverts commit 9c7edb8311409a141b0dc1d5e480c68c629f1997.
Fixes ASAN errors
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4736
Change-Id: I1b1dae754d357b01da7169c8e7c59d7d8d8a10f6
Reviewed-on: https://skia-review.googlesource.com/4736
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/vk/GrVkUtil.cpp b/src/gpu/vk/GrVkUtil.cpp
index a14f827..1d93e8d 100644
--- a/src/gpu/vk/GrVkUtil.cpp
+++ b/src/gpu/vk/GrVkUtil.cpp
@@ -19,58 +19,62 @@
}
switch (config) {
+ case kUnknown_GrPixelConfig:
+ return false;
case kRGBA_8888_GrPixelConfig:
*format = VK_FORMAT_R8G8B8A8_UNORM;
- break;
+ return true;
case kBGRA_8888_GrPixelConfig:
*format = VK_FORMAT_B8G8R8A8_UNORM;
- break;
+ return true;
case kSRGBA_8888_GrPixelConfig:
*format = VK_FORMAT_R8G8B8A8_SRGB;
- break;
+ return true;
case kSBGRA_8888_GrPixelConfig:
*format = VK_FORMAT_B8G8R8A8_SRGB;
- break;
+ return true;
+ case kRGBA_8888_sint_GrPixelConfig:
+ *format = VK_FORMAT_R8G8B8A8_SINT;
+ return true;
case kRGB_565_GrPixelConfig:
*format = VK_FORMAT_R5G6B5_UNORM_PACK16;
- break;
+ return true;
case kRGBA_4444_GrPixelConfig:
// R4G4B4A4 is not required to be supported so we actually
// store the data is if it was B4G4R4A4 and swizzle in shaders
*format = VK_FORMAT_B4G4R4A4_UNORM_PACK16;
- break;
+ return true;
case kIndex_8_GrPixelConfig:
// No current vulkan support for this config
return false;
case kAlpha_8_GrPixelConfig:
*format = VK_FORMAT_R8_UNORM;
- break;
+ return true;
case kETC1_GrPixelConfig:
// converting to ETC2 which is a superset of ETC1
*format = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;
- break;
+ return true;
case kLATC_GrPixelConfig:
// No current vulkan support for this config
return false;
case kR11_EAC_GrPixelConfig:
*format = VK_FORMAT_EAC_R11_UNORM_BLOCK;
- break;
+ return true;
case kASTC_12x12_GrPixelConfig:
*format = VK_FORMAT_ASTC_12x12_UNORM_BLOCK;
- break;
+ return true;
case kRGBA_float_GrPixelConfig:
*format = VK_FORMAT_R32G32B32A32_SFLOAT;
- break;
+ return true;
case kRGBA_half_GrPixelConfig:
*format = VK_FORMAT_R16G16B16A16_SFLOAT;
- break;
+ return true;
case kAlpha_half_GrPixelConfig:
*format = VK_FORMAT_R16_SFLOAT;
- break;
- default:
- return false;
+ return true;
}
- return true;
+ SkFAIL("Unexpected config");
+ return false;
}
bool GrVkFormatToPixelConfig(VkFormat format, GrPixelConfig* config) {
@@ -92,6 +96,9 @@
case VK_FORMAT_B8G8R8A8_SRGB:
*config = kSBGRA_8888_GrPixelConfig;
break;
+ case VK_FORMAT_R8G8B8A8_SINT:
+ *config = kRGBA_8888_sint_GrPixelConfig;
+ break;
case VK_FORMAT_R5G6B5_UNORM_PACK16:
*config = kRGB_565_GrPixelConfig;
break;