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

Unified Diff: src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp

Issue 500153002: Remove reliance on linked in GL functions for assembling GLES interfaces (Closed) Base URL: https://skia.googlesource.com/skia.git@gmcfg
Patch Set: cleanup Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
diff --git a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
index 6552f7c179fbadaa6071d40674d335626ae56348..0d06b2d600caeebe8e0073448d40b824fc1699d5 100644
--- a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
+++ b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
@@ -8,17 +8,19 @@
#include "gl/GrGLInterface.h"
+#include "gl/GrGLAssembleInterface.h"
-#ifndef GL_GLEXT_PROTOTYPES
-#define GL_GLEXT_PROTOTYPES
-#endif
-
-#include "GLES2/gl2.h"
-#include "GLES2/gl2ext.h"
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
#include "EGL/egl.h"
-#define GET_PROC(name) \
- interface->fFunctions.f ## name = (GrGL ## name ## Proc) GetProcAddress(ghANGLELib, "gl" #name);
+static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) {
+ GrGLFuncPtr proc = (GrGLFuncPtr) GetProcAddress((HMODULE)ctx, name);
+ if (NULL != proc) {
+ return proc;
+ }
+ return eglGetProcAddress(name);
+}
const GrGLInterface* GrGLCreateANGLEInterface() {
@@ -33,155 +35,5 @@ const GrGLInterface* GrGLCreateANGLEInterface() {
return NULL;
}
- GrGLInterface* interface = SkNEW(GrGLInterface);
- interface->fStandard = kGLES_GrGLStandard;
-
- GrGLInterface::Functions* functions = &interface->fFunctions;
-
- GET_PROC(ActiveTexture);
- GET_PROC(AttachShader);
- GET_PROC(BindAttribLocation);
- GET_PROC(BindBuffer);
- GET_PROC(BindTexture);
- functions->fBindVertexArray =
- (GrGLBindVertexArrayProc) eglGetProcAddress("glBindVertexArrayOES");
- GET_PROC(BlendColor);
- GET_PROC(BlendFunc);
- GET_PROC(BufferData);
- GET_PROC(BufferSubData);
- GET_PROC(Clear);
- GET_PROC(ClearColor);
- GET_PROC(ClearStencil);
- GET_PROC(ColorMask);
- GET_PROC(CompileShader);
- GET_PROC(CompressedTexImage2D);
- GET_PROC(CompressedTexSubImage2D);
- GET_PROC(CopyTexSubImage2D);
- GET_PROC(CreateProgram);
- GET_PROC(CreateShader);
- GET_PROC(CullFace);
- GET_PROC(DeleteBuffers);
- GET_PROC(DeleteProgram);
- GET_PROC(DeleteShader);
- GET_PROC(DeleteTextures);
- functions->fDeleteVertexArrays =
- (GrGLDeleteVertexArraysProc) eglGetProcAddress("glDeleteVertexArraysOES");
- GET_PROC(DepthMask);
- GET_PROC(Disable);
- GET_PROC(DisableVertexAttribArray);
- GET_PROC(DrawArrays);
- GET_PROC(DrawElements);
- GET_PROC(Enable);
- GET_PROC(EnableVertexAttribArray);
- GET_PROC(Finish);
- GET_PROC(Flush);
- GET_PROC(FrontFace);
- GET_PROC(GenBuffers);
- GET_PROC(GenerateMipmap);
- GET_PROC(GenTextures);
- functions->fGenVertexArrays =
- (GrGLGenVertexArraysProc) eglGetProcAddress("glGenVertexArraysOES");
- GET_PROC(GetBufferParameteriv);
- GET_PROC(GetError);
- GET_PROC(GetIntegerv);
- GET_PROC(GetProgramInfoLog);
- GET_PROC(GetProgramiv);
- GET_PROC(GetShaderInfoLog);
- GET_PROC(GetShaderiv);
- GET_PROC(GetString);
- GET_PROC(GetStringi);
- GET_PROC(GetUniformLocation);
- GET_PROC(LineWidth);
- GET_PROC(LinkProgram);
- GET_PROC(PixelStorei);
- GET_PROC(ReadPixels);
- GET_PROC(Scissor);
- GET_PROC(ShaderSource);
- GET_PROC(StencilFunc);
- GET_PROC(StencilFuncSeparate);
- GET_PROC(StencilMask);
- GET_PROC(StencilMaskSeparate);
- GET_PROC(StencilOp);
- GET_PROC(StencilOpSeparate);
- GET_PROC(TexImage2D);
- GET_PROC(TexParameteri);
- GET_PROC(TexParameteriv);
- GET_PROC(TexSubImage2D);
-#if GL_ARB_texture_storage
- GET_PROC(TexStorage2D);
-#elif GL_EXT_texture_storage
- functions->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2DEXT");
-#endif
- GET_PROC(Uniform1f);
- GET_PROC(Uniform1i);
- GET_PROC(Uniform1fv);
- GET_PROC(Uniform1iv);
-
- GET_PROC(Uniform2f);
- GET_PROC(Uniform2i);
- GET_PROC(Uniform2fv);
- GET_PROC(Uniform2iv);
-
- GET_PROC(Uniform3f);
- GET_PROC(Uniform3i);
- GET_PROC(Uniform3fv);
- GET_PROC(Uniform3iv);
-
- GET_PROC(Uniform4f);
- GET_PROC(Uniform4i);
- GET_PROC(Uniform4fv);
- GET_PROC(Uniform4iv);
-
- GET_PROC(UniformMatrix2fv);
- GET_PROC(UniformMatrix3fv);
- GET_PROC(UniformMatrix4fv);
- GET_PROC(UseProgram);
- GET_PROC(VertexAttrib4fv);
- GET_PROC(VertexAttribPointer);
- GET_PROC(Viewport);
- GET_PROC(BindFramebuffer);
- GET_PROC(BindRenderbuffer);
- GET_PROC(CheckFramebufferStatus);
- GET_PROC(DeleteFramebuffers);
- GET_PROC(DeleteRenderbuffers);
- GET_PROC(FramebufferRenderbuffer);
- GET_PROC(FramebufferTexture2D);
- GET_PROC(GenFramebuffers);
- GET_PROC(GenRenderbuffers);
- GET_PROC(GetFramebufferAttachmentParameteriv);
- GET_PROC(GetRenderbufferParameteriv);
- GET_PROC(RenderbufferStorage);
-
- functions->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOES");
- functions->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBufferOES");
-
-#if GL_ES_VERSION_3_0
- functions->fMapBufferRange = GET_PROC(glMapBufferRange);
- functions->fFlushMappedBufferRange = GET_PROC(glFlushMappedBufferRange);
-#else
- functions->fMapBufferRange = (GrGLMapBufferRangeProc) eglGetProcAddress("glMapBufferRange");
- functions->fFlushMappedBufferRange = (GrGLFlushMappedBufferRangeProc) eglGetProcAddress("glFlushMappedBufferRange");
-#endif
-
- functions->fInsertEventMarker = (GrGLInsertEventMarkerProc) eglGetProcAddress("glInsertEventMarkerEXT");
- functions->fPushGroupMarker = (GrGLInsertEventMarkerProc) eglGetProcAddress("glPushGroupMarkerEXT");
- functions->fPopGroupMarker = (GrGLPopGroupMarkerProc) eglGetProcAddress("glPopGroupMarkerEXT");
-
-#if GL_ES_VERSION_3_0
- GET_PROC(InvalidateFramebuffer);
- GET_PROC(InvalidateSubFramebuffer);
-#else
- functions->fInvalidateFramebuffer = (GrGLInvalidateFramebufferProc) eglGetProcAddress("glInvalidateFramebuffer");
- functions->fInvalidateSubFramebuffer = (GrGLInvalidateSubFramebufferProc) eglGetProcAddress("glInvalidateSubFramebuffer");
-#endif
- functions->fInvalidateBufferData = (GrGLInvalidateBufferDataProc) eglGetProcAddress("glInvalidateBufferData");
- functions->fInvalidateBufferSubData = (GrGLInvalidateBufferSubDataProc) eglGetProcAddress("glInvalidateBufferSubData");
- functions->fInvalidateTexImage = (GrGLInvalidateTexImageProc) eglGetProcAddress("glInvalidateTexImage");
- functions->fInvalidateTexSubImage = (GrGLInvalidateTexSubImageProc) eglGetProcAddress("glInvalidateTexSubImage");
-
- interface->fExtensions.init(kGLES_GrGLStandard,
- functions->fGetString,
- functions->fGetStringi,
- functions->fGetIntegerv);
- return interface;
+ return GrGLAssembleGLESInterface(ghANGLELib, angle_get_gl_proc);
}

Powered by Google App Engine
This is Rietveld 408576698