Add RG format to Metal

Bug: skia:8243
Change-Id: I2140a558afeacaca26c81355c906cf6ae16a2df4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206917
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Jim Van Verth 2019-04-09 15:26:38 -04:00 committed by Skia Commit-Bot
parent 9816878163
commit 46431bf9d0
2 changed files with 9 additions and 3 deletions

View File

@ -400,6 +400,10 @@ void GrMtlCaps::initConfigTable() {
info = &fConfigTable[kRGB_888_GrPixelConfig];
info->fFlags = ConfigInfo::kTextureable_Flag;
// RG_88 uses RG8Unorm
info = &fConfigTable[kRG_88_GrPixelConfig];
info->fFlags = ConfigInfo::kTextureable_Flag;
// BGRA_8888 uses BGRA8Unorm
info = &fConfigTable[kBGRA_8888_GrPixelConfig];
info->fFlags = ConfigInfo::kAllFlags;
@ -561,7 +565,9 @@ static GrPixelConfig get_yuva_config(GrMTLPixelFormat grFormat) {
case MTLPixelFormatR8Unorm:
return kAlpha_8_as_Red_GrPixelConfig;
break;
// TODO: Add RG_88 format here
case MTLPixelFormatRG8Unorm:
return kRG_88_GrPixelConfig;
break;
case MTLPixelFormatRGBA8Unorm:
return kRGBA_8888_GrPixelConfig;
break;

View File

@ -37,8 +37,8 @@ bool GrPixelConfigToMTLFormat(GrPixelConfig config, MTLPixelFormat* format) {
*format = MTLPixelFormatRGBA8Unorm;
return true;
case kRG_88_GrPixelConfig:
// TODO: MTLPixelFormatRG8Unorm
return false;
*format = MTLPixelFormatRG8Unorm;
return true;
case kBGRA_8888_GrPixelConfig:
*format = MTLPixelFormatBGRA8Unorm;
return true;