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

Side by Side Diff: src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp

Issue 13941006: Add glCopyTexSubImage2D to GrGLInterface (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "gl/GrGLInterface.h" 10 #include "gl/GrGLInterface.h"
11 11
12 #ifndef GL_GLEXT_PROTOTYPES 12 #ifndef GL_GLEXT_PROTOTYPES
13 #define GL_GLEXT_PROTOTYPES 13 #define GL_GLEXT_PROTOTYPES
14 #endif 14 #endif
15 15
16 #include "GLES2/gl2.h" 16 #include "GLES2/gl2.h"
17 #include "GLES2/gl2ext.h" 17 #include "GLES2/gl2ext.h"
18 #include "EGL/egl.h" 18 #include "EGL/egl.h"
19 19
20 #define GR_GET_PROC(procType, baseName) \ 20 #define GET_PROC(name) \
21 interface->f ## baseName = (procType) GetProcAddress(ghANGLELib, "gl" #baseN ame); 21 interface->f ## name = (GrGL ## name ## Proc) GetProcAddress(ghANGLELib, "gl " #name);
22 22
23 const GrGLInterface* GrGLCreateANGLEInterface() { 23 const GrGLInterface* GrGLCreateANGLEInterface() {
24 24
25 static SkAutoTUnref<GrGLInterface> glInterface; 25 static SkAutoTUnref<GrGLInterface> glInterface;
26 static HMODULE ghANGLELib = NULL; 26 static HMODULE ghANGLELib = NULL;
27 27
28 if (NULL == ghANGLELib) { 28 if (NULL == ghANGLELib) {
29 // We load the ANGLE library and never let it go 29 // We load the ANGLE library and never let it go
30 ghANGLELib = LoadLibrary("libGLESv2.dll"); 30 ghANGLELib = LoadLibrary("libGLESv2.dll");
31 } 31 }
32 if (NULL == ghANGLELib) { 32 if (NULL == ghANGLELib) {
33 // We can't setup the interface correctly w/o the DLL 33 // We can't setup the interface correctly w/o the DLL
34 return NULL; 34 return NULL;
35 } 35 }
36 36
37 if (!glInterface.get()) { 37 if (!glInterface.get()) {
38 GrGLInterface* interface = new GrGLInterface; 38 GrGLInterface* interface = new GrGLInterface;
39 glInterface.reset(interface); 39 glInterface.reset(interface);
40 interface->fBindingsExported = kES2_GrGLBinding; 40 interface->fBindingsExported = kES2_GrGLBinding;
41 41
42 GR_GET_PROC(GrGLActiveTextureProc, ActiveTexture); 42 GET_PROC(ActiveTexture);
43 GR_GET_PROC(GrGLAttachShaderProc, AttachShader); 43 GET_PROC(AttachShader);
44 GR_GET_PROC(GrGLBindAttribLocationProc, BindAttribLocation); 44 GET_PROC(BindAttribLocation);
45 GR_GET_PROC(GrGLBindBufferProc, BindBuffer); 45 GET_PROC(BindBuffer);
46 GR_GET_PROC(GrGLBindTextureProc, BindTexture); 46 GET_PROC(BindTexture);
47 interface->fBindVertexArray = 47 interface->fBindVertexArray =
48 (GrGLBindVertexArrayProc) eglGetProcAddress("glBindVertexArrayOES"); 48 (GrGLBindVertexArrayProc) eglGetProcAddress("glBindVertexArrayOES");
49 GR_GET_PROC(GrGLBlendColorProc, BlendColor); 49 GET_PROC(BlendColor);
50 GR_GET_PROC(GrGLBlendFuncProc, BlendFunc); 50 GET_PROC(BlendFunc);
51 GR_GET_PROC(GrGLBufferDataProc, BufferData); 51 GET_PROC(BufferData);
52 GR_GET_PROC(GrGLBufferSubDataProc, BufferSubData); 52 GET_PROC(BufferSubData);
53 GR_GET_PROC(GrGLClearProc, Clear); 53 GET_PROC(Clear);
54 GR_GET_PROC(GrGLClearColorProc, ClearColor); 54 GET_PROC(ClearColor);
55 GR_GET_PROC(GrGLClearStencilProc, ClearStencil); 55 GET_PROC(ClearStencil);
56 GR_GET_PROC(GrGLColorMaskProc, ColorMask); 56 GET_PROC(ColorMask);
57 GR_GET_PROC(GrGLCompileShaderProc, CompileShader); 57 GET_PROC(CompileShader);
58 GR_GET_PROC(GrGLCompressedTexImage2DProc, CompressedTexImage2D); 58 GET_PROC(CompressedTexImage2D);
59 GR_GET_PROC(GrGLCreateProgramProc, CreateProgram); 59 GET_PROC(CopyTexSubImage2D);
60 GR_GET_PROC(GrGLCreateShaderProc, CreateShader); 60 GET_PROC(CreateProgram);
61 GR_GET_PROC(GrGLCullFaceProc, CullFace); 61 GET_PROC(CreateShader);
62 GR_GET_PROC(GrGLDeleteBuffersProc, DeleteBuffers); 62 GET_PROC(CullFace);
63 GR_GET_PROC(GrGLDeleteProgramProc, DeleteProgram); 63 GET_PROC(DeleteBuffers);
64 GR_GET_PROC(GrGLDeleteShaderProc, DeleteShader); 64 GET_PROC(DeleteProgram);
65 GR_GET_PROC(GrGLDeleteTexturesProc, DeleteTextures); 65 GET_PROC(DeleteShader);
66 GET_PROC(DeleteTextures);
66 interface->fDeleteVertexArrays = 67 interface->fDeleteVertexArrays =
67 (GrGLDeleteVertexArraysProc) eglGetProcAddress("glDeleteVertexArrays OES"); 68 (GrGLDeleteVertexArraysProc) eglGetProcAddress("glDeleteVertexArrays OES");
68 GR_GET_PROC(GrGLDepthMaskProc, DepthMask); 69 GET_PROC(DepthMask);
69 GR_GET_PROC(GrGLDisableProc, Disable); 70 GET_PROC(Disable);
70 GR_GET_PROC(GrGLDisableVertexAttribArrayProc, DisableVertexAttribArray); 71 GET_PROC(DisableVertexAttribArray);
71 GR_GET_PROC(GrGLDrawArraysProc, DrawArrays); 72 GET_PROC(DrawArrays);
72 GR_GET_PROC(GrGLDrawElementsProc, DrawElements); 73 GET_PROC(DrawElements);
73 GR_GET_PROC(GrGLEnableProc, Enable); 74 GET_PROC(Enable);
74 GR_GET_PROC(GrGLEnableVertexAttribArrayProc, EnableVertexAttribArray); 75 GET_PROC(EnableVertexAttribArray);
75 GR_GET_PROC(GrGLFinishProc, Finish); 76 GET_PROC(Finish);
76 GR_GET_PROC(GrGLFlushProc, Flush); 77 GET_PROC(Flush);
77 GR_GET_PROC(GrGLFrontFaceProc, FrontFace); 78 GET_PROC(FrontFace);
78 GR_GET_PROC(GrGLGenBuffersProc, GenBuffers); 79 GET_PROC(GenBuffers);
79 GR_GET_PROC(GrGLGenTexturesProc, GenTextures); 80 GET_PROC(GenTextures);
80 interface->fGenVertexArrays = 81 interface->fGenVertexArrays =
81 (GrGLGenVertexArraysProc) eglGetProcAddress("glGenVertexArraysOES"); 82 (GrGLGenVertexArraysProc) eglGetProcAddress("glGenVertexArraysOES");
82 GR_GET_PROC(GrGLGetBufferParameterivProc, GetBufferParameteriv); 83 GET_PROC(GetBufferParameteriv);
83 GR_GET_PROC(GrGLGetErrorProc, GetError); 84 GET_PROC(GetError);
84 GR_GET_PROC(GrGLGetIntegervProc, GetIntegerv); 85 GET_PROC(GetIntegerv);
85 GR_GET_PROC(GrGLGetProgramInfoLogProc, GetProgramInfoLog); 86 GET_PROC(GetProgramInfoLog);
86 GR_GET_PROC(GrGLGetProgramivProc, GetProgramiv); 87 GET_PROC(GetProgramiv);
87 GR_GET_PROC(GrGLGetShaderInfoLogProc, GetShaderInfoLog); 88 GET_PROC(GetShaderInfoLog);
88 GR_GET_PROC(GrGLGetShaderivProc, GetShaderiv); 89 GET_PROC(GetShaderiv);
89 GR_GET_PROC(GrGLGetStringProc, GetString); 90 GET_PROC(GetString);
90 GR_GET_PROC(GrGLGetUniformLocationProc, GetUniformLocation); 91 GET_PROC(GetUniformLocation);
91 GR_GET_PROC(GrGLLineWidthProc, LineWidth); 92 GET_PROC(LineWidth);
92 GR_GET_PROC(GrGLLinkProgramProc, LinkProgram); 93 GET_PROC(LinkProgram);
93 GR_GET_PROC(GrGLPixelStoreiProc, PixelStorei); 94 GET_PROC(PixelStorei);
94 GR_GET_PROC(GrGLReadPixelsProc, ReadPixels); 95 GET_PROC(ReadPixels);
95 GR_GET_PROC(GrGLScissorProc, Scissor); 96 GET_PROC(Scissor);
96 GR_GET_PROC(GrGLShaderSourceProc, ShaderSource); 97 GET_PROC(ShaderSource);
97 GR_GET_PROC(GrGLStencilFuncProc, StencilFunc); 98 GET_PROC(StencilFunc);
98 GR_GET_PROC(GrGLStencilFuncSeparateProc, StencilFuncSeparate); 99 GET_PROC(StencilFuncSeparate);
99 GR_GET_PROC(GrGLStencilMaskProc, StencilMask); 100 GET_PROC(StencilMask);
100 GR_GET_PROC(GrGLStencilMaskSeparateProc, StencilMaskSeparate); 101 GET_PROC(StencilMaskSeparate);
101 GR_GET_PROC(GrGLStencilOpProc, StencilOp); 102 GET_PROC(StencilOp);
102 GR_GET_PROC(GrGLStencilOpSeparateProc, StencilOpSeparate); 103 GET_PROC(StencilOpSeparate);
103 GR_GET_PROC(GrGLTexImage2DProc, TexImage2D); 104 GET_PROC(TexImage2D);
104 GR_GET_PROC(GrGLTexParameteriProc, TexParameteri); 105 GET_PROC(TexParameteri);
105 GR_GET_PROC(GrGLTexParameterivProc, TexParameteriv); 106 GET_PROC(TexParameteriv);
106 GR_GET_PROC(GrGLTexSubImage2DProc, TexSubImage2D); 107 GET_PROC(TexSubImage2D);
107 #if GL_ARB_texture_storage 108 #if GL_ARB_texture_storage
108 GR_GET_PROC(GrGLTexStorage2DProc, TexStorage2D); 109 GET_PROC(TexStorage2D);
109 #elif GL_EXT_texture_storage 110 #elif GL_EXT_texture_storage
110 interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glT exStorage2DEXT"); 111 interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glT exStorage2DEXT");
111 #endif 112 #endif
112 GR_GET_PROC(GrGLUniform1fProc, Uniform1f); 113 GET_PROC(Uniform1f);
113 GR_GET_PROC(GrGLUniform1iProc, Uniform1i); 114 GET_PROC(Uniform1i);
114 GR_GET_PROC(GrGLUniform1fvProc, Uniform1fv); 115 GET_PROC(Uniform1fv);
115 GR_GET_PROC(GrGLUniform1ivProc, Uniform1iv); 116 GET_PROC(Uniform1iv);
116 117
117 GR_GET_PROC(GrGLUniform2fProc, Uniform2f); 118 GET_PROC(Uniform2f);
118 GR_GET_PROC(GrGLUniform2iProc, Uniform2i); 119 GET_PROC(Uniform2i);
119 GR_GET_PROC(GrGLUniform2fvProc, Uniform2fv); 120 GET_PROC(Uniform2fv);
120 GR_GET_PROC(GrGLUniform2ivProc, Uniform2iv); 121 GET_PROC(Uniform2iv);
121 122
122 GR_GET_PROC(GrGLUniform3fProc, Uniform3f); 123 GET_PROC(Uniform3f);
123 GR_GET_PROC(GrGLUniform3iProc, Uniform3i); 124 GET_PROC(Uniform3i);
124 GR_GET_PROC(GrGLUniform3fvProc, Uniform3fv); 125 GET_PROC(Uniform3fv);
125 GR_GET_PROC(GrGLUniform3ivProc, Uniform3iv); 126 GET_PROC(Uniform3iv);
126 127
127 GR_GET_PROC(GrGLUniform4fProc, Uniform4f); 128 GET_PROC(Uniform4f);
128 GR_GET_PROC(GrGLUniform4iProc, Uniform4i); 129 GET_PROC(Uniform4i);
129 GR_GET_PROC(GrGLUniform4fvProc, Uniform4fv); 130 GET_PROC(Uniform4fv);
130 GR_GET_PROC(GrGLUniform4ivProc, Uniform4iv); 131 GET_PROC(Uniform4iv);
131 132
132 GR_GET_PROC(GrGLUniformMatrix2fvProc, UniformMatrix2fv); 133 GET_PROC(UniformMatrix2fv);
133 GR_GET_PROC(GrGLUniformMatrix3fvProc, UniformMatrix3fv); 134 GET_PROC(UniformMatrix3fv);
134 GR_GET_PROC(GrGLUniformMatrix4fvProc, UniformMatrix4fv); 135 GET_PROC(UniformMatrix4fv);
135 GR_GET_PROC(GrGLUseProgramProc, UseProgram); 136 GET_PROC(UseProgram);
136 GR_GET_PROC(GrGLVertexAttrib4fvProc, VertexAttrib4fv); 137 GET_PROC(VertexAttrib4fv);
137 GR_GET_PROC(GrGLVertexAttribPointerProc, VertexAttribPointer); 138 GET_PROC(VertexAttribPointer);
138 GR_GET_PROC(GrGLViewportProc, Viewport); 139 GET_PROC(Viewport);
139 GR_GET_PROC(GrGLBindFramebufferProc, BindFramebuffer); 140 GET_PROC(BindFramebuffer);
140 GR_GET_PROC(GrGLBindRenderbufferProc, BindRenderbuffer); 141 GET_PROC(BindRenderbuffer);
141 GR_GET_PROC(GrGLCheckFramebufferStatusProc, CheckFramebufferStatus); 142 GET_PROC(CheckFramebufferStatus);
142 GR_GET_PROC(GrGLDeleteFramebuffersProc, DeleteFramebuffers); 143 GET_PROC(DeleteFramebuffers);
143 GR_GET_PROC(GrGLDeleteRenderbuffersProc, DeleteRenderbuffers); 144 GET_PROC(DeleteRenderbuffers);
144 GR_GET_PROC(GrGLFramebufferRenderbufferProc, FramebufferRenderbuffer); 145 GET_PROC(FramebufferRenderbuffer);
145 GR_GET_PROC(GrGLFramebufferTexture2DProc, FramebufferTexture2D); 146 GET_PROC(FramebufferTexture2D);
146 GR_GET_PROC(GrGLGenFramebuffersProc, GenFramebuffers); 147 GET_PROC(GenFramebuffers);
147 GR_GET_PROC(GrGLGenRenderbuffersProc, GenRenderbuffers); 148 GET_PROC(GenRenderbuffers);
148 GR_GET_PROC(GrGLGetFramebufferAttachmentParameterivProc, 149 GET_PROC(GetFramebufferAttachmentParameteriv);
149 GetFramebufferAttachmentParameteriv); 150 GET_PROC(GetRenderbufferParameteriv);
150 GR_GET_PROC(GrGLGetRenderbufferParameterivProc, 151 GET_PROC(RenderbufferStorage);
151 GetRenderbufferParameteriv);
152 GR_GET_PROC(GrGLRenderbufferStorageProc, RenderbufferStorage);
153 152
154 interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuff erOES"); 153 interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuff erOES");
155 interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnm apBufferOES"); 154 interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnm apBufferOES");
156 } 155 }
157 glInterface.get()->ref(); 156 glInterface.get()->ref();
158 return glInterface.get(); 157 return glInterface.get();
159 } 158 }
OLDNEW
« no previous file with comments | « src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp ('k') | src/gpu/gl/debug/GrGLCreateDebugInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698