OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
6 #include <GLES2/gl2ext.h> | 6 #include <GLES2/gl2ext.h> |
| 7 #include <stdint.h> |
7 | 8 |
8 #include "gpu/command_buffer/tests/gl_manager.h" | 9 #include "gpu/command_buffer/tests/gl_manager.h" |
9 #include "gpu/command_buffer/tests/gl_test_utils.h" | 10 #include "gpu/command_buffer/tests/gl_test_utils.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 | 12 |
12 namespace gpu { | 13 namespace gpu { |
13 | 14 |
14 // A collection of tests that exercise the GL_EXT_srgb extension. | 15 // A collection of tests that exercise the GL_EXT_srgb extension. |
15 class GLEXTSRGBTest : public testing::Test { | 16 class GLEXTSRGBTest : public testing::Test { |
16 protected: | 17 protected: |
(...skipping 10 matching lines...) Expand all Loading... |
27 // OpenGL. | 28 // OpenGL. |
28 TEST_F(GLEXTSRGBTest, TexImageSRGBALPHAFormat) { | 29 TEST_F(GLEXTSRGBTest, TexImageSRGBALPHAFormat) { |
29 if (!IsApplicable()) | 30 if (!IsApplicable()) |
30 return; | 31 return; |
31 static const int kWidth = 10; | 32 static const int kWidth = 10; |
32 static const int kHeight = 10; | 33 static const int kHeight = 10; |
33 static const int kSubImageX = kWidth / 2; | 34 static const int kSubImageX = kWidth / 2; |
34 static const int kSubImageY = kHeight / 2; | 35 static const int kSubImageY = kHeight / 2; |
35 static const int kSubImageWidth = kWidth / 2; | 36 static const int kSubImageWidth = kWidth / 2; |
36 static const int kSubImageHeight = kHeight / 2; | 37 static const int kSubImageHeight = kHeight / 2; |
37 static const uint8 kImageColor[] = {255, 255, 255, 255}; | 38 static const uint8_t kImageColor[] = {255, 255, 255, 255}; |
38 static const uint8 kSubImageColor[] = {128, 128, 128, 128}; | 39 static const uint8_t kSubImageColor[] = {128, 128, 128, 128}; |
39 | 40 |
40 uint8 pixels[kWidth * kHeight * 4]; | 41 uint8_t pixels[kWidth * kHeight * 4]; |
41 | 42 |
42 GLuint tex = 0; | 43 GLuint tex = 0; |
43 glGenTextures(1, &tex); | 44 glGenTextures(1, &tex); |
44 glBindTexture(GL_TEXTURE_2D, tex); | 45 glBindTexture(GL_TEXTURE_2D, tex); |
45 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 46 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
46 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 47 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
47 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 48 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
48 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 49 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
49 | 50 |
50 memset(pixels, kImageColor[0], sizeof(pixels)); | 51 memset(pixels, kImageColor[0], sizeof(pixels)); |
(...skipping 14 matching lines...) Expand all Loading... |
65 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 66 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
66 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 67 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
67 | 68 |
68 GLTestHelper::CheckPixels(0, 0, kSubImageX, kHeight, 0, kImageColor); | 69 GLTestHelper::CheckPixels(0, 0, kSubImageX, kHeight, 0, kImageColor); |
69 GLTestHelper::CheckPixels(0, 0, kWidth, kSubImageY, 0, kImageColor); | 70 GLTestHelper::CheckPixels(0, 0, kWidth, kSubImageY, 0, kImageColor); |
70 GLTestHelper::CheckPixels(kSubImageX, kSubImageY, kSubImageWidth, | 71 GLTestHelper::CheckPixels(kSubImageX, kSubImageY, kSubImageWidth, |
71 kSubImageHeight, 0, kSubImageColor); | 72 kSubImageHeight, 0, kSubImageColor); |
72 } | 73 } |
73 | 74 |
74 } // namespace gpu | 75 } // namespace gpu |
OLD | NEW |