Revert "Use glTexStorage for non-MIP mapped textures."

This reverts commit 4acd3591e7.

Reason for revert: broke command buffer bot

Original change's description:
> Use glTexStorage for non-MIP mapped textures.
> 
> We used to lazily add MIP levels to textures that originally only had
> a base level. However, we don't do that anymore.
> 
> Also, add workaround for BGRA+Intel Windows driver+ES.
> 
> 
> Change-Id: I595261d12608effed4c7d4d4e5777869969acf84
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202719
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com

Change-Id: Ie91a31f8558564ddd45d63591bf0725c64faa514
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202949
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2019-03-22 14:01:26 +00:00 committed by Skia Commit-Bot
parent d64be92bbe
commit d18cf5f6d4
2 changed files with 11 additions and 14 deletions

View File

@ -1336,8 +1336,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
Adds R16F, RG16F, RGBA16F, R32F, RG32F, RGBA32F, R11F_G11F_B10F.
*/
GrGLStandard standard = ctxInfo.standard();
// Correctness workarounds.
bool disableTextureRedForMesa = false;
bool disableSRGBForX86PowerVR = false;
@ -1346,7 +1344,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
bool disableSRGBRenderWithMSAAForMacAMD = false;
bool disableRGB8ForMali400 = false;
bool disableGrayLumFBOForMesa = false;
bool disableBGRATextureStorageForIntelWindowsES = false;
if (!contextOptions.fDisableDriverCorrectnessWorkarounds) {
// ARB_texture_rg is part of OpenGL 3.0, but osmesa doesn't support GL_RED
@ -1379,13 +1376,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
#endif
// Mali-400 fails ReadPixels tests, mostly with non-0xFF alpha values when read as GL_RGBA8.
disableRGB8ForMali400 = kMali4xx_GrGLRenderer == ctxInfo.renderer();
#if defined(SK_BUILD_FOR_WIN)
// On Intel Windows ES contexts it seems that using texture storage with BGRA causes
// problems with cross-context SkImages.
disableBGRATextureStorageForIntelWindowsES = kIntel_GrGLDriver == ctxInfo.driver() &&
GR_IS_GR_GL_ES(standard);
#endif
}
uint32_t nonMSAARenderFlags = ConfigInfo::kRenderable_Flag |
@ -1394,6 +1384,7 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
if (kNone_MSFBOType != fMSFBOType) {
allRenderFlags |= ConfigInfo::kRenderableWithMSAA_Flag;
}
GrGLStandard standard = ctxInfo.standard();
// standard can be unused (optimzed away) if SK_ASSUME_GL_ES is set
sk_ignore_unused_variable(standard);
GrGLVersion version = ctxInfo.version();
@ -1542,9 +1533,7 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag |
nonMSAARenderFlags;
// GL_EXT_texture storage has defined interactions with GL_EXT_texture_format_BGRA8888.
if (ctxInfo.hasExtension("GL_EXT_texture_storage") &&
!disableBGRATextureStorageForIntelWindowsES) {
if (ctxInfo.hasExtension("GL_EXT_texture_storage")) {
supportsBGRATexStorage = true;
}
if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888") &&

View File

@ -987,7 +987,15 @@ static bool allocate_and_populate_texture(GrPixelConfig config,
int baseWidth, int baseHeight) {
CLEAR_ERROR_BEFORE_ALLOC(&interface);
if (caps.isConfigTexSupportEnabled(config)) {
bool useTexStorage = caps.isConfigTexSupportEnabled(config);
// We can only use TexStorage if we know we will not later change the storage requirements.
// This means if we may later want to add mipmaps, we cannot use TexStorage.
// Right now, we cannot know if we will later add mipmaps or not.
// The only time we can use TexStorage is when we already have the
// mipmaps.
useTexStorage &= mipLevelCount > 1;
if (useTexStorage) {
// We never resize or change formats of textures.
GL_ALLOC_CALL(&interface,
TexStorage2D(target, SkTMax(mipLevelCount, 1), internalFormatForTexStorage,