1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/output/shader.h"
7 #include "cc/test/test_gles2_interface.h"
8 #include "cc/test/test_web_graphics_context_3d.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/geometry/point.h"
11 #include "ui/gfx/geometry/size.h"
15 TEST(ShaderTest
, HighpThresholds
) {
16 // The test context always uses a mediump precision of 10 bits which
17 // corresponds to a native highp threshold of 2^10 = 1024
18 scoped_ptr
<TestWebGraphicsContext3D
> stub_context
=
19 TestWebGraphicsContext3D::Create();
20 TestGLES2Interface
stub_gl(stub_context
.get());
22 int threshold_cache
= 0;
24 gfx::Point
closePoint(512, 512);
25 gfx::Size
smallSize(512, 512);
26 gfx::Point
farPoint(2560, 2560);
27 gfx::Size
bigSize(2560, 2560);
30 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM
,
31 TexCoordPrecisionRequired(&stub_gl
, &threshold_cache
, threshold_min
,
33 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM
,
34 TexCoordPrecisionRequired(&stub_gl
, &threshold_cache
, threshold_min
,
36 EXPECT_EQ(TEX_COORD_PRECISION_HIGH
,
37 TexCoordPrecisionRequired(&stub_gl
, &threshold_cache
, threshold_min
,
39 EXPECT_EQ(TEX_COORD_PRECISION_HIGH
,
40 TexCoordPrecisionRequired(&stub_gl
, &threshold_cache
, threshold_min
,
44 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM
,
45 TexCoordPrecisionRequired(&stub_gl
, &threshold_cache
, threshold_min
,
47 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM
,
48 TexCoordPrecisionRequired(&stub_gl
, &threshold_cache
, threshold_min
,
50 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM
,
51 TexCoordPrecisionRequired(&stub_gl
, &threshold_cache
, threshold_min
,
53 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM
,
54 TexCoordPrecisionRequired(&stub_gl
, &threshold_cache
, threshold_min
,