Index: cc/trees/layer_tree_host_pixeltest_blending.cc |
diff --git a/cc/trees/layer_tree_host_pixeltest_blending.cc b/cc/trees/layer_tree_host_pixeltest_blending.cc |
index 5bce9ddb70196fdba90d7c3d3de95f549ab1eee9..eaae2ccf5dee18a68d9d70e9aabe32f18366e5ac 100644 |
--- a/cc/trees/layer_tree_host_pixeltest_blending.cc |
+++ b/cc/trees/layer_tree_host_pixeltest_blending.cc |
@@ -6,6 +6,7 @@ |
#include "cc/layers/solid_color_layer.h" |
#include "cc/test/layer_tree_pixel_test.h" |
#include "cc/test/pixel_comparator.h" |
+#include "cc/test/test_in_process_context_provider.h" |
#if !defined(OS_ANDROID) |
@@ -52,6 +53,22 @@ using RenderPassOptions = uint32; |
const uint32 kUseMasks = 1 << 0; |
const uint32 kUseAntialiasing = 1 << 1; |
const uint32 kUseColorMatrix = 1 << 2; |
+const uint32 kUseBlendMinMax = 1 << 3; |
+ |
+class BlendingTestInProcessContextProvider |
+ : public TestInProcessContextProvider { |
+ public: |
+ BlendingTestInProcessContextProvider(bool minmax) : blend_minmax_(minmax) {} |
+ virtual ContextProvider::Capabilities ContextCapabilities() override { |
+ ContextProvider::Capabilities caps = ContextProvider::Capabilities(); |
+ caps.gpu.blend_minmax = blend_minmax_; |
+ return caps; |
+ } |
+ |
+ private: |
+ virtual ~BlendingTestInProcessContextProvider() {} |
+ bool blend_minmax_; |
+}; |
class LayerTreeHostBlendingPixelTest : public LayerTreePixelTest { |
public: |
@@ -59,6 +76,10 @@ class LayerTreeHostBlendingPixelTest : public LayerTreePixelTest { |
pixel_comparator_.reset(new FuzzyPixelOffByOneComparator(true)); |
} |
+ virtual scoped_refptr<ContextProvider> CreteTestContextProvider() override { |
+ return new BlendingTestInProcessContextProvider(blend_minmax_); |
+ } |
+ |
virtual void InitializeSettings(LayerTreeSettings* settings) override { |
settings->force_antialiasing = force_antialiasing_; |
} |
@@ -230,6 +251,7 @@ class LayerTreeHostBlendingPixelTest : public LayerTreePixelTest { |
this->impl_side_painting_ = false; |
this->force_antialiasing_ = (flags & kUseAntialiasing); |
+ this->blend_minmax_ = (flags & kUseBlendMinMax); |
if ((flags & kUseAntialiasing) && (type == PIXEL_TEST_GL)) { |
// Anti aliasing causes differences up to 7 pixels at the edges. |
@@ -284,6 +306,7 @@ class LayerTreeHostBlendingPixelTest : public LayerTreePixelTest { |
} |
bool force_antialiasing_ = false; |
+ bool blend_minmax_ = false; |
}; |
TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRoot_GL) { |
@@ -437,6 +460,61 @@ TEST_F(LayerTreeHostBlendingPixelTest, |
kUseMasks | kUseAntialiasing | kUseColorMatrix); |
} |
+// Tests for render passes with GL_EXT_blend_minmax enabled. |
+TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPass_MMGL) { |
+ RunBlendingWithRenderPass(PIXEL_TEST_GL, |
+ FILE_PATH_LITERAL("blending_render_pass.png"), |
+ kUseBlendMinMax); |
+} |
+ |
+TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassAA_MMGL) { |
+ RunBlendingWithRenderPass(PIXEL_TEST_GL, |
+ FILE_PATH_LITERAL("blending_render_pass.png"), |
+ kUseAntialiasing | kUseBlendMinMax); |
+} |
+ |
+TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassWithMask_MMGL) { |
+ RunBlendingWithRenderPass(PIXEL_TEST_GL, |
+ FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
+ kUseMasks | kUseBlendMinMax); |
+} |
+ |
+TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassWithMaskAA_MMGL) { |
+ RunBlendingWithRenderPass(PIXEL_TEST_GL, |
+ FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
+ kUseMasks | kUseAntialiasing | kUseBlendMinMax); |
+} |
+ |
+TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassColorMatrix_MMGL) { |
+ RunBlendingWithRenderPass(PIXEL_TEST_GL, |
+ FILE_PATH_LITERAL("blending_render_pass_cm.png"), |
+ kUseColorMatrix | kUseBlendMinMax); |
+} |
+ |
+TEST_F(LayerTreeHostBlendingPixelTest, |
+ BlendingWithRenderPassColorMatrixAA_MMGL) { |
+ RunBlendingWithRenderPass( |
+ PIXEL_TEST_GL, |
+ FILE_PATH_LITERAL("blending_render_pass_cm.png"), |
+ kUseAntialiasing | kUseColorMatrix | kUseBlendMinMax); |
+} |
+ |
+TEST_F(LayerTreeHostBlendingPixelTest, |
+ BlendingWithRenderPassWithMaskColorMatrix_MMGL) { |
+ RunBlendingWithRenderPass( |
+ PIXEL_TEST_GL, |
+ FILE_PATH_LITERAL("blending_render_pass_mask_cm.png"), |
+ kUseMasks | kUseColorMatrix | kUseBlendMinMax); |
+} |
+ |
+TEST_F(LayerTreeHostBlendingPixelTest, |
+ BlendingWithRenderPassWithMaskColorMatrixAA_MMGL) { |
+ RunBlendingWithRenderPass( |
+ PIXEL_TEST_GL, |
+ FILE_PATH_LITERAL("blending_render_pass_mask_cm.png"), |
+ kUseMasks | kUseAntialiasing | kUseColorMatrix | kUseBlendMinMax); |
+} |
+ |
} // namespace |
} // namespace cc |