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 <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 3194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3205 GLbyte data[64]; | 3205 GLbyte data[64]; |
3206 }; | 3206 }; |
3207 | 3207 |
3208 Mailbox mailbox = Mailbox::Generate(); | 3208 Mailbox mailbox = Mailbox::Generate(); |
3209 Cmds expected; | 3209 Cmds expected; |
3210 expected.cmd.Init(GL_TEXTURE_2D, mailbox.name); | 3210 expected.cmd.Init(GL_TEXTURE_2D, mailbox.name); |
3211 gl_->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 3211 gl_->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
3212 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3212 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3213 } | 3213 } |
3214 | 3214 |
| 3215 TEST_F(GLES2ImplementationTest, CreateAndConsumeTextureCHROMIUM) { |
| 3216 struct Cmds { |
| 3217 cmds::CreateAndConsumeTextureCHROMIUMImmediate cmd; |
| 3218 GLbyte data[64]; |
| 3219 }; |
| 3220 |
| 3221 Mailbox mailbox = Mailbox::Generate(); |
| 3222 Cmds expected; |
| 3223 expected.cmd.Init(GL_TEXTURE_2D, kTexturesStartId, mailbox.name); |
| 3224 GLuint id = gl_->CreateAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| 3225 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 3226 EXPECT_EQ(kTexturesStartId, id); |
| 3227 } |
| 3228 |
3215 TEST_F(GLES2ImplementationTest, ProduceTextureCHROMIUM) { | 3229 TEST_F(GLES2ImplementationTest, ProduceTextureCHROMIUM) { |
3216 struct Cmds { | 3230 struct Cmds { |
3217 cmds::ProduceTextureCHROMIUMImmediate cmd; | 3231 cmds::ProduceTextureCHROMIUMImmediate cmd; |
3218 GLbyte data[64]; | 3232 GLbyte data[64]; |
3219 }; | 3233 }; |
3220 | 3234 |
3221 Mailbox mailbox = Mailbox::Generate(); | 3235 Mailbox mailbox = Mailbox::Generate(); |
3222 Cmds expected; | 3236 Cmds expected; |
3223 expected.cmd.Init(GL_TEXTURE_2D, mailbox.name); | 3237 expected.cmd.Init(GL_TEXTURE_2D, mailbox.name); |
3224 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 3238 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
3225 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3239 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3226 } | 3240 } |
3227 | 3241 |
| 3242 TEST_F(GLES2ImplementationTest, ProduceTextureDirectCHROMIUM) { |
| 3243 struct Cmds { |
| 3244 cmds::ProduceTextureDirectCHROMIUMImmediate cmd; |
| 3245 GLbyte data[64]; |
| 3246 }; |
| 3247 |
| 3248 Mailbox mailbox = Mailbox::Generate(); |
| 3249 Cmds expected; |
| 3250 expected.cmd.Init(kTexturesStartId, GL_TEXTURE_2D, mailbox.name); |
| 3251 gl_->ProduceTextureDirectCHROMIUM( |
| 3252 kTexturesStartId, GL_TEXTURE_2D, mailbox.name); |
| 3253 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 3254 } |
| 3255 |
3228 TEST_F(GLES2ImplementationTest, LimitSizeAndOffsetTo32Bit) { | 3256 TEST_F(GLES2ImplementationTest, LimitSizeAndOffsetTo32Bit) { |
3229 GLsizeiptr size; | 3257 GLsizeiptr size; |
3230 GLintptr offset; | 3258 GLintptr offset; |
3231 if (sizeof(size) <= 4 || sizeof(offset) <= 4) | 3259 if (sizeof(size) <= 4 || sizeof(offset) <= 4) |
3232 return; | 3260 return; |
3233 // The below two casts should be no-op, as we return early if | 3261 // The below two casts should be no-op, as we return early if |
3234 // it's 32-bit system. | 3262 // it's 32-bit system. |
3235 int64 value64 = 0x100000000; | 3263 int64 value64 = 0x100000000; |
3236 size = static_cast<GLsizeiptr>(value64); | 3264 size = static_cast<GLsizeiptr>(value64); |
3237 offset = static_cast<GLintptr>(value64); | 3265 offset = static_cast<GLintptr>(value64); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3375 ContextInitOptions init_options; | 3403 ContextInitOptions init_options; |
3376 init_options.bind_generates_resource_client = true; | 3404 init_options.bind_generates_resource_client = true; |
3377 init_options.bind_generates_resource_service = false; | 3405 init_options.bind_generates_resource_service = false; |
3378 EXPECT_FALSE(Initialize(init_options)); | 3406 EXPECT_FALSE(Initialize(init_options)); |
3379 } | 3407 } |
3380 | 3408 |
3381 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 3409 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
3382 | 3410 |
3383 } // namespace gles2 | 3411 } // namespace gles2 |
3384 } // namespace gpu | 3412 } // namespace gpu |
OLD | NEW |