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

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

Issue 665463003: gpu: Add CHROMIUM_image support to in-process command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-gpu-memory-buffer-factory-to-gpu-image-factory
Patch Set: make code more consistent with command buffer proxy Created 6 years, 2 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/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" 5 #include "webkit/common/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
(...skipping 21 matching lines...) Expand all
32 32
33 // static 33 // static
34 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> 34 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
35 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( 35 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
36 const blink::WebGraphicsContext3D::Attributes& attributes, 36 const blink::WebGraphicsContext3D::Attributes& attributes,
37 bool lose_context_when_out_of_memory, 37 bool lose_context_when_out_of_memory,
38 gfx::AcceleratedWidget window) { 38 gfx::AcceleratedWidget window) {
39 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone); 39 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone);
40 bool is_offscreen = false; 40 bool is_offscreen = false;
41 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( 41 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
42 scoped_ptr< ::gpu::GLInProcessContext>(), 42 scoped_ptr<::gpu::GLInProcessContext>(),
43 attributes, 43 attributes,
44 lose_context_when_out_of_memory, 44 lose_context_when_out_of_memory,
45 is_offscreen, 45 is_offscreen,
46 window)); 46 window,
47 nullptr,
48 nullptr));
47 } 49 }
48 50
49 // static 51 // static
50 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> 52 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
51 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( 53 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
52 const blink::WebGraphicsContext3D::Attributes& attributes, 54 const blink::WebGraphicsContext3D::Attributes& attributes,
53 bool lose_context_when_out_of_memory) { 55 bool lose_context_when_out_of_memory) {
54 bool is_offscreen = true; 56 bool is_offscreen = true;
55 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( 57 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
56 scoped_ptr< ::gpu::GLInProcessContext>(), 58 scoped_ptr<::gpu::GLInProcessContext>(),
57 attributes, 59 attributes,
58 lose_context_when_out_of_memory, 60 lose_context_when_out_of_memory,
59 is_offscreen, 61 is_offscreen,
60 gfx::kNullAcceleratedWidget)); 62 gfx::kNullAcceleratedWidget,
63 nullptr,
64 nullptr));
61 } 65 }
62 66
63 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> 67 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
64 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( 68 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext(
65 scoped_ptr< ::gpu::GLInProcessContext> context, 69 scoped_ptr< ::gpu::GLInProcessContext> context,
66 const blink::WebGraphicsContext3D::Attributes& attributes) { 70 const blink::WebGraphicsContext3D::Attributes& attributes) {
67 bool lose_context_when_out_of_memory = false; // Not used. 71 bool lose_context_when_out_of_memory = false; // Not used.
68 bool is_offscreen = true; // Not used. 72 bool is_offscreen = true; // Not used.
69 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( 73 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
70 context.Pass(), 74 context.Pass(),
71 attributes, 75 attributes,
72 lose_context_when_out_of_memory, 76 lose_context_when_out_of_memory,
73 is_offscreen, 77 is_offscreen,
74 gfx::kNullAcceleratedWidget /* window. Not used. */)); 78 gfx::kNullAcceleratedWidget /* window. Not used. */,
79 nullptr,
80 nullptr));
75 } 81 }
76 82
77 WebGraphicsContext3DInProcessCommandBufferImpl:: 83 WebGraphicsContext3DInProcessCommandBufferImpl::
78 WebGraphicsContext3DInProcessCommandBufferImpl( 84 WebGraphicsContext3DInProcessCommandBufferImpl(
79 scoped_ptr< ::gpu::GLInProcessContext> context, 85 scoped_ptr<::gpu::GLInProcessContext> context,
80 const blink::WebGraphicsContext3D::Attributes& attributes, 86 const blink::WebGraphicsContext3D::Attributes& attributes,
81 bool lose_context_when_out_of_memory, 87 bool lose_context_when_out_of_memory,
82 bool is_offscreen, 88 bool is_offscreen,
83 gfx::AcceleratedWidget window) 89 gfx::AcceleratedWidget window,
90 ::gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
91 ::gpu::ImageFactory* image_factory)
84 : share_resources_(attributes.shareResources), 92 : share_resources_(attributes.shareResources),
85 webgl_context_(attributes.webGL), 93 webgl_context_(attributes.webGL),
86 is_offscreen_(is_offscreen), 94 is_offscreen_(is_offscreen),
87 window_(window), 95 window_(window),
88 context_(context.Pass()) { 96 context_(context.Pass()),
97 gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
98 image_factory_(image_factory) {
89 ConvertAttributes(attributes, &attribs_); 99 ConvertAttributes(attributes, &attribs_);
90 attribs_.lose_context_when_out_of_memory = lose_context_when_out_of_memory; 100 attribs_.lose_context_when_out_of_memory = lose_context_when_out_of_memory;
91 } 101 }
92 102
93 WebGraphicsContext3DInProcessCommandBufferImpl:: 103 WebGraphicsContext3DInProcessCommandBufferImpl::
94 ~WebGraphicsContext3DInProcessCommandBufferImpl() { 104 ~WebGraphicsContext3DInProcessCommandBufferImpl() {
95 } 105 }
96 106
97 size_t WebGraphicsContext3DInProcessCommandBufferImpl::GetMappedMemoryLimit() { 107 size_t WebGraphicsContext3DInProcessCommandBufferImpl::GetMappedMemoryLimit() {
98 return context_->GetMappedMemoryLimit(); 108 return context_->GetMappedMemoryLimit();
(...skipping 16 matching lines...) Expand all
115 context_.reset(GLInProcessContext::Create( 125 context_.reset(GLInProcessContext::Create(
116 NULL, /* service */ 126 NULL, /* service */
117 NULL, /* surface */ 127 NULL, /* surface */
118 is_offscreen_, 128 is_offscreen_,
119 window_, 129 window_,
120 gfx::Size(1, 1), 130 gfx::Size(1, 1),
121 NULL, /* share_context */ 131 NULL, /* share_context */
122 share_resources_, 132 share_resources_,
123 attribs_, 133 attribs_,
124 gpu_preference, 134 gpu_preference,
125 ::gpu::GLInProcessContextSharedMemoryLimits())); 135 ::gpu::GLInProcessContextSharedMemoryLimits(),
136 gpu_memory_buffer_manager_,
137 image_factory_));
126 } 138 }
127 139
128 if (context_) { 140 if (context_) {
129 base::Closure context_lost_callback = base::Bind( 141 base::Closure context_lost_callback = base::Bind(
130 &WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost, 142 &WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost,
131 base::Unretained(this)); 143 base::Unretained(this));
132 context_->SetContextLostCallback(context_lost_callback); 144 context_->SetContextLostCallback(context_lost_callback);
133 } else { 145 } else {
134 initialize_failed_ = true; 146 initialize_failed_ = true;
135 return false; 147 return false;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { 181 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() {
170 // TODO(kbr): improve the precision here. 182 // TODO(kbr): improve the precision here.
171 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; 183 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB;
172 if (context_lost_callback_) { 184 if (context_lost_callback_) {
173 context_lost_callback_->onContextLost(); 185 context_lost_callback_->onContextLost();
174 } 186 }
175 } 187 }
176 188
177 } // namespace gpu 189 } // namespace gpu
178 } // namespace webkit 190 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698