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

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: Include proper internalformat support.[D 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
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)
90 : helper_(helper), 89 : helper_(helper),
91 transfer_buffer_(transfer_buffer), 90 transfer_buffer_(transfer_buffer),
92 angle_pack_reverse_row_order_status_(kUnknownExtensionStatus), 91 angle_pack_reverse_row_order_status_(kUnknownExtensionStatus),
93 chromium_framebuffer_multisample_(kUnknownExtensionStatus), 92 chromium_framebuffer_multisample_(kUnknownExtensionStatus),
94 pack_alignment_(4), 93 pack_alignment_(4),
95 unpack_alignment_(4), 94 unpack_alignment_(4),
96 unpack_flip_y_(false), 95 unpack_flip_y_(false),
97 unpack_row_length_(0), 96 unpack_row_length_(0),
98 unpack_skip_rows_(0), 97 unpack_skip_rows_(0),
99 unpack_skip_pixels_(0), 98 unpack_skip_pixels_(0),
100 pack_reverse_row_order_(false), 99 pack_reverse_row_order_(false),
101 active_texture_unit_(0), 100 active_texture_unit_(0),
102 bound_framebuffer_(0), 101 bound_framebuffer_(0),
103 bound_read_framebuffer_(0), 102 bound_read_framebuffer_(0),
104 bound_renderbuffer_(0), 103 bound_renderbuffer_(0),
105 current_program_(0), 104 current_program_(0),
106 bound_array_buffer_id_(0), 105 bound_array_buffer_id_(0),
107 bound_pixel_pack_transfer_buffer_id_(0), 106 bound_pixel_pack_transfer_buffer_id_(0),
108 bound_pixel_unpack_transfer_buffer_id_(0), 107 bound_pixel_unpack_transfer_buffer_id_(0),
109 error_bits_(0), 108 error_bits_(0),
110 debug_(false), 109 debug_(false),
111 use_count_(0), 110 use_count_(0),
112 current_query_(NULL), 111 current_query_(NULL),
113 error_message_callback_(NULL), 112 error_message_callback_(NULL) {
114 image_factory_(image_factory) {
115 GPU_DCHECK(helper); 113 GPU_DCHECK(helper);
116 GPU_DCHECK(transfer_buffer); 114 GPU_DCHECK(transfer_buffer);
117 115
118 char temp[128]; 116 char temp[128];
119 sprintf(temp, "%p", static_cast<void*>(this)); 117 sprintf(temp, "%p", static_cast<void*>(this));
120 this_in_hex_ = std::string(temp); 118 this_in_hex_ = std::string(temp);
121 119
122 GPU_CLIENT_LOG_CODE_BLOCK({ 120 GPU_CLIENT_LOG_CODE_BLOCK({
123 debug_ = CommandLine::ForCurrentProcess()->HasSwitch( 121 debug_ = CommandLine::ForCurrentProcess()->HasSwitch(
124 switches::kEnableGPUClientLogging); 122 switches::kEnableGPUClientLogging);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 static_state_.int_state.num_compressed_texture_formats); 156 static_state_.int_state.num_compressed_texture_formats);
159 util_.set_num_shader_binary_formats( 157 util_.set_num_shader_binary_formats(
160 static_state_.int_state.num_shader_binary_formats); 158 static_state_.int_state.num_shader_binary_formats);
161 159
162 texture_units_.reset( 160 texture_units_.reset(
163 new TextureUnit[ 161 new TextureUnit[
164 static_state_.int_state.max_combined_texture_image_units]); 162 static_state_.int_state.max_combined_texture_image_units]);
165 163
166 query_tracker_.reset(new QueryTracker(mapped_memory_.get())); 164 query_tracker_.reset(new QueryTracker(mapped_memory_.get()));
167 buffer_tracker_.reset(new BufferTracker(mapped_memory_.get())); 165 buffer_tracker_.reset(new BufferTracker(mapped_memory_.get()));
168 gpu_memory_buffer_tracker_.reset(new GpuMemoryBufferTracker(image_factory_)); 166 gpu_memory_buffer_tracker_.reset(new GpuMemoryBufferTracker(helper_));
169 167
170 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 168 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
171 GetIdHandler(id_namespaces::kBuffers)->MakeIds( 169 GetIdHandler(id_namespaces::kBuffers)->MakeIds(
172 this, kClientSideArrayId, arraysize(reserved_ids_), &reserved_ids_[0]); 170 this, kClientSideArrayId, arraysize(reserved_ids_), &reserved_ids_[0]);
173 #endif 171 #endif
174 172
175 vertex_array_object_manager_.reset(new VertexArrayObjectManager( 173 vertex_array_object_manager_.reset(new VertexArrayObjectManager(
176 static_state_.int_state.max_vertex_attribs, 174 static_state_.int_state.max_vertex_attribs,
177 reserved_ids_[0], 175 reserved_ids_[0],
178 reserved_ids_[1])); 176 reserved_ids_[1]));
(...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 // Clears the bucket so if the command fails nothing will be in it. 2077 // Clears the bucket so if the command fails nothing will be in it.
2080 helper_->SetBucketSize(kResultBucketId, 0); 2078 helper_->SetBucketSize(kResultBucketId, 0);
2081 helper_->GetString(name, kResultBucketId); 2079 helper_->GetString(name, kResultBucketId);
2082 std::string str; 2080 std::string str;
2083 if (GetBucketAsString(kResultBucketId, &str)) { 2081 if (GetBucketAsString(kResultBucketId, &str)) {
2084 // Adds extensions implemented on client side only. 2082 // Adds extensions implemented on client side only.
2085 switch (name) { 2083 switch (name) {
2086 case GL_EXTENSIONS: 2084 case GL_EXTENSIONS:
2087 str += std::string(str.empty() ? "" : " ") + 2085 str += std::string(str.empty() ? "" : " ") +
2088 "GL_CHROMIUM_flipy " 2086 "GL_CHROMIUM_flipy "
2087 "GL_CHROMIUM_map_image "
2089 "GL_CHROMIUM_map_sub " 2088 "GL_CHROMIUM_map_sub "
2090 "GL_CHROMIUM_shallow_flush " 2089 "GL_CHROMIUM_shallow_flush "
2091 "GL_EXT_unpack_subimage"; 2090 "GL_EXT_unpack_subimage";
2092 if (image_factory_ != NULL) {
2093 // The first space character is intentional.
2094 str += " GL_CHROMIUM_map_image";
2095 }
2096 break; 2091 break;
2097 default: 2092 default:
2098 break; 2093 break;
2099 } 2094 }
2100 2095
2101 // Because of WebGL the extensions can change. We have to cache each unique 2096 // 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 2097 // result since we don't know when the client will stop referring to a
2103 // previous one it queries. 2098 // previous one it queries.
2104 GLStringMap::iterator it = gl_strings_.find(name); 2099 GLStringMap::iterator it = gl_strings_.find(name);
2105 if (it == gl_strings_.end()) { 2100 if (it == gl_strings_.end()) {
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after
3822 CheckGLError(); 3817 CheckGLError();
3823 } 3818 }
3824 3819
3825 // Include the auto-generated part of this file. We split this because it means 3820 // 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 3821 // 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. 3822 // instead of having to edit some template or the code generator.
3828 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 3823 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
3829 3824
3830 } // namespace gles2 3825 } // namespace gles2
3831 } // namespace gpu 3826 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698