| OLD | NEW |
| 1 // Copyright (c) 2012 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 // Tests for GLES2Implementation. | 5 // Tests for GLES2Implementation. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 | 8 |
| 9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
| 10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
| (...skipping 2995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3006 EXPECT_CALL(*command_buffer(), OnFlush()) | 3006 EXPECT_CALL(*command_buffer(), OnFlush()) |
| 3007 .WillOnce(DoAll(SetMemory(result1.ptr, uint32_t(sizeof(kString))), | 3007 .WillOnce(DoAll(SetMemory(result1.ptr, uint32_t(sizeof(kString))), |
| 3008 SetMemory(mem1.ptr, kString))) | 3008 SetMemory(mem1.ptr, kString))) |
| 3009 .RetiresOnSaturation(); | 3009 .RetiresOnSaturation(); |
| 3010 | 3010 |
| 3011 const GLubyte* result = gl_->GetString(GL_EXTENSIONS); | 3011 const GLubyte* result = gl_->GetString(GL_EXTENSIONS); |
| 3012 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3012 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 3013 EXPECT_STREQ(expected_str, reinterpret_cast<const char*>(result)); | 3013 EXPECT_STREQ(expected_str, reinterpret_cast<const char*>(result)); |
| 3014 } | 3014 } |
| 3015 | 3015 |
| 3016 TEST_F(GLES2ImplementationTest, PixelStoreiGLPackReverseRowOrderANGLE) { | |
| 3017 const uint32_t kBucketId = GLES2Implementation::kResultBucketId; | |
| 3018 const Str7 kString = {"foobar"}; | |
| 3019 struct Cmds { | |
| 3020 cmd::SetBucketSize set_bucket_size1; | |
| 3021 cmds::GetString get_string; | |
| 3022 cmd::GetBucketStart get_bucket_start; | |
| 3023 cmd::SetToken set_token1; | |
| 3024 cmd::SetBucketSize set_bucket_size2; | |
| 3025 cmds::PixelStorei pixel_store; | |
| 3026 }; | |
| 3027 | |
| 3028 ExpectedMemoryInfo mem1 = GetExpectedMemory(MaxTransferBufferSize()); | |
| 3029 ExpectedMemoryInfo result1 = | |
| 3030 GetExpectedResultMemory(sizeof(cmd::GetBucketStart::Result)); | |
| 3031 | |
| 3032 Cmds expected; | |
| 3033 expected.set_bucket_size1.Init(kBucketId, 0); | |
| 3034 expected.get_string.Init(GL_EXTENSIONS, kBucketId); | |
| 3035 expected.get_bucket_start.Init( | |
| 3036 kBucketId, result1.id, result1.offset, | |
| 3037 MaxTransferBufferSize(), mem1.id, mem1.offset); | |
| 3038 expected.set_token1.Init(GetNextToken()); | |
| 3039 expected.set_bucket_size2.Init(kBucketId, 0); | |
| 3040 expected.pixel_store.Init(GL_PACK_REVERSE_ROW_ORDER_ANGLE, 1); | |
| 3041 | |
| 3042 EXPECT_CALL(*command_buffer(), OnFlush()) | |
| 3043 .WillOnce(DoAll(SetMemory(result1.ptr, uint32_t(sizeof(kString))), | |
| 3044 SetMemory(mem1.ptr, kString))) | |
| 3045 .RetiresOnSaturation(); | |
| 3046 | |
| 3047 gl_->PixelStorei(GL_PACK_REVERSE_ROW_ORDER_ANGLE, 1); | |
| 3048 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | |
| 3049 } | |
| 3050 | |
| 3051 TEST_F(GLES2ImplementationTest, CreateProgram) { | 3016 TEST_F(GLES2ImplementationTest, CreateProgram) { |
| 3052 struct Cmds { | 3017 struct Cmds { |
| 3053 cmds::CreateProgram cmd; | 3018 cmds::CreateProgram cmd; |
| 3054 }; | 3019 }; |
| 3055 | 3020 |
| 3056 Cmds expected; | 3021 Cmds expected; |
| 3057 expected.cmd.Init(kProgramsAndShadersStartId); | 3022 expected.cmd.Init(kProgramsAndShadersStartId); |
| 3058 GLuint id = gl_->CreateProgram(); | 3023 GLuint id = gl_->CreateProgram(); |
| 3059 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3024 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 3060 EXPECT_EQ(kProgramsAndShadersStartId, id); | 3025 EXPECT_EQ(kProgramsAndShadersStartId, id); |
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4259 ContextInitOptions init_options; | 4224 ContextInitOptions init_options; |
| 4260 init_options.transfer_buffer_initialize_fail = true; | 4225 init_options.transfer_buffer_initialize_fail = true; |
| 4261 EXPECT_FALSE(Initialize(init_options)); | 4226 EXPECT_FALSE(Initialize(init_options)); |
| 4262 } | 4227 } |
| 4263 | 4228 |
| 4264 #include "base/macros.h" | 4229 #include "base/macros.h" |
| 4265 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 4230 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
| 4266 | 4231 |
| 4267 } // namespace gles2 | 4232 } // namespace gles2 |
| 4268 } // namespace gpu | 4233 } // namespace gpu |
| OLD | NEW |