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

Side by Side Diff: gpu/gles2_conform_support/egl/display.cc

Issue 7792008: Manually merging trunk revs 95836 and 96904 to 835 branch (third attempt, nacl should be fixed) (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « gpu/demos/framework/window.cc ('k') | gpu/gpu.gyp » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gles2_conform_support/egl/display.h" 5 #include "gpu/gles2_conform_support/egl/display.h"
6 6
7 #include <vector> 7 #include <vector>
8 #include "gpu/command_buffer/client/gles2_lib.h" 8 #include "gpu/command_buffer/client/gles2_lib.h"
9 #include "gpu/command_buffer/service/command_buffer_service.h" 9 #include "gpu/command_buffer/service/command_buffer_service.h"
10 #include "gpu/command_buffer/service/context_group.h"
10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 11 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
11 #include "gpu/command_buffer/service/gpu_scheduler.h" 12 #include "gpu/command_buffer/service/gpu_scheduler.h"
12 #include "gpu/GLES2/gles2_command_buffer.h" 13 #include "gpu/GLES2/gles2_command_buffer.h"
13 #include "gpu/gles2_conform_support/egl/config.h" 14 #include "gpu/gles2_conform_support/egl/config.h"
14 #include "gpu/gles2_conform_support/egl/surface.h" 15 #include "gpu/gles2_conform_support/egl/surface.h"
15 16
16 namespace { 17 namespace {
17 const int32 kCommandBufferSize = 1024 * 1024; 18 const int32 kCommandBufferSize = 1024 * 1024;
18 const int32 kTransferBufferSize = 512 * 1024; 19 const int32 kTransferBufferSize = 512 * 1024;
19 } 20 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 EGLSurface Display::CreateWindowSurface(EGLConfig config, 102 EGLSurface Display::CreateWindowSurface(EGLConfig config,
102 EGLNativeWindowType win, 103 EGLNativeWindowType win,
103 const EGLint* attrib_list) { 104 const EGLint* attrib_list) {
104 if (surface_ != NULL) { 105 if (surface_ != NULL) {
105 // We do not support more than one window surface. 106 // We do not support more than one window surface.
106 return EGL_NO_SURFACE; 107 return EGL_NO_SURFACE;
107 } 108 }
108 109
109 using gpu::GpuScheduler; 110 using gpu::GpuScheduler;
110 std::vector<int32> attribs; 111 std::vector<int32> attribs;
112 gpu::gles2::ContextGroup::Ref group(new gpu::gles2::ContextGroup(true));
111 scoped_ptr<GpuScheduler> gpu_scheduler( 113 scoped_ptr<GpuScheduler> gpu_scheduler(
112 GpuScheduler::Create(command_buffer_.get(), 114 GpuScheduler::Create(command_buffer_.get(),
113 NULL, 115 NULL,
114 NULL)); 116 NULL));
115 if (!gpu_scheduler->Initialize( 117 if (!gpu_scheduler->Initialize(
116 win, gfx::Size(), false, gpu::gles2::DisallowedExtensions(), NULL, 118 win, gfx::Size(), false, gpu::gles2::DisallowedExtensions(), NULL,
117 attribs, NULL)) 119 attribs, NULL))
118 return EGL_NO_SURFACE; 120 return EGL_NO_SURFACE;
119 121
120 command_buffer_->SetPutOffsetChangeCallback( 122 command_buffer_->SetPutOffsetChangeCallback(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 DCHECK(transfer_buffer_id_ != -1); 154 DCHECK(transfer_buffer_id_ != -1);
153 gpu::Buffer buffer = command_buffer_->GetTransferBuffer(transfer_buffer_id_); 155 gpu::Buffer buffer = command_buffer_->GetTransferBuffer(transfer_buffer_id_);
154 DCHECK(buffer.ptr != NULL); 156 DCHECK(buffer.ptr != NULL);
155 bool share_resources = share_ctx != NULL; 157 bool share_resources = share_ctx != NULL;
156 using gpu::gles2::GLES2Implementation; 158 using gpu::gles2::GLES2Implementation;
157 context_.reset(new GLES2Implementation( 159 context_.reset(new GLES2Implementation(
158 gles2_cmd_helper_.get(), 160 gles2_cmd_helper_.get(),
159 buffer.size, 161 buffer.size,
160 buffer.ptr, 162 buffer.ptr,
161 transfer_buffer_id_, 163 transfer_buffer_id_,
162 share_resources)); 164 share_resources,
165 true));
163 166
164 context_->CommandBufferEnableCHROMIUM( 167 context_->CommandBufferEnableCHROMIUM(
165 PEPPER3D_ALLOW_BUFFERS_ON_MULTIPLE_TARGETS); 168 PEPPER3D_ALLOW_BUFFERS_ON_MULTIPLE_TARGETS);
166 context_->CommandBufferEnableCHROMIUM( 169 context_->CommandBufferEnableCHROMIUM(
167 PEPPER3D_SUPPORT_FIXED_ATTRIBS); 170 PEPPER3D_SUPPORT_FIXED_ATTRIBS);
168 171
169 return context_.get(); 172 return context_.get();
170 } 173 }
171 174
172 void Display::DestroyContext(EGLContext ctx) { 175 void Display::DestroyContext(EGLContext ctx) {
173 DCHECK(IsValidContext(ctx)); 176 DCHECK(IsValidContext(ctx));
174 context_.reset(); 177 context_.reset();
175 } 178 }
176 179
177 bool Display::MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx) { 180 bool Display::MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx) {
178 if (ctx == EGL_NO_CONTEXT) { 181 if (ctx == EGL_NO_CONTEXT) {
179 gles2::SetGLContext(NULL); 182 gles2::SetGLContext(NULL);
180 } else { 183 } else {
181 DCHECK(IsValidSurface(draw)); 184 DCHECK(IsValidSurface(draw));
182 DCHECK(IsValidSurface(read)); 185 DCHECK(IsValidSurface(read));
183 DCHECK(IsValidContext(ctx)); 186 DCHECK(IsValidContext(ctx));
184 gles2::SetGLContext(context_.get()); 187 gles2::SetGLContext(context_.get());
185 } 188 }
186 return true; 189 return true;
187 } 190 }
188 191
189 } // namespace egl 192 } // namespace egl
OLDNEW
« no previous file with comments | « gpu/demos/framework/window.cc ('k') | gpu/gpu.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698