| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 namespace base { | 28 namespace base { |
| 29 class CommandLine; | 29 class CommandLine; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace gpu { | 32 namespace gpu { |
| 33 namespace gles2 { | 33 namespace gles2 { |
| 34 | 34 |
| 35 class MemoryTracker; | 35 class MemoryTracker; |
| 36 | 36 |
| 37 class GLES2DecoderTestBase : public ::testing::TestWithParam<bool> { | 37 class GLES2DecoderTestBase : public testing::Test { |
| 38 public: | 38 public: |
| 39 GLES2DecoderTestBase(); | 39 GLES2DecoderTestBase(); |
| 40 virtual ~GLES2DecoderTestBase(); | 40 virtual ~GLES2DecoderTestBase(); |
| 41 | 41 |
| 42 // Template to call glGenXXX functions. | 42 // Template to call glGenXXX functions. |
| 43 template <typename T> | 43 template <typename T> |
| 44 void GenHelper(GLuint client_id) { | 44 void GenHelper(GLuint client_id) { |
| 45 int8 buffer[sizeof(T) + sizeof(client_id)]; | 45 int8 buffer[sizeof(T) + sizeof(client_id)]; |
| 46 T& cmd = *reinterpret_cast<T*>(&buffer); | 46 T& cmd = *reinterpret_cast<T*>(&buffer); |
| 47 cmd.Init(1, &client_id); | 47 cmd.Init(1, &client_id); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 GLuint renderbuffer_service_id, | 262 GLuint renderbuffer_service_id, |
| 263 GLenum error); | 263 GLenum error); |
| 264 void DoFramebufferTexture2D( | 264 void DoFramebufferTexture2D( |
| 265 GLenum target, GLenum attachment, GLenum tex_target, | 265 GLenum target, GLenum attachment, GLenum tex_target, |
| 266 GLuint texture_client_id, GLuint texture_service_id, | 266 GLuint texture_client_id, GLuint texture_service_id, |
| 267 GLint level, GLenum error); | 267 GLint level, GLenum error); |
| 268 void DoVertexAttribPointer( | 268 void DoVertexAttribPointer( |
| 269 GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset); | 269 GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset); |
| 270 void DoVertexAttribDivisorANGLE(GLuint index, GLuint divisor); | 270 void DoVertexAttribDivisorANGLE(GLuint index, GLuint divisor); |
| 271 | 271 |
| 272 void DoEnableDisable(GLenum cap, bool enable); | |
| 273 | |
| 274 void DoEnableVertexAttribArray(GLint index); | 272 void DoEnableVertexAttribArray(GLint index); |
| 275 | 273 |
| 276 void DoBufferData(GLenum target, GLsizei size); | 274 void DoBufferData(GLenum target, GLsizei size); |
| 277 | 275 |
| 278 void DoBufferSubData( | 276 void DoBufferSubData( |
| 279 GLenum target, GLint offset, GLsizei size, const void* data); | 277 GLenum target, GLint offset, GLsizei size, const void* data); |
| 280 | 278 |
| 281 void SetupVertexBuffer(); | 279 void SetupVertexBuffer(); |
| 282 void SetupAllNeededVertexBuffers(); | 280 void SetupAllNeededVertexBuffers(); |
| 283 | 281 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 GLenum target, | 323 GLenum target, |
| 326 GLuint clear_bits, | 324 GLuint clear_bits, |
| 327 GLclampf restore_red, | 325 GLclampf restore_red, |
| 328 GLclampf restore_green, | 326 GLclampf restore_green, |
| 329 GLclampf restore_blue, | 327 GLclampf restore_blue, |
| 330 GLclampf restore_alpha, | 328 GLclampf restore_alpha, |
| 331 GLuint restore_stencil, | 329 GLuint restore_stencil, |
| 332 GLclampf restore_depth, | 330 GLclampf restore_depth, |
| 333 bool restore_scissor_test); | 331 bool restore_scissor_test); |
| 334 | 332 |
| 335 void SetupExpectationsForDepthMask(bool mask); | |
| 336 void SetupExpectationsForEnableDisable(GLenum cap, bool enable); | |
| 337 void SetupExpectationsForColorMask(bool red, | |
| 338 bool green, | |
| 339 bool blue, | |
| 340 bool alpha); | |
| 341 | |
| 342 void SetupExpectationsForApplyingDirtyState( | 333 void SetupExpectationsForApplyingDirtyState( |
| 343 bool framebuffer_is_rgb, | 334 bool framebuffer_is_rgb, |
| 344 bool framebuffer_has_depth, | 335 bool framebuffer_has_depth, |
| 345 bool framebuffer_has_stencil, | 336 bool framebuffer_has_stencil, |
| 346 GLuint color_bits, // NOTE! bits are 0x1000, 0x0100, 0x0010, and 0x0001 | 337 GLuint color_bits, // NOTE! bits are 0x1000, 0x0100, 0x0010, and 0x0001 |
| 347 bool depth_mask, | 338 bool depth_mask, |
| 348 bool depth_enabled, | 339 bool depth_enabled, |
| 349 GLuint front_stencil_mask, | 340 GLuint front_stencil_mask, |
| 350 GLuint back_stencil_mask, | 341 GLuint back_stencil_mask, |
| 351 bool stencil_enabled); | 342 bool stencil_enabled, |
| 343 bool cull_face_enabled, |
| 344 bool scissor_test_enabled, |
| 345 bool blend_enabled); |
| 352 | 346 |
| 353 void SetupExpectationsForApplyingDefaultDirtyState(); | 347 void SetupExpectationsForApplyingDefaultDirtyState(); |
| 354 | 348 |
| 355 void AddExpectationsForSimulatedAttrib0WithError( | 349 void AddExpectationsForSimulatedAttrib0WithError( |
| 356 GLsizei num_vertices, GLuint buffer_id, GLenum error); | 350 GLsizei num_vertices, GLuint buffer_id, GLenum error); |
| 357 | 351 |
| 358 void AddExpectationsForSimulatedAttrib0( | 352 void AddExpectationsForSimulatedAttrib0( |
| 359 GLsizei num_vertices, GLuint buffer_id); | 353 GLsizei num_vertices, GLuint buffer_id); |
| 360 | 354 |
| 361 void AddExpectationsForGenVertexArraysOES(); | 355 void AddExpectationsForGenVertexArraysOES(); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 GLuint client_query_id_; | 503 GLuint client_query_id_; |
| 510 GLuint client_vertexarray_id_; | 504 GLuint client_vertexarray_id_; |
| 511 | 505 |
| 512 uint32 shared_memory_id_; | 506 uint32 shared_memory_id_; |
| 513 uint32 shared_memory_offset_; | 507 uint32 shared_memory_offset_; |
| 514 void* shared_memory_address_; | 508 void* shared_memory_address_; |
| 515 void* shared_memory_base_; | 509 void* shared_memory_base_; |
| 516 | 510 |
| 517 int8 immediate_buffer_[256]; | 511 int8 immediate_buffer_[256]; |
| 518 | 512 |
| 519 const bool ignore_cached_state_for_test_; | |
| 520 bool cached_color_mask_red_; | |
| 521 bool cached_color_mask_green_; | |
| 522 bool cached_color_mask_blue_; | |
| 523 bool cached_color_mask_alpha_; | |
| 524 bool cached_depth_mask_; | |
| 525 uint32 cached_stencil_front_mask_; | |
| 526 uint32 cached_stencil_back_mask_; | |
| 527 | |
| 528 struct EnableFlags { | |
| 529 EnableFlags(); | |
| 530 bool cached_blend; | |
| 531 bool cached_cull_face; | |
| 532 bool cached_depth_test; | |
| 533 bool cached_dither; | |
| 534 bool cached_polygon_offset_fill; | |
| 535 bool cached_sample_alpha_to_coverage; | |
| 536 bool cached_sample_coverage; | |
| 537 bool cached_scissor_test; | |
| 538 bool cached_stencil_test; | |
| 539 }; | |
| 540 | |
| 541 EnableFlags enable_flags_; | |
| 542 | |
| 543 private: | 513 private: |
| 544 class MockCommandBufferEngine : public CommandBufferEngine { | 514 class MockCommandBufferEngine : public CommandBufferEngine { |
| 545 public: | 515 public: |
| 546 MockCommandBufferEngine(); | 516 MockCommandBufferEngine(); |
| 547 | 517 |
| 548 virtual ~MockCommandBufferEngine(); | 518 virtual ~MockCommandBufferEngine(); |
| 549 | 519 |
| 550 virtual scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32 shm_id) | 520 virtual scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32 shm_id) |
| 551 OVERRIDE; | 521 OVERRIDE; |
| 552 | 522 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 protected: | 554 protected: |
| 585 virtual void SetUp() OVERRIDE; | 555 virtual void SetUp() OVERRIDE; |
| 586 virtual void TearDown() OVERRIDE; | 556 virtual void TearDown() OVERRIDE; |
| 587 | 557 |
| 588 }; | 558 }; |
| 589 | 559 |
| 590 } // namespace gles2 | 560 } // namespace gles2 |
| 591 } // namespace gpu | 561 } // namespace gpu |
| 592 | 562 |
| 593 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 563 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
| OLD | NEW |