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

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.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 (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 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 3454 matching lines...) Expand 10 before | Expand all | Expand 10 after
3465 CheckGLError(); 3465 CheckGLError();
3466 } 3466 }
3467 3467
3468 void GLES2Implementation::GenMailboxCHROMIUM( 3468 void GLES2Implementation::GenMailboxCHROMIUM(
3469 GLbyte* mailbox) { 3469 GLbyte* mailbox) {
3470 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3470 GPU_CLIENT_SINGLE_THREAD_CHECK();
3471 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenMailboxCHROMIUM(" 3471 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenMailboxCHROMIUM("
3472 << static_cast<const void*>(mailbox) << ")"); 3472 << static_cast<const void*>(mailbox) << ")");
3473 TRACE_EVENT0("gpu", "GLES2::GenMailboxCHROMIUM"); 3473 TRACE_EVENT0("gpu", "GLES2::GenMailboxCHROMIUM");
3474 3474
3475 std::vector<gpu::Mailbox> names; 3475 gpu::Mailbox result = gpu::Mailbox::Generate();
3476 if (!gpu_control_->GenerateMailboxNames(1, &names)) { 3476 memcpy(mailbox, result.name, sizeof(result.name));
3477 SetGLError(GL_OUT_OF_MEMORY, "glGenMailboxCHROMIUM", "Generate failed."); 3477 }
3478 return; 3478
3479 } 3479 void GLES2Implementation::ProduceTextureCHROMIUM(GLenum target,
3480 memcpy(mailbox, names[0].name, GL_MAILBOX_SIZE_CHROMIUM); 3480 const GLbyte* data) {
3481 GPU_CLIENT_SINGLE_THREAD_CHECK();
3482 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glProduceTextureCHROMIUM("
3483 << static_cast<const void*>(data) << ")");
3484 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data);
3485 DCHECK(mailbox.Verify()) << "ProduceTextureCHROMIUM was passed a "
3486 "mailbox that was not generated by "
3487 "GenMailboxCHROMIUM.";
3488 helper_->ProduceTextureCHROMIUMImmediate(target, data);
3489 CheckGLError();
3490 }
3491
3492 void GLES2Implementation::ConsumeTextureCHROMIUM(GLenum target,
3493 const GLbyte* data) {
3494 GPU_CLIENT_SINGLE_THREAD_CHECK();
3495 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glConsumeTextureCHROMIUM("
3496 << static_cast<const void*>(data) << ")");
3497 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data);
3498 DCHECK(mailbox.Verify()) << "ConsumeTextureCHROMIUM was passed a "
3499 "mailbox that was not generated by "
3500 "GenMailboxCHROMIUM.";
3501 helper_->ConsumeTextureCHROMIUMImmediate(target, data);
3502 CheckGLError();
3481 } 3503 }
3482 3504
3483 void GLES2Implementation::PushGroupMarkerEXT( 3505 void GLES2Implementation::PushGroupMarkerEXT(
3484 GLsizei length, const GLchar* marker) { 3506 GLsizei length, const GLchar* marker) {
3485 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3507 GPU_CLIENT_SINGLE_THREAD_CHECK();
3486 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPushGroupMarkerEXT(" 3508 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPushGroupMarkerEXT("
3487 << length << ", " << marker << ")"); 3509 << length << ", " << marker << ")");
3488 if (!marker) { 3510 if (!marker) {
3489 marker = ""; 3511 marker = "";
3490 } 3512 }
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
3897 CheckGLError(); 3919 CheckGLError();
3898 } 3920 }
3899 3921
3900 // Include the auto-generated part of this file. We split this because it means 3922 // Include the auto-generated part of this file. We split this because it means
3901 // we can easily edit the non-auto generated parts right here in this file 3923 // we can easily edit the non-auto generated parts right here in this file
3902 // instead of having to edit some template or the code generator. 3924 // instead of having to edit some template or the code generator.
3903 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 3925 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
3904 3926
3905 } // namespace gles2 3927 } // namespace gles2
3906 } // namespace gpu 3928 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698