| 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 "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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() { | 79 GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() { |
| 80 --gles2_implementation_->use_count_; | 80 --gles2_implementation_->use_count_; |
| 81 CHECK_EQ(0, gles2_implementation_->use_count_); | 81 CHECK_EQ(0, gles2_implementation_->use_count_); |
| 82 } | 82 } |
| 83 | 83 |
| 84 GLES2Implementation::GLES2Implementation( | 84 GLES2Implementation::GLES2Implementation( |
| 85 GLES2CmdHelper* helper, | 85 GLES2CmdHelper* helper, |
| 86 ShareGroup* share_group, | 86 ShareGroup* share_group, |
| 87 TransferBufferInterface* transfer_buffer, | 87 TransferBufferInterface* transfer_buffer, |
| 88 bool bind_generates_resource, | 88 bool bind_generates_resource, |
| 89 GpuControl* gpu_control) | 89 GpuControl* gpu_control, |
| 90 const Capabilities& capabilities) |
| 90 : helper_(helper), | 91 : helper_(helper), |
| 91 transfer_buffer_(transfer_buffer), | 92 transfer_buffer_(transfer_buffer), |
| 92 angle_pack_reverse_row_order_status_(kUnknownExtensionStatus), | 93 angle_pack_reverse_row_order_status_(kUnknownExtensionStatus), |
| 93 chromium_framebuffer_multisample_(kUnknownExtensionStatus), | 94 chromium_framebuffer_multisample_(kUnknownExtensionStatus), |
| 94 pack_alignment_(4), | 95 pack_alignment_(4), |
| 95 unpack_alignment_(4), | 96 unpack_alignment_(4), |
| 96 unpack_flip_y_(false), | 97 unpack_flip_y_(false), |
| 97 unpack_row_length_(0), | 98 unpack_row_length_(0), |
| 98 unpack_skip_rows_(0), | 99 unpack_skip_rows_(0), |
| 99 unpack_skip_pixels_(0), | 100 unpack_skip_pixels_(0), |
| 100 pack_reverse_row_order_(false), | 101 pack_reverse_row_order_(false), |
| 101 active_texture_unit_(0), | 102 active_texture_unit_(0), |
| 102 bound_framebuffer_(0), | 103 bound_framebuffer_(0), |
| 103 bound_read_framebuffer_(0), | 104 bound_read_framebuffer_(0), |
| 104 bound_renderbuffer_(0), | 105 bound_renderbuffer_(0), |
| 105 current_program_(0), | 106 current_program_(0), |
| 106 bound_array_buffer_id_(0), | 107 bound_array_buffer_id_(0), |
| 107 bound_pixel_pack_transfer_buffer_id_(0), | 108 bound_pixel_pack_transfer_buffer_id_(0), |
| 108 bound_pixel_unpack_transfer_buffer_id_(0), | 109 bound_pixel_unpack_transfer_buffer_id_(0), |
| 109 error_bits_(0), | 110 error_bits_(0), |
| 110 debug_(false), | 111 debug_(false), |
| 111 use_count_(0), | 112 use_count_(0), |
| 112 error_message_callback_(NULL), | 113 error_message_callback_(NULL), |
| 113 gpu_control_(gpu_control), | 114 gpu_control_(gpu_control), |
| 114 capabilities_(gpu_control->GetCapabilities()), | 115 capabilities_(capabilities), |
| 115 weak_ptr_factory_(this) { | 116 weak_ptr_factory_(this) { |
| 116 DCHECK(helper); | 117 DCHECK(helper); |
| 117 DCHECK(transfer_buffer); | 118 DCHECK(transfer_buffer); |
| 118 DCHECK(gpu_control); | 119 DCHECK(gpu_control); |
| 119 | 120 |
| 120 std::stringstream ss; | 121 std::stringstream ss; |
| 121 ss << std::hex << this; | 122 ss << std::hex << this; |
| 122 this_in_hex_ = ss.str(); | 123 this_in_hex_ = ss.str(); |
| 123 | 124 |
| 124 GPU_CLIENT_LOG_CODE_BLOCK({ | 125 GPU_CLIENT_LOG_CODE_BLOCK({ |
| (...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2135 // Clears the bucket so if the command fails nothing will be in it. | 2136 // Clears the bucket so if the command fails nothing will be in it. |
| 2136 helper_->SetBucketSize(kResultBucketId, 0); | 2137 helper_->SetBucketSize(kResultBucketId, 0); |
| 2137 helper_->GetString(name, kResultBucketId); | 2138 helper_->GetString(name, kResultBucketId); |
| 2138 std::string str; | 2139 std::string str; |
| 2139 if (GetBucketAsString(kResultBucketId, &str)) { | 2140 if (GetBucketAsString(kResultBucketId, &str)) { |
| 2140 // Adds extensions implemented on client side only. | 2141 // Adds extensions implemented on client side only. |
| 2141 switch (name) { | 2142 switch (name) { |
| 2142 case GL_EXTENSIONS: | 2143 case GL_EXTENSIONS: |
| 2143 str += std::string(str.empty() ? "" : " ") + | 2144 str += std::string(str.empty() ? "" : " ") + |
| 2144 "GL_CHROMIUM_flipy " | 2145 "GL_CHROMIUM_flipy " |
| 2146 "GL_CHROMIUM_map_image " |
| 2145 "GL_EXT_unpack_subimage"; | 2147 "GL_EXT_unpack_subimage"; |
| 2146 if (capabilities_.map_image) { | |
| 2147 // The first space character is intentional. | |
| 2148 str += " GL_CHROMIUM_map_image"; | |
| 2149 } | |
| 2150 break; | 2148 break; |
| 2151 default: | 2149 default: |
| 2152 break; | 2150 break; |
| 2153 } | 2151 } |
| 2154 | 2152 |
| 2155 // Because of WebGL the extensions can change. We have to cache each unique | 2153 // Because of WebGL the extensions can change. We have to cache each unique |
| 2156 // result since we don't know when the client will stop referring to a | 2154 // result since we don't know when the client will stop referring to a |
| 2157 // previous one it queries. | 2155 // previous one it queries. |
| 2158 GLStringMap::iterator it = gl_strings_.find(name); | 2156 GLStringMap::iterator it = gl_strings_.find(name); |
| 2159 if (it == gl_strings_.end()) { | 2157 if (it == gl_strings_.end()) { |
| (...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3921 CheckGLError(); | 3919 CheckGLError(); |
| 3922 } | 3920 } |
| 3923 | 3921 |
| 3924 // 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 |
| 3925 // 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 |
| 3926 // instead of having to edit some template or the code generator. | 3924 // instead of having to edit some template or the code generator. |
| 3927 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 3925 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 3928 | 3926 |
| 3929 } // namespace gles2 | 3927 } // namespace gles2 |
| 3930 } // namespace gpu | 3928 } // namespace gpu |
| OLD | NEW |