Fixes for running on the iOS simulator.

* Disable pixel formats not supported by Metal on the simulator
* Work around invalid sample count value in GLES

Change-Id: I711c3d906ef1c0a467dfc1fb5d36eac2277e7ae0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/282270
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2020-04-08 13:53:55 -04:00 committed by Skia Commit-Bot
parent 185d3d4fa7
commit 5ca3e54301
2 changed files with 9 additions and 3 deletions

View File

@ -3094,7 +3094,13 @@ void GrGLCaps::setupSampleCounts(const GrGLContextInfo& ctxInfo, const GrGLInter
// returned by GL so that the array is ascending.
fFormatTable[i].fColorSampleCounts[0] = 1;
for (int j = 0; j < count; ++j) {
#if TARGET_OS_SIMULATOR
// The iOS simulator is reporting incorrect values for sample counts,
// so force them to be a power of 2.
fFormatTable[i].fColorSampleCounts[j+1] = SkPrevPow2(temp[count - j - 1]);
#else
fFormatTable[i].fColorSampleCounts[j+1] = temp[count - j - 1];
#endif
}
}
} else {

View File

@ -572,7 +572,7 @@ void GrMtlCaps::initFormatTable() {
}
}
#ifdef SK_BUILD_FOR_IOS
#if defined(SK_BUILD_FOR_IOS) && !TARGET_OS_SIMULATOR
// Format: B5G6R5Unorm
{
info = &fFormatTable[GetFormatIndex(MTLPixelFormatB5G6R5Unorm)];
@ -836,7 +836,7 @@ void GrMtlCaps::initFormatTable() {
this->setColorType(GrColorType::kAlpha_8, { MTLPixelFormatR8Unorm,
MTLPixelFormatA8Unorm });
#ifdef SK_BUILD_FOR_IOS
#if defined(SK_BUILD_FOR_IOS) && !TARGET_OS_SIMULATOR
this->setColorType(GrColorType::kBGR_565, { MTLPixelFormatB5G6R5Unorm });
this->setColorType(GrColorType::kABGR_4444, { MTLPixelFormatABGR4Unorm });
#endif
@ -1076,7 +1076,7 @@ std::vector<GrCaps::TestFormatColorTypeCombination> GrMtlCaps::getTestingCombina
std::vector<GrCaps::TestFormatColorTypeCombination> combos = {
{ GrColorType::kAlpha_8, GrBackendFormat::MakeMtl(MTLPixelFormatA8Unorm) },
{ GrColorType::kAlpha_8, GrBackendFormat::MakeMtl(MTLPixelFormatR8Unorm) },
#ifdef SK_BUILD_FOR_IOS
#if defined(SK_BUILD_FOR_IOS) && !TARGET_OS_SIMULATOR
{ GrColorType::kBGR_565, GrBackendFormat::MakeMtl(MTLPixelFormatB5G6R5Unorm) },
{ GrColorType::kABGR_4444, GrBackendFormat::MakeMtl(MTLPixelFormatABGR4Unorm) },
#endif