| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 // Typedef for server-side objects like OpenGL textures and program objects. | 68 // Typedef for server-side objects like OpenGL textures and program objects. |
| 69 typedef WGC3Duint WebGLId; | 69 typedef WGC3Duint WebGLId; |
| 70 | 70 |
| 71 // This interface abstracts the operations performed by the | 71 // This interface abstracts the operations performed by the |
| 72 // GraphicsContext3D in order to implement WebGL. Nearly all of the | 72 // GraphicsContext3D in order to implement WebGL. Nearly all of the |
| 73 // methods exposed on this interface map directly to entry points in | 73 // methods exposed on this interface map directly to entry points in |
| 74 // the OpenGL ES 2.0 API. | 74 // the OpenGL ES 2.0 API. |
| 75 class WebGraphicsContext3D : public WebNonCopyable { | 75 class WebGraphicsContext3D : public WebNonCopyable { |
| 76 public: | 76 public: |
| 77 // Return value from getActiveUniform and getActiveAttrib. | |
| 78 struct ActiveInfo { | |
| 79 WebString name; | |
| 80 WGC3Denum type; | |
| 81 WGC3Dint size; | |
| 82 }; | |
| 83 | |
| 84 // Context creation attributes. | 77 // Context creation attributes. |
| 85 struct Attributes { | 78 struct Attributes { |
| 86 bool alpha = true; | 79 bool alpha = true; |
| 87 bool depth = true; | 80 bool depth = true; |
| 88 bool stencil = true; | 81 bool stencil = true; |
| 89 bool antialias = true; | 82 bool antialias = true; |
| 90 bool premultipliedAlpha = true; | 83 bool premultipliedAlpha = true; |
| 91 bool canRecoverFromContextLoss = true; | 84 bool canRecoverFromContextLoss = true; |
| 92 bool noExtensions = false; | 85 bool noExtensions = false; |
| 93 bool shareResources = true; | 86 bool shareResources = true; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 public: | 122 public: |
| 130 virtual void onErrorMessage(const WebString&, WGC3Dint) = 0; | 123 virtual void onErrorMessage(const WebString&, WGC3Dint) = 0; |
| 131 | 124 |
| 132 protected: | 125 protected: |
| 133 virtual ~WebGraphicsErrorMessageCallback() { } | 126 virtual ~WebGraphicsErrorMessageCallback() { } |
| 134 }; | 127 }; |
| 135 | 128 |
| 136 // This destructor needs to be public so that using classes can destroy inst
ances if initialization fails. | 129 // This destructor needs to be public so that using classes can destroy inst
ances if initialization fails. |
| 137 virtual ~WebGraphicsContext3D() { } | 130 virtual ~WebGraphicsContext3D() { } |
| 138 | 131 |
| 139 // The entry points below map directly to the OpenGL ES 2.0 API. | |
| 140 // See: http://www.khronos.org/registry/gles/ | |
| 141 // and: http://www.khronos.org/opengles/sdk/docs/man/ | |
| 142 virtual bool getActiveAttrib(WebGLId program, WGC3Duint index, ActiveInfo&)
= 0; | |
| 143 virtual bool getActiveUniform(WebGLId program, WGC3Duint index, ActiveInfo&)
= 0; | |
| 144 virtual WebString getProgramInfoLog(WebGLId program) = 0; | |
| 145 virtual WebString getShaderInfoLog(WebGLId shader) = 0; | |
| 146 virtual WebString getShaderSource(WebGLId shader) = 0; | |
| 147 | |
| 148 virtual void setErrorMessageCallback(WebGraphicsErrorMessageCallback* callba
ck) { } | 132 virtual void setErrorMessageCallback(WebGraphicsErrorMessageCallback* callba
ck) { } |
| 149 | 133 |
| 150 virtual WebString getTranslatedShaderSourceANGLE(WebGLId shader) = 0; | |
| 151 | |
| 152 // Prefer getting a GLES2Interface off WebGraphicsContext3DProvider if possi
ble, and avoid using WebGraphicsContext3D at all. | 134 // Prefer getting a GLES2Interface off WebGraphicsContext3DProvider if possi
ble, and avoid using WebGraphicsContext3D at all. |
| 153 virtual gpu::gles2::GLES2Interface* getGLES2Interface() = 0; | 135 virtual gpu::gles2::GLES2Interface* getGLES2Interface() = 0; |
| 154 }; | 136 }; |
| 155 | 137 |
| 156 } // namespace blink | 138 } // namespace blink |
| 157 | 139 |
| 158 #endif | 140 #endif |
| OLD | NEW |