OLD | NEW |
---|---|
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
6 | 6 |
7 #include "gpu/command_buffer/service/feature_info.h" | 7 #include "gpu/command_buffer/service/feature_info.h" |
8 #include "gpu/command_buffer/service/gl_utils.h" | 8 #include "gpu/command_buffer/service/gl_utils.h" |
9 #include "ui/gl/gl_version_info.h" | 9 #include "ui/gl/gl_version_info.h" |
10 | 10 |
11 namespace gpu { | 11 namespace gpu { |
12 namespace gles2 { | 12 namespace gles2 { |
13 | 13 |
14 PassthroughResources::PassthroughResources() {} | |
15 | |
16 PassthroughResources::~PassthroughResources() {} | |
piman
2016/09/13 01:07:32
If there are still resources in here, they should
Geoff Lang
2016/09/13 17:49:57
Done, fixed the destruction logic. asserts are no
| |
17 | |
14 GLES2DecoderPassthroughImpl::GLES2DecoderPassthroughImpl(ContextGroup* group) | 18 GLES2DecoderPassthroughImpl::GLES2DecoderPassthroughImpl(ContextGroup* group) |
15 : commands_to_process_(0), | 19 : commands_to_process_(0), |
16 debug_marker_manager_(), | 20 debug_marker_manager_(), |
17 logger_(&debug_marker_manager_), | 21 logger_(&debug_marker_manager_), |
18 surface_(), | 22 surface_(), |
19 context_(), | 23 context_(), |
20 group_(group), | 24 group_(group), |
21 feature_info_(group->feature_info()) { | 25 feature_info_(group->feature_info()) { |
22 DCHECK(group); | 26 DCHECK(group); |
23 } | 27 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 | 110 |
107 if (!group_->Initialize(this, attrib_helper.context_type, | 111 if (!group_->Initialize(this, attrib_helper.context_type, |
108 disallowed_features)) { | 112 disallowed_features)) { |
109 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. | 113 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. |
110 Destroy(true); | 114 Destroy(true); |
111 return false; | 115 return false; |
112 } | 116 } |
113 | 117 |
114 image_manager_.reset(new ImageManager()); | 118 image_manager_.reset(new ImageManager()); |
115 | 119 |
120 resources_ = group_->passthrough_resources(); | |
121 | |
122 mailbox_manager_ = group_->mailbox_manager(); | |
123 | |
124 // Query information about the texture units | |
125 GLint num_texture_units = 0; | |
126 glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &num_texture_units); | |
127 | |
128 active_texture_unit_ = 0; | |
129 bound_textures_.resize(num_texture_units, 0); | |
130 | |
116 set_initialized(); | 131 set_initialized(); |
117 return true; | 132 return true; |
118 } | 133 } |
119 | 134 |
120 void GLES2DecoderPassthroughImpl::Destroy(bool have_context) { | 135 void GLES2DecoderPassthroughImpl::Destroy(bool have_context) { |
121 if (image_manager_.get()) { | 136 if (image_manager_.get()) { |
122 image_manager_->Destroy(have_context); | 137 image_manager_->Destroy(have_context); |
123 image_manager_.reset(); | 138 image_manager_.reset(); |
124 } | 139 } |
125 } | 140 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 | 183 |
169 gpu::gles2::GLES2Util* GLES2DecoderPassthroughImpl::GetGLES2Util() { | 184 gpu::gles2::GLES2Util* GLES2DecoderPassthroughImpl::GetGLES2Util() { |
170 return nullptr; | 185 return nullptr; |
171 } | 186 } |
172 | 187 |
173 gl::GLContext* GLES2DecoderPassthroughImpl::GetGLContext() { | 188 gl::GLContext* GLES2DecoderPassthroughImpl::GetGLContext() { |
174 return nullptr; | 189 return nullptr; |
175 } | 190 } |
176 | 191 |
177 gpu::gles2::ContextGroup* GLES2DecoderPassthroughImpl::GetContextGroup() { | 192 gpu::gles2::ContextGroup* GLES2DecoderPassthroughImpl::GetContextGroup() { |
178 return nullptr; | 193 return group_.get(); |
179 } | 194 } |
180 | 195 |
181 const FeatureInfo* GLES2DecoderPassthroughImpl::GetFeatureInfo() const { | 196 const FeatureInfo* GLES2DecoderPassthroughImpl::GetFeatureInfo() const { |
182 return nullptr; | 197 return group_->feature_info(); |
183 } | 198 } |
184 | 199 |
185 gpu::Capabilities GLES2DecoderPassthroughImpl::GetCapabilities() { | 200 gpu::Capabilities GLES2DecoderPassthroughImpl::GetCapabilities() { |
186 DCHECK(initialized()); | 201 DCHECK(initialized()); |
187 Capabilities caps; | 202 Capabilities caps; |
188 | 203 |
189 PopulateNumericCapabilities(&caps, feature_info_.get()); | 204 PopulateNumericCapabilities(&caps, feature_info_.get()); |
190 | 205 |
191 caps.bind_generates_resource_chromium = group_->bind_generates_resource(); | 206 caps.bind_generates_resource_chromium = group_->bind_generates_resource(); |
192 caps.egl_image_external = | 207 caps.egl_image_external = |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 | 302 |
288 size_t GLES2DecoderPassthroughImpl::GetSavedBackTextureCountForTest() { | 303 size_t GLES2DecoderPassthroughImpl::GetSavedBackTextureCountForTest() { |
289 return 0; | 304 return 0; |
290 } | 305 } |
291 | 306 |
292 size_t GLES2DecoderPassthroughImpl::GetCreatedBackTextureCountForTest() { | 307 size_t GLES2DecoderPassthroughImpl::GetCreatedBackTextureCountForTest() { |
293 return 0; | 308 return 0; |
294 } | 309 } |
295 | 310 |
296 void GLES2DecoderPassthroughImpl::SetFenceSyncReleaseCallback( | 311 void GLES2DecoderPassthroughImpl::SetFenceSyncReleaseCallback( |
297 const FenceSyncReleaseCallback& callback) {} | 312 const FenceSyncReleaseCallback& callback) { |
313 fence_sync_release_callback_ = callback; | |
314 } | |
298 | 315 |
299 void GLES2DecoderPassthroughImpl::SetWaitFenceSyncCallback( | 316 void GLES2DecoderPassthroughImpl::SetWaitFenceSyncCallback( |
300 const WaitFenceSyncCallback& callback) {} | 317 const WaitFenceSyncCallback& callback) { |
318 wait_fence_sync_callback_ = callback; | |
319 } | |
301 | 320 |
302 void GLES2DecoderPassthroughImpl::SetDescheduleUntilFinishedCallback( | 321 void GLES2DecoderPassthroughImpl::SetDescheduleUntilFinishedCallback( |
303 const NoParamCallback& callback) {} | 322 const NoParamCallback& callback) {} |
304 | 323 |
305 void GLES2DecoderPassthroughImpl::SetRescheduleAfterFinishedCallback( | 324 void GLES2DecoderPassthroughImpl::SetRescheduleAfterFinishedCallback( |
306 const NoParamCallback& callback) {} | 325 const NoParamCallback& callback) {} |
307 | 326 |
308 gpu::gles2::QueryManager* GLES2DecoderPassthroughImpl::GetQueryManager() { | 327 gpu::gles2::QueryManager* GLES2DecoderPassthroughImpl::GetQueryManager() { |
309 return nullptr; | 328 return nullptr; |
310 } | 329 } |
(...skipping 26 matching lines...) Expand all Loading... | |
337 | 356 |
338 bool GLES2DecoderPassthroughImpl::HasPollingWork() const { | 357 bool GLES2DecoderPassthroughImpl::HasPollingWork() const { |
339 return false; | 358 return false; |
340 } | 359 } |
341 | 360 |
342 void GLES2DecoderPassthroughImpl::PerformPollingWork() {} | 361 void GLES2DecoderPassthroughImpl::PerformPollingWork() {} |
343 | 362 |
344 bool GLES2DecoderPassthroughImpl::GetServiceTextureId( | 363 bool GLES2DecoderPassthroughImpl::GetServiceTextureId( |
345 uint32_t client_texture_id, | 364 uint32_t client_texture_id, |
346 uint32_t* service_texture_id) { | 365 uint32_t* service_texture_id) { |
347 return false; | 366 return resources_->texture_id_map.GetServiceID(client_texture_id, |
367 service_texture_id); | |
348 } | 368 } |
349 | 369 |
350 gpu::error::ContextLostReason | 370 gpu::error::ContextLostReason |
351 GLES2DecoderPassthroughImpl::GetContextLostReason() { | 371 GLES2DecoderPassthroughImpl::GetContextLostReason() { |
352 return error::kUnknown; | 372 return error::kUnknown; |
353 } | 373 } |
354 | 374 |
355 bool GLES2DecoderPassthroughImpl::ClearLevel(Texture* texture, | 375 bool GLES2DecoderPassthroughImpl::ClearLevel(Texture* texture, |
356 unsigned target, | 376 unsigned target, |
357 int level, | 377 int level, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
443 }, /* NOLINT */ | 463 }, /* NOLINT */ |
444 | 464 |
445 const GLES2DecoderPassthroughImpl::CommandInfo | 465 const GLES2DecoderPassthroughImpl::CommandInfo |
446 GLES2DecoderPassthroughImpl::command_info[] = { | 466 GLES2DecoderPassthroughImpl::command_info[] = { |
447 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; | 467 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; |
448 | 468 |
449 #undef GLES2_CMD_OP | 469 #undef GLES2_CMD_OP |
450 | 470 |
451 } // namespace gles2 | 471 } // namespace gles2 |
452 } // namespace gpu | 472 } // namespace gpu |
OLD | NEW |