Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h

Issue 245923008: Optimize GLES2DecoderImpl::ApplyDirtyState. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on refactored gles2_cmd_decoder_unittest.cc Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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::Test { 37 class GLES2DecoderTestBase : public ::testing::TestWithParam<bool> {
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
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
272 void DoEnableVertexAttribArray(GLint index); 274 void DoEnableVertexAttribArray(GLint index);
273 275
274 void DoBufferData(GLenum target, GLsizei size); 276 void DoBufferData(GLenum target, GLsizei size);
275 277
276 void DoBufferSubData( 278 void DoBufferSubData(
277 GLenum target, GLint offset, GLsizei size, const void* data); 279 GLenum target, GLint offset, GLsizei size, const void* data);
278 280
279 void SetupVertexBuffer(); 281 void SetupVertexBuffer();
280 void SetupAllNeededVertexBuffers(); 282 void SetupAllNeededVertexBuffers();
281 283
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 GLenum target, 325 GLenum target,
324 GLuint clear_bits, 326 GLuint clear_bits,
325 GLclampf restore_red, 327 GLclampf restore_red,
326 GLclampf restore_green, 328 GLclampf restore_green,
327 GLclampf restore_blue, 329 GLclampf restore_blue,
328 GLclampf restore_alpha, 330 GLclampf restore_alpha,
329 GLuint restore_stencil, 331 GLuint restore_stencil,
330 GLclampf restore_depth, 332 GLclampf restore_depth,
331 bool restore_scissor_test); 333 bool restore_scissor_test);
332 334
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
333 void SetupExpectationsForApplyingDirtyState( 342 void SetupExpectationsForApplyingDirtyState(
334 bool framebuffer_is_rgb, 343 bool framebuffer_is_rgb,
335 bool framebuffer_has_depth, 344 bool framebuffer_has_depth,
336 bool framebuffer_has_stencil, 345 bool framebuffer_has_stencil,
337 GLuint color_bits, // NOTE! bits are 0x1000, 0x0100, 0x0010, and 0x0001 346 GLuint color_bits, // NOTE! bits are 0x1000, 0x0100, 0x0010, and 0x0001
338 bool depth_mask, 347 bool depth_mask,
339 bool depth_enabled, 348 bool depth_enabled,
340 GLuint front_stencil_mask, 349 GLuint front_stencil_mask,
341 GLuint back_stencil_mask, 350 GLuint back_stencil_mask,
342 bool stencil_enabled, 351 bool stencil_enabled);
343 bool cull_face_enabled,
344 bool scissor_test_enabled,
345 bool blend_enabled);
346 352
347 void SetupExpectationsForApplyingDefaultDirtyState(); 353 void SetupExpectationsForApplyingDefaultDirtyState();
348 354
349 void AddExpectationsForSimulatedAttrib0WithError( 355 void AddExpectationsForSimulatedAttrib0WithError(
350 GLsizei num_vertices, GLuint buffer_id, GLenum error); 356 GLsizei num_vertices, GLuint buffer_id, GLenum error);
351 357
352 void AddExpectationsForSimulatedAttrib0( 358 void AddExpectationsForSimulatedAttrib0(
353 GLsizei num_vertices, GLuint buffer_id); 359 GLsizei num_vertices, GLuint buffer_id);
354 360
355 void AddExpectationsForGenVertexArraysOES(); 361 void AddExpectationsForGenVertexArraysOES();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 GLuint client_query_id_; 509 GLuint client_query_id_;
504 GLuint client_vertexarray_id_; 510 GLuint client_vertexarray_id_;
505 511
506 uint32 shared_memory_id_; 512 uint32 shared_memory_id_;
507 uint32 shared_memory_offset_; 513 uint32 shared_memory_offset_;
508 void* shared_memory_address_; 514 void* shared_memory_address_;
509 void* shared_memory_base_; 515 void* shared_memory_base_;
510 516
511 int8 immediate_buffer_[256]; 517 int8 immediate_buffer_[256];
512 518
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
513 private: 543 private:
514 class MockCommandBufferEngine : public CommandBufferEngine { 544 class MockCommandBufferEngine : public CommandBufferEngine {
515 public: 545 public:
516 MockCommandBufferEngine(); 546 MockCommandBufferEngine();
517 547
518 virtual ~MockCommandBufferEngine(); 548 virtual ~MockCommandBufferEngine();
519 549
520 virtual scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32 shm_id) 550 virtual scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32 shm_id)
521 OVERRIDE; 551 OVERRIDE;
522 552
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 protected: 584 protected:
555 virtual void SetUp() OVERRIDE; 585 virtual void SetUp() OVERRIDE;
556 virtual void TearDown() OVERRIDE; 586 virtual void TearDown() OVERRIDE;
557 587
558 }; 588 };
559 589
560 } // namespace gles2 590 } // namespace gles2
561 } // namespace gpu 591 } // namespace gpu
562 592
563 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ 593 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698