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 3007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3018 EXPECT_CALL(*command_buffer(), OnFlush()) | 3018 EXPECT_CALL(*command_buffer(), OnFlush()) |
3019 .WillOnce(DoAll(SetMemory(result1.ptr, uint32_t(sizeof(kString))), | 3019 .WillOnce(DoAll(SetMemory(result1.ptr, uint32_t(sizeof(kString))), |
3020 SetMemory(mem1.ptr, kString))) | 3020 SetMemory(mem1.ptr, kString))) |
3021 .RetiresOnSaturation(); | 3021 .RetiresOnSaturation(); |
3022 | 3022 |
3023 const GLubyte* result = gl_->GetString(GL_EXTENSIONS); | 3023 const GLubyte* result = gl_->GetString(GL_EXTENSIONS); |
3024 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3024 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3025 EXPECT_STREQ(expected_str, reinterpret_cast<const char*>(result)); | 3025 EXPECT_STREQ(expected_str, reinterpret_cast<const char*>(result)); |
3026 } | 3026 } |
3027 | 3027 |
3028 TEST_F(GLES2ImplementationTest, PixelStoreiGLPackReverseRowOrderANGLE) { | |
3029 const uint32_t kBucketId = GLES2Implementation::kResultBucketId; | |
3030 const Str7 kString = {"foobar"}; | |
3031 struct Cmds { | |
3032 cmd::SetBucketSize set_bucket_size1; | |
3033 cmds::GetString get_string; | |
3034 cmd::GetBucketStart get_bucket_start; | |
3035 cmd::SetToken set_token1; | |
3036 cmd::SetBucketSize set_bucket_size2; | |
3037 cmds::PixelStorei pixel_store; | |
3038 }; | |
3039 | |
3040 ExpectedMemoryInfo mem1 = GetExpectedMemory(MaxTransferBufferSize()); | |
3041 ExpectedMemoryInfo result1 = | |
3042 GetExpectedResultMemory(sizeof(cmd::GetBucketStart::Result)); | |
3043 | |
3044 Cmds expected; | |
3045 expected.set_bucket_size1.Init(kBucketId, 0); | |
3046 expected.get_string.Init(GL_EXTENSIONS, kBucketId); | |
3047 expected.get_bucket_start.Init( | |
3048 kBucketId, result1.id, result1.offset, | |
3049 MaxTransferBufferSize(), mem1.id, mem1.offset); | |
3050 expected.set_token1.Init(GetNextToken()); | |
3051 expected.set_bucket_size2.Init(kBucketId, 0); | |
3052 expected.pixel_store.Init(GL_PACK_REVERSE_ROW_ORDER_ANGLE, 1); | |
3053 | |
3054 EXPECT_CALL(*command_buffer(), OnFlush()) | |
3055 .WillOnce(DoAll(SetMemory(result1.ptr, uint32_t(sizeof(kString))), | |
3056 SetMemory(mem1.ptr, kString))) | |
3057 .RetiresOnSaturation(); | |
3058 | |
3059 gl_->PixelStorei(GL_PACK_REVERSE_ROW_ORDER_ANGLE, 1); | |
3060 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | |
3061 } | |
3062 | |
3063 TEST_F(GLES2ImplementationTest, CreateProgram) { | 3028 TEST_F(GLES2ImplementationTest, CreateProgram) { |
3064 struct Cmds { | 3029 struct Cmds { |
3065 cmds::CreateProgram cmd; | 3030 cmds::CreateProgram cmd; |
3066 }; | 3031 }; |
3067 | 3032 |
3068 Cmds expected; | 3033 Cmds expected; |
3069 expected.cmd.Init(kProgramsAndShadersStartId); | 3034 expected.cmd.Init(kProgramsAndShadersStartId); |
3070 GLuint id = gl_->CreateProgram(); | 3035 GLuint id = gl_->CreateProgram(); |
3071 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3036 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3072 EXPECT_EQ(kProgramsAndShadersStartId, id); | 3037 EXPECT_EQ(kProgramsAndShadersStartId, id); |
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4271 ContextInitOptions init_options; | 4236 ContextInitOptions init_options; |
4272 init_options.transfer_buffer_initialize_fail = true; | 4237 init_options.transfer_buffer_initialize_fail = true; |
4273 EXPECT_FALSE(Initialize(init_options)); | 4238 EXPECT_FALSE(Initialize(init_options)); |
4274 } | 4239 } |
4275 | 4240 |
4276 #include "base/macros.h" | 4241 #include "base/macros.h" |
4277 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 4242 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
4278 | 4243 |
4279 } // namespace gles2 | 4244 } // namespace gles2 |
4280 } // namespace gpu | 4245 } // namespace gpu |
OLD | NEW |