Revert "Experimental: Add R_16 and RG_1616 to Ganesh"
This reverts commit 93d0146dc6
.
Reason for revert: revertting so we can revert previous change
Original change's description:
> Experimental: Add R_16 and RG_1616 to Ganesh
>
> This is to support the P016 and P010 YUV formats. Initially, only Vulkan and GL support these formats.
>
> Change-Id: Ie9609e59c12528079f8d379359ddb9bac85b6a29
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218546
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,robertphillips@google.com
Change-Id: I00e1bf32404983b09f0933b2a9d65aa40a5ee754
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218959
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
9e3169b2f6
commit
992df579a4
@ -60,11 +60,7 @@ enum GrPixelConfig {
|
||||
kRGBA_half_Clamped_GrPixelConfig,
|
||||
kRGB_ETC1_GrPixelConfig,
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
kR_16_GrPixelConfig,
|
||||
kRG_1616_GrPixelConfig,
|
||||
|
||||
kLast_GrPixelConfig = kRG_1616_GrPixelConfig
|
||||
kLast_GrPixelConfig = kRGB_ETC1_GrPixelConfig
|
||||
};
|
||||
static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
|
||||
|
||||
@ -689,10 +685,7 @@ enum GrVertexAttribType {
|
||||
kInt_GrVertexAttribType,
|
||||
kUint_GrVertexAttribType,
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
kUShort_norm_GrVertexAttribType,
|
||||
|
||||
kLast_GrVertexAttribType = kUShort_norm_GrVertexAttribType
|
||||
kLast_GrVertexAttribType = kUint_GrVertexAttribType
|
||||
};
|
||||
static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1;
|
||||
|
||||
@ -898,9 +891,6 @@ static inline GrSRGBEncoded GrPixelConfigIsSRGBEncoded(GrPixelConfig config) {
|
||||
case kRGBA_half_GrPixelConfig:
|
||||
case kRGBA_half_Clamped_GrPixelConfig:
|
||||
case kRGB_ETC1_GrPixelConfig:
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig:
|
||||
case kRG_1616_GrPixelConfig:
|
||||
return GrSRGBEncoded::kNo;
|
||||
}
|
||||
SK_ABORT("Invalid pixel config");
|
||||
@ -944,12 +934,6 @@ static inline size_t GrBytesPerPixel(GrPixelConfig config) {
|
||||
case kUnknown_GrPixelConfig:
|
||||
case kRGB_ETC1_GrPixelConfig:
|
||||
return 0;
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig:
|
||||
return 2;
|
||||
case kRG_1616_GrPixelConfig:
|
||||
return 4;
|
||||
}
|
||||
SK_ABORT("Invalid pixel config");
|
||||
return 0;
|
||||
@ -966,9 +950,6 @@ static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
|
||||
case kGray_8_as_Red_GrPixelConfig:
|
||||
case kRG_float_GrPixelConfig:
|
||||
case kRGB_ETC1_GrPixelConfig:
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig:
|
||||
case kRG_1616_GrPixelConfig:
|
||||
return true;
|
||||
case kAlpha_8_GrPixelConfig:
|
||||
case kAlpha_8_as_Alpha_GrPixelConfig:
|
||||
@ -1018,9 +999,6 @@ static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) {
|
||||
case kRGBA_half_GrPixelConfig:
|
||||
case kRGBA_half_Clamped_GrPixelConfig:
|
||||
case kRGB_ETC1_GrPixelConfig:
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig:
|
||||
case kRG_1616_GrPixelConfig:
|
||||
return false;
|
||||
}
|
||||
SK_ABORT("Invalid pixel config.");
|
||||
@ -1047,9 +1025,6 @@ static inline bool GrPixelConfigIsFloatingPoint(GrPixelConfig config) {
|
||||
case kSBGRA_8888_GrPixelConfig:
|
||||
case kRGBA_1010102_GrPixelConfig:
|
||||
case kRGB_ETC1_GrPixelConfig:
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig:
|
||||
case kRG_1616_GrPixelConfig:
|
||||
return false;
|
||||
case kRGBA_float_GrPixelConfig:
|
||||
case kRG_float_GrPixelConfig:
|
||||
@ -1078,7 +1053,29 @@ static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) {
|
||||
switch (config) {
|
||||
case kRGB_ETC1_GrPixelConfig:
|
||||
return true;
|
||||
default:
|
||||
case kUnknown_GrPixelConfig:
|
||||
case kAlpha_8_GrPixelConfig:
|
||||
case kAlpha_8_as_Alpha_GrPixelConfig:
|
||||
case kAlpha_8_as_Red_GrPixelConfig:
|
||||
case kGray_8_GrPixelConfig:
|
||||
case kGray_8_as_Lum_GrPixelConfig:
|
||||
case kGray_8_as_Red_GrPixelConfig:
|
||||
case kRGB_565_GrPixelConfig:
|
||||
case kRGBA_4444_GrPixelConfig:
|
||||
case kRGB_888_GrPixelConfig:
|
||||
case kRGB_888X_GrPixelConfig:
|
||||
case kRG_88_GrPixelConfig:
|
||||
case kRGBA_8888_GrPixelConfig:
|
||||
case kBGRA_8888_GrPixelConfig:
|
||||
case kSRGBA_8888_GrPixelConfig:
|
||||
case kSBGRA_8888_GrPixelConfig:
|
||||
case kRGBA_1010102_GrPixelConfig:
|
||||
case kRGBA_float_GrPixelConfig:
|
||||
case kRG_float_GrPixelConfig:
|
||||
case kAlpha_half_GrPixelConfig:
|
||||
case kAlpha_half_as_Red_GrPixelConfig:
|
||||
case kRGBA_half_GrPixelConfig:
|
||||
case kRGBA_half_Clamped_GrPixelConfig:
|
||||
return false;
|
||||
}
|
||||
SK_ABORT("Invalid pixel config");
|
||||
@ -1092,7 +1089,29 @@ static inline GrPixelConfig GrMakePixelConfigUncompressed(GrPixelConfig config)
|
||||
switch (config) {
|
||||
case kRGB_ETC1_GrPixelConfig:
|
||||
return kRGBA_8888_GrPixelConfig;
|
||||
default:
|
||||
case kUnknown_GrPixelConfig:
|
||||
case kAlpha_8_GrPixelConfig:
|
||||
case kAlpha_8_as_Alpha_GrPixelConfig:
|
||||
case kAlpha_8_as_Red_GrPixelConfig:
|
||||
case kGray_8_GrPixelConfig:
|
||||
case kGray_8_as_Lum_GrPixelConfig:
|
||||
case kGray_8_as_Red_GrPixelConfig:
|
||||
case kRGB_565_GrPixelConfig:
|
||||
case kRGBA_4444_GrPixelConfig:
|
||||
case kRGB_888_GrPixelConfig:
|
||||
case kRGB_888X_GrPixelConfig:
|
||||
case kRG_88_GrPixelConfig:
|
||||
case kRGBA_8888_GrPixelConfig:
|
||||
case kBGRA_8888_GrPixelConfig:
|
||||
case kSRGBA_8888_GrPixelConfig:
|
||||
case kSBGRA_8888_GrPixelConfig:
|
||||
case kRGBA_1010102_GrPixelConfig:
|
||||
case kRGBA_float_GrPixelConfig:
|
||||
case kRG_float_GrPixelConfig:
|
||||
case kAlpha_half_GrPixelConfig:
|
||||
case kAlpha_half_as_Red_GrPixelConfig:
|
||||
case kRGBA_half_GrPixelConfig:
|
||||
case kRGBA_half_Clamped_GrPixelConfig:
|
||||
return config;
|
||||
}
|
||||
SK_ABORT("Invalid pixel config");
|
||||
@ -1112,7 +1131,29 @@ static inline size_t GrCompressedFormatDataSize(GrPixelConfig config,
|
||||
SkASSERT((height & 3) == 0);
|
||||
return (width >> 2) * (height >> 2) * 8;
|
||||
|
||||
default:
|
||||
case kUnknown_GrPixelConfig:
|
||||
case kAlpha_8_GrPixelConfig:
|
||||
case kAlpha_8_as_Alpha_GrPixelConfig:
|
||||
case kAlpha_8_as_Red_GrPixelConfig:
|
||||
case kGray_8_GrPixelConfig:
|
||||
case kGray_8_as_Lum_GrPixelConfig:
|
||||
case kGray_8_as_Red_GrPixelConfig:
|
||||
case kRGB_565_GrPixelConfig:
|
||||
case kRGBA_4444_GrPixelConfig:
|
||||
case kRGB_888_GrPixelConfig:
|
||||
case kRGB_888X_GrPixelConfig:
|
||||
case kRG_88_GrPixelConfig:
|
||||
case kRGBA_8888_GrPixelConfig:
|
||||
case kBGRA_8888_GrPixelConfig:
|
||||
case kSRGBA_8888_GrPixelConfig:
|
||||
case kSBGRA_8888_GrPixelConfig:
|
||||
case kRGBA_1010102_GrPixelConfig:
|
||||
case kRGBA_float_GrPixelConfig:
|
||||
case kRG_float_GrPixelConfig:
|
||||
case kAlpha_half_GrPixelConfig:
|
||||
case kAlpha_half_as_Red_GrPixelConfig:
|
||||
case kRGBA_half_GrPixelConfig:
|
||||
case kRGBA_half_Clamped_GrPixelConfig:
|
||||
SK_ABORT("Unknown compressed pixel config");
|
||||
return 4 * width * height;
|
||||
}
|
||||
@ -1152,9 +1193,6 @@ static inline GrSLPrecision GrSLSamplerPrecision(GrPixelConfig config) {
|
||||
case kRGBA_half_GrPixelConfig:
|
||||
case kRGBA_half_Clamped_GrPixelConfig:
|
||||
case kRGBA_1010102_GrPixelConfig:
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig:
|
||||
case kRG_1616_GrPixelConfig:
|
||||
return kMedium_GrSLPrecision;
|
||||
}
|
||||
SK_ABORT("Unexpected type");
|
||||
@ -1185,10 +1223,6 @@ enum class GrColorType {
|
||||
kRG_F32,
|
||||
kRGBA_F32,
|
||||
kRGB_ETC1, // This type doesn't appear in SkColorType at all.
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
kR_16, // Not in SkColorType
|
||||
kRG_1616, // Not in SkColorType
|
||||
};
|
||||
|
||||
static inline SkColorType GrColorTypeToSkColorType(GrColorType ct) {
|
||||
@ -1209,9 +1243,6 @@ static inline SkColorType GrColorTypeToSkColorType(GrColorType ct) {
|
||||
case GrColorType::kRG_F32: return kUnknown_SkColorType;
|
||||
case GrColorType::kRGBA_F32: return kRGBA_F32_SkColorType;
|
||||
case GrColorType::kRGB_ETC1: return kUnknown_SkColorType;
|
||||
// Experimental (for P016 and P010)
|
||||
case GrColorType::kR_16: return kUnknown_SkColorType;
|
||||
case GrColorType::kRG_1616: return kUnknown_SkColorType;
|
||||
}
|
||||
SK_ABORT("Invalid GrColorType");
|
||||
return kUnknown_SkColorType;
|
||||
@ -1257,10 +1288,6 @@ static inline uint32_t GrColorTypeComponentFlags(GrColorType ct) {
|
||||
kGreen_SkColorTypeComponentFlag;
|
||||
case GrColorType::kRGBA_F32: return kRGBA_SkColorTypeComponentFlags;
|
||||
case GrColorType::kRGB_ETC1: return kRGB_SkColorTypeComponentFlags;
|
||||
// Experimental (for P016 and P010)
|
||||
case GrColorType::kR_16: return kRed_SkColorTypeComponentFlag;
|
||||
case GrColorType::kRG_1616: return kRed_SkColorTypeComponentFlag |
|
||||
kGreen_SkColorTypeComponentFlag;
|
||||
}
|
||||
SK_ABORT("Invalid GrColorType");
|
||||
return kUnknown_SkColorType;
|
||||
@ -1292,9 +1319,6 @@ static inline int GrColorTypeBytesPerPixel(GrColorType ct) {
|
||||
case GrColorType::kRGBA_F16_Clamped: return 8;
|
||||
case GrColorType::kRG_F32: return 8;
|
||||
case GrColorType::kRGBA_F32: return 16;
|
||||
// Experimental (for P016 and P010)
|
||||
case GrColorType::kR_16: return 2;
|
||||
case GrColorType::kRG_1616: return 4;
|
||||
}
|
||||
SK_ABORT("Invalid GrColorType");
|
||||
return 0;
|
||||
@ -1375,14 +1399,6 @@ static inline GrColorType GrPixelConfigToColorTypeAndEncoding(GrPixelConfig conf
|
||||
case kGray_8_as_Red_GrPixelConfig:
|
||||
*srgbEncoded = GrSRGBEncoded::kNo;
|
||||
return GrColorType::kGray_8;
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig:
|
||||
*srgbEncoded = GrSRGBEncoded::kNo;
|
||||
return GrColorType::kR_16;
|
||||
case kRG_1616_GrPixelConfig:
|
||||
*srgbEncoded = GrSRGBEncoded::kNo;
|
||||
return GrColorType::kRG_1616;
|
||||
|
||||
}
|
||||
SK_ABORT("Invalid GrPixelConfig");
|
||||
return GrColorType::kUnknown;
|
||||
@ -1456,14 +1472,6 @@ static inline GrPixelConfig GrColorTypeToPixelConfig(GrColorType config,
|
||||
case GrColorType::kRGB_ETC1:
|
||||
return (GrSRGBEncoded::kYes == srgbEncoded) ? kUnknown_GrPixelConfig
|
||||
: kRGB_ETC1_GrPixelConfig;
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
case GrColorType::kR_16:
|
||||
return (GrSRGBEncoded::kYes == srgbEncoded) ? kUnknown_GrPixelConfig
|
||||
: kR_16_GrPixelConfig;
|
||||
case GrColorType::kRG_1616:
|
||||
return (GrSRGBEncoded::kYes == srgbEncoded) ? kUnknown_GrPixelConfig
|
||||
: kRG_1616_GrPixelConfig;
|
||||
}
|
||||
SK_ABORT("Invalid GrColorType");
|
||||
return kUnknown_GrPixelConfig;
|
||||
|
@ -156,9 +156,6 @@ static const char* pixel_config_name(GrPixelConfig config) {
|
||||
case kRGBA_half_GrPixelConfig: return "RGBAHalf";
|
||||
case kRGBA_half_Clamped_GrPixelConfig: return "RGBAHalfClamped";
|
||||
case kRGB_ETC1_GrPixelConfig: return "RGBETC1";
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig: return "R16";
|
||||
case kRG_1616_GrPixelConfig: return "RG1616";
|
||||
}
|
||||
SK_ABORT("Invalid pixel config");
|
||||
return "<invalid>";
|
||||
|
@ -262,21 +262,6 @@ static bool fill_buffer_with_color(GrPixelConfig config, int width, int height,
|
||||
sk_memset64((uint64_t *) dest, rgbaHalf, width * height);
|
||||
break;
|
||||
}
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig: {
|
||||
uint16_t r16 = SkScalarRoundToInt(colorf.fR * 65535.0f);
|
||||
sk_memset16((uint16_t*) dest, r16, width * height);
|
||||
break;
|
||||
}
|
||||
case kRG_1616_GrPixelConfig: {
|
||||
uint16_t r16 = SkScalarRoundToInt(colorf.fR * 65535.0f);
|
||||
uint16_t g16 = SkScalarRoundToInt(colorf.fG * 65535.0f);
|
||||
|
||||
uint32_t rg1616 = r16 << 16 | g16;
|
||||
|
||||
sk_memset32((uint32_t*) dest, rg1616, width * height);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
|
@ -353,9 +353,6 @@ static constexpr inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
|
||||
return sizeof(int32_t);
|
||||
case kUint_GrVertexAttribType:
|
||||
return sizeof(uint32_t);
|
||||
// Experimental (for P016 and P010)
|
||||
case kUShort_norm_GrVertexAttribType:
|
||||
return sizeof(uint16_t);
|
||||
}
|
||||
// GCC fails because SK_ABORT evaluates to non constexpr. clang and cl.exe think this is
|
||||
// unreachable and don't complain.
|
||||
|
@ -70,9 +70,6 @@ static bool valid_premul_color_type(GrColorType ct) {
|
||||
case GrColorType::kRG_F32: return false;
|
||||
case GrColorType::kRGBA_F32: return true;
|
||||
case GrColorType::kRGB_ETC1: return false;
|
||||
// Experimental (for P016 and P010)
|
||||
case GrColorType::kR_16: return false;
|
||||
case GrColorType::kRG_1616: return false;
|
||||
}
|
||||
SK_ABORT("Invalid GrColorType");
|
||||
return false;
|
||||
@ -106,9 +103,6 @@ static bool valid_premul_config(GrPixelConfig config) {
|
||||
case kAlpha_half_as_Red_GrPixelConfig: return false;
|
||||
case kGray_8_as_Lum_GrPixelConfig: return false;
|
||||
case kGray_8_as_Red_GrPixelConfig: return false;
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig: return false;
|
||||
case kRG_1616_GrPixelConfig: return false;
|
||||
}
|
||||
SK_ABORT("Invalid GrPixelConfig");
|
||||
return false;
|
||||
|
@ -319,9 +319,6 @@ static inline int32_t dither_range_type_for_config(GrPixelConfig dstConfig) {
|
||||
case kRGB_888X_GrPixelConfig:
|
||||
case kRG_88_GrPixelConfig:
|
||||
case kBGRA_8888_GrPixelConfig:
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig:
|
||||
case kRG_1616_GrPixelConfig:
|
||||
return 0;
|
||||
case kRGB_565_GrPixelConfig:
|
||||
return 1;
|
||||
|
@ -1869,11 +1869,11 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
|
||||
}
|
||||
|
||||
ConfigInfo& redInfo = fConfigTable[kAlpha_8_as_Red_GrPixelConfig];
|
||||
redInfo.fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
|
||||
redInfo.fFormatType = kNormalizedFixedPoint_FormatType;
|
||||
redInfo.fFormats.fBaseInternalFormat = GR_GL_RED;
|
||||
redInfo.fFormats.fSizedInternalFormat = GR_GL_R8;
|
||||
redInfo.fFormats.fExternalFormat[kReadPixels_ExternalFormatUsage] = GR_GL_RED;
|
||||
redInfo.fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
|
||||
redInfo.fFormatType = kNormalizedFixedPoint_FormatType;
|
||||
shaderCaps->fConfigTextureSwizzle[kAlpha_8_as_Red_GrPixelConfig] = GrSwizzle::RRRR();
|
||||
|
||||
// ES2 Command Buffer does not allow TexStorage with R8_EXT (so Alpha_8 and Gray_8)
|
||||
@ -1898,11 +1898,11 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
|
||||
}
|
||||
|
||||
ConfigInfo& grayLumInfo = fConfigTable[kGray_8_as_Lum_GrPixelConfig];
|
||||
grayLumInfo.fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
|
||||
grayLumInfo.fFormatType = kNormalizedFixedPoint_FormatType;
|
||||
grayLumInfo.fFormats.fBaseInternalFormat = GR_GL_LUMINANCE;
|
||||
grayLumInfo.fFormats.fSizedInternalFormat = GR_GL_LUMINANCE8;
|
||||
grayLumInfo.fFormats.fExternalFormat[kReadPixels_ExternalFormatUsage] = GR_GL_LUMINANCE;
|
||||
grayLumInfo.fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
|
||||
grayLumInfo.fFormatType = kNormalizedFixedPoint_FormatType;
|
||||
shaderCaps->fConfigTextureSwizzle[kGray_8_as_Lum_GrPixelConfig] = GrSwizzle::RGBA();
|
||||
|
||||
if ((GR_IS_GR_GL(standard) && version <= GR_GL_VER(3, 0)) ||
|
||||
@ -1912,13 +1912,13 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
|
||||
}
|
||||
|
||||
ConfigInfo& grayRedInfo = fConfigTable[kGray_8_as_Red_GrPixelConfig];
|
||||
grayRedInfo.fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
|
||||
grayRedInfo.fFormatType = kNormalizedFixedPoint_FormatType;
|
||||
grayRedInfo.fFormats.fBaseInternalFormat = GR_GL_RED;
|
||||
grayRedInfo.fFormats.fSizedInternalFormat = GR_GL_R8;
|
||||
grayRedInfo.fFormats.fExternalFormat[kReadPixels_ExternalFormatUsage] = GR_GL_RED;
|
||||
grayRedInfo.fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
|
||||
grayRedInfo.fFormatType = kNormalizedFixedPoint_FormatType;
|
||||
grayRedInfo.fFlags = ConfigInfo::kTextureable_Flag;
|
||||
shaderCaps->fConfigTextureSwizzle[kGray_8_as_Red_GrPixelConfig] = GrSwizzle::RRRA();
|
||||
grayRedInfo.fFlags = ConfigInfo::kTextureable_Flag;
|
||||
|
||||
// Leaving Gray8 as non-renderable, to keep things simple and match raster. However, we do
|
||||
// enable the FBOColorAttachment_Flag so that we can bind it to an FBO for copies.
|
||||
@ -2135,59 +2135,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
|
||||
} // No WebGL support
|
||||
shaderCaps->fConfigTextureSwizzle[kRGB_ETC1_GrPixelConfig] = GrSwizzle::RGBA();
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
{
|
||||
// For desktop:
|
||||
// GL 3.0 requires support for R16 & RG16
|
||||
// GL_ARB_texture_rg adds R16 & RG16 support for OpenGL 1.1 and above
|
||||
// For ES:
|
||||
// GL_EXT_texture_norm16 adds support but it requires ES 3.1
|
||||
// There is also the GL_NV_image_formats extension - for further investigation
|
||||
bool r16AndRG1616Supported = false;
|
||||
if (GR_IS_GR_GL(standard)) {
|
||||
if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_texture_rg")) {
|
||||
r16AndRG1616Supported = true;
|
||||
}
|
||||
} else if (GR_IS_GR_GL_ES(standard)) {
|
||||
if (version >= GR_GL_VER(3, 1) && ctxInfo.hasExtension("GL_EXT_texture_norm16")) {
|
||||
r16AndRG1616Supported = true;
|
||||
}
|
||||
} // No WebGL support
|
||||
|
||||
{
|
||||
ConfigInfo& r16Info = fConfigTable[kR_16_GrPixelConfig];
|
||||
|
||||
r16Info.fFormats.fBaseInternalFormat = GR_GL_RED;
|
||||
r16Info.fFormats.fSizedInternalFormat = GR_GL_R16;
|
||||
r16Info.fFormats.fExternalFormat[kReadPixels_ExternalFormatUsage] = GR_GL_RED;
|
||||
r16Info.fFormats.fExternalType = GR_GL_UNSIGNED_SHORT;
|
||||
r16Info.fFormatType = kNormalizedFixedPoint_FormatType;
|
||||
if (r16AndRG1616Supported) {
|
||||
r16Info.fFlags = ConfigInfo::kTextureable_Flag;
|
||||
}
|
||||
// We should only ever be sampling the R channel of this format so don't bother
|
||||
// with a fancy swizzle.
|
||||
shaderCaps->fConfigTextureSwizzle[kR_16_GrPixelConfig] = GrSwizzle::RGBA();
|
||||
}
|
||||
|
||||
{
|
||||
ConfigInfo& rg1616Info = fConfigTable[kRG_1616_GrPixelConfig];
|
||||
|
||||
rg1616Info.fFormats.fBaseInternalFormat = GR_GL_RG;
|
||||
rg1616Info.fFormats.fSizedInternalFormat = GR_GL_RG16;
|
||||
rg1616Info.fFormats.fExternalFormat[kReadPixels_ExternalFormatUsage] = GR_GL_RG;
|
||||
rg1616Info.fFormats.fExternalType = GR_GL_UNSIGNED_SHORT;
|
||||
rg1616Info.fFormatType = kNormalizedFixedPoint_FormatType;
|
||||
if (r16AndRG1616Supported) {
|
||||
rg1616Info.fFlags = ConfigInfo::kTextureable_Flag;
|
||||
}
|
||||
// We should only ever be sampling the R and G channels of this format so don't bother
|
||||
// with a fancy swizzle.
|
||||
shaderCaps->fConfigTextureSwizzle[kRG_1616_GrPixelConfig] = GrSwizzle::RGBA();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Bulk populate the texture internal/external formats here and then deal with exceptions below.
|
||||
|
||||
// ES 2.0 requires that the internal/external formats match.
|
||||
@ -3305,13 +3252,6 @@ static GrPixelConfig get_yuva_config(GrGLenum format) {
|
||||
case GR_GL_R16F:
|
||||
config = kAlpha_half_as_Red_GrPixelConfig;
|
||||
break;
|
||||
// Experimental (for P016 and P010)
|
||||
case GR_GL_R16:
|
||||
config = kR_16_GrPixelConfig;
|
||||
break;
|
||||
case GR_GL_RG16:
|
||||
config = kRG_1616_GrPixelConfig;
|
||||
break;
|
||||
}
|
||||
|
||||
return config;
|
||||
@ -3369,11 +3309,6 @@ static bool format_color_type_valid_pair(GrGLenum format, GrColorType colorType)
|
||||
return GR_GL_RGBA32F == format;
|
||||
case GrColorType::kRGB_ETC1:
|
||||
return GR_GL_COMPRESSED_RGB8_ETC2 == format || GR_GL_COMPRESSED_ETC1_RGB8 == format;
|
||||
// Experimental (for P016 and P010)
|
||||
case GrColorType::kR_16:
|
||||
return GR_GL_R16 == format;
|
||||
case GrColorType::kRG_1616:
|
||||
return GR_GL_RG16 == format;
|
||||
}
|
||||
SK_ABORT("Unknown color type");
|
||||
return false;
|
||||
|
@ -887,12 +887,6 @@ static inline GrGLint config_alignment(GrPixelConfig config) {
|
||||
case kRGB_ETC1_GrPixelConfig:
|
||||
case kUnknown_GrPixelConfig:
|
||||
return 0;
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig:
|
||||
return 2;
|
||||
case kRG_1616_GrPixelConfig:
|
||||
return 4;
|
||||
}
|
||||
SK_ABORT("Invalid pixel config");
|
||||
return 0;
|
||||
@ -4024,14 +4018,6 @@ static bool gl_format_to_pixel_config(GrGLenum format, GrPixelConfig* config) {
|
||||
case GR_GL_R16F:
|
||||
*config = kAlpha_half_GrPixelConfig;
|
||||
return true;
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
case GR_GL_R16:
|
||||
*config = kR_16_GrPixelConfig;
|
||||
return true;
|
||||
case GR_GL_RG16:
|
||||
*config = kRG_1616_GrPixelConfig;
|
||||
return true;
|
||||
}
|
||||
|
||||
SK_ABORT("Unexpected config");
|
||||
|
@ -633,12 +633,6 @@ size_t GrGLBytesPerFormat(GrGLenum glFormat) {
|
||||
case GR_GL_COMPRESSED_RGB8_ETC2: // fall through
|
||||
case GR_GL_COMPRESSED_ETC1_RGB8:
|
||||
return 0;
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
case GR_GL_R16:
|
||||
return 2;
|
||||
case GR_GL_RG16:
|
||||
return 4;
|
||||
}
|
||||
|
||||
SK_ABORT("Invalid GL format");
|
||||
|
@ -74,9 +74,6 @@ static AttribLayout attrib_layout(GrVertexAttribType type) {
|
||||
return {false, 1, GR_GL_INT};
|
||||
case kUint_GrVertexAttribType:
|
||||
return {false, 1, GR_GL_UNSIGNED_INT};
|
||||
// Experimental (for P016 and P010)
|
||||
case kUShort_norm_GrVertexAttribType:
|
||||
return {true, 1, GR_GL_UNSIGNED_SHORT};
|
||||
}
|
||||
SK_ABORT("Unknown vertex attrib type");
|
||||
return {false, 0, 0};
|
||||
|
@ -446,13 +446,6 @@ void GrMtlCaps::initConfigTable() {
|
||||
|
||||
info = &fConfigTable[kRGBA_half_Clamped_GrPixelConfig];
|
||||
info->fFlags = ConfigInfo::kAllFlags;
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
info = &fConfigTable[kR_16_GrPixelConfig];
|
||||
info->fFlags = 0;
|
||||
|
||||
info = &fConfigTable[kRG_1616_GrPixelConfig];
|
||||
info->fFlags = 0;
|
||||
}
|
||||
|
||||
void GrMtlCaps::initStencilFormat(id<MTLDevice> physDev) {
|
||||
@ -585,13 +578,6 @@ static GrPixelConfig get_yuva_config(GrMTLPixelFormat grFormat) {
|
||||
case MTLPixelFormatBGRA8Unorm:
|
||||
return kBGRA_8888_GrPixelConfig;
|
||||
break;
|
||||
// Experimental (for P016 and P010)
|
||||
case MTLPixelFormatR16Unorm:
|
||||
return kR_16_GrPixelConfig;
|
||||
break;
|
||||
case MTLPixelFormatRG16Unorm:
|
||||
return kRG_1616_GrPixelConfig;
|
||||
break;
|
||||
default:
|
||||
return kUnknown_GrPixelConfig;
|
||||
break;
|
||||
@ -666,11 +652,6 @@ static bool format_color_type_valid_pair(MTLPixelFormat format, GrColorType colo
|
||||
#else
|
||||
return MTLPixelFormatETC2_RGB8 == format;
|
||||
#endif
|
||||
// Experimental (for P016 and P010)
|
||||
case GrColorType::kR_16:
|
||||
return MTLPixelFormatR16Unorm == format;
|
||||
case GrColorType::kRG_1616:
|
||||
return MTLPixelFormatRG16Unorm == format;
|
||||
}
|
||||
SK_ABORT("Unknown color type");
|
||||
return false;
|
||||
|
@ -756,13 +756,6 @@ static bool mtl_format_to_pixel_config(MTLPixelFormat format, GrPixelConfig* con
|
||||
*config = kRGB_ETC1_GrPixelConfig;
|
||||
return true;
|
||||
#endif
|
||||
// Experimental (for P016 and P010)
|
||||
case MTLPixelFormatR16Unorm:
|
||||
*config = kR_16_GrPixelConfig;
|
||||
return true;
|
||||
case MTLPixelFormatRG16Unorm:
|
||||
*config = kRG_1616_GrPixelConfig;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -141,9 +141,6 @@ static inline MTLVertexFormat attribute_type_to_mtlformat(GrVertexAttribType typ
|
||||
return MTLVertexFormatInt;
|
||||
case kUint_GrVertexAttribType:
|
||||
return MTLVertexFormatUInt;
|
||||
// Experimental (for P016 and P010)
|
||||
case kUShort_norm_GrVertexAttribType:
|
||||
return MTLVertexFormatUShortNormalized;
|
||||
}
|
||||
SK_ABORT("Unknown vertex attribute type");
|
||||
return MTLVertexFormatInvalid;
|
||||
|
@ -104,12 +104,6 @@ bool GrPixelConfigToMTLFormat(GrPixelConfig config, MTLPixelFormat* format) {
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
case kR_16_GrPixelConfig:
|
||||
*format = MTLPixelFormatR16Unorm;
|
||||
return true;
|
||||
case kRG_1616_GrPixelConfig:
|
||||
*format = MTLPixelFormatRG16Unorm;
|
||||
return true;
|
||||
}
|
||||
SK_ABORT("Unexpected config");
|
||||
return false;
|
||||
|
@ -110,11 +110,6 @@ static int get_compatible_format_class(GrPixelConfig config) {
|
||||
case kGray_8_as_Lum_GrPixelConfig:
|
||||
SK_ABORT("Unsupported Vulkan pixel config");
|
||||
return 0;
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig:
|
||||
return 2;
|
||||
case kRG_1616_GrPixelConfig:
|
||||
return 4;
|
||||
}
|
||||
SK_ABORT("Invalid pixel config");
|
||||
return 0;
|
||||
@ -718,9 +713,6 @@ static bool format_is_srgb(VkFormat format) {
|
||||
case VK_FORMAT_R32G32_SFLOAT:
|
||||
case VK_FORMAT_R16G16B16A16_SFLOAT:
|
||||
case VK_FORMAT_R16_SFLOAT:
|
||||
// Experimental (for P016 and P010)
|
||||
case VK_FORMAT_R16_UNORM:
|
||||
case VK_FORMAT_R16G16_UNORM:
|
||||
return false;
|
||||
default:
|
||||
SK_ABORT("Unsupported VkFormat");
|
||||
@ -747,11 +739,7 @@ static constexpr VkFormat kVkFormats[] = {
|
||||
VK_FORMAT_R32G32_SFLOAT,
|
||||
VK_FORMAT_R8G8B8A8_SRGB,
|
||||
VK_FORMAT_B8G8R8A8_SRGB,
|
||||
VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK,
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
VK_FORMAT_R16_UNORM,
|
||||
VK_FORMAT_R16G16_UNORM,
|
||||
VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK
|
||||
};
|
||||
|
||||
const GrVkCaps::FormatInfo& GrVkCaps::getFormatInfo(VkFormat format) const {
|
||||
@ -1090,11 +1078,6 @@ static GrPixelConfig get_yuva_config(VkFormat vkFormat) {
|
||||
return kBGRA_8888_GrPixelConfig;
|
||||
case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
|
||||
return kRGBA_1010102_GrPixelConfig;
|
||||
// Experimental (for P016 and P010)
|
||||
case VK_FORMAT_R16_UNORM:
|
||||
return kR_16_GrPixelConfig;
|
||||
case VK_FORMAT_R16G16_UNORM:
|
||||
return kRG_1616_GrPixelConfig;
|
||||
default:
|
||||
return kUnknown_GrPixelConfig;
|
||||
}
|
||||
@ -1157,11 +1140,6 @@ static bool format_color_type_valid_pair(VkFormat vkFormat, GrColorType colorTyp
|
||||
return VK_FORMAT_R32G32B32A32_SFLOAT == vkFormat;
|
||||
case GrColorType::kRGB_ETC1:
|
||||
return VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK == vkFormat;
|
||||
// Experimental (for P016 and P010)
|
||||
case GrColorType::kR_16:
|
||||
return VK_FORMAT_R16_UNORM == vkFormat;
|
||||
case GrColorType::kRG_1616:
|
||||
return VK_FORMAT_R16G16_UNORM == vkFormat;
|
||||
}
|
||||
SK_ABORT("Unknown color type");
|
||||
return false;
|
||||
|
@ -223,7 +223,7 @@ private:
|
||||
|
||||
SkTDArray<int> fColorSampleCounts;
|
||||
};
|
||||
static const size_t kNumVkFormats = 19;
|
||||
static const size_t kNumVkFormats = 17;
|
||||
FormatInfo fFormatTable[kNumVkFormats];
|
||||
|
||||
const FormatInfo& getFormatInfo(VkFormat) const;
|
||||
|
@ -1827,13 +1827,6 @@ static bool vk_format_to_pixel_config(VkFormat format, GrPixelConfig* config) {
|
||||
case VK_FORMAT_R16_SFLOAT:
|
||||
*config = kAlpha_half_GrPixelConfig;
|
||||
return true;
|
||||
// Experimental (for P016 and P010)
|
||||
case VK_FORMAT_R16_UNORM:
|
||||
*config = kR_16_GrPixelConfig;
|
||||
return true;
|
||||
case VK_FORMAT_R16G16_UNORM:
|
||||
*config = kRG_1616_GrPixelConfig;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -74,9 +74,6 @@ static inline VkFormat attrib_type_to_vkformat(GrVertexAttribType type) {
|
||||
return VK_FORMAT_R32_SINT;
|
||||
case kUint_GrVertexAttribType:
|
||||
return VK_FORMAT_R32_UINT;
|
||||
// Experimental (for P016 and P010)
|
||||
case kUShort_norm_GrVertexAttribType:
|
||||
return VK_FORMAT_R16_UNORM;
|
||||
}
|
||||
SK_ABORT("Unknown vertex attrib type");
|
||||
return VK_FORMAT_UNDEFINED;
|
||||
|
@ -83,13 +83,6 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) {
|
||||
case kAlpha_half_as_Red_GrPixelConfig:
|
||||
*format = VK_FORMAT_R16_SFLOAT;
|
||||
return true;
|
||||
// Experimental (for P016 and P010)
|
||||
case kR_16_GrPixelConfig:
|
||||
*format = VK_FORMAT_R16_UNORM;
|
||||
return true;
|
||||
case kRG_1616_GrPixelConfig:
|
||||
*format = VK_FORMAT_R16G16_UNORM;
|
||||
return true;
|
||||
}
|
||||
SK_ABORT("Unexpected config");
|
||||
return false;
|
||||
@ -136,11 +129,6 @@ bool GrVkFormatPixelConfigPairIsValid(VkFormat format, GrPixelConfig config) {
|
||||
case VK_FORMAT_R16_SFLOAT:
|
||||
return kAlpha_half_GrPixelConfig == config ||
|
||||
kAlpha_half_as_Red_GrPixelConfig == config;
|
||||
// Experimental (for P016 and P010)
|
||||
case VK_FORMAT_R16_UNORM:
|
||||
return kR_16_GrPixelConfig == config;
|
||||
case VK_FORMAT_R16G16_UNORM:
|
||||
return kRG_1616_GrPixelConfig == config;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -165,10 +153,6 @@ bool GrVkFormatIsSupported(VkFormat format) {
|
||||
case VK_FORMAT_R32G32_SFLOAT:
|
||||
case VK_FORMAT_R16G16B16A16_SFLOAT:
|
||||
case VK_FORMAT_R16_SFLOAT:
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
case VK_FORMAT_R16_UNORM:
|
||||
case VK_FORMAT_R16G16_UNORM:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -306,12 +290,6 @@ size_t GrVkBytesPerFormat(VkFormat vkFormat) {
|
||||
case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
|
||||
return 0;
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
case VK_FORMAT_R16_UNORM:
|
||||
return 2;
|
||||
case VK_FORMAT_R16G16_UNORM:
|
||||
return 4;
|
||||
|
||||
default:
|
||||
SK_ABORT("Invalid Vk format");
|
||||
return 0;
|
||||
|
@ -454,12 +454,6 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GLBackendAllocationTest, reporter, ctxInfo) {
|
||||
kRGB_ETC1_GrPixelConfig, SkColors::kRed },
|
||||
{ kUnknown_SkColorType, GR_GL_COMPRESSED_ETC1_RGB8,
|
||||
kRGB_ETC1_GrPixelConfig, SkColors::kRed },
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
{ kUnknown_SkColorType, GR_GL_R16,
|
||||
kR_16_GrPixelConfig, SkColors::kRed },
|
||||
{ kUnknown_SkColorType, GR_GL_RG16,
|
||||
kRG_1616_GrPixelConfig, SkColors::kYellow },
|
||||
};
|
||||
|
||||
for (auto combo : combinations) {
|
||||
@ -599,11 +593,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendAllocationTest, reporter, ctxInfo) {
|
||||
{ kUnknown_SkColorType, VK_FORMAT_R32G32_SFLOAT, { 0.7f, 0.7f, 0, 0 } },
|
||||
{ kUnknown_SkColorType, VK_FORMAT_R8G8_UNORM, { 0.5f, 0.5f, 0, 0 } },
|
||||
{ kUnknown_SkColorType, VK_FORMAT_R16_SFLOAT, { 1.0f, 0, 0, 0.5f } },
|
||||
{ kUnknown_SkColorType, VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK, SkColors::kRed },
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
{ kUnknown_SkColorType, VK_FORMAT_R16_UNORM, SkColors::kRed },
|
||||
{ kUnknown_SkColorType, VK_FORMAT_R16G16_UNORM, SkColors::kYellow },
|
||||
{ kUnknown_SkColorType, VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK, SkColors::kRed },
|
||||
};
|
||||
|
||||
for (auto combo : combinations) {
|
||||
|
@ -104,10 +104,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
|
||||
kRGBA_half_GrPixelConfig,
|
||||
kRGBA_half_Clamped_GrPixelConfig,
|
||||
kRGB_ETC1_GrPixelConfig,
|
||||
|
||||
// Experimental (for P016 and P010)
|
||||
kR_16_GrPixelConfig,
|
||||
kRG_1616_GrPixelConfig,
|
||||
};
|
||||
GR_STATIC_ASSERT(kGrPixelConfigCnt == SK_ARRAY_COUNT(configs));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user