Skip the sRGB mip-map testing on command buffer

Chromium command buffer now has the sRGB decode extension, but it doesn't
make any guarantees about the interaction with glGenerateMipmap.

BUG=skia:

Review-Url: https://codereview.chromium.org/2557603006
This commit is contained in:
brianosman 2016-12-07 10:03:25 -08:00 committed by Commit bot
parent 27eb22b994
commit 851c2386ba
3 changed files with 10 additions and 1 deletions

View File

@ -52,6 +52,7 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
fRGBAToBGRAReadbackConversionsAreSlow = false;
fDoManualMipmapping = false;
fSRGBDecodeDisableSupport = false;
fSRGBDecodeDisableAffectsMipmaps = false;
fBlitFramebufferFlags = kNoSupport_BlitFramebufferFlag;
@ -609,6 +610,8 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
}
fSRGBDecodeDisableSupport = ctxInfo.hasExtension("GL_EXT_texture_sRGB_decode");
fSRGBDecodeDisableAffectsMipmaps = fSRGBDecodeDisableSupport &&
kChromium_GrGLDriver != ctxInfo.driver();
// Requires fTextureRedSupport, fTextureSwizzleSupport, msaa support, ES compatibility have
// already been detected.

View File

@ -346,6 +346,7 @@ public:
bool doManualMipmapping() const { return fDoManualMipmapping; }
bool srgbDecodeDisableSupport() const { return fSRGBDecodeDisableSupport; }
bool srgbDecodeDisableAffectsMipmaps() const { return fSRGBDecodeDisableAffectsMipmaps; }
/**
* Returns a string containing the caps info.
@ -424,6 +425,7 @@ private:
bool fRGBAToBGRAReadbackConversionsAreSlow : 1;
bool fDoManualMipmapping : 1;
bool fSRGBDecodeDisableSupport : 1;
bool fSRGBDecodeDisableAffectsMipmaps : 1;
uint32_t fBlitFramebufferFlags;

View File

@ -148,10 +148,14 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
// skbug.com/5048). On GL, we may not have sRGB decode support. In that case, rendering sRGB
// textures to a legacy surface produces nonsense, so this part of the test is meaningless.
//
// We also skip this part of the test on command buffer (via srgbDecodeDisableAffectsMipmaps),
// because that implementation of the extension doesn't ensure that mips respect the setting.
//
// TODO: Once Vulkan supports legacy mip-mapping, we can promote this to GrCaps. Right now,
// Vulkan has most of the functionality, but not the mip-mapping part that's being tested here.
GrGLGpu* glGpu = static_cast<GrGLGpu*>(context->getGpu());
if (glGpu->glCaps().srgbDecodeDisableSupport()) {
if (glGpu->glCaps().srgbDecodeDisableSupport() &&
glGpu->glCaps().srgbDecodeDisableAffectsMipmaps()) {
read_and_check_pixels(reporter, l32RenderTargetContext->asTexture().get(), expectedLinear,
error, "re-render as linear");
}