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

Side by Side Diff: gpu/command_buffer/service/gl_utils.h

Issue 2134006: Added EGL based GLContext.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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
« no previous file with comments | « gpu/command_buffer/service/gl_mock.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // This file includes all the necessary GL headers and implements some useful 5 // This file includes all the necessary GL headers and implements some useful
6 // utilities. 6 // utilities.
7 7
8 #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_ 8 #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_
9 #define GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_ 9 #define GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_
10 10
11 #include <build/build_config.h> 11 #include "build/build_config.h"
12 #include "app/gfx/gl/gl_bindings.h"
12 13
13 #if defined(UNIT_TEST) 14 // GLES2 defines not part of Desktop GL
14 #include "gpu/command_buffer/service/gl_mock.h" 15 // Shader Precision-Specified Types
15 // OpenGL constants not defined in OpenGL ES 2.0 needed when compiling 16 #define GL_LOW_FLOAT 0x8DF0
16 // unit tests. For native OpenGL ES 2.0 backend these are not used. For OpenGL 17 #define GL_MEDIUM_FLOAT 0x8DF1
17 // backend these must be defined by the local system. 18 #define GL_HIGH_FLOAT 0x8DF2
18 #if !defined(GL_VERTEX_PROGRAM_POINT_SIZE) 19 #define GL_LOW_INT 0x8DF3
19 #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 20 #define GL_MEDIUM_INT 0x8DF4
20 #endif 21 #define GL_HIGH_INT 0x8DF5
21 #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 22 #define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
22 #define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A 23 #define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
23 #define GL_MAX_VARYING_FLOATS 0x8B4B 24 #define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
24 #else 25 #define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
25 #if defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) 26 #define GL_MAX_VARYING_VECTORS 0x8DFC
26 #include <GLES2/gl2.h> // NOLINT 27 #define GL_SHADER_BINARY_FORMATS 0x8DF8
27 28 #define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
28 #define glClearDepth glClearDepthf 29 #define GL_SHADER_COMPILER 0x8DFA
29 #define glDepthRange glDepthRangef
30
31 // Buffer Objects
32 #define glBindBufferARB glBindBuffer
33 #define glBufferDataARB glBufferData
34 #define glBufferSubDataARB glBufferSubData
35 #define glDeleteBuffersARB glDeleteBuffers
36 #define glGenBuffersARB glGenBuffers
37
38 // Framebuffer Objects
39 #define glBindFramebufferEXT glBindFramebuffer
40 #define glBindRenderbufferEXT glBindRenderbuffer
41 #define glCheckFramebufferStatusEXT glCheckFramebufferStatus
42 #define glDeleteFramebuffersEXT glDeleteFramebuffers
43 #define glDeleteRenderbuffersEXT glDeleteRenderbuffers
44 #define glFramebufferRenderbufferEXT glFramebufferRenderbuffer
45 #define glFramebufferTexture2DEXT glFramebufferTexture2D
46 #define glGenFramebuffersEXT glGenFramebuffers
47 #define glGenRenderbuffersEXT glGenRenderbuffers
48 #define glGetFramebufferAttachmentParameterivEXT \
49 glGetFramebufferAttachmentParameteriv
50 #define glGetRenderbufferParameterivEXT glGetRenderbufferParameteriv
51 #define glIsFramebufferEXT glIsFramebuffer
52 #define glIsRenderbufferEXT glIsFramebuffer
53 #define glRenderbufferStorageEXT glRenderbufferStorage
54
55 // Texture Objects
56 #define glGenerateMipmapEXT glGenerateMipmap
57
58 #else // !GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2
59 #include <GL/glew.h> // NOLINT
60 #include <GL/osmew.h>
61 #if defined(OS_WIN)
62 #include <GL/wglew.h> // NOLINT
63 #elif defined(OS_LINUX)
64 #include <GL/glxew.h> // NOLINT
65 #endif // OS_WIN
66
67 // GLES2 defines not part of Desktop GL
68 // Shader Precision-Specified Types
69 #define GL_LOW_FLOAT 0x8DF0
70 #define GL_MEDIUM_FLOAT 0x8DF1
71 #define GL_HIGH_FLOAT 0x8DF2
72 #define GL_LOW_INT 0x8DF3
73 #define GL_MEDIUM_INT 0x8DF4
74 #define GL_HIGH_INT 0x8DF5
75 #define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
76 #define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
77 #define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
78 #define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
79 #define GL_MAX_VARYING_VECTORS 0x8DFC
80 #define GL_SHADER_BINARY_FORMATS 0x8DF8
81 #define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
82 #define GL_SHADER_COMPILER 0x8DFA
83
84 #endif // GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2
85
86 #endif // UNIT_TEST
87 30
88 #define GL_GLEXT_PROTOTYPES 1 31 #define GL_GLEXT_PROTOTYPES 1
89 32
90 // Define this for extra GL error debugging (slower). 33 // Define this for extra GL error debugging (slower).
91 // #define GL_ERROR_DEBUGGING 34 // #define GL_ERROR_DEBUGGING
92 #ifdef GL_ERROR_DEBUGGING 35 #ifdef GL_ERROR_DEBUGGING
93 #define CHECK_GL_ERROR() do { \ 36 #define CHECK_GL_ERROR() do { \
94 GLenum gl_error = glGetError(); \ 37 GLenum gl_error = glGetError(); \
95 LOG_IF(ERROR, gl_error != GL_NO_ERROR) << "GL Error :" << gl_error; \ 38 LOG_IF(ERROR, gl_error != GL_NO_ERROR) << "GL Error :" << gl_error; \
96 } while (0) 39 } while (0)
97 #else // GL_ERROR_DEBUGGING 40 #else // GL_ERROR_DEBUGGING
98 #define CHECK_GL_ERROR() void(0) 41 #define CHECK_GL_ERROR() void(0)
99 #endif // GL_ERROR_DEBUGGING 42 #endif // GL_ERROR_DEBUGGING
100 43
101 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_ 44 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gl_mock.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698