Remove unused/barely-supported compressed GrPixelConfigs

Change-Id: Ie7b813c8b0523ae53cf9f2328645ddf4c5af49a8
Reviewed-on: https://skia-review.googlesource.com/8326
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2017-02-10 14:44:58 -05:00 committed by Skia Commit-Bot
parent b43a3e0160
commit b34727f1a3
8 changed files with 23 additions and 164 deletions

View File

@ -13,7 +13,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
// Helper function that uploads the given SkImage using MakdeFromDeferredTextureImageData and then
// Helper function that uploads the given SkImage using MakeFromDeferredTextureImageData and then
// draws the uploaded version at the specified coordinates.
static void DrawDeferredTextureImageData(SkCanvas* canvas,
SkImage::DeferredTextureImageUsageParams* params) {

View File

@ -252,28 +252,6 @@ enum GrPixelConfig {
* ETC1 Compressed Data
*/
kETC1_GrPixelConfig,
/**
* LATC/RGTC/3Dc/BC4 Compressed Data
*/
kLATC_GrPixelConfig,
/**
* R11 EAC Compressed Data
* (Corresponds to section C.3.5 of the OpenGL 4.4 core profile spec)
*/
kR11_EAC_GrPixelConfig,
/**
* 12x12 ASTC Compressed Data
* ASTC stands for Adaptive Scalable Texture Compression. It is a technique
* that allows for a lot of customization in the compressed representataion
* of a block. The only thing fixed in the representation is the block size,
* which means that a texture that contains ASTC data must be treated as
* having RGBA values. However, there are single-channel encodings which set
* the alpha to opaque and all three RGB channels equal effectively making the
* compression format a single channel such as R11 EAC and LATC.
*/
kASTC_12x12_GrPixelConfig,
/**
* Byte order is r, g, b, a. This color format is 32 bits per channel
*/
@ -314,9 +292,6 @@ static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) {
switch (config) {
case kETC1_GrPixelConfig:
case kLATC_GrPixelConfig:
case kR11_EAC_GrPixelConfig:
case kASTC_12x12_GrPixelConfig:
return true;
case kUnknown_GrPixelConfig:
case kAlpha_8_GrPixelConfig:
@ -342,11 +317,7 @@ static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) {
static inline GrPixelConfig GrMakePixelConfigUncompressed(GrPixelConfig config) {
switch (config) {
case kETC1_GrPixelConfig:
case kASTC_12x12_GrPixelConfig:
return kRGBA_8888_GrPixelConfig;
case kLATC_GrPixelConfig:
case kR11_EAC_GrPixelConfig:
return kAlpha_8_GrPixelConfig;
case kUnknown_GrPixelConfig:
case kAlpha_8_GrPixelConfig:
case kGray_8_GrPixelConfig:
@ -383,9 +354,6 @@ static inline bool GrPixelConfigIs8888Unorm(GrPixelConfig config) {
case kRGBA_4444_GrPixelConfig:
case kRGBA_8888_sint_GrPixelConfig:
case kETC1_GrPixelConfig:
case kLATC_GrPixelConfig:
case kR11_EAC_GrPixelConfig:
case kASTC_12x12_GrPixelConfig:
case kRGBA_float_GrPixelConfig:
case kRG_float_GrPixelConfig:
case kAlpha_half_GrPixelConfig:
@ -412,9 +380,6 @@ static inline bool GrPixelConfigIsSRGB(GrPixelConfig config) {
case kBGRA_8888_GrPixelConfig:
case kRGBA_8888_sint_GrPixelConfig:
case kETC1_GrPixelConfig:
case kLATC_GrPixelConfig:
case kR11_EAC_GrPixelConfig:
case kASTC_12x12_GrPixelConfig:
case kRGBA_float_GrPixelConfig:
case kRG_float_GrPixelConfig:
case kAlpha_half_GrPixelConfig:
@ -444,9 +409,6 @@ static inline GrPixelConfig GrPixelConfigSwapRAndB(GrPixelConfig config) {
case kRGBA_4444_GrPixelConfig:
case kRGBA_8888_sint_GrPixelConfig:
case kETC1_GrPixelConfig:
case kLATC_GrPixelConfig:
case kR11_EAC_GrPixelConfig:
case kASTC_12x12_GrPixelConfig:
case kRGBA_float_GrPixelConfig:
case kRG_float_GrPixelConfig:
case kAlpha_half_GrPixelConfig:
@ -481,9 +443,6 @@ static inline size_t GrBytesPerPixel(GrPixelConfig config) {
return 8;
case kUnknown_GrPixelConfig:
case kETC1_GrPixelConfig:
case kLATC_GrPixelConfig:
case kR11_EAC_GrPixelConfig:
case kASTC_12x12_GrPixelConfig:
return 0;
}
SkFAIL("Invalid pixel config");
@ -508,9 +467,6 @@ static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
case kRGBA_float_GrPixelConfig:
case kRG_float_GrPixelConfig:
case kUnknown_GrPixelConfig:
case kLATC_GrPixelConfig:
case kR11_EAC_GrPixelConfig:
case kASTC_12x12_GrPixelConfig:
return false;
}
SkFAIL("Invalid pixel config");
@ -519,9 +475,6 @@ static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) {
switch (config) {
case kR11_EAC_GrPixelConfig:
case kLATC_GrPixelConfig:
case kASTC_12x12_GrPixelConfig:
case kAlpha_8_GrPixelConfig:
case kAlpha_half_GrPixelConfig:
return true;
@ -562,9 +515,6 @@ static inline bool GrPixelConfigIsFloatingPoint(GrPixelConfig config) {
case kSBGRA_8888_GrPixelConfig:
case kRGBA_8888_sint_GrPixelConfig:
case kETC1_GrPixelConfig:
case kLATC_GrPixelConfig:
case kR11_EAC_GrPixelConfig:
case kASTC_12x12_GrPixelConfig:
return false;
}
SkFAIL("Invalid pixel config");
@ -796,18 +746,11 @@ static inline size_t GrCompressedFormatDataSize(GrPixelConfig config,
SkASSERT(GrPixelConfigIsCompressed(config));
switch (config) {
case kR11_EAC_GrPixelConfig:
case kLATC_GrPixelConfig:
case kETC1_GrPixelConfig:
SkASSERT((width & 3) == 0);
SkASSERT((height & 3) == 0);
return (width >> 2) * (height >> 2) * 8;
case kASTC_12x12_GrPixelConfig:
SkASSERT((width % 12) == 0);
SkASSERT((height % 12) == 0);
return (width / 12) * (height / 12) * 16;
case kUnknown_GrPixelConfig:
case kAlpha_8_GrPixelConfig:
case kGray_8_GrPixelConfig:

View File

@ -22,9 +22,6 @@ static const char* pixel_config_name(GrPixelConfig config) {
case kSBGRA_8888_GrPixelConfig: return "SBGRA8888";
case kRGBA_8888_sint_GrPixelConfig: return "RGBA8888_sint";
case kETC1_GrPixelConfig: return "ETC1";
case kLATC_GrPixelConfig: return "LATC";
case kR11_EAC_GrPixelConfig: return "R11EAC";
case kASTC_12x12_GrPixelConfig: return "ASTC12x12";
case kRGBA_float_GrPixelConfig: return "RGBAFloat";
case kRG_float_GrPixelConfig: return "RGFloat";
case kAlpha_half_GrPixelConfig: return "AlphaHalf";

View File

@ -212,15 +212,12 @@ void GrShaderCaps::initSamplerPrecisionTable() {
table[kSBGRA_8888_GrPixelConfig] = lowp;
table[kRGBA_8888_sint_GrPixelConfig] = lowp;
table[kETC1_GrPixelConfig] = lowp;
table[kLATC_GrPixelConfig] = lowp;
table[kR11_EAC_GrPixelConfig] = lowp;
table[kASTC_12x12_GrPixelConfig] = lowp;
table[kRGBA_float_GrPixelConfig] = kHigh_GrSLPrecision;
table[kRG_float_GrPixelConfig] = kHigh_GrSLPrecision;
table[kAlpha_half_GrPixelConfig] = mediump;
table[kRGBA_half_GrPixelConfig] = mediump;
GR_STATIC_ASSERT(18 == kGrPixelConfigCnt);
GR_STATIC_ASSERT(15 == kGrPixelConfigCnt);
}
}

View File

@ -1925,82 +1925,28 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
// No sized/unsized internal format distinction for compressed formats, no external format.
// Below we set the external formats and types to 0.
// May change the internal format based on extensions.
fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat =
GR_GL_COMPRESSED_LUMINANCE_LATC1;
fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat =
GR_GL_COMPRESSED_LUMINANCE_LATC1;
if (ctxInfo.hasExtension("GL_EXT_texture_compression_latc") ||
ctxInfo.hasExtension("GL_NV_texture_compression_latc")) {
fConfigTable[kLATC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
} else if ((kGL_GrGLStandard == standard && version >= GR_GL_VER(3, 0)) ||
ctxInfo.hasExtension("GL_EXT_texture_compression_rgtc") ||
ctxInfo.hasExtension("GL_ARB_texture_compression_rgtc")) {
// RGTC is identical and available on OpenGL 3.0+ as well as with extensions
fConfigTable[kLATC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat =
GR_GL_COMPRESSED_RED_RGTC1;
fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat =
GR_GL_COMPRESSED_RED_RGTC1;
} else if (ctxInfo.hasExtension("GL_AMD_compressed_3DC_texture")) {
fConfigTable[kLATC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_COMPRESSED_3DC_X;
fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat =
GR_GL_COMPRESSED_3DC_X;
}
fConfigTable[kLATC_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] = 0;
fConfigTable[kLATC_GrPixelConfig].fFormats.fExternalType = 0;
fConfigTable[kLATC_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
fConfigTable[kLATC_GrPixelConfig].fSwizzle = GrSwizzle::RRRR();
fConfigTable[kETC1_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_COMPRESSED_ETC1_RGB8;
fConfigTable[kETC1_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_COMPRESSED_ETC1_RGB8;
fConfigTable[kETC1_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] = 0;
fConfigTable[kETC1_GrPixelConfig].fFormats.fExternalType = 0;
fConfigTable[kETC1_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
if (kGL_GrGLStandard == standard) {
if (version >= GR_GL_VER(4, 3) || ctxInfo.hasExtension("GL_ARB_ES3_compatibility")) {
fConfigTable[kETC1_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
}
} else {
if (version >= GR_GL_VER(3, 0) ||
ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") ||
// ETC2 is a superset of ETC1, so we can just check for that, too.
(ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") &&
ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture"))) {
fConfigTable[kETC1_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
{
fConfigTable[kETC1_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_COMPRESSED_ETC1_RGB8;
fConfigTable[kETC1_GrPixelConfig].fFormats.fSizedInternalFormat =
GR_GL_COMPRESSED_ETC1_RGB8;
fConfigTable[kETC1_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] = 0;
fConfigTable[kETC1_GrPixelConfig].fFormats.fExternalType = 0;
fConfigTable[kETC1_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
if (kGL_GrGLStandard == standard) {
if (version >= GR_GL_VER(4, 3) || ctxInfo.hasExtension("GL_ARB_ES3_compatibility")) {
fConfigTable[kETC1_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
}
} else {
if (version >= GR_GL_VER(3, 0) ||
ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") ||
// ETC2 is a superset of ETC1, so we can just check for that, too.
(ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") &&
ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture"))) {
fConfigTable[kETC1_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
}
}
fConfigTable[kETC1_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
}
fConfigTable[kETC1_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_COMPRESSED_R11_EAC;
fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_COMPRESSED_R11_EAC;
fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] = 0;
fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fExternalType = 0;
fConfigTable[kR11_EAC_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
// Check for R11_EAC. We don't support R11_EAC on desktop, as most cards default to
// decompressing the textures in the driver, and is generally slower.
if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0)) {
fConfigTable[kR11_EAC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
}
fConfigTable[kR11_EAC_GrPixelConfig].fSwizzle = GrSwizzle::RRRR();
fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fBaseInternalFormat =
GR_GL_COMPRESSED_RGBA_ASTC_12x12;
fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fSizedInternalFormat =
GR_GL_COMPRESSED_RGBA_ASTC_12x12;
fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] =
0;
fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fExternalType = 0;
fConfigTable[kASTC_12x12_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
if (ctxInfo.hasExtension("GL_KHR_texture_compression_astc_hdr") ||
ctxInfo.hasExtension("GL_KHR_texture_compression_astc_ldr") ||
ctxInfo.hasExtension("GL_OES_texture_compression_astc")) {
fConfigTable[kASTC_12x12_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
}
fConfigTable[kASTC_12x12_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
// Bulk populate the texture internal/external formats here and then deal with exceptions below.

View File

@ -946,9 +946,6 @@ static inline GrGLint config_alignment(GrPixelConfig config) {
return 4;
case kUnknown_GrPixelConfig:
case kETC1_GrPixelConfig:
case kLATC_GrPixelConfig:
case kR11_EAC_GrPixelConfig:
case kASTC_12x12_GrPixelConfig:
return 0;
}
SkFAIL("Invalid pixel config");

View File

@ -260,12 +260,6 @@ void GrVkCaps::initConfigTable(const GrVkInterface* interface, VkPhysicalDevice
const uint16_t kFlagsToRemove = ConfigInfo::kTextureable_Flag|ConfigInfo::kRenderable_Flag;
fConfigTable[kETC1_GrPixelConfig].fOptimalFlags &= ~kFlagsToRemove;
fConfigTable[kETC1_GrPixelConfig].fLinearFlags &= ~kFlagsToRemove;
fConfigTable[kLATC_GrPixelConfig].fOptimalFlags &= ~kFlagsToRemove;
fConfigTable[kLATC_GrPixelConfig].fLinearFlags &= ~kFlagsToRemove;
fConfigTable[kR11_EAC_GrPixelConfig].fOptimalFlags &= ~kFlagsToRemove;
fConfigTable[kR11_EAC_GrPixelConfig].fLinearFlags &= ~kFlagsToRemove;
fConfigTable[kASTC_12x12_GrPixelConfig].fOptimalFlags &= ~kFlagsToRemove;
fConfigTable[kASTC_12x12_GrPixelConfig].fLinearFlags &= ~kFlagsToRemove;
}
void GrVkCaps::ConfigInfo::InitConfigFlags(VkFormatFeatureFlags vkFlags, uint16_t* flags) {

View File

@ -52,15 +52,6 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) {
// converting to ETC2 which is a superset of ETC1
*format = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;
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;
return true;
case kASTC_12x12_GrPixelConfig:
*format = VK_FORMAT_ASTC_12x12_UNORM_BLOCK;
return true;
case kRGBA_float_GrPixelConfig:
*format = VK_FORMAT_R32G32B32A32_SFLOAT;
return true;
@ -112,13 +103,7 @@ bool GrVkFormatToPixelConfig(VkFormat format, GrPixelConfig* config) {
*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;
*config = kETC1_GrPixelConfig; // this conversion seems a bit sketchy
break;
case VK_FORMAT_R32G32B32A32_SFLOAT:
*config = kRGBA_float_GrPixelConfig;