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

Side by Side Diff: cc/test/test_web_graphics_context_3d.cc

Issue 165393003: gpu: Generate mailboxes on client side (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "cc/test/test_web_graphics_context_3d.h" 5 #include "cc/test/test_web_graphics_context_3d.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 // static 46 // static
47 scoped_ptr<TestWebGraphicsContext3D> TestWebGraphicsContext3D::Create() { 47 scoped_ptr<TestWebGraphicsContext3D> TestWebGraphicsContext3D::Create() {
48 return make_scoped_ptr(new TestWebGraphicsContext3D()); 48 return make_scoped_ptr(new TestWebGraphicsContext3D());
49 } 49 }
50 50
51 TestWebGraphicsContext3D::TestWebGraphicsContext3D() 51 TestWebGraphicsContext3D::TestWebGraphicsContext3D()
52 : context_id_(s_context_id++), 52 : context_id_(s_context_id++),
53 times_bind_texture_succeeds_(-1), 53 times_bind_texture_succeeds_(-1),
54 times_end_query_succeeds_(-1), 54 times_end_query_succeeds_(-1),
55 times_gen_mailbox_succeeds_(-1),
56 context_lost_(false), 55 context_lost_(false),
57 times_map_image_chromium_succeeds_(-1), 56 times_map_image_chromium_succeeds_(-1),
58 times_map_buffer_chromium_succeeds_(-1), 57 times_map_buffer_chromium_succeeds_(-1),
59 next_program_id_(1000), 58 next_program_id_(1000),
60 next_shader_id_(2000), 59 next_shader_id_(2000),
61 max_texture_size_(2048), 60 max_texture_size_(2048),
62 reshape_called_(false), 61 reshape_called_(false),
63 width_(0), 62 width_(0),
64 height_(0), 63 height_(0),
65 scale_factor_(-1.f), 64 scale_factor_(-1.f),
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 range[1] = 62; 420 range[1] = 62;
422 *precision = 16; 421 *precision = 16;
423 break; 422 break;
424 default: 423 default:
425 NOTREACHED(); 424 NOTREACHED();
426 break; 425 break;
427 } 426 }
428 } 427 }
429 428
430 void TestWebGraphicsContext3D::genMailboxCHROMIUM(GLbyte* mailbox) { 429 void TestWebGraphicsContext3D::genMailboxCHROMIUM(GLbyte* mailbox) {
431 if (times_gen_mailbox_succeeds_ >= 0) {
432 if (!times_gen_mailbox_succeeds_) {
433 loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
434 GL_INNOCENT_CONTEXT_RESET_ARB);
435 }
436 --times_gen_mailbox_succeeds_;
437 }
438 if (context_lost_) {
439 memset(mailbox, 0, GL_MAILBOX_SIZE_CHROMIUM);
440 return;
441 }
442
443 static char mailbox_name1 = '1'; 430 static char mailbox_name1 = '1';
444 static char mailbox_name2 = '1'; 431 static char mailbox_name2 = '1';
445 mailbox[0] = mailbox_name1; 432 mailbox[0] = mailbox_name1;
446 mailbox[1] = mailbox_name2; 433 mailbox[1] = mailbox_name2;
447 mailbox[2] = '\0'; 434 mailbox[2] = '\0';
448 if (++mailbox_name1 == 0) { 435 if (++mailbox_name1 == 0) {
449 mailbox_name1 = '1'; 436 mailbox_name1 = '1';
450 ++mailbox_name2; 437 ++mailbox_name2;
451 } 438 }
452 } 439 }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 732
746 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} 733 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {}
747 734
748 TestWebGraphicsContext3D::Buffer::~Buffer() {} 735 TestWebGraphicsContext3D::Buffer::~Buffer() {}
749 736
750 TestWebGraphicsContext3D::Image::Image() {} 737 TestWebGraphicsContext3D::Image::Image() {}
751 738
752 TestWebGraphicsContext3D::Image::~Image() {} 739 TestWebGraphicsContext3D::Image::~Image() {}
753 740
754 } // namespace cc 741 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698