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

Side by Side Diff: webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc

Issue 10534173: GPU Program Caching (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: solid in-memory implementation Created 8 years, 6 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
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 "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" 5 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #ifndef GL_GLEXT_PROTOTYPES 8 #ifndef GL_GLEXT_PROTOTYPES
9 #define GL_GLEXT_PROTOTYPES 1 9 #define GL_GLEXT_PROTOTYPES 1
10 #endif 10 #endif
11 #include <GLES2/gl2ext.h> 11 #include <GLES2/gl2ext.h>
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <set> 14 #include <set>
15 15
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/bind_helpers.h" 17 #include "base/bind_helpers.h"
18 #include "base/callback.h" 18 #include "base/callback.h"
19 #include "base/command_line.h" 19 #include "base/command_line.h"
20 #include "base/lazy_instance.h" 20 #include "base/lazy_instance.h"
21 #include "base/logging.h" 21 #include "base/logging.h"
22 #include "base/memory/singleton.h" 22 #include "base/memory/singleton.h"
23 #include "base/memory/weak_ptr.h"
23 #include "base/message_loop.h" 24 #include "base/message_loop.h"
24 #include "base/metrics/histogram.h" 25 #include "base/metrics/histogram.h"
25 #include "base/string_tokenizer.h" 26 #include "base/string_tokenizer.h"
26 #include "base/synchronization/lock.h" 27 #include "base/synchronization/lock.h"
27 #include "gpu/command_buffer/client/gles2_implementation.h" 28 #include "gpu/command_buffer/client/gles2_implementation.h"
28 #include "gpu/command_buffer/client/gles2_lib.h" 29 #include "gpu/command_buffer/client/gles2_lib.h"
29 #include "gpu/command_buffer/client/transfer_buffer.h" 30 #include "gpu/command_buffer/client/transfer_buffer.h"
30 #include "gpu/command_buffer/common/constants.h" 31 #include "gpu/command_buffer/common/constants.h"
31 #include "gpu/command_buffer/service/command_buffer_service.h" 32 #include "gpu/command_buffer/service/command_buffer_service.h"
32 #include "gpu/command_buffer/service/context_group.h" 33 #include "gpu/command_buffer/service/context_group.h"
33 #include "gpu/command_buffer/service/transfer_buffer_manager.h" 34 #include "gpu/command_buffer/service/transfer_buffer_manager.h"
34 #include "gpu/command_buffer/service/gpu_scheduler.h" 35 #include "gpu/command_buffer/service/gpu_scheduler.h"
35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
38 #include "ui/gl/gl_context.h" 39 #include "ui/gl/gl_context.h"
39 #include "ui/gl/gl_share_group.h" 40 #include "ui/gl/gl_share_group.h"
40 #include "ui/gl/gl_surface.h" 41 #include "ui/gl/gl_surface.h"
41 #include "webkit/glue/gl_bindings_skia_cmd_buffer.h" 42 #include "webkit/glue/gl_bindings_skia_cmd_buffer.h"
42 43
44
45 namespace gpu {
46 namespace gles2 {
47 class ProgramCache;
48 }
49 }
50
43 using gpu::Buffer; 51 using gpu::Buffer;
44 using gpu::CommandBuffer; 52 using gpu::CommandBuffer;
45 using gpu::CommandBufferService; 53 using gpu::CommandBufferService;
46 using gpu::gles2::GLES2CmdHelper; 54 using gpu::gles2::GLES2CmdHelper;
47 using gpu::gles2::GLES2Implementation; 55 using gpu::gles2::GLES2Implementation;
48 using gpu::GpuScheduler; 56 using gpu::GpuScheduler;
49 using gpu::TransferBuffer; 57 using gpu::TransferBuffer;
50 using gpu::TransferBufferManager; 58 using gpu::TransferBufferManager;
51 using gpu::TransferBufferManagerInterface; 59 using gpu::TransferBufferManagerInterface;
60 using gpu::gles2::ProgramCache;
52 61
53 namespace webkit { 62 namespace webkit {
54 namespace gpu { 63 namespace gpu {
55 64
56 class GLInProcessContext : public base::SupportsWeakPtr<GLInProcessContext> { 65 class GLInProcessContext : public base::SupportsWeakPtr<GLInProcessContext> {
57 public: 66 public:
58 // These are the same error codes as used by EGL. 67 // These are the same error codes as used by EGL.
59 enum Error { 68 enum Error {
60 SUCCESS = 0x3000, 69 SUCCESS = 0x3000,
61 NOT_INITIALIZED = 0x3001, 70 NOT_INITIALIZED = 0x3001,
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 if (!command_buffer_->Initialize()) { 415 if (!command_buffer_->Initialize()) {
407 LOG(ERROR) << "Could not initialize command buffer."; 416 LOG(ERROR) << "Could not initialize command buffer.";
408 Destroy(); 417 Destroy();
409 return false; 418 return false;
410 } 419 }
411 420
412 // TODO(gman): This needs to be true if this is Pepper. 421 // TODO(gman): This needs to be true if this is Pepper.
413 bool bind_generates_resource = false; 422 bool bind_generates_resource = false;
414 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group ? 423 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group ?
415 context_group->decoder_->GetContextGroup() : 424 context_group->decoder_->GetContextGroup() :
416 new ::gpu::gles2::ContextGroup(NULL, bind_generates_resource))); 425 new ::gpu::gles2::ContextGroup(NULL,
426 bind_generates_resource,
427 base::WeakPtr<ProgramCache>())));
417 428
418 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(), 429 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(),
419 decoder_.get(), 430 decoder_.get(),
420 decoder_.get())); 431 decoder_.get()));
421 432
422 decoder_->set_engine(gpu_scheduler_.get()); 433 decoder_->set_engine(gpu_scheduler_.get());
423 434
424 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1)); 435 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1));
425 436
426 if (!surface_.get()) { 437 if (!surface_.get()) {
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { 1643 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() {
1633 // TODO(kbr): improve the precision here. 1644 // TODO(kbr): improve the precision here.
1634 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; 1645 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB;
1635 if (context_lost_callback_) { 1646 if (context_lost_callback_) {
1636 context_lost_callback_->onContextLost(); 1647 context_lost_callback_->onContextLost();
1637 } 1648 }
1638 } 1649 }
1639 1650
1640 } // namespace gpu 1651 } // namespace gpu
1641 } // namespace webkit 1652 } // namespace webkit
OLDNEW
« gpu/command_buffer/service/program_cache.h ('K') | « ui/gl/gl_interface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698