Support more YUV texture formats for Metal

Bug: skia:8243
Change-Id: Ie8b562f4e8ec6efeff1be7d7e0f3ff89ab3e99a7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219487
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Jim Van Verth 2019-06-11 11:53:07 -04:00 committed by Skia Commit-Bot
parent 024bd0058b
commit 6488077ea3

View File

@ -376,6 +376,14 @@ void GrMtlCaps::initConfigTable() {
info = &fConfigTable[kSBGRA_8888_GrPixelConfig];
info->fFlags = ConfigInfo::kAllFlags;
// kRGBA_1010102 uses RGB10A2Unorm
info = &fConfigTable[kRGBA_1010102_GrPixelConfig];
if (this->isMac() || fFamilyGroup >= 3) {
info->fFlags = ConfigInfo::kAllFlags;
} else {
info->fFlags = ConfigInfo::kTextureable_Flag;
}
// RGBA_float uses RGBA32Float
info = &fConfigTable[kRGBA_float_GrPixelConfig];
if (this->isMac()) {
@ -404,11 +412,23 @@ void GrMtlCaps::initConfigTable() {
info->fFlags = ConfigInfo::kAllFlags;
// Experimental (for P016 and P010)
// R_16 uses R16Unorm
info = &fConfigTable[kR_16_GrPixelConfig];
info->fFlags = 0;
if (this->isMac()) {
info->fFlags = ConfigInfo::kAllFlags;
} else {
info->fFlags = ConfigInfo::kTextureable_Flag | ConfigInfo::kRenderable_Flag |
ConfigInfo::kMSAA_Flag;
}
// RG_1616 uses RG16Unorm
info = &fConfigTable[kRG_1616_GrPixelConfig];
info->fFlags = 0;
if (this->isMac()) {
info->fFlags = ConfigInfo::kAllFlags;
} else {
info->fFlags = ConfigInfo::kTextureable_Flag | ConfigInfo::kRenderable_Flag |
ConfigInfo::kMSAA_Flag;
}
}
void GrMtlCaps::initStencilFormat(id<MTLDevice> physDev) {
@ -541,6 +561,9 @@ static GrPixelConfig get_yuva_config(GrMTLPixelFormat grFormat) {
case MTLPixelFormatBGRA8Unorm:
return kBGRA_8888_GrPixelConfig;
break;
case MTLPixelFormatRGB10A2Unorm:
return kRGBA_1010102_GrPixelConfig;
break;
// Experimental (for P016 and P010)
case MTLPixelFormatR16Unorm:
return kR_16_GrPixelConfig;