| 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 // 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 <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <GLES2/gl2ext.h> | 12 #include <GLES2/gl2ext.h> |
| 13 #include "../client/mapped_memory.h" | 13 #include "../client/mapped_memory.h" |
| 14 #include "../client/program_info_manager.h" | 14 #include "../client/program_info_manager.h" |
| 15 #include "../client/query_tracker.h" | 15 #include "../client/query_tracker.h" |
| 16 #include "../client/share_group.h" |
| 16 #include "../client/transfer_buffer.h" | 17 #include "../client/transfer_buffer.h" |
| 17 #include "../common/gles2_cmd_utils.h" | 18 #include "../common/gles2_cmd_utils.h" |
| 18 #include "../common/id_allocator.h" | 19 #include "../common/id_allocator.h" |
| 19 #include "../common/trace_event.h" | 20 #include "../common/trace_event.h" |
| 20 | 21 |
| 21 #if defined(__native_client__) && !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) | 22 #if defined(__native_client__) && !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) |
| 22 #define GLES2_SUPPORT_CLIENT_SIDE_ARRAYS | 23 #define GLES2_SUPPORT_CLIENT_SIDE_ARRAYS |
| 23 #endif | 24 #endif |
| 24 | 25 |
| 25 #if defined(GPU_CLIENT_DEBUG) | 26 #if defined(GPU_CLIENT_DEBUG) |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 ++gles2_implementation_->use_count_; | 569 ++gles2_implementation_->use_count_; |
| 569 } | 570 } |
| 570 | 571 |
| 571 GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() { | 572 GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() { |
| 572 --gles2_implementation_->use_count_; | 573 --gles2_implementation_->use_count_; |
| 573 GPU_CHECK_EQ(0, gles2_implementation_->use_count_); | 574 GPU_CHECK_EQ(0, gles2_implementation_->use_count_); |
| 574 } | 575 } |
| 575 | 576 |
| 576 GLES2Implementation::GLES2Implementation( | 577 GLES2Implementation::GLES2Implementation( |
| 577 GLES2CmdHelper* helper, | 578 GLES2CmdHelper* helper, |
| 579 ShareGroup* share_group, |
| 578 TransferBufferInterface* transfer_buffer, | 580 TransferBufferInterface* transfer_buffer, |
| 579 bool share_resources, | 581 bool share_resources, |
| 580 bool bind_generates_resource) | 582 bool bind_generates_resource) |
| 581 : helper_(helper), | 583 : helper_(helper), |
| 582 transfer_buffer_(transfer_buffer), | 584 transfer_buffer_(transfer_buffer), |
| 583 angle_pack_reverse_row_order_status(kUnknownExtensionStatus), | 585 angle_pack_reverse_row_order_status(kUnknownExtensionStatus), |
| 584 pack_alignment_(4), | 586 pack_alignment_(4), |
| 585 unpack_alignment_(4), | 587 unpack_alignment_(4), |
| 586 unpack_flip_y_(false), | 588 unpack_flip_y_(false), |
| 587 pack_reverse_row_order_(false), | 589 pack_reverse_row_order_(false), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 599 use_count_(0), | 601 use_count_(0), |
| 600 current_query_(NULL), | 602 current_query_(NULL), |
| 601 error_message_callback_(NULL) { | 603 error_message_callback_(NULL) { |
| 602 GPU_DCHECK(helper); | 604 GPU_DCHECK(helper); |
| 603 GPU_DCHECK(transfer_buffer); | 605 GPU_DCHECK(transfer_buffer); |
| 604 GPU_CLIENT_LOG_CODE_BLOCK({ | 606 GPU_CLIENT_LOG_CODE_BLOCK({ |
| 605 debug_ = CommandLine::ForCurrentProcess()->HasSwitch( | 607 debug_ = CommandLine::ForCurrentProcess()->HasSwitch( |
| 606 switches::kEnableGPUClientLogging); | 608 switches::kEnableGPUClientLogging); |
| 607 }); | 609 }); |
| 608 | 610 |
| 611 share_group_ = (share_group ? share_group : new ShareGroup()); |
| 612 |
| 609 memset(&reserved_ids_, 0, sizeof(reserved_ids_)); | 613 memset(&reserved_ids_, 0, sizeof(reserved_ids_)); |
| 610 } | 614 } |
| 611 | 615 |
| 612 bool GLES2Implementation::Initialize( | 616 bool GLES2Implementation::Initialize( |
| 613 unsigned int starting_transfer_buffer_size, | 617 unsigned int starting_transfer_buffer_size, |
| 614 unsigned int min_transfer_buffer_size, | 618 unsigned int min_transfer_buffer_size, |
| 615 unsigned int max_transfer_buffer_size) { | 619 unsigned int max_transfer_buffer_size) { |
| 616 GPU_DCHECK_GE(starting_transfer_buffer_size, min_transfer_buffer_size); | 620 GPU_DCHECK_GE(starting_transfer_buffer_size, min_transfer_buffer_size); |
| 617 GPU_DCHECK_LE(starting_transfer_buffer_size, max_transfer_buffer_size); | 621 GPU_DCHECK_LE(starting_transfer_buffer_size, max_transfer_buffer_size); |
| 618 GPU_DCHECK_GE(min_transfer_buffer_size, kStartingOffset); | 622 GPU_DCHECK_GE(min_transfer_buffer_size, kStartingOffset); |
| (...skipping 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3254 helper_->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); | 3258 helper_->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); |
| 3255 } | 3259 } |
| 3256 #else | 3260 #else |
| 3257 helper_->DrawElementsInstancedANGLE( | 3261 helper_->DrawElementsInstancedANGLE( |
| 3258 mode, count, type, ToGLuint(indices), primcount); | 3262 mode, count, type, ToGLuint(indices), primcount); |
| 3259 #endif | 3263 #endif |
| 3260 } | 3264 } |
| 3261 | 3265 |
| 3262 } // namespace gles2 | 3266 } // namespace gles2 |
| 3263 } // namespace gpu | 3267 } // namespace gpu |
| OLD | NEW |