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

Side by Side Diff: gpu/skia_bindings/gl_bindings_skia_cmd_buffer.cc

Issue 2154373002: Limit Skia to ES2 functionality in GLES2Interface/Skia bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename Created 4 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/skia_bindings/gl_bindings_skia_cmd_buffer.h" 5 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h"
6 6
7 #include "gpu/command_buffer/client/gles2_interface.h" 7 #include "gpu/command_buffer/client/gles2_interface.h"
8 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" 8 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
9 9
10 using gpu::gles2::GLES2Interface; 10 using gpu::gles2::GLES2Interface;
11 11
12 namespace { 12 namespace {
13 template <typename R, typename... Args> 13 template <typename R, typename... Args>
14 std::function<R(Args...)> gles_bind(R (GLES2Interface::*func)(Args...), 14 std::function<R(Args...)> gles_bind(R (GLES2Interface::*func)(Args...),
15 GLES2Interface* gles2Interface) { 15 GLES2Interface* gles2Interface) {
16 return [func, gles2Interface](Args... args) { 16 return [func, gles2Interface](Args... args) {
17 return (gles2Interface->*func)(args...); 17 return (gles2Interface->*func)(args...);
18 }; 18 };
19 } 19 }
20 } // namespace 20 } // namespace
21 21
22 namespace skia_bindings { 22 namespace skia_bindings {
23 23
24 sk_sp<GrGLInterface> CreateGLES2InterfaceBindings(GLES2Interface* impl) { 24 sk_sp<GrGLInterface> CreateGLES2InterfaceBindings(GLES2Interface* impl) {
25 // Until Chromium is passing the WebGL 2.0 conformance we're limiting Skia to
26 // a GLES 2.0 interface (plus extensions).
27 auto get_string_version_override = [impl](GLenum name) {
28 if (name == GL_VERSION)
29 return reinterpret_cast<const GLubyte*>("OpenGL ES 2.0 Chromium");
30 return impl->GetString(name);
31 };
32
25 sk_sp<GrGLInterface> interface(new GrGLInterface); 33 sk_sp<GrGLInterface> interface(new GrGLInterface);
26 interface->fStandard = kGLES_GrGLStandard; 34 interface->fStandard = kGLES_GrGLStandard;
27 interface->fExtensions.init( 35 interface->fExtensions.init(kGLES_GrGLStandard, get_string_version_override,
28 kGLES_GrGLStandard, gles_bind(&GLES2Interface::GetString, impl), nullptr, 36 nullptr,
29 gles_bind(&GLES2Interface::GetIntegerv, impl)); 37 gles_bind(&GLES2Interface::GetIntegerv, impl));
30 38
31 GrGLInterface::Functions* functions = &interface->fFunctions; 39 GrGLInterface::Functions* functions = &interface->fFunctions;
32 functions->fActiveTexture = gles_bind(&GLES2Interface::ActiveTexture, impl); 40 functions->fActiveTexture = gles_bind(&GLES2Interface::ActiveTexture, impl);
33 functions->fAttachShader = gles_bind(&GLES2Interface::AttachShader, impl); 41 functions->fAttachShader = gles_bind(&GLES2Interface::AttachShader, impl);
34 functions->fBindAttribLocation = 42 functions->fBindAttribLocation =
35 gles_bind(&GLES2Interface::BindAttribLocation, impl); 43 gles_bind(&GLES2Interface::BindAttribLocation, impl);
36 functions->fBindBuffer = gles_bind(&GLES2Interface::BindBuffer, impl); 44 functions->fBindBuffer = gles_bind(&GLES2Interface::BindBuffer, impl);
37 functions->fBindTexture = gles_bind(&GLES2Interface::BindTexture, impl); 45 functions->fBindTexture = gles_bind(&GLES2Interface::BindTexture, impl);
38 functions->fBindVertexArray = 46 functions->fBindVertexArray =
39 gles_bind(&GLES2Interface::BindVertexArrayOES, impl); 47 gles_bind(&GLES2Interface::BindVertexArrayOES, impl);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 functions->fGetError = gles_bind(&GLES2Interface::GetError, impl); 92 functions->fGetError = gles_bind(&GLES2Interface::GetError, impl);
85 functions->fGetIntegerv = gles_bind(&GLES2Interface::GetIntegerv, impl); 93 functions->fGetIntegerv = gles_bind(&GLES2Interface::GetIntegerv, impl);
86 functions->fGetProgramInfoLog = 94 functions->fGetProgramInfoLog =
87 gles_bind(&GLES2Interface::GetProgramInfoLog, impl); 95 gles_bind(&GLES2Interface::GetProgramInfoLog, impl);
88 functions->fGetProgramiv = gles_bind(&GLES2Interface::GetProgramiv, impl); 96 functions->fGetProgramiv = gles_bind(&GLES2Interface::GetProgramiv, impl);
89 functions->fGetShaderInfoLog = 97 functions->fGetShaderInfoLog =
90 gles_bind(&GLES2Interface::GetShaderInfoLog, impl); 98 gles_bind(&GLES2Interface::GetShaderInfoLog, impl);
91 functions->fGetShaderiv = gles_bind(&GLES2Interface::GetShaderiv, impl); 99 functions->fGetShaderiv = gles_bind(&GLES2Interface::GetShaderiv, impl);
92 functions->fGetShaderPrecisionFormat = 100 functions->fGetShaderPrecisionFormat =
93 gles_bind(&GLES2Interface::GetShaderPrecisionFormat, impl); 101 gles_bind(&GLES2Interface::GetShaderPrecisionFormat, impl);
94 functions->fGetString = gles_bind(&GLES2Interface::GetString, impl); 102 functions->fGetString = get_string_version_override;
95 functions->fGetUniformLocation = 103 functions->fGetUniformLocation =
96 gles_bind(&GLES2Interface::GetUniformLocation, impl); 104 gles_bind(&GLES2Interface::GetUniformLocation, impl);
97 functions->fInsertEventMarker = 105 functions->fInsertEventMarker =
98 gles_bind(&GLES2Interface::InsertEventMarkerEXT, impl); 106 gles_bind(&GLES2Interface::InsertEventMarkerEXT, impl);
99 functions->fLineWidth = gles_bind(&GLES2Interface::LineWidth, impl); 107 functions->fLineWidth = gles_bind(&GLES2Interface::LineWidth, impl);
100 functions->fLinkProgram = gles_bind(&GLES2Interface::LinkProgram, impl); 108 functions->fLinkProgram = gles_bind(&GLES2Interface::LinkProgram, impl);
101 functions->fMapBufferSubData = 109 functions->fMapBufferSubData =
102 gles_bind(&GLES2Interface::MapBufferSubDataCHROMIUM, impl); 110 gles_bind(&GLES2Interface::MapBufferSubDataCHROMIUM, impl);
103 functions->fMapTexSubImage2D = 111 functions->fMapTexSubImage2D =
104 gles_bind(&GLES2Interface::MapTexSubImage2DCHROMIUM, impl); 112 gles_bind(&GLES2Interface::MapTexSubImage2DCHROMIUM, impl);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 functions->fProgramPathFragmentInputGen = 251 functions->fProgramPathFragmentInputGen =
244 gles_bind(&GLES2Interface::ProgramPathFragmentInputGenCHROMIUM, impl); 252 gles_bind(&GLES2Interface::ProgramPathFragmentInputGenCHROMIUM, impl);
245 functions->fBindFragmentInputLocation = 253 functions->fBindFragmentInputLocation =
246 gles_bind(&GLES2Interface::BindFragmentInputLocationCHROMIUM, impl); 254 gles_bind(&GLES2Interface::BindFragmentInputLocationCHROMIUM, impl);
247 functions->fCoverageModulation = 255 functions->fCoverageModulation =
248 gles_bind(&GLES2Interface::CoverageModulationCHROMIUM, impl); 256 gles_bind(&GLES2Interface::CoverageModulationCHROMIUM, impl);
249 return interface; 257 return interface;
250 } 258 }
251 259
252 } // namespace skia_bindings 260 } // namespace skia_bindings
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698