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

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

Issue 2436813005: Update Skia GL bindings to ES3 (Closed)
Patch Set: just bindings Created 3 years, 8 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
33 sk_sp<GrGLInterface> interface(new GrGLInterface); 25 sk_sp<GrGLInterface> interface(new GrGLInterface);
34 interface->fStandard = kGLES_GrGLStandard; 26 interface->fStandard = kGLES_GrGLStandard;
35 interface->fExtensions.init(kGLES_GrGLStandard, get_string_version_override, 27
36 nullptr, 28 auto get_string = gles_bind(&GLES2Interface::GetString, impl);
37 gles_bind(&GLES2Interface::GetIntegerv, impl)); 29 auto get_stringi = gles_bind(&GLES2Interface::GetStringi, impl);
30 auto get_integerv = gles_bind(&GLES2Interface::GetIntegerv, impl);
31 interface->fExtensions.init(kGLES_GrGLStandard, get_string, get_stringi,
32 get_integerv);
38 33
39 GrGLInterface::Functions* functions = &interface->fFunctions; 34 GrGLInterface::Functions* functions = &interface->fFunctions;
40 functions->fActiveTexture = gles_bind(&GLES2Interface::ActiveTexture, impl); 35 functions->fActiveTexture = gles_bind(&GLES2Interface::ActiveTexture, impl);
41 functions->fAttachShader = gles_bind(&GLES2Interface::AttachShader, impl); 36 functions->fAttachShader = gles_bind(&GLES2Interface::AttachShader, impl);
42 functions->fBindAttribLocation = 37 functions->fBindAttribLocation =
43 gles_bind(&GLES2Interface::BindAttribLocation, impl); 38 gles_bind(&GLES2Interface::BindAttribLocation, impl);
44 functions->fBindBuffer = gles_bind(&GLES2Interface::BindBuffer, impl); 39 functions->fBindBuffer = gles_bind(&GLES2Interface::BindBuffer, impl);
45 functions->fBindTexture = gles_bind(&GLES2Interface::BindTexture, impl); 40 functions->fBindTexture = gles_bind(&GLES2Interface::BindTexture, impl);
46 functions->fBindVertexArray = 41 functions->fBindVertexArray =
47 gles_bind(&GLES2Interface::BindVertexArrayOES, impl); 42 gles_bind(&GLES2Interface::BindVertexArrayOES, impl);
48 functions->fBlendBarrier = gles_bind(&GLES2Interface::BlendBarrierKHR, impl); 43 functions->fBlendBarrier = gles_bind(&GLES2Interface::BlendBarrierKHR, impl);
49 functions->fBlendColor = gles_bind(&GLES2Interface::BlendColor, impl); 44 functions->fBlendColor = gles_bind(&GLES2Interface::BlendColor, impl);
50 functions->fBlendEquation = gles_bind(&GLES2Interface::BlendEquation, impl); 45 functions->fBlendEquation = gles_bind(&GLES2Interface::BlendEquation, impl);
51 functions->fBlendFunc = gles_bind(&GLES2Interface::BlendFunc, impl); 46 functions->fBlendFunc = gles_bind(&GLES2Interface::BlendFunc, impl);
52 functions->fBufferData = gles_bind(&GLES2Interface::BufferData, impl); 47 functions->fBufferData = gles_bind(&GLES2Interface::BufferData, impl);
53 functions->fBufferSubData = gles_bind(&GLES2Interface::BufferSubData, impl); 48 functions->fBufferSubData = gles_bind(&GLES2Interface::BufferSubData, impl);
54 functions->fClear = gles_bind(&GLES2Interface::Clear, impl); 49 functions->fClear = gles_bind(&GLES2Interface::Clear, impl);
55 functions->fClearColor = gles_bind(&GLES2Interface::ClearColor, impl); 50 functions->fClearColor = gles_bind(&GLES2Interface::ClearColor, impl);
56 functions->fClearStencil = gles_bind(&GLES2Interface::ClearStencil, impl); 51 functions->fClearStencil = gles_bind(&GLES2Interface::ClearStencil, impl);
52 functions->fClientWaitSync = gles_bind(&GLES2Interface::ClientWaitSync, impl);
57 functions->fColorMask = gles_bind(&GLES2Interface::ColorMask, impl); 53 functions->fColorMask = gles_bind(&GLES2Interface::ColorMask, impl);
58 functions->fCompileShader = gles_bind(&GLES2Interface::CompileShader, impl); 54 functions->fCompileShader = gles_bind(&GLES2Interface::CompileShader, impl);
59 functions->fCompressedTexImage2D = 55 functions->fCompressedTexImage2D =
60 gles_bind(&GLES2Interface::CompressedTexImage2D, impl); 56 gles_bind(&GLES2Interface::CompressedTexImage2D, impl);
61 functions->fCompressedTexSubImage2D = 57 functions->fCompressedTexSubImage2D =
62 gles_bind(&GLES2Interface::CompressedTexSubImage2D, impl); 58 gles_bind(&GLES2Interface::CompressedTexSubImage2D, impl);
63 functions->fCopyTexSubImage2D = 59 functions->fCopyTexSubImage2D =
64 gles_bind(&GLES2Interface::CopyTexSubImage2D, impl); 60 gles_bind(&GLES2Interface::CopyTexSubImage2D, impl);
65 functions->fCreateProgram = gles_bind(&GLES2Interface::CreateProgram, impl); 61 functions->fCreateProgram = gles_bind(&GLES2Interface::CreateProgram, impl);
66 functions->fCreateShader = gles_bind(&GLES2Interface::CreateShader, impl); 62 functions->fCreateShader = gles_bind(&GLES2Interface::CreateShader, impl);
67 functions->fCullFace = gles_bind(&GLES2Interface::CullFace, impl); 63 functions->fCullFace = gles_bind(&GLES2Interface::CullFace, impl);
68 functions->fDeleteBuffers = gles_bind(&GLES2Interface::DeleteBuffers, impl); 64 functions->fDeleteBuffers = gles_bind(&GLES2Interface::DeleteBuffers, impl);
69 functions->fDeleteProgram = gles_bind(&GLES2Interface::DeleteProgram, impl); 65 functions->fDeleteProgram = gles_bind(&GLES2Interface::DeleteProgram, impl);
70 functions->fDeleteShader = gles_bind(&GLES2Interface::DeleteShader, impl); 66 functions->fDeleteShader = gles_bind(&GLES2Interface::DeleteShader, impl);
67 functions->fDeleteSync = gles_bind(&GLES2Interface::DeleteSync, impl);
71 functions->fDeleteTextures = gles_bind(&GLES2Interface::DeleteTextures, impl); 68 functions->fDeleteTextures = gles_bind(&GLES2Interface::DeleteTextures, impl);
72 functions->fDeleteVertexArrays = 69 functions->fDeleteVertexArrays =
73 gles_bind(&GLES2Interface::DeleteVertexArraysOES, impl); 70 gles_bind(&GLES2Interface::DeleteVertexArraysOES, impl);
74 functions->fDepthMask = gles_bind(&GLES2Interface::DepthMask, impl); 71 functions->fDepthMask = gles_bind(&GLES2Interface::DepthMask, impl);
75 functions->fDisable = gles_bind(&GLES2Interface::Disable, impl); 72 functions->fDisable = gles_bind(&GLES2Interface::Disable, impl);
76 functions->fDisableVertexAttribArray = 73 functions->fDisableVertexAttribArray =
77 gles_bind(&GLES2Interface::DisableVertexAttribArray, impl); 74 gles_bind(&GLES2Interface::DisableVertexAttribArray, impl);
78 functions->fDiscardFramebuffer = 75 functions->fDiscardFramebuffer =
79 gles_bind(&GLES2Interface::DiscardFramebufferEXT, impl); 76 gles_bind(&GLES2Interface::DiscardFramebufferEXT, impl);
80 functions->fDrawArrays = gles_bind(&GLES2Interface::DrawArrays, impl); 77 functions->fDrawArrays = gles_bind(&GLES2Interface::DrawArrays, impl);
78 functions->fDrawArraysInstanced =
79 gles_bind(&GLES2Interface::DrawArraysInstancedANGLE, impl);
81 functions->fDrawElements = gles_bind(&GLES2Interface::DrawElements, impl); 80 functions->fDrawElements = gles_bind(&GLES2Interface::DrawElements, impl);
81 functions->fDrawElementsInstanced =
82 gles_bind(&GLES2Interface::DrawElementsInstancedANGLE, impl);
83 functions->fDrawRangeElements =
84 gles_bind(&GLES2Interface::DrawRangeElements, impl);
82 functions->fEnable = gles_bind(&GLES2Interface::Enable, impl); 85 functions->fEnable = gles_bind(&GLES2Interface::Enable, impl);
83 functions->fEnableVertexAttribArray = 86 functions->fEnableVertexAttribArray =
84 gles_bind(&GLES2Interface::EnableVertexAttribArray, impl); 87 gles_bind(&GLES2Interface::EnableVertexAttribArray, impl);
88 functions->fFenceSync = gles_bind(&GLES2Interface::FenceSync, impl);
85 functions->fFinish = gles_bind(&GLES2Interface::Finish, impl); 89 functions->fFinish = gles_bind(&GLES2Interface::Finish, impl);
86 functions->fFlush = gles_bind(&GLES2Interface::Flush, impl); 90 functions->fFlush = gles_bind(&GLES2Interface::Flush, impl);
91 functions->fFlushMappedBufferRange =
92 gles_bind(&GLES2Interface::FlushMappedBufferRange, impl);
87 functions->fFrontFace = gles_bind(&GLES2Interface::FrontFace, impl); 93 functions->fFrontFace = gles_bind(&GLES2Interface::FrontFace, impl);
88 functions->fGenBuffers = gles_bind(&GLES2Interface::GenBuffers, impl); 94 functions->fGenBuffers = gles_bind(&GLES2Interface::GenBuffers, impl);
89 functions->fGenTextures = gles_bind(&GLES2Interface::GenTextures, impl); 95 functions->fGenTextures = gles_bind(&GLES2Interface::GenTextures, impl);
90 functions->fGenVertexArrays = 96 functions->fGenVertexArrays =
91 gles_bind(&GLES2Interface::GenVertexArraysOES, impl); 97 gles_bind(&GLES2Interface::GenVertexArraysOES, impl);
92 functions->fGetBufferParameteriv = 98 functions->fGetBufferParameteriv =
93 gles_bind(&GLES2Interface::GetBufferParameteriv, impl); 99 gles_bind(&GLES2Interface::GetBufferParameteriv, impl);
94 functions->fGetError = gles_bind(&GLES2Interface::GetError, impl); 100 functions->fGetError = gles_bind(&GLES2Interface::GetError, impl);
95 functions->fGetIntegerv = gles_bind(&GLES2Interface::GetIntegerv, impl); 101 functions->fGetIntegerv = get_integerv;
96 functions->fGetProgramInfoLog = 102 functions->fGetProgramInfoLog =
97 gles_bind(&GLES2Interface::GetProgramInfoLog, impl); 103 gles_bind(&GLES2Interface::GetProgramInfoLog, impl);
98 functions->fGetProgramiv = gles_bind(&GLES2Interface::GetProgramiv, impl); 104 functions->fGetProgramiv = gles_bind(&GLES2Interface::GetProgramiv, impl);
99 functions->fGetShaderInfoLog = 105 functions->fGetShaderInfoLog =
100 gles_bind(&GLES2Interface::GetShaderInfoLog, impl); 106 gles_bind(&GLES2Interface::GetShaderInfoLog, impl);
101 functions->fGetShaderiv = gles_bind(&GLES2Interface::GetShaderiv, impl); 107 functions->fGetShaderiv = gles_bind(&GLES2Interface::GetShaderiv, impl);
102 functions->fGetShaderPrecisionFormat = 108 functions->fGetShaderPrecisionFormat =
103 gles_bind(&GLES2Interface::GetShaderPrecisionFormat, impl); 109 gles_bind(&GLES2Interface::GetShaderPrecisionFormat, impl);
104 functions->fGetString = get_string_version_override; 110 functions->fGetString = get_string;
111 functions->fGetStringi = get_stringi;
105 functions->fGetUniformLocation = 112 functions->fGetUniformLocation =
106 gles_bind(&GLES2Interface::GetUniformLocation, impl); 113 gles_bind(&GLES2Interface::GetUniformLocation, impl);
107 functions->fInsertEventMarker = 114 functions->fInsertEventMarker =
108 gles_bind(&GLES2Interface::InsertEventMarkerEXT, impl); 115 gles_bind(&GLES2Interface::InsertEventMarkerEXT, impl);
116 functions->fInvalidateFramebuffer =
117 gles_bind(&GLES2Interface::InvalidateFramebuffer, impl);
118 functions->fInvalidateSubFramebuffer =
119 gles_bind(&GLES2Interface::InvalidateSubFramebuffer, impl);
109 functions->fIsTexture = gles_bind(&GLES2Interface::IsTexture, impl); 120 functions->fIsTexture = gles_bind(&GLES2Interface::IsTexture, impl);
110 functions->fLineWidth = gles_bind(&GLES2Interface::LineWidth, impl); 121 functions->fLineWidth = gles_bind(&GLES2Interface::LineWidth, impl);
111 functions->fLinkProgram = gles_bind(&GLES2Interface::LinkProgram, impl); 122 functions->fLinkProgram = gles_bind(&GLES2Interface::LinkProgram, impl);
123 functions->fMapBufferRange = gles_bind(&GLES2Interface::MapBufferRange, impl);
112 functions->fMapBufferSubData = 124 functions->fMapBufferSubData =
113 gles_bind(&GLES2Interface::MapBufferSubDataCHROMIUM, impl); 125 gles_bind(&GLES2Interface::MapBufferSubDataCHROMIUM, impl);
114 functions->fMapTexSubImage2D = 126 functions->fMapTexSubImage2D =
115 gles_bind(&GLES2Interface::MapTexSubImage2DCHROMIUM, impl); 127 gles_bind(&GLES2Interface::MapTexSubImage2DCHROMIUM, impl);
116 functions->fPixelStorei = gles_bind(&GLES2Interface::PixelStorei, impl); 128 functions->fPixelStorei = gles_bind(&GLES2Interface::PixelStorei, impl);
117 functions->fPopGroupMarker = 129 functions->fPopGroupMarker =
118 gles_bind(&GLES2Interface::PopGroupMarkerEXT, impl); 130 gles_bind(&GLES2Interface::PopGroupMarkerEXT, impl);
119 functions->fPushGroupMarker = 131 functions->fPushGroupMarker =
120 gles_bind(&GLES2Interface::PushGroupMarkerEXT, impl); 132 gles_bind(&GLES2Interface::PushGroupMarkerEXT, impl);
121 functions->fReadPixels = gles_bind(&GLES2Interface::ReadPixels, impl); 133 functions->fReadPixels = gles_bind(&GLES2Interface::ReadPixels, impl);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 functions->fUnmapTexSubImage2D = 174 functions->fUnmapTexSubImage2D =
163 gles_bind(&GLES2Interface::UnmapTexSubImage2DCHROMIUM, impl); 175 gles_bind(&GLES2Interface::UnmapTexSubImage2DCHROMIUM, impl);
164 functions->fUseProgram = gles_bind(&GLES2Interface::UseProgram, impl); 176 functions->fUseProgram = gles_bind(&GLES2Interface::UseProgram, impl);
165 functions->fVertexAttrib1f = gles_bind(&GLES2Interface::VertexAttrib1f, impl); 177 functions->fVertexAttrib1f = gles_bind(&GLES2Interface::VertexAttrib1f, impl);
166 functions->fVertexAttrib2fv = 178 functions->fVertexAttrib2fv =
167 gles_bind(&GLES2Interface::VertexAttrib2fv, impl); 179 gles_bind(&GLES2Interface::VertexAttrib2fv, impl);
168 functions->fVertexAttrib3fv = 180 functions->fVertexAttrib3fv =
169 gles_bind(&GLES2Interface::VertexAttrib3fv, impl); 181 gles_bind(&GLES2Interface::VertexAttrib3fv, impl);
170 functions->fVertexAttrib4fv = 182 functions->fVertexAttrib4fv =
171 gles_bind(&GLES2Interface::VertexAttrib4fv, impl); 183 gles_bind(&GLES2Interface::VertexAttrib4fv, impl);
184 functions->fVertexAttribDivisor =
185 gles_bind(&GLES2Interface::VertexAttribDivisorANGLE, impl);
172 functions->fVertexAttribPointer = 186 functions->fVertexAttribPointer =
173 gles_bind(&GLES2Interface::VertexAttribPointer, impl); 187 gles_bind(&GLES2Interface::VertexAttribPointer, impl);
188 functions->fVertexAttribIPointer =
189 gles_bind(&GLES2Interface::VertexAttribIPointer, impl);
174 functions->fViewport = gles_bind(&GLES2Interface::Viewport, impl); 190 functions->fViewport = gles_bind(&GLES2Interface::Viewport, impl);
191 functions->fWaitSync = gles_bind(&GLES2Interface::WaitSync, impl);
175 functions->fBindFramebuffer = 192 functions->fBindFramebuffer =
176 gles_bind(&GLES2Interface::BindFramebuffer, impl); 193 gles_bind(&GLES2Interface::BindFramebuffer, impl);
177 functions->fBindRenderbuffer = 194 functions->fBindRenderbuffer =
178 gles_bind(&GLES2Interface::BindRenderbuffer, impl); 195 gles_bind(&GLES2Interface::BindRenderbuffer, impl);
179 functions->fCheckFramebufferStatus = 196 functions->fCheckFramebufferStatus =
180 gles_bind(&GLES2Interface::CheckFramebufferStatus, impl); 197 gles_bind(&GLES2Interface::CheckFramebufferStatus, impl);
181 functions->fDeleteFramebuffers = 198 functions->fDeleteFramebuffers =
182 gles_bind(&GLES2Interface::DeleteFramebuffers, impl); 199 gles_bind(&GLES2Interface::DeleteFramebuffers, impl);
183 functions->fDeleteRenderbuffers = 200 functions->fDeleteRenderbuffers =
184 gles_bind(&GLES2Interface::DeleteRenderbuffers, impl); 201 gles_bind(&GLES2Interface::DeleteRenderbuffers, impl);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 functions->fProgramPathFragmentInputGen = 271 functions->fProgramPathFragmentInputGen =
255 gles_bind(&GLES2Interface::ProgramPathFragmentInputGenCHROMIUM, impl); 272 gles_bind(&GLES2Interface::ProgramPathFragmentInputGenCHROMIUM, impl);
256 functions->fBindFragmentInputLocation = 273 functions->fBindFragmentInputLocation =
257 gles_bind(&GLES2Interface::BindFragmentInputLocationCHROMIUM, impl); 274 gles_bind(&GLES2Interface::BindFragmentInputLocationCHROMIUM, impl);
258 functions->fCoverageModulation = 275 functions->fCoverageModulation =
259 gles_bind(&GLES2Interface::CoverageModulationCHROMIUM, impl); 276 gles_bind(&GLES2Interface::CoverageModulationCHROMIUM, impl);
260 return interface; 277 return interface;
261 } 278 }
262 279
263 } // namespace skia_bindings 280 } // 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