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

Side by Side Diff: src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp

Issue 22856006: Recognize that ES3 supports texture storage. Add workaround for apparent Adreno bug. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« src/gpu/gl/GrGLInterface.cpp ('K') | « src/gpu/gl/GrGLUtil.cpp ('k') | 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 // Modified from chromium/src/webkit/glue/gl_bindings_skia_cmd_buffer.cc 1 // Modified from chromium/src/webkit/glue/gl_bindings_skia_cmd_buffer.cc
2 2
3 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be 4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file. 5 // found in the LICENSE file.
6 6
7 #include "gl/GrGLExtensions.h" 7 #include "gl/GrGLExtensions.h"
8 #include "gl/GrGLInterface.h" 8 #include "gl/GrGLInterface.h"
9 #include "gl/GrGLUtil.h"
9 10
10 #ifndef GL_GLEXT_PROTOTYPES 11 #ifndef GL_GLEXT_PROTOTYPES
11 #define GL_GLEXT_PROTOTYPES 12 #define GL_GLEXT_PROTOTYPES
12 #endif 13 #endif
13 14
14 #include <GLES2/gl2.h> 15 #include <GLES2/gl2.h>
15 #include <GLES2/gl2ext.h> 16 #include <GLES2/gl2ext.h>
16 17
17 #include <EGL/egl.h> 18 #include <EGL/egl.h>
18 19
19 const GrGLInterface* GrGLCreateNativeInterface() { 20 const GrGLInterface* GrGLCreateNativeInterface() {
20 static SkAutoTUnref<GrGLInterface> glInterface; 21 static SkAutoTUnref<GrGLInterface> glInterface;
21 if (!glInterface.get()) { 22 if (!glInterface.get()) {
22 GrGLExtensions extensions; 23 GrGLExtensions extensions;
23 if (!extensions.init(kES_GrGLBinding, glGetString, NULL, glGetIntegerv)) { 24 if (!extensions.init(kES_GrGLBinding, glGetString, NULL, glGetIntegerv)) {
24 return NULL; 25 return NULL;
25 } 26 }
27 const char* verStr = reinterpret_cast<const char*>(glGetString(GR_GL_VER SION));
28 GrGLVersion version = GrGLGetVersionFromString(verStr);
29 if (version < GR_GL_VER(2,0)) {
30 return NULL;
31 }
32
26 GrGLInterface* interface = new GrGLInterface; 33 GrGLInterface* interface = new GrGLInterface;
27 glInterface.reset(interface); 34 glInterface.reset(interface);
28 interface->fBindingsExported = kES_GrGLBinding; 35 interface->fBindingsExported = kES_GrGLBinding;
29 interface->fActiveTexture = glActiveTexture; 36 interface->fActiveTexture = glActiveTexture;
30 interface->fAttachShader = glAttachShader; 37 interface->fAttachShader = glAttachShader;
31 interface->fBindAttribLocation = glBindAttribLocation; 38 interface->fBindAttribLocation = glBindAttribLocation;
32 interface->fBindBuffer = glBindBuffer; 39 interface->fBindBuffer = glBindBuffer;
33 interface->fBindTexture = glBindTexture; 40 interface->fBindTexture = glBindTexture;
34 interface->fBindVertexArray = glBindVertexArrayOES; 41 interface->fBindVertexArray = glBindVertexArrayOES;
35 interface->fBlendColor = glBlendColor; 42 interface->fBlendColor = glBlendColor;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 interface->fStencilFunc = glStencilFunc; 94 interface->fStencilFunc = glStencilFunc;
88 interface->fStencilFuncSeparate = glStencilFuncSeparate; 95 interface->fStencilFuncSeparate = glStencilFuncSeparate;
89 interface->fStencilMask = glStencilMask; 96 interface->fStencilMask = glStencilMask;
90 interface->fStencilMaskSeparate = glStencilMaskSeparate; 97 interface->fStencilMaskSeparate = glStencilMaskSeparate;
91 interface->fStencilOp = glStencilOp; 98 interface->fStencilOp = glStencilOp;
92 interface->fStencilOpSeparate = glStencilOpSeparate; 99 interface->fStencilOpSeparate = glStencilOpSeparate;
93 interface->fTexImage2D = glTexImage2D; 100 interface->fTexImage2D = glTexImage2D;
94 interface->fTexParameteri = glTexParameteri; 101 interface->fTexParameteri = glTexParameteri;
95 interface->fTexParameteriv = glTexParameteriv; 102 interface->fTexParameteriv = glTexParameteriv;
96 interface->fTexSubImage2D = glTexSubImage2D; 103 interface->fTexSubImage2D = glTexSubImage2D;
97 #if GL_ARB_texture_storage 104
98 interface->fTexStorage2D = glTexStorage2D; 105 if (version >= GR_GL_VER(3,0)) {
99 #elif GL_EXT_texture_storage 106 #if GL_ES_VERSION_3_0
100 interface->fTexStorage2D = glTexStorage2DEXT; 107 interface->fTexStorage2D = glTexStorage2D;
101 #else 108 #else
102 interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glT exStorage2DEXT"); 109 interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress( "glTexStorage2D");
103 #endif 110 #endif
111 } else {
112 #if GL_EXT_texture_storage
113 interface->fTexStorage2D = glTexStorage2DEXT;
114 #else
115 interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress( "glTexStorage2DEXT");
116 #endif
117 }
118
104 #if GL_EXT_discard_framebuffer 119 #if GL_EXT_discard_framebuffer
105 interface->fDiscardFramebuffer = glDiscardFramebufferEXT; 120 interface->fDiscardFramebuffer = glDiscardFramebufferEXT;
106 #endif 121 #endif
107 interface->fUniform1f = glUniform1f; 122 interface->fUniform1f = glUniform1f;
108 interface->fUniform1i = glUniform1i; 123 interface->fUniform1i = glUniform1i;
109 interface->fUniform1fv = glUniform1fv; 124 interface->fUniform1fv = glUniform1fv;
110 interface->fUniform1iv = glUniform1iv; 125 interface->fUniform1iv = glUniform1iv;
111 interface->fUniform2f = glUniform2f; 126 interface->fUniform2f = glUniform2f;
112 interface->fUniform2i = glUniform2i; 127 interface->fUniform2i = glUniform2i;
113 interface->fUniform2fv = glUniform2fv; 128 interface->fUniform2fv = glUniform2fv;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 interface->fMapBuffer = glMapBufferOES; 175 interface->fMapBuffer = glMapBufferOES;
161 interface->fUnmapBuffer = glUnmapBufferOES; 176 interface->fUnmapBuffer = glUnmapBufferOES;
162 #else 177 #else
163 interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuff erOES"); 178 interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuff erOES");
164 interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnm apBufferOES"); 179 interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnm apBufferOES");
165 #endif 180 #endif
166 } 181 }
167 glInterface.get()->ref(); 182 glInterface.get()->ref();
168 return glInterface.get(); 183 return glInterface.get();
169 } 184 }
OLDNEW
« src/gpu/gl/GrGLInterface.cpp ('K') | « src/gpu/gl/GrGLUtil.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698