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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2447533002: ui: Add ref-counting to GLFence class.
Patch Set: rebase Created 4 years, 1 month 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
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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 GLES2DecoderImpl* decoder_; 451 GLES2DecoderImpl* decoder_;
452 GLuint id_; 452 GLuint id_;
453 DISALLOW_COPY_AND_ASSIGN(BackFramebuffer); 453 DISALLOW_COPY_AND_ASSIGN(BackFramebuffer);
454 }; 454 };
455 455
456 struct FenceCallback { 456 struct FenceCallback {
457 FenceCallback() : fence(gl::GLFence::Create()) { DCHECK(fence); } 457 FenceCallback() : fence(gl::GLFence::Create()) { DCHECK(fence); }
458 FenceCallback(FenceCallback&&) = default; 458 FenceCallback(FenceCallback&&) = default;
459 FenceCallback& operator=(FenceCallback&&) = default; 459 FenceCallback& operator=(FenceCallback&&) = default;
460 std::vector<base::Closure> callbacks; 460 std::vector<base::Closure> callbacks;
461 std::unique_ptr<gl::GLFence> fence; 461 scoped_refptr<gl::GLFence> fence;
462 }; 462 };
463 463
464 // } // anonymous namespace. 464 // } // anonymous namespace.
465 465
466 // static 466 // static
467 const unsigned int GLES2Decoder::kDefaultStencilMask = 467 const unsigned int GLES2Decoder::kDefaultStencilMask =
468 static_cast<unsigned int>(-1); 468 static_cast<unsigned int>(-1);
469 469
470 bool GLES2Decoder::GetServiceTextureId(uint32_t client_texture_id, 470 bool GLES2Decoder::GetServiceTextureId(uint32_t client_texture_id,
471 uint32_t* service_texture_id) { 471 uint32_t* service_texture_id) {
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 const unsigned char* gpu_decoder_category_; 2353 const unsigned char* gpu_decoder_category_;
2354 int gpu_trace_level_; 2354 int gpu_trace_level_;
2355 bool gpu_trace_commands_; 2355 bool gpu_trace_commands_;
2356 bool gpu_debug_commands_; 2356 bool gpu_debug_commands_;
2357 2357
2358 std::queue<FenceCallback> pending_readpixel_fences_; 2358 std::queue<FenceCallback> pending_readpixel_fences_;
2359 2359
2360 // After a second fence is inserted, both the GpuChannelMessageQueue and 2360 // After a second fence is inserted, both the GpuChannelMessageQueue and
2361 // CommandExecutor are descheduled. Once the first fence has completed, both 2361 // CommandExecutor are descheduled. Once the first fence has completed, both
2362 // get rescheduled. 2362 // get rescheduled.
2363 std::vector<std::unique_ptr<gl::GLFence>> deschedule_until_finished_fences_; 2363 std::vector<scoped_refptr<gl::GLFence>> deschedule_until_finished_fences_;
2364 2364
2365 // Used to validate multisample renderbuffers if needed 2365 // Used to validate multisample renderbuffers if needed
2366 typedef base::hash_map<GLenum, GLuint> TextureMap; 2366 typedef base::hash_map<GLenum, GLuint> TextureMap;
2367 TextureMap validation_textures_; 2367 TextureMap validation_textures_;
2368 GLuint validation_fbo_multisample_; 2368 GLuint validation_fbo_multisample_;
2369 GLuint validation_fbo_; 2369 GLuint validation_fbo_;
2370 2370
2371 typedef gpu::gles2::GLES2Decoder::Error (GLES2DecoderImpl::*CmdHandler)( 2371 typedef gpu::gles2::GLES2Decoder::Error (GLES2DecoderImpl::*CmdHandler)(
2372 uint32_t immediate_data_size, 2372 uint32_t immediate_data_size,
2373 const volatile void* data); 2373 const volatile void* data);
(...skipping 12972 matching lines...) Expand 10 before | Expand all | Expand 10 after
15346 uint32_t immediate_data_size, 15346 uint32_t immediate_data_size,
15347 const volatile void* cmd_data) { 15347 const volatile void* cmd_data) {
15348 if (deschedule_until_finished_callback_.is_null() || 15348 if (deschedule_until_finished_callback_.is_null() ||
15349 reschedule_after_finished_callback_.is_null()) { 15349 reschedule_after_finished_callback_.is_null()) {
15350 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 15350 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
15351 "glDescheduleUntilFinishedCHROMIUM", 15351 "glDescheduleUntilFinishedCHROMIUM",
15352 "Not fully implemented."); 15352 "Not fully implemented.");
15353 return error::kNoError; 15353 return error::kNoError;
15354 } 15354 }
15355 15355
15356 std::unique_ptr<gl::GLFence> fence(gl::GLFence::Create()); 15356 scoped_refptr<gl::GLFence> fence(gl::GLFence::Create());
15357 deschedule_until_finished_fences_.push_back(std::move(fence)); 15357 deschedule_until_finished_fences_.push_back(std::move(fence));
15358 15358
15359 if (deschedule_until_finished_fences_.size() == 1) 15359 if (deschedule_until_finished_fences_.size() == 1)
15360 return error::kNoError; 15360 return error::kNoError;
15361 15361
15362 DCHECK_EQ(2u, deschedule_until_finished_fences_.size()); 15362 DCHECK_EQ(2u, deschedule_until_finished_fences_.size());
15363 if (deschedule_until_finished_fences_[0]->HasCompleted()) { 15363 if (deschedule_until_finished_fences_[0]->HasCompleted()) {
15364 deschedule_until_finished_fences_.erase( 15364 deschedule_until_finished_fences_.erase(
15365 deschedule_until_finished_fences_.begin()); 15365 deschedule_until_finished_fences_.begin());
15366 return error::kNoError; 15366 return error::kNoError;
(...skipping 3321 matching lines...) Expand 10 before | Expand all | Expand 10 after
18688 } 18688 }
18689 18689
18690 // Include the auto-generated part of this file. We split this because it means 18690 // Include the auto-generated part of this file. We split this because it means
18691 // we can easily edit the non-auto generated parts right here in this file 18691 // we can easily edit the non-auto generated parts right here in this file
18692 // instead of having to edit some template or the code generator. 18692 // instead of having to edit some template or the code generator.
18693 #include "base/macros.h" 18693 #include "base/macros.h"
18694 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 18694 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
18695 18695
18696 } // namespace gles2 18696 } // namespace gles2
18697 } // namespace gpu 18697 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/fence_manager.cc ('k') | gpu/command_buffer/service/mailbox_manager_sync.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698