Kevin Lubick | 3902628 | 2019-03-28 12:46:40 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 Google LLC |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | * |
| 7 | * THIS FILE IS AUTOGENERATED |
| 8 | * Make edits to tools/gpu/gl/interface/templates.go or they will |
| 9 | * be overwritten. |
| 10 | */ |
| 11 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 12 | #include "include/gpu/gl/GrGLAssembleHelpers.h" |
| 13 | #include "include/gpu/gl/GrGLAssembleInterface.h" |
| 14 | #include "src/gpu/gl/GrGLUtil.h" |
Kevin Lubick | 3902628 | 2019-03-28 12:46:40 -0400 | [diff] [blame] | 15 | |
| 16 | #define GET_PROC(F) functions->f##F = (GrGL##F##Fn*)get(ctx, "gl" #F) |
| 17 | #define GET_PROC_SUFFIX(F, S) functions->f##F = (GrGL##F##Fn*)get(ctx, "gl" #F #S) |
| 18 | #define GET_PROC_LOCAL(F) GrGL##F##Fn* F = (GrGL##F##Fn*)get(ctx, "gl" #F) |
| 19 | |
| 20 | #define GET_EGL_PROC_SUFFIX(F, S) functions->fEGL##F = (GrEGL##F##Fn*)get(ctx, "egl" #F #S) |
| 21 | |
| 22 | #if SK_DISABLE_WEBGL_INTERFACE |
| 23 | sk_sp<const GrGLInterface> GrGLMakeAssembledWebGLInterface(void *ctx, GrGLGetProc get) { |
| 24 | return nullptr; |
| 25 | } |
| 26 | #else |
| 27 | sk_sp<const GrGLInterface> GrGLMakeAssembledWebGLInterface(void *ctx, GrGLGetProc get) { |
| 28 | GET_PROC_LOCAL(GetString); |
| 29 | if (nullptr == GetString) { |
| 30 | return nullptr; |
| 31 | } |
| 32 | |
| 33 | const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION)); |
| 34 | GrGLVersion glVer = GrGLGetVersionFromString(verStr); |
| 35 | |
| 36 | if (glVer < GR_GL_VER(1,0)) { |
| 37 | return nullptr; |
| 38 | } |
| 39 | |
| 40 | GET_PROC_LOCAL(GetIntegerv); |
| 41 | GET_PROC_LOCAL(GetStringi); |
| 42 | GrEGLQueryStringFn* queryString; |
| 43 | GrEGLDisplay display; |
| 44 | GrGetEGLQueryAndDisplay(&queryString, &display, ctx, get); |
| 45 | GrGLExtensions extensions; |
| 46 | if (!extensions.init(kWebGL_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString, |
| 47 | display)) { |
| 48 | return nullptr; |
| 49 | } |
| 50 | |
| 51 | sk_sp<GrGLInterface> interface(new GrGLInterface); |
| 52 | GrGLInterface::Functions* functions = &interface->fFunctions; |
| 53 | |
| 54 | // Autogenerated content follows |
| 55 | GET_PROC(ActiveTexture); |
| 56 | GET_PROC(AttachShader); |
| 57 | GET_PROC(BindAttribLocation); |
| 58 | GET_PROC(BindBuffer); |
| 59 | GET_PROC(BindTexture); |
| 60 | GET_PROC(BlendColor); |
| 61 | GET_PROC(BlendEquation); |
| 62 | GET_PROC(BlendFunc); |
| 63 | GET_PROC(BufferData); |
| 64 | GET_PROC(BufferSubData); |
| 65 | GET_PROC(Clear); |
| 66 | GET_PROC(ClearColor); |
| 67 | GET_PROC(ClearStencil); |
| 68 | GET_PROC(ColorMask); |
| 69 | GET_PROC(CompileShader); |
| 70 | GET_PROC(CompressedTexImage2D); |
| 71 | GET_PROC(CompressedTexSubImage2D); |
| 72 | GET_PROC(CopyTexSubImage2D); |
| 73 | GET_PROC(CreateProgram); |
| 74 | GET_PROC(CreateShader); |
| 75 | GET_PROC(CullFace); |
| 76 | GET_PROC(DeleteBuffers); |
| 77 | GET_PROC(DeleteProgram); |
| 78 | GET_PROC(DeleteShader); |
| 79 | GET_PROC(DeleteTextures); |
| 80 | GET_PROC(DepthMask); |
| 81 | GET_PROC(Disable); |
| 82 | GET_PROC(DisableVertexAttribArray); |
| 83 | GET_PROC(DrawArrays); |
| 84 | GET_PROC(DrawElements); |
| 85 | GET_PROC(Enable); |
| 86 | GET_PROC(EnableVertexAttribArray); |
| 87 | GET_PROC(Finish); |
| 88 | GET_PROC(Flush); |
| 89 | GET_PROC(FrontFace); |
| 90 | GET_PROC(GenBuffers); |
| 91 | GET_PROC(GenTextures); |
| 92 | GET_PROC(GetBufferParameteriv); |
| 93 | GET_PROC(GetError); |
| 94 | GET_PROC(GetIntegerv); |
| 95 | GET_PROC(GetProgramInfoLog); |
| 96 | GET_PROC(GetProgramiv); |
| 97 | GET_PROC(GetShaderInfoLog); |
| 98 | GET_PROC(GetShaderiv); |
| 99 | GET_PROC(GetString); |
| 100 | GET_PROC(GetUniformLocation); |
| 101 | GET_PROC(IsTexture); |
| 102 | GET_PROC(LineWidth); |
| 103 | GET_PROC(LinkProgram); |
| 104 | GET_PROC(PixelStorei); |
| 105 | GET_PROC(ReadPixels); |
| 106 | GET_PROC(Scissor); |
| 107 | GET_PROC(ShaderSource); |
| 108 | GET_PROC(StencilFunc); |
| 109 | GET_PROC(StencilFuncSeparate); |
| 110 | GET_PROC(StencilMask); |
| 111 | GET_PROC(StencilMaskSeparate); |
| 112 | GET_PROC(StencilOp); |
| 113 | GET_PROC(StencilOpSeparate); |
| 114 | GET_PROC(TexImage2D); |
| 115 | GET_PROC(TexParameterf); |
| 116 | GET_PROC(TexParameterfv); |
| 117 | GET_PROC(TexParameteri); |
| 118 | GET_PROC(TexParameteriv); |
| 119 | GET_PROC(TexSubImage2D); |
| 120 | GET_PROC(Uniform1f); |
| 121 | GET_PROC(Uniform1fv); |
| 122 | GET_PROC(Uniform1i); |
| 123 | GET_PROC(Uniform1iv); |
| 124 | GET_PROC(Uniform2f); |
| 125 | GET_PROC(Uniform2fv); |
| 126 | GET_PROC(Uniform2i); |
| 127 | GET_PROC(Uniform2iv); |
| 128 | GET_PROC(Uniform3f); |
| 129 | GET_PROC(Uniform3fv); |
| 130 | GET_PROC(Uniform3i); |
| 131 | GET_PROC(Uniform3iv); |
| 132 | GET_PROC(Uniform4f); |
| 133 | GET_PROC(Uniform4fv); |
| 134 | GET_PROC(Uniform4i); |
| 135 | GET_PROC(Uniform4iv); |
| 136 | GET_PROC(UniformMatrix2fv); |
| 137 | GET_PROC(UniformMatrix3fv); |
| 138 | GET_PROC(UniformMatrix4fv); |
| 139 | GET_PROC(UseProgram); |
| 140 | GET_PROC(VertexAttrib1f); |
| 141 | GET_PROC(VertexAttrib2fv); |
| 142 | GET_PROC(VertexAttrib3fv); |
| 143 | GET_PROC(VertexAttrib4fv); |
| 144 | GET_PROC(VertexAttribPointer); |
| 145 | GET_PROC(Viewport); |
| 146 | |
| 147 | if (glVer >= GR_GL_VER(2,0)) { |
| 148 | GET_PROC(GetStringi); |
| 149 | } |
| 150 | |
| 151 | if (glVer >= GR_GL_VER(2,0)) { |
| 152 | GET_PROC(BindVertexArray); |
| 153 | GET_PROC(DeleteVertexArrays); |
| 154 | GET_PROC(GenVertexArrays); |
| 155 | } else if (extensions.has("GL_OES_vertex_array_object")) { |
| 156 | GET_PROC_SUFFIX(BindVertexArray, OES); |
| 157 | GET_PROC_SUFFIX(DeleteVertexArrays, OES); |
| 158 | GET_PROC_SUFFIX(GenVertexArrays, OES); |
| 159 | } else if (extensions.has("OES_vertex_array_object")) { |
| 160 | GET_PROC_SUFFIX(BindVertexArray, OES); |
| 161 | GET_PROC_SUFFIX(DeleteVertexArrays, OES); |
| 162 | GET_PROC_SUFFIX(GenVertexArrays, OES); |
| 163 | } |
| 164 | |
| 165 | if (glVer >= GR_GL_VER(2,0)) { |
| 166 | GET_PROC(DrawArraysInstanced); |
| 167 | GET_PROC(DrawElementsInstanced); |
| 168 | } |
| 169 | |
| 170 | if (glVer >= GR_GL_VER(2,0)) { |
| 171 | GET_PROC(DrawBuffers); |
Kevin Lubick | 3902628 | 2019-03-28 12:46:40 -0400 | [diff] [blame] | 172 | GET_PROC(ReadBuffer); |
| 173 | } |
| 174 | |
| 175 | if (glVer >= GR_GL_VER(2,0)) { |
| 176 | GET_PROC(DrawRangeElements); |
| 177 | } |
| 178 | |
| 179 | if (glVer >= GR_GL_VER(2,0)) { |
| 180 | GET_PROC(TexStorage2D); |
| 181 | } |
| 182 | |
| 183 | if (glVer >= GR_GL_VER(2,0)) { |
| 184 | GET_PROC(VertexAttribIPointer); |
| 185 | } |
| 186 | |
| 187 | GET_PROC(BindFramebuffer); |
| 188 | GET_PROC(BindRenderbuffer); |
| 189 | GET_PROC(CheckFramebufferStatus); |
| 190 | GET_PROC(DeleteFramebuffers); |
| 191 | GET_PROC(DeleteRenderbuffers); |
| 192 | GET_PROC(FramebufferRenderbuffer); |
| 193 | GET_PROC(FramebufferTexture2D); |
| 194 | GET_PROC(GenFramebuffers); |
| 195 | GET_PROC(GenRenderbuffers); |
| 196 | GET_PROC(GenerateMipmap); |
| 197 | GET_PROC(GetFramebufferAttachmentParameteriv); |
| 198 | GET_PROC(GetRenderbufferParameteriv); |
| 199 | GET_PROC(RenderbufferStorage); |
| 200 | |
| 201 | if (glVer >= GR_GL_VER(2,0)) { |
| 202 | GET_PROC(RenderbufferStorageMultisample); |
| 203 | } |
| 204 | |
| 205 | if (glVer >= GR_GL_VER(2,0)) { |
| 206 | GET_PROC(ClientWaitSync); |
| 207 | GET_PROC(DeleteSync); |
| 208 | GET_PROC(FenceSync); |
| 209 | GET_PROC(IsSync); |
| 210 | GET_PROC(WaitSync); |
| 211 | } |
| 212 | |
| 213 | if (glVer >= GR_GL_VER(2,0)) { |
| 214 | GET_PROC(BindSampler); |
| 215 | GET_PROC(DeleteSamplers); |
| 216 | GET_PROC(GenSamplers); |
| 217 | GET_PROC(SamplerParameteri); |
| 218 | GET_PROC(SamplerParameteriv); |
| 219 | } |
| 220 | |
| 221 | if (glVer >= GR_GL_VER(2,0)) { |
| 222 | GET_PROC(InvalidateFramebuffer); |
| 223 | GET_PROC(InvalidateSubFramebuffer); |
| 224 | } |
| 225 | |
| 226 | GET_PROC(GetShaderPrecisionFormat); |
| 227 | |
| 228 | |
| 229 | // End autogenerated content |
| 230 | |
| 231 | interface->fStandard = kWebGL_GrGLStandard; |
| 232 | interface->fExtensions.swap(&extensions); |
| 233 | |
Brian Salomon | 9c73e3d | 2019-08-15 10:55:49 -0400 | [diff] [blame] | 234 | return interface; |
Kevin Lubick | 3902628 | 2019-03-28 12:46:40 -0400 | [diff] [blame] | 235 | } |
| 236 | #endif |