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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include "base/atomicops.h" | 7 #include "base/atomicops.h" |
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
10 #include "gpu/command_buffer/common/id_allocator.h" | 10 #include "gpu/command_buffer/common/id_allocator.h" |
(...skipping 8385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8396 // Check we get out of memory and no call to glBufferData if Ensure | 8396 // Check we get out of memory and no call to glBufferData if Ensure |
8397 // fails. | 8397 // fails. |
8398 EXPECT_CALL(*memory_tracker, EnsureGPUMemoryAvailable(128)) | 8398 EXPECT_CALL(*memory_tracker, EnsureGPUMemoryAvailable(128)) |
8399 .WillOnce(Return(false)) | 8399 .WillOnce(Return(false)) |
8400 .RetiresOnSaturation(); | 8400 .RetiresOnSaturation(); |
8401 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 8401 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
8402 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 8402 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
8403 EXPECT_EQ(128u, memory_tracker->GetPoolSize(MemoryTracker::kManaged)); | 8403 EXPECT_EQ(128u, memory_tracker->GetPoolSize(MemoryTracker::kManaged)); |
8404 } | 8404 } |
8405 | 8405 |
| 8406 TEST_F(GLES2DecoderTest, DrawBuffersEXTImmediateSuccceeds) { |
| 8407 const GLsizei count = 1; |
| 8408 const GLenum bufs[] = { GL_COLOR_ATTACHMENT0 }; |
| 8409 DrawBuffersEXTImmediate& cmd = |
| 8410 *GetImmediateAs<DrawBuffersEXTImmediate>(); |
| 8411 cmd.Init(count, bufs); |
| 8412 |
| 8413 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
| 8414 kServiceFramebufferId); |
| 8415 EXPECT_CALL(*gl_, DrawBuffersARB(count, _)) |
| 8416 .Times(1) |
| 8417 .RetiresOnSaturation(); |
| 8418 EXPECT_EQ(error::kNoError, |
| 8419 ExecuteImmediateCmd(cmd, sizeof(bufs))); |
| 8420 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8421 } |
| 8422 |
| 8423 TEST_F(GLES2DecoderTest, DrawBuffersEXTImmediateFails) { |
| 8424 const GLsizei count = 1; |
| 8425 const GLenum bufs[] = { GL_COLOR_ATTACHMENT1_EXT }; |
| 8426 DrawBuffersEXTImmediate& cmd = |
| 8427 *GetImmediateAs<DrawBuffersEXTImmediate>(); |
| 8428 cmd.Init(count, bufs); |
| 8429 |
| 8430 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
| 8431 kServiceFramebufferId); |
| 8432 EXPECT_EQ(error::kNoError, |
| 8433 ExecuteImmediateCmd(cmd, sizeof(bufs))); |
| 8434 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 8435 } |
| 8436 |
| 8437 TEST_F(GLES2DecoderTest, DrawBuffersEXTImmediateBackbuffer) { |
| 8438 const GLsizei count = 1; |
| 8439 const GLenum bufs[] = { GL_BACK }; |
| 8440 DrawBuffersEXTImmediate& cmd = |
| 8441 *GetImmediateAs<DrawBuffersEXTImmediate>(); |
| 8442 cmd.Init(count, bufs); |
| 8443 |
| 8444 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
| 8445 kServiceFramebufferId); |
| 8446 EXPECT_EQ(error::kNoError, |
| 8447 ExecuteImmediateCmd(cmd, sizeof(bufs))); |
| 8448 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 8449 |
| 8450 DoBindFramebuffer(GL_FRAMEBUFFER, 0, 0); // unbind |
| 8451 |
| 8452 EXPECT_CALL(*gl_, DrawBuffersARB(count, _)) |
| 8453 .Times(1) |
| 8454 .RetiresOnSaturation(); |
| 8455 |
| 8456 EXPECT_EQ(error::kNoError, |
| 8457 ExecuteImmediateCmd(cmd, sizeof(bufs))); |
| 8458 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8459 } |
| 8460 |
8406 // TODO(gman): Complete this test. | 8461 // TODO(gman): Complete this test. |
8407 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { | 8462 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { |
8408 // } | 8463 // } |
8409 | 8464 |
8410 // TODO(gman): BufferData | 8465 // TODO(gman): BufferData |
8411 | 8466 |
8412 // TODO(gman): BufferDataImmediate | 8467 // TODO(gman): BufferDataImmediate |
8413 | 8468 |
8414 // TODO(gman): BufferSubData | 8469 // TODO(gman): BufferSubData |
8415 | 8470 |
(...skipping 16 matching lines...) Expand all Loading... |
8432 // TODO(gman): TexImage2DImmediate | 8487 // TODO(gman): TexImage2DImmediate |
8433 | 8488 |
8434 // TODO(gman): TexSubImage2DImmediate | 8489 // TODO(gman): TexSubImage2DImmediate |
8435 | 8490 |
8436 // TODO(gman): UseProgram | 8491 // TODO(gman): UseProgram |
8437 | 8492 |
8438 // TODO(gman): SwapBuffers | 8493 // TODO(gman): SwapBuffers |
8439 | 8494 |
8440 } // namespace gles2 | 8495 } // namespace gles2 |
8441 } // namespace gpu | 8496 } // namespace gpu |
OLD | NEW |