| 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 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
| 7 | 7 |
| 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/service/buffer_manager.h" | 10 #include "gpu/command_buffer/service/buffer_manager.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 T GetSharedMemoryAs() { | 88 T GetSharedMemoryAs() { |
| 89 return reinterpret_cast<T>(shared_memory_address_); | 89 return reinterpret_cast<T>(shared_memory_address_); |
| 90 } | 90 } |
| 91 | 91 |
| 92 template <typename T> | 92 template <typename T> |
| 93 T GetSharedMemoryAsWithOffset(uint32 offset) { | 93 T GetSharedMemoryAsWithOffset(uint32 offset) { |
| 94 void* ptr = reinterpret_cast<int8*>(shared_memory_address_) + offset; | 94 void* ptr = reinterpret_cast<int8*>(shared_memory_address_) + offset; |
| 95 return reinterpret_cast<T>(ptr); | 95 return reinterpret_cast<T>(ptr); |
| 96 } | 96 } |
| 97 | 97 |
| 98 gfx::GLImage* GetImage(GLuint image_id) { |
| 99 return engine_->GetImage(image_id); |
| 100 } |
| 101 |
| 98 IdAllocatorInterface* GetIdAllocator(GLuint namespace_id) { | 102 IdAllocatorInterface* GetIdAllocator(GLuint namespace_id) { |
| 99 return group_->GetIdAllocator(namespace_id); | 103 return group_->GetIdAllocator(namespace_id); |
| 100 } | 104 } |
| 101 | 105 |
| 102 Buffer* GetBuffer(GLuint service_id) { | 106 Buffer* GetBuffer(GLuint service_id) { |
| 103 return group_->buffer_manager()->GetBuffer(service_id); | 107 return group_->buffer_manager()->GetBuffer(service_id); |
| 104 } | 108 } |
| 105 | 109 |
| 106 Framebuffer* GetFramebuffer(GLuint service_id) { | 110 Framebuffer* GetFramebuffer(GLuint service_id) { |
| 107 return group_->framebuffer_manager()->GetFramebuffer(service_id); | 111 return group_->framebuffer_manager()->GetFramebuffer(service_id); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 static const GLint kUniform2DesiredLocation = -1; | 473 static const GLint kUniform2DesiredLocation = -1; |
| 470 static const GLint kUniform3DesiredLocation = -1; | 474 static const GLint kUniform3DesiredLocation = -1; |
| 471 static const GLenum kUniform1Type = GL_SAMPLER_2D; | 475 static const GLenum kUniform1Type = GL_SAMPLER_2D; |
| 472 static const GLenum kUniform2Type = GL_INT_VEC2; | 476 static const GLenum kUniform2Type = GL_INT_VEC2; |
| 473 static const GLenum kUniform3Type = GL_FLOAT_VEC3; | 477 static const GLenum kUniform3Type = GL_FLOAT_VEC3; |
| 474 static const GLenum kUniformSamplerExternalType = GL_SAMPLER_EXTERNAL_OES; | 478 static const GLenum kUniformSamplerExternalType = GL_SAMPLER_EXTERNAL_OES; |
| 475 static const GLenum kUniformCubemapType = GL_SAMPLER_CUBE; | 479 static const GLenum kUniformCubemapType = GL_SAMPLER_CUBE; |
| 476 static const GLint kInvalidUniformLocation = 30; | 480 static const GLint kInvalidUniformLocation = 30; |
| 477 static const GLint kBadUniformIndex = 1000; | 481 static const GLint kBadUniformIndex = 1000; |
| 478 | 482 |
| 483 static const int32 kImageId = 801; |
| 484 static const int32 kInvalidImageId = 802; |
| 485 |
| 479 // Use StrictMock to make 100% sure we know how GL will be called. | 486 // Use StrictMock to make 100% sure we know how GL will be called. |
| 480 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; | 487 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; |
| 481 scoped_refptr<gfx::GLSurfaceStub> surface_; | 488 scoped_refptr<gfx::GLSurfaceStub> surface_; |
| 482 scoped_refptr<gfx::GLContextStub> context_; | 489 scoped_refptr<gfx::GLContextStub> context_; |
| 483 scoped_ptr<GLES2Decoder> mock_decoder_; | 490 scoped_ptr<GLES2Decoder> mock_decoder_; |
| 484 scoped_ptr<GLES2Decoder> decoder_; | 491 scoped_ptr<GLES2Decoder> decoder_; |
| 485 MemoryTracker* memory_tracker_; | 492 MemoryTracker* memory_tracker_; |
| 486 | 493 |
| 487 GLuint client_buffer_id_; | 494 GLuint client_buffer_id_; |
| 488 GLuint client_framebuffer_id_; | 495 GLuint client_framebuffer_id_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 519 virtual void set_token(int32 token) OVERRIDE; | 526 virtual void set_token(int32 token) OVERRIDE; |
| 520 | 527 |
| 521 virtual bool SetGetBuffer(int32 /* transfer_buffer_id */) OVERRIDE; | 528 virtual bool SetGetBuffer(int32 /* transfer_buffer_id */) OVERRIDE; |
| 522 | 529 |
| 523 // Overridden from CommandBufferEngine. | 530 // Overridden from CommandBufferEngine. |
| 524 virtual bool SetGetOffset(int32 offset) OVERRIDE; | 531 virtual bool SetGetOffset(int32 offset) OVERRIDE; |
| 525 | 532 |
| 526 // Overridden from CommandBufferEngine. | 533 // Overridden from CommandBufferEngine. |
| 527 virtual int32 GetGetOffset() OVERRIDE; | 534 virtual int32 GetGetOffset() OVERRIDE; |
| 528 | 535 |
| 536 virtual gfx::GLImage* GetImage(int32 image_id) OVERRIDE; |
| 537 |
| 529 private: | 538 private: |
| 530 scoped_ptr<int8[]> data_; | 539 scoped_ptr<int8[]> data_; |
| 531 gpu::Buffer valid_buffer_; | 540 gpu::Buffer valid_buffer_; |
| 532 gpu::Buffer invalid_buffer_; | 541 gpu::Buffer invalid_buffer_; |
| 542 scoped_refptr<gfx::GLImage> valid_image_; |
| 533 }; | 543 }; |
| 534 | 544 |
| 535 void AddExpectationsForVertexAttribManager(); | 545 void AddExpectationsForVertexAttribManager(); |
| 536 | 546 |
| 537 scoped_ptr< ::testing::StrictMock<MockCommandBufferEngine> > engine_; | 547 scoped_ptr< ::testing::StrictMock<MockCommandBufferEngine> > engine_; |
| 538 scoped_ptr< ::testing::StrictMock<MockStreamTextureManager> > | 548 scoped_ptr< ::testing::StrictMock<MockStreamTextureManager> > |
| 539 stream_texture_manager_; | 549 stream_texture_manager_; |
| 540 scoped_refptr<ContextGroup> group_; | 550 scoped_refptr<ContextGroup> group_; |
| 541 }; | 551 }; |
| 542 | 552 |
| 543 class GLES2DecoderWithShaderTestBase : public GLES2DecoderTestBase { | 553 class GLES2DecoderWithShaderTestBase : public GLES2DecoderTestBase { |
| 544 public: | 554 public: |
| 545 GLES2DecoderWithShaderTestBase() | 555 GLES2DecoderWithShaderTestBase() |
| 546 : GLES2DecoderTestBase() { | 556 : GLES2DecoderTestBase() { |
| 547 } | 557 } |
| 548 | 558 |
| 549 protected: | 559 protected: |
| 550 virtual void SetUp() OVERRIDE; | 560 virtual void SetUp() OVERRIDE; |
| 551 virtual void TearDown() OVERRIDE; | 561 virtual void TearDown() OVERRIDE; |
| 552 | 562 |
| 553 }; | 563 }; |
| 554 | 564 |
| 555 } // namespace gles2 | 565 } // namespace gles2 |
| 556 } // namespace gpu | 566 } // namespace gpu |
| 557 | 567 |
| 558 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 568 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
| OLD | NEW |