| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "../client/gles2_implementation.h" | 7 #include "../client/gles2_implementation.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 debug_ = CommandLine::ForCurrentProcess()->HasSwitch( | 555 debug_ = CommandLine::ForCurrentProcess()->HasSwitch( |
| 556 switches::kEnableGPUClientLogging); | 556 switches::kEnableGPUClientLogging); |
| 557 }); | 557 }); |
| 558 | 558 |
| 559 // Allocate space for simple GL results. | 559 // Allocate space for simple GL results. |
| 560 result_buffer_ = transfer_buffer; | 560 result_buffer_ = transfer_buffer; |
| 561 result_shm_offset_ = 0; | 561 result_shm_offset_ = 0; |
| 562 memset(&reserved_ids_, 0, sizeof(reserved_ids_)); | 562 memset(&reserved_ids_, 0, sizeof(reserved_ids_)); |
| 563 | 563 |
| 564 mapped_memory_.reset(new MappedMemoryManager(helper_)); | 564 mapped_memory_.reset(new MappedMemoryManager(helper_)); |
| 565 SetSharedMemoryChunkSizeMultiple(1024 * 1024 * 2); |
| 565 | 566 |
| 566 if (share_resources) { | 567 if (share_resources) { |
| 567 if (!bind_generates_resource) { | 568 if (!bind_generates_resource) { |
| 568 buffer_id_handler_.reset( | 569 buffer_id_handler_.reset( |
| 569 new StrictSharedIdHandler(this, id_namespaces::kBuffers)); | 570 new StrictSharedIdHandler(this, id_namespaces::kBuffers)); |
| 570 framebuffer_id_handler_.reset( | 571 framebuffer_id_handler_.reset( |
| 571 new StrictSharedIdHandler(this, id_namespaces::kFramebuffers)); | 572 new StrictSharedIdHandler(this, id_namespaces::kFramebuffers)); |
| 572 renderbuffer_id_handler_.reset( | 573 renderbuffer_id_handler_.reset( |
| 573 new StrictSharedIdHandler(this, id_namespaces::kRenderbuffers)); | 574 new StrictSharedIdHandler(this, id_namespaces::kRenderbuffers)); |
| 574 program_and_shader_id_handler_.reset( | 575 program_and_shader_id_handler_.reset( |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 reserved_ids_[1])); | 635 reserved_ids_[1])); |
| 635 #endif | 636 #endif |
| 636 } | 637 } |
| 637 | 638 |
| 638 GLES2Implementation::~GLES2Implementation() { | 639 GLES2Implementation::~GLES2Implementation() { |
| 639 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) | 640 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) |
| 640 DeleteBuffers(arraysize(reserved_ids_), &reserved_ids_[0]); | 641 DeleteBuffers(arraysize(reserved_ids_), &reserved_ids_[0]); |
| 641 #endif | 642 #endif |
| 642 } | 643 } |
| 643 | 644 |
| 645 void GLES2Implementation::SetSharedMemoryChunkSizeMultiple( |
| 646 unsigned int multiple) { |
| 647 mapped_memory_->set_chunk_size_multiple(multiple); |
| 648 } |
| 649 |
| 644 void GLES2Implementation::FreeUnusedSharedMemory() { | 650 void GLES2Implementation::FreeUnusedSharedMemory() { |
| 645 mapped_memory_->FreeUnused(); | 651 mapped_memory_->FreeUnused(); |
| 646 } | 652 } |
| 647 | 653 |
| 648 void GLES2Implementation::WaitForCmd() { | 654 void GLES2Implementation::WaitForCmd() { |
| 649 TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); | 655 TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); |
| 650 helper_->CommandBufferHelper::Finish(); | 656 helper_->CommandBufferHelper::Finish(); |
| 651 } | 657 } |
| 652 | 658 |
| 653 GLenum GLES2Implementation::GetError() { | 659 GLenum GLES2Implementation::GetError() { |
| (...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2652 | 2658 |
| 2653 void GLES2Implementation::DestroyStreamTextureCHROMIUM(GLuint texture) { | 2659 void GLES2Implementation::DestroyStreamTextureCHROMIUM(GLuint texture) { |
| 2654 GPU_CLIENT_LOG("[" << this << "] DestroyStreamTextureCHROMIUM(" | 2660 GPU_CLIENT_LOG("[" << this << "] DestroyStreamTextureCHROMIUM(" |
| 2655 << texture << ")"); | 2661 << texture << ")"); |
| 2656 TRACE_EVENT0("gpu", "GLES2::DestroyStreamTextureCHROMIUM"); | 2662 TRACE_EVENT0("gpu", "GLES2::DestroyStreamTextureCHROMIUM"); |
| 2657 helper_->DestroyStreamTextureCHROMIUM(texture); | 2663 helper_->DestroyStreamTextureCHROMIUM(texture); |
| 2658 } | 2664 } |
| 2659 | 2665 |
| 2660 } // namespace gles2 | 2666 } // namespace gles2 |
| 2661 } // namespace gpu | 2667 } // namespace gpu |
| OLD | NEW |