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

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 20017005: gpu: Refactor GpuMemoryBuffer framework for multi-process support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() { 79 GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() {
80 --gles2_implementation_->use_count_; 80 --gles2_implementation_->use_count_;
81 GPU_CHECK_EQ(0, gles2_implementation_->use_count_); 81 GPU_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 ImageFactory* image_factory) 89 GpuControl* gpu_control)
90 : helper_(helper), 90 : helper_(helper),
91 transfer_buffer_(transfer_buffer), 91 transfer_buffer_(transfer_buffer),
92 angle_pack_reverse_row_order_status_(kUnknownExtensionStatus), 92 angle_pack_reverse_row_order_status_(kUnknownExtensionStatus),
93 chromium_framebuffer_multisample_(kUnknownExtensionStatus), 93 chromium_framebuffer_multisample_(kUnknownExtensionStatus),
94 pack_alignment_(4), 94 pack_alignment_(4),
95 unpack_alignment_(4), 95 unpack_alignment_(4),
96 unpack_flip_y_(false), 96 unpack_flip_y_(false),
97 unpack_row_length_(0), 97 unpack_row_length_(0),
98 unpack_skip_rows_(0), 98 unpack_skip_rows_(0),
99 unpack_skip_pixels_(0), 99 unpack_skip_pixels_(0),
100 pack_reverse_row_order_(false), 100 pack_reverse_row_order_(false),
101 active_texture_unit_(0), 101 active_texture_unit_(0),
102 bound_framebuffer_(0), 102 bound_framebuffer_(0),
103 bound_read_framebuffer_(0), 103 bound_read_framebuffer_(0),
104 bound_renderbuffer_(0), 104 bound_renderbuffer_(0),
105 current_program_(0), 105 current_program_(0),
106 bound_array_buffer_id_(0), 106 bound_array_buffer_id_(0),
107 bound_pixel_pack_transfer_buffer_id_(0), 107 bound_pixel_pack_transfer_buffer_id_(0),
108 bound_pixel_unpack_transfer_buffer_id_(0), 108 bound_pixel_unpack_transfer_buffer_id_(0),
109 error_bits_(0), 109 error_bits_(0),
110 debug_(false), 110 debug_(false),
111 use_count_(0), 111 use_count_(0),
112 current_query_(NULL), 112 current_query_(NULL),
113 error_message_callback_(NULL), 113 error_message_callback_(NULL),
114 image_factory_(image_factory) { 114 gpu_control_(gpu_control) {
115 GPU_DCHECK(helper); 115 GPU_DCHECK(helper);
116 GPU_DCHECK(transfer_buffer); 116 GPU_DCHECK(transfer_buffer);
117 117
118 char temp[128]; 118 char temp[128];
119 sprintf(temp, "%p", static_cast<void*>(this)); 119 sprintf(temp, "%p", static_cast<void*>(this));
120 this_in_hex_ = std::string(temp); 120 this_in_hex_ = std::string(temp);
121 121
122 GPU_CLIENT_LOG_CODE_BLOCK({ 122 GPU_CLIENT_LOG_CODE_BLOCK({
123 debug_ = CommandLine::ForCurrentProcess()->HasSwitch( 123 debug_ = CommandLine::ForCurrentProcess()->HasSwitch(
124 switches::kEnableGPUClientLogging); 124 switches::kEnableGPUClientLogging);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 static_state_.int_state.num_compressed_texture_formats); 158 static_state_.int_state.num_compressed_texture_formats);
159 util_.set_num_shader_binary_formats( 159 util_.set_num_shader_binary_formats(
160 static_state_.int_state.num_shader_binary_formats); 160 static_state_.int_state.num_shader_binary_formats);
161 161
162 texture_units_.reset( 162 texture_units_.reset(
163 new TextureUnit[ 163 new TextureUnit[
164 static_state_.int_state.max_combined_texture_image_units]); 164 static_state_.int_state.max_combined_texture_image_units]);
165 165
166 query_tracker_.reset(new QueryTracker(mapped_memory_.get())); 166 query_tracker_.reset(new QueryTracker(mapped_memory_.get()));
167 buffer_tracker_.reset(new BufferTracker(mapped_memory_.get())); 167 buffer_tracker_.reset(new BufferTracker(mapped_memory_.get()));
168 gpu_memory_buffer_tracker_.reset(new GpuMemoryBufferTracker(image_factory_)); 168 gpu_memory_buffer_tracker_.reset(new GpuMemoryBufferTracker(gpu_control_));
169 169
170 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 170 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
171 GetIdHandler(id_namespaces::kBuffers)->MakeIds( 171 GetIdHandler(id_namespaces::kBuffers)->MakeIds(
172 this, kClientSideArrayId, arraysize(reserved_ids_), &reserved_ids_[0]); 172 this, kClientSideArrayId, arraysize(reserved_ids_), &reserved_ids_[0]);
173 #endif 173 #endif
174 174
175 vertex_array_object_manager_.reset(new VertexArrayObjectManager( 175 vertex_array_object_manager_.reset(new VertexArrayObjectManager(
176 static_state_.int_state.max_vertex_attribs, 176 static_state_.int_state.max_vertex_attribs,
177 reserved_ids_[0], 177 reserved_ids_[0],
178 reserved_ids_[1])); 178 reserved_ids_[1]));
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 std::string str; 2082 std::string str;
2083 if (GetBucketAsString(kResultBucketId, &str)) { 2083 if (GetBucketAsString(kResultBucketId, &str)) {
2084 // Adds extensions implemented on client side only. 2084 // Adds extensions implemented on client side only.
2085 switch (name) { 2085 switch (name) {
2086 case GL_EXTENSIONS: 2086 case GL_EXTENSIONS:
2087 str += std::string(str.empty() ? "" : " ") + 2087 str += std::string(str.empty() ? "" : " ") +
2088 "GL_CHROMIUM_flipy " 2088 "GL_CHROMIUM_flipy "
2089 "GL_CHROMIUM_map_sub " 2089 "GL_CHROMIUM_map_sub "
2090 "GL_CHROMIUM_shallow_flush " 2090 "GL_CHROMIUM_shallow_flush "
2091 "GL_EXT_unpack_subimage"; 2091 "GL_EXT_unpack_subimage";
2092 if (image_factory_ != NULL) { 2092 if (gpu_control_ != NULL) {
2093 // The first space character is intentional. 2093 // The first space character is intentional.
2094 str += " GL_CHROMIUM_map_image"; 2094 str += " GL_CHROMIUM_map_image";
2095 } 2095 }
2096 break; 2096 break;
2097 default: 2097 default:
2098 break; 2098 break;
2099 } 2099 }
2100 2100
2101 // Because of WebGL the extensions can change. We have to cache each unique 2101 // Because of WebGL the extensions can change. We have to cache each unique
2102 // result since we don't know when the client will stop referring to a 2102 // result since we don't know when the client will stop referring to a
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after
3822 CheckGLError(); 3822 CheckGLError();
3823 } 3823 }
3824 3824
3825 // Include the auto-generated part of this file. We split this because it means 3825 // Include the auto-generated part of this file. We split this because it means
3826 // we can easily edit the non-auto generated parts right here in this file 3826 // we can easily edit the non-auto generated parts right here in this file
3827 // instead of having to edit some template or the code generator. 3827 // instead of having to edit some template or the code generator.
3828 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 3828 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
3829 3829
3830 } // namespace gles2 3830 } // namespace gles2
3831 } // namespace gpu 3831 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.h ('k') | gpu/command_buffer/client/gles2_implementation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698