Revert "Allow direct readback for formats in non-ES OpenGL"
This reverts commit 162d16891fa07768d9fb9fbcd357a06878284907.
Reason for revert: red on bots
Original change's description:
> Allow direct readback for formats in non-ES OpenGL
>
> Bug: skia:8962
> Change-Id: I85a2e228892a54cc2a0abd607d034515a9af12af
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250258
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: I9509665678e3f4984143ff4f2d91565c4339a006
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8962
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250656
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 30a7cdb..ef45e14 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -1377,7 +1377,7 @@
this->setColorTypeFormat(GrColorType::kRGBA_8888, GrGLFormat::kRGBA8);
// External IO ColorTypes:
- ctInfo.fExternalIOFormatCount = 2;
+ ctInfo.fExternalIOFormatCount = 1;
ctInfo.fExternalIOFormats.reset(
new ColorTypeInfo::ExternalIOFormats[ctInfo.fExternalIOFormatCount]());
int ioIdx = 0;
@@ -1389,14 +1389,6 @@
ioFormat.fExternalTexImageFormat = GR_GL_RGBA;
ioFormat.fExternalReadFormat = GR_GL_RGBA;
}
- // Format: RGBA8, Surface: kRGBA_8888, Data: kBGRA_8888
- {
- auto& ioFormat = ctInfo.fExternalIOFormats[ioIdx++];
- ioFormat.fColorType = GrColorType::kBGRA_8888;
- ioFormat.fExternalType = GR_GL_UNSIGNED_BYTE;
- ioFormat.fExternalTexImageFormat = 0; // TODO: Enable this on non-ES GL
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_BGRA : 0;
- }
}
// Format: RGBA8, Surface: kBGRA_8888
@@ -1417,7 +1409,7 @@
ioFormat.fColorType = GrColorType::kBGRA_8888;
ioFormat.fExternalType = GR_GL_UNSIGNED_BYTE;
ioFormat.fExternalTexImageFormat = GR_GL_BGRA;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_BGRA : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: RGBA8, Surface: kBGRA_8888, Data: kRGBA_8888
@@ -1506,7 +1498,7 @@
ioFormat.fColorType = GrColorType::kAlpha_8;
ioFormat.fExternalType = GR_GL_UNSIGNED_BYTE;
ioFormat.fExternalTexImageFormat = GR_GL_RED;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_RED : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: R8, Surface: kAlpha_8, Data: kAlpha_8xxx
@@ -1538,7 +1530,7 @@
ioFormat.fColorType = GrColorType::kGray_8;
ioFormat.fExternalType = GR_GL_UNSIGNED_BYTE;
ioFormat.fExternalTexImageFormat = GR_GL_RED;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_RED : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: R8, Surface: kGray_8, Data: kGray_8xxx
@@ -1631,7 +1623,7 @@
ioFormat.fColorType = GrColorType::kAlpha_8;
ioFormat.fExternalType = GR_GL_UNSIGNED_BYTE;
ioFormat.fExternalTexImageFormat = GR_GL_ALPHA;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_ALPHA : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: ALPHA8, Surface: kAlpha_8, Data: kRGBA_8888
@@ -1837,7 +1829,6 @@
ioFormat.fExternalType = GR_GL_UNSIGNED_BYTE;
ioFormat.fExternalTexImageFormat = GR_GL_BGRA;
ioFormat.fExternalReadFormat = 0;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_BGRA : 0;
}
// Format: BGRA8, Surface: kBGRA_8888, Data: kRGBA_8888
@@ -1906,7 +1897,7 @@
ioFormat.fColorType = GrColorType::kBGR_565;
ioFormat.fExternalType = GR_GL_UNSIGNED_SHORT_5_6_5;
ioFormat.fExternalTexImageFormat = GR_GL_RGB;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_RGB : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: RGB565, Surface: kBGR_565, Data: kRGBA_8888
@@ -2009,7 +2000,7 @@
ioFormat.fColorType = GrColorType::kRGBA_F16;
ioFormat.fExternalType = halfFloatType;
ioFormat.fExternalTexImageFormat = GR_GL_RGBA;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_RGBA : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: RGBA16F, Surface: kRGBA_F16, Data: kRGBA_F32
@@ -2040,7 +2031,7 @@
ioFormat.fColorType = GrColorType::kRGBA_F16_Clamped;
ioFormat.fExternalType = halfFloatType;
ioFormat.fExternalTexImageFormat = GR_GL_RGBA;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_RGBA : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: RGBA16F, Surface: kRGBA_F16_Clamped, Data: kRGBA_F32
@@ -2129,7 +2120,7 @@
ioFormat.fColorType = GrColorType::kAlpha_F16;
ioFormat.fExternalType = halfFloatType;
ioFormat.fExternalTexImageFormat = GR_GL_RED;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_RED : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: R16F, Surface: kAlpha_F16, Data: kAlpha_F32xxx
@@ -2358,9 +2349,6 @@
ioFormat.fExternalType = GR_GL_UNSIGNED_BYTE;
ioFormat.fExternalTexImageFormat = GR_GL_RG;
ioFormat.fExternalReadFormat = 0;
- if (GR_IS_GR_GL(standard) && !formatWorkarounds.fDisallowDirectRG8ReadPixels) {
- ioFormat.fExternalReadFormat = GR_GL_RG;
- }
}
// Format: RG8, Surface: kRG_88, Data: kRGBA_8888
@@ -2420,7 +2408,7 @@
ioFormat.fColorType = GrColorType::kRGBA_1010102;
ioFormat.fExternalType = GR_GL_UNSIGNED_INT_2_10_10_10_REV;
ioFormat.fExternalTexImageFormat = GR_GL_RGBA;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_RGBA : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: RGB10_A2, Surface: kRGBA_1010102, Data: kRGBA_8888
@@ -2482,7 +2470,7 @@
ioFormat.fColorType = GrColorType::kABGR_4444;
ioFormat.fExternalType = GR_GL_UNSIGNED_SHORT_4_4_4_4;
ioFormat.fExternalTexImageFormat = GR_GL_RGBA;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_RGBA : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: RGBA4, Surface: kABGR_4444, Data: kRGBA_8888
@@ -2689,7 +2677,7 @@
ioFormat.fColorType = GrColorType::kAlpha_16;
ioFormat.fExternalType = GR_GL_UNSIGNED_SHORT;
ioFormat.fExternalTexImageFormat = GR_GL_RED;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_RED : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: R16, Surface: kAlpha_16, Data: kAlpha_8xxx
@@ -2755,7 +2743,7 @@
ioFormat.fColorType = GrColorType::kRG_1616;
ioFormat.fExternalType = GR_GL_UNSIGNED_SHORT;
ioFormat.fExternalTexImageFormat = GR_GL_RG;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_RG : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: GR_GL_RG16, Surface: kRG_1616, Data: kRGBA_8888
@@ -2820,7 +2808,7 @@
ioFormat.fColorType = GrColorType::kRGBA_16161616;
ioFormat.fExternalType = GR_GL_UNSIGNED_SHORT;
ioFormat.fExternalTexImageFormat = GR_GL_RGBA;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_RGBA : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: GR_GL_RGBA16, Surface: kRGBA_16161616, Data: kRGBA_8888
@@ -2909,7 +2897,7 @@
ioFormat.fColorType = GrColorType::kRG_F16;
ioFormat.fExternalType = halfFloatType;
ioFormat.fExternalTexImageFormat = GR_GL_RG;
- ioFormat.fExternalReadFormat = GR_IS_GR_GL(standard) ? GR_GL_RG : 0;
+ ioFormat.fExternalReadFormat = 0;
}
// Format: GR_GL_RG16F, Surface: kRG_F16, Data: kRGBA_F32
@@ -2949,6 +2937,8 @@
for (int k = 0; k < ctInfo.fExternalIOFormatCount; ++k) {
const auto& ioInfo = ctInfo.fExternalIOFormats[k];
SkASSERT(ioInfo.fColorType != GrColorType::kUnknown);
+ // Make sure we at least support either reading or tex image.
+ SkASSERT(ioInfo.fExternalReadFormat || ioInfo.fExternalTexImageFormat);
}
}
}
@@ -3692,13 +3682,6 @@
formatWorkarounds->fDisableLuminance16F = kIntelBroadwell_GrGLRenderer == ctxInfo.renderer() ||
ctxInfo.vendor() == kQualcomm_GrGLVendor;
-#ifdef SK_BUILD_FOR_MAC
- // On a MacBookPro 11.5 running MacOS 10.13 with a Radeon M370X the TransferPixelsFrom test
- // fails when transfering out from a GL_RG8 texture using GL_RG/GL_UNSIGNED_BYTE.
- formatWorkarounds->fDisallowDirectRG8ReadPixels =
- ctxInfo.renderer() == kAMDRadeonR9M3xx_GrGLRenderer;
-#endif
-
#ifdef SK_BUILD_FOR_ANDROID
// We don't usually use glTexStorage() on Android for performance reasons. (crbug.com/945506).
// On a NVIDIA Shield TV running Android 7.0 creating a texture with glTexImage2D() with
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 99058a6..ef10d76 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -449,7 +449,6 @@
bool fDisableRGB8ForMali400 = false;
bool fDisableLuminance16F = false;
bool fDontDisableTexStorageOnAndroid = false;
- bool fDisallowDirectRG8ReadPixels = false;
};
void applyDriverCorrectnessWorkarounds(const GrGLContextInfo&, const GrContextOptions&,
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp
index aca2e46..73d3e15 100644
--- a/src/gpu/gl/GrGLUtil.cpp
+++ b/src/gpu/gl/GrGLUtil.cpp
@@ -466,9 +466,7 @@
n = sscanf(amdString, "Radeon (TM) R9 M%c%c%c",
&amdGeneration, &amdTier, &amdRevision);
if (3 == n) {
- if ('3' == amdGeneration) {
- return kAMDRadeonR9M3xx_GrGLRenderer;
- } else if ('4' == amdGeneration) {
+ if ('4' == amdGeneration) {
return kAMDRadeonR9M4xx_GrGLRenderer;
}
}
diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h
index 9b72f0a..65913ff 100644
--- a/src/gpu/gl/GrGLUtil.h
+++ b/src/gpu/gl/GrGLUtil.h
@@ -95,7 +95,6 @@
kANGLE_GrGLRenderer,
kAMDRadeonHD7xxx_GrGLRenderer, // AMD Radeon HD 7000 Series
- kAMDRadeonR9M3xx_GrGLRenderer, // AMD Radeon R9 M300 Series
kAMDRadeonR9M4xx_GrGLRenderer, // AMD Radeon R9 M400 Series
kOther_GrGLRenderer