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