OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/command_buffer/common/gles2_cmd_utils.h" | 5 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
9 | 9 |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 EXPECT_EQ(4u, GLES2Util::RenderbufferBytesPerPixel(GL_RGBA)); | 174 EXPECT_EQ(4u, GLES2Util::RenderbufferBytesPerPixel(GL_RGBA)); |
175 EXPECT_EQ( | 175 EXPECT_EQ( |
176 4u, GLES2Util::RenderbufferBytesPerPixel(GL_DEPTH24_STENCIL8_OES)); | 176 4u, GLES2Util::RenderbufferBytesPerPixel(GL_DEPTH24_STENCIL8_OES)); |
177 EXPECT_EQ(4u, GLES2Util::RenderbufferBytesPerPixel(GL_RGB8_OES)); | 177 EXPECT_EQ(4u, GLES2Util::RenderbufferBytesPerPixel(GL_RGB8_OES)); |
178 EXPECT_EQ(4u, GLES2Util::RenderbufferBytesPerPixel(GL_RGBA8_OES)); | 178 EXPECT_EQ(4u, GLES2Util::RenderbufferBytesPerPixel(GL_RGBA8_OES)); |
179 EXPECT_EQ( | 179 EXPECT_EQ( |
180 4u, GLES2Util::RenderbufferBytesPerPixel(GL_DEPTH_COMPONENT24_OES)); | 180 4u, GLES2Util::RenderbufferBytesPerPixel(GL_DEPTH_COMPONENT24_OES)); |
181 EXPECT_EQ(0u, GLES2Util::RenderbufferBytesPerPixel(-1)); | 181 EXPECT_EQ(0u, GLES2Util::RenderbufferBytesPerPixel(-1)); |
182 } | 182 } |
183 | 183 |
| 184 TEST_F(GLES2UtilTest, SwizzleLocation) { |
| 185 GLint power = 1; |
| 186 for (GLint p = 0; p < 5; ++p, power *= 10) { |
| 187 GLint limit = power * 20 + 1; |
| 188 for (GLint ii = -limit; ii < limit; ii += power) { |
| 189 GLint s = GLES2Util::SwizzleLocation(ii); |
| 190 EXPECT_EQ(ii, GLES2Util::UnswizzleLocation(s)); |
| 191 } |
| 192 } |
| 193 } |
| 194 |
184 } // namespace gles2 | 195 } // namespace gles2 |
185 } // namespace gpu | 196 } // namespace gpu |
186 | 197 |
OLD | NEW |