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/gl_mock.h" | 8 #include "gpu/command_buffer/common/gl_mock.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 293 |
294 void SetupExpectationsForApplyingDirtyState( | 294 void SetupExpectationsForApplyingDirtyState( |
295 bool framebuffer_is_rgb, | 295 bool framebuffer_is_rgb, |
296 bool framebuffer_has_depth, | 296 bool framebuffer_has_depth, |
297 bool framebuffer_has_stencil, | 297 bool framebuffer_has_stencil, |
298 GLuint color_bits, // NOTE! bits are 0x1000, 0x0100, 0x0010, and 0x0001 | 298 GLuint color_bits, // NOTE! bits are 0x1000, 0x0100, 0x0010, and 0x0001 |
299 bool depth_mask, | 299 bool depth_mask, |
300 bool depth_enabled, | 300 bool depth_enabled, |
301 GLuint front_stencil_mask, | 301 GLuint front_stencil_mask, |
302 GLuint back_stencil_mask, | 302 GLuint back_stencil_mask, |
303 bool stencil_enabled); | 303 bool stencil_enabled, |
| 304 bool cull_face_enabled, |
| 305 bool scissor_test_enabled); |
304 | 306 |
305 void SetupExpectationsForApplyingDefaultDirtyState(); | 307 void SetupExpectationsForApplyingDefaultDirtyState(); |
306 | 308 |
307 void AddExpectationsForSimulatedAttrib0WithError( | 309 void AddExpectationsForSimulatedAttrib0WithError( |
308 GLsizei num_vertices, GLuint buffer_id, GLenum error); | 310 GLsizei num_vertices, GLuint buffer_id, GLenum error); |
309 | 311 |
310 void AddExpectationsForSimulatedAttrib0( | 312 void AddExpectationsForSimulatedAttrib0( |
311 GLsizei num_vertices, GLuint buffer_id); | 313 GLsizei num_vertices, GLuint buffer_id); |
312 | 314 |
313 GLvoid* BufferOffset(unsigned i) { | 315 GLvoid* BufferOffset(unsigned i) { |
314 return static_cast<int8 *>(NULL)+(i); | 316 return static_cast<int8 *>(NULL)+(i); |
315 } | 317 } |
316 | 318 |
317 template <typename Command, typename Result> | 319 template <typename Command, typename Result> |
318 bool IsObjectHelper(GLuint client_id) { | 320 bool IsObjectHelper(GLuint client_id) { |
319 Result* result = static_cast<Result*>(shared_memory_address_); | 321 Result* result = static_cast<Result*>(shared_memory_address_); |
320 Command cmd; | 322 Command cmd; |
321 cmd.Init(client_id, kSharedMemoryId, kSharedMemoryOffset); | 323 cmd.Init(client_id, kSharedMemoryId, kSharedMemoryOffset); |
322 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 324 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
323 bool isObject = static_cast<bool>(*result); | 325 bool isObject = static_cast<bool>(*result); |
324 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 326 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
325 return isObject; | 327 return isObject; |
326 } | 328 } |
327 | 329 |
328 protected: | 330 protected: |
| 331 static const int kBackBufferWidth = 128; |
| 332 static const int kBackBufferHeight = 64; |
| 333 |
329 static const GLint kMaxTextureSize = 2048; | 334 static const GLint kMaxTextureSize = 2048; |
330 static const GLint kMaxCubeMapTextureSize = 256; | 335 static const GLint kMaxCubeMapTextureSize = 256; |
331 static const GLint kNumVertexAttribs = 16; | 336 static const GLint kNumVertexAttribs = 16; |
332 static const GLint kNumTextureUnits = 8; | 337 static const GLint kNumTextureUnits = 8; |
333 static const GLint kMaxTextureImageUnits = 8; | 338 static const GLint kMaxTextureImageUnits = 8; |
334 static const GLint kMaxVertexTextureImageUnits = 2; | 339 static const GLint kMaxVertexTextureImageUnits = 2; |
335 static const GLint kMaxFragmentUniformVectors = 16; | 340 static const GLint kMaxFragmentUniformVectors = 16; |
336 static const GLint kMaxVaryingVectors = 8; | 341 static const GLint kMaxVaryingVectors = 8; |
337 static const GLint kMaxVertexUniformVectors = 128; | 342 static const GLint kMaxVertexUniformVectors = 128; |
| 343 static const GLint kMaxViewportWidth = 8192; |
| 344 static const GLint kMaxViewportHeight = 8192; |
| 345 |
| 346 static const GLint kViewportX = 0; |
| 347 static const GLint kViewportY = 0; |
| 348 static const GLint kViewportWidth = kBackBufferWidth; |
| 349 static const GLint kViewportHeight = kBackBufferHeight; |
338 | 350 |
339 static const GLuint kServiceAttrib0BufferId = 801; | 351 static const GLuint kServiceAttrib0BufferId = 801; |
340 static const GLuint kServiceFixedAttribBufferId = 802; | 352 static const GLuint kServiceFixedAttribBufferId = 802; |
341 | 353 |
342 static const GLuint kServiceBufferId = 301; | 354 static const GLuint kServiceBufferId = 301; |
343 static const GLuint kServiceFramebufferId = 302; | 355 static const GLuint kServiceFramebufferId = 302; |
344 static const GLuint kServiceRenderbufferId = 303; | 356 static const GLuint kServiceRenderbufferId = 303; |
345 static const GLuint kServiceTextureId = 304; | 357 static const GLuint kServiceTextureId = 304; |
346 static const GLuint kServiceProgramId = 305; | 358 static const GLuint kServiceProgramId = 305; |
347 static const GLuint kServiceShaderId = 306; | 359 static const GLuint kServiceShaderId = 306; |
348 static const GLuint kServiceElementBufferId = 308; | 360 static const GLuint kServiceElementBufferId = 308; |
349 static const GLuint kServiceQueryId = 309; | 361 static const GLuint kServiceQueryId = 309; |
350 | 362 |
351 static const int32 kSharedMemoryId = 401; | 363 static const int32 kSharedMemoryId = 401; |
352 static const size_t kSharedBufferSize = 2048; | 364 static const size_t kSharedBufferSize = 2048; |
353 static const uint32 kSharedMemoryOffset = 132; | 365 static const uint32 kSharedMemoryOffset = 132; |
354 static const int32 kInvalidSharedMemoryId = 402; | 366 static const int32 kInvalidSharedMemoryId = 402; |
355 static const uint32 kInvalidSharedMemoryOffset = kSharedBufferSize + 1; | 367 static const uint32 kInvalidSharedMemoryOffset = kSharedBufferSize + 1; |
356 static const uint32 kInitialResult = 0xBDBDBDBDu; | 368 static const uint32 kInitialResult = 0xBDBDBDBDu; |
357 static const uint8 kInitialMemoryValue = 0xBDu; | 369 static const uint8 kInitialMemoryValue = 0xBDu; |
358 | 370 |
359 static const uint32 kNewClientId = 501; | 371 static const uint32 kNewClientId = 501; |
360 static const uint32 kNewServiceId = 502; | 372 static const uint32 kNewServiceId = 502; |
361 static const uint32 kInvalidClientId = 601; | 373 static const uint32 kInvalidClientId = 601; |
362 | 374 |
363 static const int kBackBufferWidth = 128; | |
364 static const int kBackBufferHeight = 64; | |
365 | |
366 static const GLuint kServiceVertexShaderId = 321; | 375 static const GLuint kServiceVertexShaderId = 321; |
367 static const GLuint kServiceFragmentShaderId = 322; | 376 static const GLuint kServiceFragmentShaderId = 322; |
368 | 377 |
| 378 static const GLuint kServiceCopyTextureChromiumShaderId = 701; |
| 379 static const GLuint kServiceCopyTextureChromiumProgramId = 721; |
| 380 |
| 381 static const GLuint kServiceCopyTextureChromiumTextureBufferId = 751; |
| 382 static const GLuint kServiceCopyTextureChromiumVertexBufferId = 752; |
| 383 static const GLuint kServiceCopyTextureChromiumFBOId = 753; |
| 384 static const GLuint kServiceCopyTextureChromiumPositionAttrib = 761; |
| 385 static const GLuint kServiceCopyTextureChromiumTexAttrib = 762; |
| 386 static const GLuint kServiceCopyTextureChromiumSamplerLocation = 763; |
| 387 |
369 static const GLsizei kNumVertices = 100; | 388 static const GLsizei kNumVertices = 100; |
370 static const GLsizei kNumIndices = 10; | 389 static const GLsizei kNumIndices = 10; |
371 static const int kValidIndexRangeStart = 1; | 390 static const int kValidIndexRangeStart = 1; |
372 static const int kValidIndexRangeCount = 7; | 391 static const int kValidIndexRangeCount = 7; |
373 static const int kInvalidIndexRangeStart = 0; | 392 static const int kInvalidIndexRangeStart = 0; |
374 static const int kInvalidIndexRangeCount = 7; | 393 static const int kInvalidIndexRangeCount = 7; |
375 static const int kOutOfRangeIndexRangeEnd = 10; | 394 static const int kOutOfRangeIndexRangeEnd = 10; |
376 static const GLuint kMaxValidIndex = 7; | 395 static const GLuint kMaxValidIndex = 7; |
377 | 396 |
378 static const GLint kMaxAttribLength = 10; | 397 static const GLint kMaxAttribLength = 10; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 DCHECK(false); | 497 DCHECK(false); |
479 return 0; | 498 return 0; |
480 } | 499 } |
481 | 500 |
482 private: | 501 private: |
483 scoped_array<int8> data_; | 502 scoped_array<int8> data_; |
484 Buffer valid_buffer_; | 503 Buffer valid_buffer_; |
485 Buffer invalid_buffer_; | 504 Buffer invalid_buffer_; |
486 }; | 505 }; |
487 | 506 |
| 507 void AddExpectationsForCopyTextureCHROMIUM(); |
| 508 |
488 scoped_ptr< ::testing::StrictMock<MockCommandBufferEngine> > engine_; | 509 scoped_ptr< ::testing::StrictMock<MockCommandBufferEngine> > engine_; |
489 ContextGroup::Ref group_; | 510 ContextGroup::Ref group_; |
490 }; | 511 }; |
491 | 512 |
492 class GLES2DecoderWithShaderTestBase : public GLES2DecoderTestBase { | 513 class GLES2DecoderWithShaderTestBase : public GLES2DecoderTestBase { |
493 public: | 514 public: |
494 GLES2DecoderWithShaderTestBase() | 515 GLES2DecoderWithShaderTestBase() |
495 : GLES2DecoderTestBase() { | 516 : GLES2DecoderTestBase() { |
496 } | 517 } |
497 | 518 |
498 protected: | 519 protected: |
499 virtual void SetUp() OVERRIDE; | 520 virtual void SetUp() OVERRIDE; |
500 virtual void TearDown() OVERRIDE; | 521 virtual void TearDown() OVERRIDE; |
501 | 522 |
502 }; | 523 }; |
503 | 524 |
504 } // namespace gles2 | 525 } // namespace gles2 |
505 } // namespace gpu | 526 } // namespace gpu |
506 | 527 |
507 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 528 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
OLD | NEW |