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

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

Issue 169403005: command_buffer: Implement path rendering functions for CHROMIUM_path_rendering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nv-pr-02-texgen
Patch Set: fix windows build Created 5 years, 5 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
« no previous file with comments | « gpu/command_buffer/client/share_group.h ('k') | gpu/command_buffer/cmd_buffer_functions.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/client/share_group.h" 5 #include "gpu/command_buffer/client/share_group.h"
6 6
7 #include <stack> 7 #include <stack>
8 #include <vector> 8 #include <vector>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 return false; 311 return false;
312 } 312 }
313 313
314 void FreeContext(GLES2Implementation* gl_impl) override {} 314 void FreeContext(GLES2Implementation* gl_impl) override {}
315 315
316 private: 316 private:
317 base::Lock lock_; 317 base::Lock lock_;
318 GLuint last_id_; 318 GLuint last_id_;
319 }; 319 };
320 320
321 class RangeIdHandler : public RangeIdHandlerInterface {
322 public:
323 RangeIdHandler() {}
324
325 void MakeIdRange(GLES2Implementation* /*gl_impl*/,
326 GLsizei n,
327 GLuint* first_id) override {
328 base::AutoLock auto_lock(lock_);
329 *first_id = id_allocator_.AllocateIDRange(n);
330 }
331
332 void FreeIdRange(GLES2Implementation* gl_impl,
333 const GLuint first_id,
334 GLsizei range,
335 DeleteRangeFn delete_fn) override {
336 base::AutoLock auto_lock(lock_);
337 DCHECK(range > 0);
338 id_allocator_.FreeIDRange(first_id, range);
339 (gl_impl->*delete_fn)(first_id, range);
340 gl_impl->helper()->CommandBufferHelper::OrderingBarrier();
341 }
342
343 void FreeContext(GLES2Implementation* gl_impl) override {}
344
345 private:
346 base::Lock lock_;
347 IdAllocator id_allocator_;
348 };
349
321 ShareGroup::ShareGroup(bool bind_generates_resource) 350 ShareGroup::ShareGroup(bool bind_generates_resource)
322 : bind_generates_resource_(bind_generates_resource) { 351 : bind_generates_resource_(bind_generates_resource) {
323 if (bind_generates_resource) { 352 if (bind_generates_resource) {
324 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { 353 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) {
325 if (i == id_namespaces::kProgramsAndShaders) { 354 if (i == id_namespaces::kProgramsAndShaders) {
326 id_handlers_[i].reset(new NonReusedIdHandler()); 355 id_handlers_[i].reset(new NonReusedIdHandler());
327 } else { 356 } else {
328 id_handlers_[i].reset(new IdHandler()); 357 id_handlers_[i].reset(new IdHandler());
329 } 358 }
330 } 359 }
331 } else { 360 } else {
332 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { 361 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) {
333 if (i == id_namespaces::kProgramsAndShaders) { 362 if (i == id_namespaces::kProgramsAndShaders) {
334 id_handlers_[i].reset(new NonReusedIdHandler()); 363 id_handlers_[i].reset(new NonReusedIdHandler());
335 } else { 364 } else {
336 id_handlers_[i].reset(new StrictIdHandler(i)); 365 id_handlers_[i].reset(new StrictIdHandler(i));
337 } 366 }
338 } 367 }
339 } 368 }
340 program_info_manager_.reset(new ProgramInfoManager); 369 program_info_manager_.reset(new ProgramInfoManager);
370 for (auto& range_id_handler : range_id_handlers_) {
371 range_id_handler.reset(new RangeIdHandler());
372 }
341 } 373 }
342 374
343 void ShareGroup::set_program_info_manager(ProgramInfoManager* manager) { 375 void ShareGroup::set_program_info_manager(ProgramInfoManager* manager) {
344 program_info_manager_.reset(manager); 376 program_info_manager_.reset(manager);
345 } 377 }
346 378
347 ShareGroup::~ShareGroup() {} 379 ShareGroup::~ShareGroup() {}
348 380
349 } // namespace gles2 381 } // namespace gles2
350 } // namespace gpu 382 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/share_group.h ('k') | gpu/command_buffer/cmd_buffer_functions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698