aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-12-02 06:43:32 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-12-02 06:43:32 -0800
commit20471894eaa441193d5ae8f2395e8244c91c55af (patch)
treecc003f32bc938c79dcc8ea6bd477193924b235b5 /tests
parent4b7b6f0229fa51f5beb71f92cb77ba84d39b41e1 (diff)
Two (related) changes here:
1) Our older iOS devices failed our sRGB tests, due to precision issues with alpha. At this point, we only test on iPadMini 4, and that appears not to have any problems. 2) iOS devices still don't have the sRGB texture decode extension. But, some clients have no interest in mixing legacy/color-correct rendering, and would like to use sRGB on these devices. This GrContextOptions flag enables sRGB support in those cases. Adjust the test code to produce sRGB capable contexts on these devices, but only for configs that have a color space. (See comment). BUG=skia:4148 Committed: https://skia.googlesource.com/skia/+/9db12d2341f3f8722c8b90b11dd4cce138a8a64e Committed: https://skia.googlesource.com/skia/+/1aeb78c5d978b35b256525b711edd942bce01444 Review-Url: https://codereview.chromium.org/2539993002
Diffstat (limited to 'tests')
-rw-r--r--tests/SRGBMipMapTest.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index a875c5c710..88f08d43d7 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -10,6 +10,7 @@
#include "GrCaps.h"
#include "GrContext.h"
#include "GrRenderTargetContext.h"
+#include "gl/GrGLGpu.h"
#include "SkCanvas.h"
#include "SkSurface.h"
@@ -142,8 +143,18 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
// 2) Draw texture to L32 surface (should generate/use linear mips)
paint.setGammaCorrect(false);
l32RenderTargetContext->drawRect(noClip, paint, SkMatrix::I(), rect);
- read_and_check_pixels(reporter, l32RenderTargetContext->asTexture().get(), expectedLinear,
- error, "re-render as linear");
+
+ // Right now, this test only runs on GL (because Vulkan doesn't support legacy mip-mapping
+ // 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.
+ //
+ // 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()) {
+ read_and_check_pixels(reporter, l32RenderTargetContext->asTexture().get(), expectedLinear,
+ error, "re-render as linear");
+ }
// 3) Go back to sRGB
paint.setGammaCorrect(true);