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

Side by Side Diff: app/gfx/gl/gl_interface.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 | « app/gfx/gl/gl_implementation_win.cc ('k') | app/gfx/gl/gl_interface.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) 2010 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 implements glue to a GL interface so we can mock it for unit 5 // This file implements glue to a GL interface so we can mock it for unit
6 // testing. It has to be Desktop GL, not GLES2 as it is used to test the service 6 // testing. It has to be Desktop GL, not GLES2 as it is used to test the service
7 // side code. 7 // side code.
8 8
9 #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_INTERFACE_H_ 9 #ifndef APP_GFX_GL_GL_INTERFACE_H_
10 #define GPU_COMMAND_BUFFER_SERVICE_GL_INTERFACE_H_ 10 #define APP_GFX_GL_GL_INTERFACE_H_
11 11
12 #include <GLES2/gl2types.h> 12 #include "app/gfx/gl/gl_bindings.h"
13 13
14 // These are Desktop GL constants that we want to test that our GLES2 14 namespace gfx {
15 // implemenation does not let through.
16 #define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
17 #define GL_BGR 0x80E0
18 #define GL_BGRA 0x80E1
19 #define GL_UNPACK_SWAP_BYTES 0x0CF0
20 #define GL_PACK_SWAP_BYTES 0x0D00
21 #define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
22 #define GL_QUADS 0x0007
23 #define GL_POLYGON 0x0009
24 #define GL_FOG 0x0B60
25 #define GL_CLIP_PLANE0 0x3000
26 #define GL_GENERATE_MIPMAP 0x8191
27 #define GL_PIXEL_PACK_BUFFER 0x88EB
28 #define GL_POINT_SPRITE 0x8861
29 #define GL_MIN 0x8007
30 #define GL_MAX 0x8008
31 #define GL_TEXTURE_1D 0x0DE0
32 #define GL_TEXTURE_3D 0x806F
33 #define GL_DOUBLE 0x140A
34 #define GL_GEOMETRY_SHADER 0x8DD9
35 #define GL_FOG_HINT 0x0C54
36
37 namespace gles2 {
38 15
39 class GLInterface { 16 class GLInterface {
40 public: 17 public:
41 virtual ~GLInterface() { 18 virtual ~GLInterface() {
42 } 19 }
43 20
44 static void SetGLInterface(GLInterface* gl_interface); 21 static void SetGLInterface(GLInterface* gl_interface);
45 22
46 static GLInterface* GetGLInterface(); 23 static GLInterface* GetGLInterface();
47 24
(...skipping 30 matching lines...) Expand all
78 virtual void BufferSubData( 55 virtual void BufferSubData(
79 GLenum target, GLintptr offset, GLsizeiptr size, const void* data) = 0; 56 GLenum target, GLintptr offset, GLsizeiptr size, const void* data) = 0;
80 57
81 virtual GLenum CheckFramebufferStatusEXT(GLenum target) = 0; 58 virtual GLenum CheckFramebufferStatusEXT(GLenum target) = 0;
82 59
83 virtual void Clear(GLbitfield mask) = 0; 60 virtual void Clear(GLbitfield mask) = 0;
84 61
85 virtual void ClearColor( 62 virtual void ClearColor(
86 GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) = 0; 63 GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) = 0;
87 64
88 virtual void ClearDepth(GLclampf depth) = 0; 65 virtual void ClearDepth(GLclampd depth) = 0;
66
67 virtual void ClearDepthf(GLclampf depth) = 0;
89 68
90 virtual void ClearStencil(GLint s) = 0; 69 virtual void ClearStencil(GLint s) = 0;
91 70
92 virtual void ColorMask( 71 virtual void ColorMask(
93 GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) = 0; 72 GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) = 0;
94 73
95 virtual void CompileShader(GLuint shader) = 0; 74 virtual void CompileShader(GLuint shader) = 0;
96 75
97 virtual void CompressedTexImage2D( 76 virtual void CompressedTexImage2D(
98 GLenum target, GLint level, GLenum internalformat, GLsizei width, 77 GLenum target, GLint level, GLenum internalformat, GLsizei width,
(...skipping 27 matching lines...) Expand all
126 GLsizei n, const GLuint* renderbuffers) = 0; 105 GLsizei n, const GLuint* renderbuffers) = 0;
127 106
128 virtual void DeleteShader(GLuint shader) = 0; 107 virtual void DeleteShader(GLuint shader) = 0;
129 108
130 virtual void DeleteTextures(GLsizei n, const GLuint* textures) = 0; 109 virtual void DeleteTextures(GLsizei n, const GLuint* textures) = 0;
131 110
132 virtual void DepthFunc(GLenum func) = 0; 111 virtual void DepthFunc(GLenum func) = 0;
133 112
134 virtual void DepthMask(GLboolean flag) = 0; 113 virtual void DepthMask(GLboolean flag) = 0;
135 114
136 virtual void DepthRange(GLclampf zNear, GLclampf zFar) = 0; 115 virtual void DepthRange(GLclampd zNear, GLclampd zFar) = 0;
116
117 virtual void DepthRangef(GLclampf zNear, GLclampf zFar) = 0;
137 118
138 virtual void DetachShader(GLuint program, GLuint shader) = 0; 119 virtual void DetachShader(GLuint program, GLuint shader) = 0;
139 120
140 virtual void Disable(GLenum cap) = 0; 121 virtual void Disable(GLenum cap) = 0;
141 122
142 virtual void DisableVertexAttribArray(GLuint index) = 0; 123 virtual void DisableVertexAttribArray(GLuint index) = 0;
143 124
144 virtual void DrawArrays(GLenum mode, GLint first, GLsizei count) = 0; 125 virtual void DrawArrays(GLenum mode, GLint first, GLsizei count) = 0;
145 126
146 virtual void DrawElements( 127 virtual void DrawElements(
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 381
401 virtual void SwapBuffers() = 0; 382 virtual void SwapBuffers() = 0;
402 383
403 virtual GLuint GetMaxValueInBuffer( 384 virtual GLuint GetMaxValueInBuffer(
404 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) = 0; 385 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) = 0;
405 386
406 private: 387 private:
407 static GLInterface* interface_; 388 static GLInterface* interface_;
408 }; 389 };
409 390
410 } // namespace gles2 391 } // namespace gfx
411 392
412 #define GL_IFACE_GET_FUN(name) ::gles2::GLInterface::GetGLInterface()->name 393 #endif // APP_GFX_GL_GL_INTERFACE_H_
413
414 #define glActiveTexture GL_IFACE_GET_FUN(ActiveTexture)
415 #define glAttachShader GL_IFACE_GET_FUN(AttachShader)
416 #define glBindAttribLocation GL_IFACE_GET_FUN(BindAttribLocation)
417 #define glBindBuffer GL_IFACE_GET_FUN(BindBuffer)
418 #define glBindFramebufferEXT GL_IFACE_GET_FUN(BindFramebufferEXT)
419 #define glBindRenderbufferEXT GL_IFACE_GET_FUN(BindRenderbufferEXT)
420 #define glBindTexture GL_IFACE_GET_FUN(BindTexture)
421 #define glBlendColor GL_IFACE_GET_FUN(BlendColor)
422 #define glBlendEquation GL_IFACE_GET_FUN(BlendEquation)
423 #define glBlendEquationSeparate GL_IFACE_GET_FUN(BlendEquationSeparate)
424 #define glBlendFunc GL_IFACE_GET_FUN(BlendFunc)
425 #define glBlendFuncSeparate GL_IFACE_GET_FUN(BlendFuncSeparate)
426 #define glBufferData GL_IFACE_GET_FUN(BufferData)
427 #define glBufferSubData GL_IFACE_GET_FUN(BufferSubData)
428 #define glCheckFramebufferStatusEXT GL_IFACE_GET_FUN(CheckFramebufferStatusEXT)
429 #define glClear GL_IFACE_GET_FUN(Clear)
430 #define glClearColor GL_IFACE_GET_FUN(ClearColor)
431 #define glClearDepth GL_IFACE_GET_FUN(ClearDepth)
432 #define glClearStencil GL_IFACE_GET_FUN(ClearStencil)
433 #define glColorMask GL_IFACE_GET_FUN(ColorMask)
434 #define glCompileShader GL_IFACE_GET_FUN(CompileShader)
435 #define glCompressedTexImage2D GL_IFACE_GET_FUN(CompressedTexImage2D)
436 #define glCompressedTexSubImage2D GL_IFACE_GET_FUN(CompressedTexSubImage2D)
437 #define glCopyTexImage2D GL_IFACE_GET_FUN(CopyTexImage2D)
438 #define glCopyTexSubImage2D GL_IFACE_GET_FUN(CopyTexSubImage2D)
439 #define glCreateProgram GL_IFACE_GET_FUN(CreateProgram)
440 #define glCreateShader GL_IFACE_GET_FUN(CreateShader)
441 #define glCullFace GL_IFACE_GET_FUN(CullFace)
442 #define glDeleteBuffersARB GL_IFACE_GET_FUN(DeleteBuffersARB)
443 #define glDeleteFramebuffersEXT GL_IFACE_GET_FUN(DeleteFramebuffersEXT)
444 #define glDeleteProgram GL_IFACE_GET_FUN(DeleteProgram)
445 #define glDeleteRenderbuffersEXT GL_IFACE_GET_FUN(DeleteRenderbuffersEXT)
446 #define glDeleteShader GL_IFACE_GET_FUN(DeleteShader)
447 #define glDeleteTextures GL_IFACE_GET_FUN(DeleteTextures)
448 #define glDepthFunc GL_IFACE_GET_FUN(DepthFunc)
449 #define glDepthMask GL_IFACE_GET_FUN(DepthMask)
450 #define glDepthRange GL_IFACE_GET_FUN(DepthRange)
451 #define glDetachShader GL_IFACE_GET_FUN(DetachShader)
452 #define glDisable GL_IFACE_GET_FUN(Disable)
453 #define glDisableVertexAttribArray GL_IFACE_GET_FUN(DisableVertexAttribArray)
454 #define glDrawArrays GL_IFACE_GET_FUN(DrawArrays)
455 #define glDrawElements GL_IFACE_GET_FUN(DrawElements)
456 #define glEnable GL_IFACE_GET_FUN(Enable)
457 #define glEnableVertexAttribArray GL_IFACE_GET_FUN(EnableVertexAttribArray)
458 #define glFinish GL_IFACE_GET_FUN(Finish)
459 #define glFlush GL_IFACE_GET_FUN(Flush)
460 #define glFramebufferRenderbufferEXT \
461 GL_IFACE_GET_FUN(FramebufferRenderbufferEXT)
462 #define glFramebufferTexture2DEXT GL_IFACE_GET_FUN(FramebufferTexture2DEXT)
463 #define glFrontFace GL_IFACE_GET_FUN(FrontFace)
464 #define glGenBuffersARB GL_IFACE_GET_FUN(GenBuffersARB)
465 #define glGenerateMipmapEXT GL_IFACE_GET_FUN(GenerateMipmapEXT)
466 #define glGenFramebuffersEXT GL_IFACE_GET_FUN(GenFramebuffersEXT)
467 #define glGenRenderbuffersEXT GL_IFACE_GET_FUN(GenRenderbuffersEXT)
468 #define glGenTextures GL_IFACE_GET_FUN(GenTextures)
469 #define glGetActiveAttrib GL_IFACE_GET_FUN(GetActiveAttrib)
470 #define glGetActiveUniform GL_IFACE_GET_FUN(GetActiveUniform)
471 #define glGetAttachedShaders GL_IFACE_GET_FUN(GetAttachedShaders)
472 #define glGetAttribLocation GL_IFACE_GET_FUN(GetAttribLocation)
473 #define glGetBooleanv GL_IFACE_GET_FUN(GetBooleanv)
474 #define glGetBufferParameteriv GL_IFACE_GET_FUN(GetBufferParameteriv)
475 #define glGetError GL_IFACE_GET_FUN(GetError)
476 #define glGetFloatv GL_IFACE_GET_FUN(GetFloatv)
477 #define glGetFramebufferAttachmentParameterivEXT \
478 GL_IFACE_GET_FUN(GetFramebufferAttachmentParameterivEXT)
479 #define glGetIntegerv GL_IFACE_GET_FUN(GetIntegerv)
480 #define glGetProgramiv GL_IFACE_GET_FUN(GetProgramiv)
481 #define glGetProgramInfoLog GL_IFACE_GET_FUN(GetProgramInfoLog)
482 #define glGetRenderbufferParameterivEXT \
483 GL_IFACE_GET_FUN(GetRenderbufferParameterivEXT)
484 #define glGetShaderiv GL_IFACE_GET_FUN(GetShaderiv)
485 #define glGetShaderInfoLog GL_IFACE_GET_FUN(GetShaderInfoLog)
486 #define glGetShaderPrecisionFormat GL_IFACE_GET_FUN(GetShaderPrecisionFormat)
487 #define glGetShaderSource GL_IFACE_GET_FUN(GetShaderSource)
488 #define glGetString GL_IFACE_GET_FUN(GetString)
489 #define glGetTexParameterfv GL_IFACE_GET_FUN(GetTexParameterfv)
490 #define glGetTexParameteriv GL_IFACE_GET_FUN(GetTexParameteriv)
491 #define glGetUniformfv GL_IFACE_GET_FUN(GetUniformfv)
492 #define glGetUniformiv GL_IFACE_GET_FUN(GetUniformiv)
493 #define glGetUniformLocation GL_IFACE_GET_FUN(GetUniformLocation)
494 #define glGetVertexAttribfv GL_IFACE_GET_FUN(GetVertexAttribfv)
495 #define glGetVertexAttribiv GL_IFACE_GET_FUN(GetVertexAttribiv)
496 #define glGetVertexAttribPointerv GL_IFACE_GET_FUN(GetVertexAttribPointerv)
497 #define glHint GL_IFACE_GET_FUN(Hint)
498 #define glIsBuffer GL_IFACE_GET_FUN(IsBuffer)
499 #define glIsEnabled GL_IFACE_GET_FUN(IsEnabled)
500 #define glIsFramebufferEXT GL_IFACE_GET_FUN(IsFramebufferEXT)
501 #define glIsProgram GL_IFACE_GET_FUN(IsProgram)
502 #define glIsRenderbufferEXT GL_IFACE_GET_FUN(IsRenderbufferEXT)
503 #define glIsShader GL_IFACE_GET_FUN(IsShader)
504 #define glIsTexture GL_IFACE_GET_FUN(IsTexture)
505 #define glLineWidth GL_IFACE_GET_FUN(LineWidth)
506 #define glLinkProgram GL_IFACE_GET_FUN(LinkProgram)
507 #define glPixelStorei GL_IFACE_GET_FUN(PixelStorei)
508 #define glPolygonOffset GL_IFACE_GET_FUN(PolygonOffset)
509 #define glReadPixels GL_IFACE_GET_FUN(ReadPixels)
510 #define glReleaseShaderCompiler GL_IFACE_GET_FUN(ReleaseShaderCompiler)
511 #define glRenderbufferStorageEXT GL_IFACE_GET_FUN(RenderbufferStorageEXT)
512 #define glSampleCoverage GL_IFACE_GET_FUN(SampleCoverage)
513 #define glScissor GL_IFACE_GET_FUN(Scissor)
514 #define glShaderBinary GL_IFACE_GET_FUN(ShaderBinary)
515 #define glShaderSource GL_IFACE_GET_FUN(ShaderSource)
516 #define glStencilFunc GL_IFACE_GET_FUN(StencilFunc)
517 #define glStencilFuncSeparate GL_IFACE_GET_FUN(StencilFuncSeparate)
518 #define glStencilMask GL_IFACE_GET_FUN(StencilMask)
519 #define glStencilMaskSeparate GL_IFACE_GET_FUN(StencilMaskSeparate)
520 #define glStencilOp GL_IFACE_GET_FUN(StencilOp)
521 #define glStencilOpSeparate GL_IFACE_GET_FUN(StencilOpSeparate)
522 #define glTexImage2D GL_IFACE_GET_FUN(TexImage2D)
523 #define glTexParameterf GL_IFACE_GET_FUN(TexParameterf)
524 #define glTexParameterfv GL_IFACE_GET_FUN(TexParameterfv)
525 #define glTexParameteri GL_IFACE_GET_FUN(TexParameteri)
526 #define glTexParameteriv GL_IFACE_GET_FUN(TexParameteriv)
527 #define glTexSubImage2D GL_IFACE_GET_FUN(TexSubImage2D)
528 #define glUniform1f GL_IFACE_GET_FUN(Uniform1f)
529 #define glUniform1fv GL_IFACE_GET_FUN(Uniform1fv)
530 #define glUniform1i GL_IFACE_GET_FUN(Uniform1i)
531 #define glUniform1iv GL_IFACE_GET_FUN(Uniform1iv)
532 #define glUniform2f GL_IFACE_GET_FUN(Uniform2f)
533 #define glUniform2fv GL_IFACE_GET_FUN(Uniform2fv)
534 #define glUniform2i GL_IFACE_GET_FUN(Uniform2i)
535 #define glUniform2iv GL_IFACE_GET_FUN(Uniform2iv)
536 #define glUniform3f GL_IFACE_GET_FUN(Uniform3f)
537 #define glUniform3fv GL_IFACE_GET_FUN(Uniform3fv)
538 #define glUniform3i GL_IFACE_GET_FUN(Uniform3i)
539 #define glUniform3iv GL_IFACE_GET_FUN(Uniform3iv)
540 #define glUniform4f GL_IFACE_GET_FUN(Uniform4f)
541 #define glUniform4fv GL_IFACE_GET_FUN(Uniform4fv)
542 #define glUniform4i GL_IFACE_GET_FUN(Uniform4i)
543 #define glUniform4iv GL_IFACE_GET_FUN(Uniform4iv)
544 #define glUniformMatrix2fv GL_IFACE_GET_FUN(UniformMatrix2fv)
545 #define glUniformMatrix3fv GL_IFACE_GET_FUN(UniformMatrix3fv)
546 #define glUniformMatrix4fv GL_IFACE_GET_FUN(UniformMatrix4fv)
547 #define glUseProgram GL_IFACE_GET_FUN(UseProgram)
548 #define glValidateProgram GL_IFACE_GET_FUN(ValidateProgram)
549 #define glVertexAttrib1f GL_IFACE_GET_FUN(VertexAttrib1f)
550 #define glVertexAttrib1fv GL_IFACE_GET_FUN(VertexAttrib1fv)
551 #define glVertexAttrib2f GL_IFACE_GET_FUN(VertexAttrib2f)
552 #define glVertexAttrib2fv GL_IFACE_GET_FUN(VertexAttrib2fv)
553 #define glVertexAttrib3f GL_IFACE_GET_FUN(VertexAttrib3f)
554 #define glVertexAttrib3fv GL_IFACE_GET_FUN(VertexAttrib3fv)
555 #define glVertexAttrib4f GL_IFACE_GET_FUN(VertexAttrib4f)
556 #define glVertexAttrib4fv GL_IFACE_GET_FUN(VertexAttrib4fv)
557 #define glVertexAttribPointer GL_IFACE_GET_FUN(VertexAttribPointer)
558 #define glViewport GL_IFACE_GET_FUN(Viewport)
559
560 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_INTERFACE_H_
561 394
562 395
563 396
OLDNEW
« no previous file with comments | « app/gfx/gl/gl_implementation_win.cc ('k') | app/gfx/gl/gl_interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698