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

Side by Side Diff: cc/resource_provider.cc

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add cc::GaneshResourceProvider Created 7 years, 10 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/resource_provider.h" 5 #include "cc/resource_provider.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 8
9 #include "base/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/string_split.h" 12 #include "base/string_split.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "cc/ganesh_resource_provider.h"
14 #include "cc/gl_renderer.h" // For the GLC() macro. 15 #include "cc/gl_renderer.h" // For the GLC() macro.
15 #include "cc/platform_color.h" 16 #include "cc/platform_color.h"
16 #include "cc/texture_uploader.h" 17 #include "cc/texture_uploader.h"
17 #include "cc/transferable_resource.h" 18 #include "cc/transferable_resource.h"
18 #include "gpu/GLES2/gl2extchromium.h" 19 #include "gpu/GLES2/gl2extchromium.h"
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
20 #include "third_party/khronos/GLES2/gl2.h" 21 #include "third_party/khronos/GLES2/gl2.h"
21 #include "third_party/khronos/GLES2/gl2ext.h" 22 #include "third_party/khronos/GLES2/gl2ext.h"
22 #include "ui/gfx/rect.h" 23 #include "ui/gfx/rect.h"
23 #include "ui/gfx/vector2d.h" 24 #include "ui/gfx/vector2d.h"
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 ResourceProvider::ResourceProvider(OutputSurface* context) 546 ResourceProvider::ResourceProvider(OutputSurface* context)
546 : m_outputSurface(context) 547 : m_outputSurface(context)
547 , m_nextId(1) 548 , m_nextId(1)
548 , m_nextChild(1) 549 , m_nextChild(1)
549 , m_defaultResourceType(GLTexture) 550 , m_defaultResourceType(GLTexture)
550 , m_useTextureStorageExt(false) 551 , m_useTextureStorageExt(false)
551 , m_useTextureUsageHint(false) 552 , m_useTextureUsageHint(false)
552 , m_useShallowFlush(false) 553 , m_useShallowFlush(false)
553 , m_maxTextureSize(0) 554 , m_maxTextureSize(0)
554 , m_bestTextureFormat(0) 555 , m_bestTextureFormat(0)
556 , m_ganeshResourceProvider(GaneshResourceProvider::Create())
555 { 557 {
556 } 558 }
557 559
558 bool ResourceProvider::initialize() 560 bool ResourceProvider::initialize()
559 { 561 {
560 DCHECK(m_threadChecker.CalledOnValidThread()); 562 DCHECK(m_threadChecker.CalledOnValidThread());
561 WebGraphicsContext3D* context3d = m_outputSurface->Context3D(); 563 WebGraphicsContext3D* context3d = m_outputSurface->Context3D();
562 if (!context3d) { 564 if (!context3d) {
563 m_maxTextureSize = INT_MAX / 2; 565 m_maxTextureSize = INT_MAX / 2;
564 m_bestTextureFormat = GL_RGBA; 566 m_bestTextureFormat = GL_RGBA;
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 gfx::Size& size = resource->size; 1046 gfx::Size& size = resource->size;
1045 GLenum format = resource->format; 1047 GLenum format = resource->format;
1046 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, resource->glId)); 1048 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, resource->glId));
1047 if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) { 1049 if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) {
1048 GLenum storageFormat = textureToStorageFormat(format); 1050 GLenum storageFormat = textureToStorageFormat(format);
1049 GLC(context3d, context3d->texStorage2DEXT(GL_TEXTURE_2D, 1, storageForma t, size.width(), size.height())); 1051 GLC(context3d, context3d->texStorage2DEXT(GL_TEXTURE_2D, 1, storageForma t, size.width(), size.height()));
1050 } else 1052 } else
1051 GLC(context3d, context3d->texImage2D(GL_TEXTURE_2D, 0, format, size.widt h(), size.height(), 0, format, GL_UNSIGNED_BYTE, 0)); 1053 GLC(context3d, context3d->texImage2D(GL_TEXTURE_2D, 0, format, size.widt h(), size.height(), 0, format, GL_UNSIGNED_BYTE, 0));
1052 } 1054 }
1053 1055
1056 void ResourceProvider::setGaneshContexts(WebKit::WebGraphicsContext3D* context3d , GrContext* grContext) {
1057 m_ganeshResourceProvider->set_contexts(context3d, grContext);
1058 }
1054 1059
1055 } // namespace cc 1060 } // namespace cc
OLDNEW
« cc/gl_renderer.cc ('K') | « cc/resource_provider.h ('k') | cc/resource_update_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698