OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Test.h" | 8 #include "Test.h" |
9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 "first render of sRGB"); | 141 "first render of sRGB"); |
142 | 142 |
143 // 2) Draw texture to L32 surface (should generate/use linear mips) | 143 // 2) Draw texture to L32 surface (should generate/use linear mips) |
144 paint.setGammaCorrect(false); | 144 paint.setGammaCorrect(false); |
145 l32RenderTargetContext->drawRect(noClip, paint, SkMatrix::I(), rect); | 145 l32RenderTargetContext->drawRect(noClip, paint, SkMatrix::I(), rect); |
146 | 146 |
147 // Right now, this test only runs on GL (because Vulkan doesn't support lega
cy mip-mapping | 147 // Right now, this test only runs on GL (because Vulkan doesn't support lega
cy mip-mapping |
148 // skbug.com/5048). On GL, we may not have sRGB decode support. In that case
, rendering sRGB | 148 // skbug.com/5048). On GL, we may not have sRGB decode support. In that case
, rendering sRGB |
149 // textures to a legacy surface produces nonsense, so this part of the test
is meaningless. | 149 // textures to a legacy surface produces nonsense, so this part of the test
is meaningless. |
150 // | 150 // |
| 151 // We also skip this part of the test on command buffer (via srgbDecodeDisab
leAffectsMipmaps), |
| 152 // because that implementation of the extension doesn't ensure that mips res
pect the setting. |
| 153 // |
151 // TODO: Once Vulkan supports legacy mip-mapping, we can promote this to GrC
aps. Right now, | 154 // TODO: Once Vulkan supports legacy mip-mapping, we can promote this to GrC
aps. Right now, |
152 // Vulkan has most of the functionality, but not the mip-mapping part that's
being tested here. | 155 // Vulkan has most of the functionality, but not the mip-mapping part that's
being tested here. |
153 GrGLGpu* glGpu = static_cast<GrGLGpu*>(context->getGpu()); | 156 GrGLGpu* glGpu = static_cast<GrGLGpu*>(context->getGpu()); |
154 if (glGpu->glCaps().srgbDecodeDisableSupport()) { | 157 if (glGpu->glCaps().srgbDecodeDisableSupport() && |
| 158 glGpu->glCaps().srgbDecodeDisableAffectsMipmaps()) { |
155 read_and_check_pixels(reporter, l32RenderTargetContext->asTexture().get(
), expectedLinear, | 159 read_and_check_pixels(reporter, l32RenderTargetContext->asTexture().get(
), expectedLinear, |
156 error, "re-render as linear"); | 160 error, "re-render as linear"); |
157 } | 161 } |
158 | 162 |
159 // 3) Go back to sRGB | 163 // 3) Go back to sRGB |
160 paint.setGammaCorrect(true); | 164 paint.setGammaCorrect(true); |
161 s32RenderTargetContext->drawRect(noClip, paint, SkMatrix::I(), rect); | 165 s32RenderTargetContext->drawRect(noClip, paint, SkMatrix::I(), rect); |
162 read_and_check_pixels(reporter, s32RenderTargetContext->asTexture().get(), e
xpectedSRGB, error, | 166 read_and_check_pixels(reporter, s32RenderTargetContext->asTexture().get(), e
xpectedSRGB, error, |
163 "re-render as sRGB"); | 167 "re-render as sRGB"); |
164 } | 168 } |
165 #endif | 169 #endif |
OLD | NEW |