| OLD | NEW |
| 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 sk_sp<GrGLInterface> interface(new GrGLInterface); | 25 sk_sp<GrGLInterface> interface(new GrGLInterface); |
| 26 |
| 26 interface->fStandard = kGLES_GrGLStandard; | 27 interface->fStandard = kGLES_GrGLStandard; |
| 27 interface->fExtensions.init( | 28 interface->fExtensions.init(kGLES_GrGLStandard, |
| 28 kGLES_GrGLStandard, gles_bind(&GLES2Interface::GetString, impl), nullptr, | 29 gles_bind(&GLES2Interface::GetString, impl), |
| 29 gles_bind(&GLES2Interface::GetIntegerv, impl)); | 30 gles_bind(&GLES2Interface::GetStringi, impl), |
| 31 gles_bind(&GLES2Interface::GetIntegerv, impl)); |
| 30 | 32 |
| 31 GrGLInterface::Functions* functions = &interface->fFunctions; | 33 GrGLInterface::Functions* functions = &interface->fFunctions; |
| 32 functions->fActiveTexture = gles_bind(&GLES2Interface::ActiveTexture, impl); | 34 functions->fActiveTexture = gles_bind(&GLES2Interface::ActiveTexture, impl); |
| 33 functions->fAttachShader = gles_bind(&GLES2Interface::AttachShader, impl); | 35 functions->fAttachShader = gles_bind(&GLES2Interface::AttachShader, impl); |
| 34 functions->fBindAttribLocation = | 36 functions->fBindAttribLocation = |
| 35 gles_bind(&GLES2Interface::BindAttribLocation, impl); | 37 gles_bind(&GLES2Interface::BindAttribLocation, impl); |
| 36 functions->fBindBuffer = gles_bind(&GLES2Interface::BindBuffer, impl); | 38 functions->fBindBuffer = gles_bind(&GLES2Interface::BindBuffer, impl); |
| 37 functions->fBindTexture = gles_bind(&GLES2Interface::BindTexture, impl); | 39 functions->fBindTexture = gles_bind(&GLES2Interface::BindTexture, impl); |
| 38 functions->fBindVertexArray = | 40 functions->fBindVertexArray = |
| 39 gles_bind(&GLES2Interface::BindVertexArrayOES, impl); | 41 gles_bind(&GLES2Interface::BindVertexArrayOES, impl); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 60 functions->fDeleteShader = gles_bind(&GLES2Interface::DeleteShader, impl); | 62 functions->fDeleteShader = gles_bind(&GLES2Interface::DeleteShader, impl); |
| 61 functions->fDeleteTextures = gles_bind(&GLES2Interface::DeleteTextures, impl); | 63 functions->fDeleteTextures = gles_bind(&GLES2Interface::DeleteTextures, impl); |
| 62 functions->fDeleteVertexArrays = | 64 functions->fDeleteVertexArrays = |
| 63 gles_bind(&GLES2Interface::DeleteVertexArraysOES, impl); | 65 gles_bind(&GLES2Interface::DeleteVertexArraysOES, impl); |
| 64 functions->fDepthMask = gles_bind(&GLES2Interface::DepthMask, impl); | 66 functions->fDepthMask = gles_bind(&GLES2Interface::DepthMask, impl); |
| 65 functions->fDisable = gles_bind(&GLES2Interface::Disable, impl); | 67 functions->fDisable = gles_bind(&GLES2Interface::Disable, impl); |
| 66 functions->fDisableVertexAttribArray = | 68 functions->fDisableVertexAttribArray = |
| 67 gles_bind(&GLES2Interface::DisableVertexAttribArray, impl); | 69 gles_bind(&GLES2Interface::DisableVertexAttribArray, impl); |
| 68 functions->fDiscardFramebuffer = | 70 functions->fDiscardFramebuffer = |
| 69 gles_bind(&GLES2Interface::DiscardFramebufferEXT, impl); | 71 gles_bind(&GLES2Interface::DiscardFramebufferEXT, impl); |
| 72 functions->fInvalidateFramebuffer = |
| 73 gles_bind(&GLES2Interface::InvalidateFramebuffer, impl); |
| 74 functions->fInvalidateSubFramebuffer = |
| 75 gles_bind(&GLES2Interface::InvalidateSubFramebuffer, impl); |
| 70 functions->fDrawArrays = gles_bind(&GLES2Interface::DrawArrays, impl); | 76 functions->fDrawArrays = gles_bind(&GLES2Interface::DrawArrays, impl); |
| 77 functions->fDrawArraysInstanced = |
| 78 gles_bind(&GLES2Interface::DrawArraysInstancedANGLE, impl); |
| 71 functions->fDrawElements = gles_bind(&GLES2Interface::DrawElements, impl); | 79 functions->fDrawElements = gles_bind(&GLES2Interface::DrawElements, impl); |
| 80 functions->fDrawElementsInstanced = |
| 81 gles_bind(&GLES2Interface::DrawElementsInstancedANGLE, impl); |
| 72 functions->fEnable = gles_bind(&GLES2Interface::Enable, impl); | 82 functions->fEnable = gles_bind(&GLES2Interface::Enable, impl); |
| 73 functions->fEnableVertexAttribArray = | 83 functions->fEnableVertexAttribArray = |
| 74 gles_bind(&GLES2Interface::EnableVertexAttribArray, impl); | 84 gles_bind(&GLES2Interface::EnableVertexAttribArray, impl); |
| 75 functions->fFinish = gles_bind(&GLES2Interface::Finish, impl); | 85 functions->fFinish = gles_bind(&GLES2Interface::Finish, impl); |
| 76 functions->fFlush = gles_bind(&GLES2Interface::Flush, impl); | 86 functions->fFlush = gles_bind(&GLES2Interface::Flush, impl); |
| 87 // functions->fFlushMappedBufferRange = |
| 88 // gles_bind(&GLES2Interface::FlushMappedBufferRange, impl); |
| 77 functions->fFrontFace = gles_bind(&GLES2Interface::FrontFace, impl); | 89 functions->fFrontFace = gles_bind(&GLES2Interface::FrontFace, impl); |
| 78 functions->fGenBuffers = gles_bind(&GLES2Interface::GenBuffers, impl); | 90 functions->fGenBuffers = gles_bind(&GLES2Interface::GenBuffers, impl); |
| 79 functions->fGenTextures = gles_bind(&GLES2Interface::GenTextures, impl); | 91 functions->fGenTextures = gles_bind(&GLES2Interface::GenTextures, impl); |
| 80 functions->fGenVertexArrays = | 92 functions->fGenVertexArrays = |
| 81 gles_bind(&GLES2Interface::GenVertexArraysOES, impl); | 93 gles_bind(&GLES2Interface::GenVertexArraysOES, impl); |
| 82 functions->fGetBufferParameteriv = | 94 functions->fGetBufferParameteriv = |
| 83 gles_bind(&GLES2Interface::GetBufferParameteriv, impl); | 95 gles_bind(&GLES2Interface::GetBufferParameteriv, impl); |
| 84 functions->fGetError = gles_bind(&GLES2Interface::GetError, impl); | 96 functions->fGetError = gles_bind(&GLES2Interface::GetError, impl); |
| 85 functions->fGetIntegerv = gles_bind(&GLES2Interface::GetIntegerv, impl); | 97 functions->fGetIntegerv = gles_bind(&GLES2Interface::GetIntegerv, impl); |
| 86 functions->fGetProgramInfoLog = | 98 functions->fGetProgramInfoLog = |
| 87 gles_bind(&GLES2Interface::GetProgramInfoLog, impl); | 99 gles_bind(&GLES2Interface::GetProgramInfoLog, impl); |
| 88 functions->fGetProgramiv = gles_bind(&GLES2Interface::GetProgramiv, impl); | 100 functions->fGetProgramiv = gles_bind(&GLES2Interface::GetProgramiv, impl); |
| 89 functions->fGetShaderInfoLog = | 101 functions->fGetShaderInfoLog = |
| 90 gles_bind(&GLES2Interface::GetShaderInfoLog, impl); | 102 gles_bind(&GLES2Interface::GetShaderInfoLog, impl); |
| 91 functions->fGetShaderiv = gles_bind(&GLES2Interface::GetShaderiv, impl); | 103 functions->fGetShaderiv = gles_bind(&GLES2Interface::GetShaderiv, impl); |
| 92 functions->fGetShaderPrecisionFormat = | 104 functions->fGetShaderPrecisionFormat = |
| 93 gles_bind(&GLES2Interface::GetShaderPrecisionFormat, impl); | 105 gles_bind(&GLES2Interface::GetShaderPrecisionFormat, impl); |
| 94 functions->fGetString = gles_bind(&GLES2Interface::GetString, impl); | 106 functions->fGetString = gles_bind(&GLES2Interface::GetString, impl); |
| 107 functions->fGetStringi = gles_bind(&GLES2Interface::GetStringi, impl); |
| 95 functions->fGetUniformLocation = | 108 functions->fGetUniformLocation = |
| 96 gles_bind(&GLES2Interface::GetUniformLocation, impl); | 109 gles_bind(&GLES2Interface::GetUniformLocation, impl); |
| 97 functions->fInsertEventMarker = | 110 functions->fInsertEventMarker = |
| 98 gles_bind(&GLES2Interface::InsertEventMarkerEXT, impl); | 111 gles_bind(&GLES2Interface::InsertEventMarkerEXT, impl); |
| 99 functions->fLineWidth = gles_bind(&GLES2Interface::LineWidth, impl); | 112 functions->fLineWidth = gles_bind(&GLES2Interface::LineWidth, impl); |
| 100 functions->fLinkProgram = gles_bind(&GLES2Interface::LinkProgram, impl); | 113 functions->fLinkProgram = gles_bind(&GLES2Interface::LinkProgram, impl); |
| 114 functions->fMapBufferRange = gles_bind(&GLES2Interface::MapBufferRange, impl); |
| 101 functions->fMapBufferSubData = | 115 functions->fMapBufferSubData = |
| 102 gles_bind(&GLES2Interface::MapBufferSubDataCHROMIUM, impl); | 116 gles_bind(&GLES2Interface::MapBufferSubDataCHROMIUM, impl); |
| 103 functions->fMapTexSubImage2D = | 117 functions->fMapTexSubImage2D = |
| 104 gles_bind(&GLES2Interface::MapTexSubImage2DCHROMIUM, impl); | 118 gles_bind(&GLES2Interface::MapTexSubImage2DCHROMIUM, impl); |
| 105 functions->fPixelStorei = gles_bind(&GLES2Interface::PixelStorei, impl); | 119 functions->fPixelStorei = gles_bind(&GLES2Interface::PixelStorei, impl); |
| 106 functions->fPopGroupMarker = | 120 functions->fPopGroupMarker = |
| 107 gles_bind(&GLES2Interface::PopGroupMarkerEXT, impl); | 121 gles_bind(&GLES2Interface::PopGroupMarkerEXT, impl); |
| 108 functions->fPushGroupMarker = | 122 functions->fPushGroupMarker = |
| 109 gles_bind(&GLES2Interface::PushGroupMarkerEXT, impl); | 123 gles_bind(&GLES2Interface::PushGroupMarkerEXT, impl); |
| 110 functions->fReadPixels = gles_bind(&GLES2Interface::ReadPixels, impl); | 124 functions->fReadPixels = gles_bind(&GLES2Interface::ReadPixels, impl); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 functions->fUnmapTexSubImage2D = | 165 functions->fUnmapTexSubImage2D = |
| 152 gles_bind(&GLES2Interface::UnmapTexSubImage2DCHROMIUM, impl); | 166 gles_bind(&GLES2Interface::UnmapTexSubImage2DCHROMIUM, impl); |
| 153 functions->fUseProgram = gles_bind(&GLES2Interface::UseProgram, impl); | 167 functions->fUseProgram = gles_bind(&GLES2Interface::UseProgram, impl); |
| 154 functions->fVertexAttrib1f = gles_bind(&GLES2Interface::VertexAttrib1f, impl); | 168 functions->fVertexAttrib1f = gles_bind(&GLES2Interface::VertexAttrib1f, impl); |
| 155 functions->fVertexAttrib2fv = | 169 functions->fVertexAttrib2fv = |
| 156 gles_bind(&GLES2Interface::VertexAttrib2fv, impl); | 170 gles_bind(&GLES2Interface::VertexAttrib2fv, impl); |
| 157 functions->fVertexAttrib3fv = | 171 functions->fVertexAttrib3fv = |
| 158 gles_bind(&GLES2Interface::VertexAttrib3fv, impl); | 172 gles_bind(&GLES2Interface::VertexAttrib3fv, impl); |
| 159 functions->fVertexAttrib4fv = | 173 functions->fVertexAttrib4fv = |
| 160 gles_bind(&GLES2Interface::VertexAttrib4fv, impl); | 174 gles_bind(&GLES2Interface::VertexAttrib4fv, impl); |
| 175 functions->fVertexAttribDivisor = |
| 176 gles_bind(&GLES2Interface::VertexAttribDivisorANGLE, impl); |
| 161 functions->fVertexAttribPointer = | 177 functions->fVertexAttribPointer = |
| 162 gles_bind(&GLES2Interface::VertexAttribPointer, impl); | 178 gles_bind(&GLES2Interface::VertexAttribPointer, impl); |
| 179 functions->fVertexAttribIPointer = |
| 180 gles_bind(&GLES2Interface::VertexAttribIPointer, impl); |
| 163 functions->fViewport = gles_bind(&GLES2Interface::Viewport, impl); | 181 functions->fViewport = gles_bind(&GLES2Interface::Viewport, impl); |
| 164 functions->fBindFramebuffer = | 182 functions->fBindFramebuffer = |
| 165 gles_bind(&GLES2Interface::BindFramebuffer, impl); | 183 gles_bind(&GLES2Interface::BindFramebuffer, impl); |
| 166 functions->fBindRenderbuffer = | 184 functions->fBindRenderbuffer = |
| 167 gles_bind(&GLES2Interface::BindRenderbuffer, impl); | 185 gles_bind(&GLES2Interface::BindRenderbuffer, impl); |
| 168 functions->fCheckFramebufferStatus = | 186 functions->fCheckFramebufferStatus = |
| 169 gles_bind(&GLES2Interface::CheckFramebufferStatus, impl); | 187 gles_bind(&GLES2Interface::CheckFramebufferStatus, impl); |
| 170 functions->fDeleteFramebuffers = | 188 functions->fDeleteFramebuffers = |
| 171 gles_bind(&GLES2Interface::DeleteFramebuffers, impl); | 189 gles_bind(&GLES2Interface::DeleteFramebuffers, impl); |
| 172 functions->fDeleteRenderbuffers = | 190 functions->fDeleteRenderbuffers = |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 functions->fProgramPathFragmentInputGen = | 261 functions->fProgramPathFragmentInputGen = |
| 244 gles_bind(&GLES2Interface::ProgramPathFragmentInputGenCHROMIUM, impl); | 262 gles_bind(&GLES2Interface::ProgramPathFragmentInputGenCHROMIUM, impl); |
| 245 functions->fBindFragmentInputLocation = | 263 functions->fBindFragmentInputLocation = |
| 246 gles_bind(&GLES2Interface::BindFragmentInputLocationCHROMIUM, impl); | 264 gles_bind(&GLES2Interface::BindFragmentInputLocationCHROMIUM, impl); |
| 247 functions->fCoverageModulation = | 265 functions->fCoverageModulation = |
| 248 gles_bind(&GLES2Interface::CoverageModulationCHROMIUM, impl); | 266 gles_bind(&GLES2Interface::CoverageModulationCHROMIUM, impl); |
| 249 return interface; | 267 return interface; |
| 250 } | 268 } |
| 251 | 269 |
| 252 } // namespace skia_bindings | 270 } // namespace skia_bindings |
| OLD | NEW |