Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/output/shader.h" | 5 #include "cc/output/shader.h" |
| 6 | 6 |
| 7 #include "cc/test/fake_web_graphics_context_3d.h" | 7 #include "gpu/command_buffer/client/gles2_interface_stub.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gfx/point.h" | 9 #include "ui/gfx/point.h" |
| 10 #include "ui/gfx/size.h" | 10 #include "ui/gfx/size.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 TEST(ShaderTest, HighpThresholds) { | 14 TEST(ShaderTest, HighpThresholds) { |
| 15 // The FakeWebGraphicsContext3D always uses a mediump precision of 10 bits | 15 // The FakeWebGraphicsContext3D always uses a mediump precision of 10 bits |
|
danakj
2013/12/03 19:24:49
Comment needs updating, and verify this is still t
jamesr
2013/12/04 01:50:21
Good catch. It isn't - I've changed this back to
| |
| 16 // which corresponds to a native highp threshold of 2^10 = 1024 | 16 // which corresponds to a native highp threshold of 2^10 = 1024 |
| 17 FakeWebGraphicsContext3D context; | 17 gpu::gles2::GLES2InterfaceStub stub_context; |
| 18 | 18 |
| 19 int threshold_cache = 0; | 19 int threshold_cache = 0; |
| 20 int threshold_min; | 20 int threshold_min; |
| 21 gfx::Point closePoint(512, 512); | 21 gfx::Point closePoint(512, 512); |
| 22 gfx::Size smallSize(512, 512); | 22 gfx::Size smallSize(512, 512); |
| 23 gfx::Point farPoint(2560, 2560); | 23 gfx::Point farPoint(2560, 2560); |
| 24 gfx::Size bigSize(2560, 2560); | 24 gfx::Size bigSize(2560, 2560); |
| 25 | 25 |
| 26 threshold_min = 0; | 26 threshold_min = 0; |
| 27 EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired( | 27 EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired( |
| 28 &context, &threshold_cache, threshold_min, closePoint)); | 28 &stub_context, &threshold_cache, threshold_min, closePoint)); |
| 29 EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired( | 29 EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired( |
| 30 &context, &threshold_cache, threshold_min, smallSize)); | 30 &stub_context, &threshold_cache, threshold_min, smallSize)); |
| 31 EXPECT_EQ(TexCoordPrecisionHigh, TexCoordPrecisionRequired( | 31 EXPECT_EQ(TexCoordPrecisionHigh, TexCoordPrecisionRequired( |
| 32 &context, &threshold_cache, threshold_min, farPoint)); | 32 &stub_context, &threshold_cache, threshold_min, farPoint)); |
| 33 EXPECT_EQ(TexCoordPrecisionHigh, TexCoordPrecisionRequired( | 33 EXPECT_EQ(TexCoordPrecisionHigh, TexCoordPrecisionRequired( |
| 34 &context, &threshold_cache, threshold_min, bigSize)); | 34 &stub_context, &threshold_cache, threshold_min, bigSize)); |
| 35 | 35 |
| 36 threshold_min = 3000; | 36 threshold_min = 3000; |
| 37 EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired( | 37 EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired( |
| 38 &context, &threshold_cache, threshold_min, closePoint)); | 38 &stub_context, &threshold_cache, threshold_min, closePoint)); |
| 39 EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired( | 39 EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired( |
| 40 &context, &threshold_cache, threshold_min, smallSize)); | 40 &stub_context, &threshold_cache, threshold_min, smallSize)); |
| 41 EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired( | 41 EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired( |
| 42 &context, &threshold_cache, threshold_min, farPoint)); | 42 &stub_context, &threshold_cache, threshold_min, farPoint)); |
| 43 EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired( | 43 EXPECT_EQ(TexCoordPrecisionMedium, TexCoordPrecisionRequired( |
| 44 &context, &threshold_cache, threshold_min, bigSize)); | 44 &stub_context, &threshold_cache, threshold_min, bigSize)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace cc | 47 } // namespace cc |
| OLD | NEW |