Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 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 #ifndef WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_IMPL_H_ | 5 #ifndef WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_IMPL_H_ |
| 6 #define WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_IMPL_H_ | 6 #define WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_IMPL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "third_party/angle/include/GLSLANG/ShaderLang.h" | 13 #include "third_party/angle/include/GLSLANG/ShaderLang.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D. h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D. h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 16 | 16 |
| 17 #if !defined(OS_MACOSX) | 17 #if !defined(OS_MACOSX) |
| 18 #define FLIP_FRAMEBUFFER_VERTICALLY | 18 #define FLIP_FRAMEBUFFER_VERTICALLY |
| 19 #endif | 19 #endif |
| 20 namespace gfx { | 20 namespace gfx { |
| 21 class GLContext; | 21 class GLContext; |
| 22 } | 22 } |
| 23 | 23 |
| 24 using WebKit::WGC3Dchar; | |
| 25 using WebKit::WGC3Denum; | |
| 26 using WebKit::WGC3Dboolean; | |
| 27 using WebKit::WGC3Dbitfield; | |
| 28 using WebKit::WGC3Dint; | |
| 29 using WebKit::WGC3Dsizei; | |
| 30 using WebKit::WGC3Duint; | |
| 31 using WebKit::WGC3Dfloat; | |
| 32 using WebKit::WGC3Dclampf; | |
| 33 using WebKit::WGC3Dintptr; | |
| 34 using WebKit::WGC3Dsizeiptr; | |
|
Ken Russell (switch to Gerrit)
2011/01/26 23:58:02
The block above should I think be guarded by #if d
| |
| 35 using WebKit::WebGLId; | |
| 36 | |
| 37 using WebKit::WebString; | |
| 38 using WebKit::WebView; | |
| 39 | |
| 40 using WebKit::WebGraphicsContext3D; | |
| 41 | |
| 24 namespace webkit { | 42 namespace webkit { |
| 25 namespace gpu { | 43 namespace gpu { |
| 26 | 44 |
| 27 // The default implementation of WebGL. In Chromium, using this class | 45 // The default implementation of WebGL. In Chromium, using this class |
| 28 // requires the sandbox to be disabled, which is strongly discouraged. | 46 // requires the sandbox to be disabled, which is strongly discouraged. |
| 29 // It is provided for support of test_shell and any Chromium ports | 47 // It is provided for support of test_shell and any Chromium ports |
| 30 // where an in-renderer WebGL implementation would be helpful. | 48 // where an in-renderer WebGL implementation would be helpful. |
| 31 | 49 |
| 50 #if defined(USE_WGC3D_TYPES) | |
| 51 | |
| 52 class WebGraphicsContext3DInProcessImpl : public WebGraphicsContext3D { | |
| 53 public: | |
| 54 WebGraphicsContext3DInProcessImpl(); | |
| 55 virtual ~WebGraphicsContext3DInProcessImpl(); | |
| 56 | |
| 57 //---------------------------------------------------------------------- | |
| 58 // WebGraphicsContext3D methods | |
| 59 virtual bool initialize( | |
| 60 WebGraphicsContext3D::Attributes attributes, WebView*, bool); | |
| 61 virtual bool makeContextCurrent(); | |
| 62 | |
| 63 virtual int width(); | |
| 64 virtual int height(); | |
| 65 | |
| 66 virtual bool isGLES2Compliant(); | |
| 67 | |
| 68 virtual void reshape(int width, int height); | |
| 69 | |
| 70 virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize); | |
| 71 | |
| 72 virtual WebGLId getPlatformTextureId(); | |
| 73 virtual void prepareTexture(); | |
| 74 | |
| 75 virtual void synthesizeGLError(WGC3Denum error); | |
| 76 virtual void* mapBufferSubDataCHROMIUM(WGC3Denum target, WGC3Dintptr offset, | |
| 77 WGC3Dsizeiptr size, WGC3Denum access); | |
| 78 virtual void unmapBufferSubDataCHROMIUM(const void*); | |
| 79 virtual void* mapTexSubImage2DCHROMIUM( | |
| 80 WGC3Denum target, | |
| 81 WGC3Dint level, | |
| 82 WGC3Dint xoffset, | |
| 83 WGC3Dint yoffset, | |
| 84 WGC3Dsizei width, | |
| 85 WGC3Dsizei height, | |
| 86 WGC3Denum format, | |
| 87 WGC3Denum type, | |
| 88 WGC3Denum access); | |
| 89 virtual void unmapTexSubImage2DCHROMIUM(const void*); | |
| 90 virtual void copyTextureToParentTextureCHROMIUM( | |
| 91 WebGLId texture, WebGLId parentTexture); | |
| 92 | |
| 93 virtual WebString getRequestableExtensionsCHROMIUM(); | |
| 94 virtual void requestExtensionCHROMIUM(const char*); | |
| 95 | |
| 96 virtual void activeTexture(WGC3Denum texture); | |
| 97 virtual void attachShader(WebGLId program, WebGLId shader); | |
| 98 virtual void bindAttribLocation( | |
| 99 WebGLId program, WGC3Duint index, const WGC3Dchar* name); | |
| 100 virtual void bindBuffer(WGC3Denum target, WebGLId buffer); | |
| 101 virtual void bindFramebuffer(WGC3Denum target, WebGLId framebuffer); | |
| 102 virtual void bindRenderbuffer( | |
| 103 WGC3Denum target, WebGLId renderbuffer); | |
| 104 virtual void bindTexture(WGC3Denum target, WebGLId texture); | |
| 105 virtual void blendColor( | |
| 106 WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha); | |
| 107 virtual void blendEquation(WGC3Denum mode); | |
| 108 virtual void blendEquationSeparate(WGC3Denum modeRGB, WGC3Denum modeAlpha); | |
| 109 virtual void blendFunc(WGC3Denum sfactor, WGC3Denum dfactor); | |
| 110 virtual void blendFuncSeparate(WGC3Denum srcRGB, WGC3Denum dstRGB, | |
| 111 WGC3Denum srcAlpha, WGC3Denum dstAlpha); | |
| 112 | |
| 113 virtual void bufferData( | |
| 114 WGC3Denum target, WGC3Dsizeiptr size, const void* data, WGC3Denum usage); | |
| 115 virtual void bufferSubData(WGC3Denum target, WGC3Dintptr offset, | |
| 116 WGC3Dsizeiptr size, const void* data); | |
| 117 | |
| 118 virtual WGC3Denum checkFramebufferStatus(WGC3Denum target); | |
| 119 virtual void clear(WGC3Dbitfield mask); | |
| 120 virtual void clearColor( | |
| 121 WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha); | |
| 122 virtual void clearDepth(WGC3Dclampf depth); | |
| 123 virtual void clearStencil(WGC3Dint s); | |
| 124 virtual void colorMask(WGC3Dboolean red, WGC3Dboolean green, | |
| 125 WGC3Dboolean blue, WGC3Dboolean alpha); | |
| 126 virtual void compileShader(WebGLId shader); | |
| 127 | |
| 128 virtual void copyTexImage2D( | |
| 129 WGC3Denum target, | |
| 130 WGC3Dint level, | |
| 131 WGC3Denum internalformat, | |
| 132 WGC3Dint x, | |
| 133 WGC3Dint y, | |
| 134 WGC3Dsizei width, | |
| 135 WGC3Dsizei height, | |
| 136 WGC3Dint border); | |
| 137 virtual void copyTexSubImage2D( | |
| 138 WGC3Denum target, | |
| 139 WGC3Dint level, | |
| 140 WGC3Dint xoffset, | |
| 141 WGC3Dint yoffset, | |
| 142 WGC3Dint x, | |
| 143 WGC3Dint y, | |
| 144 WGC3Dsizei width, | |
| 145 WGC3Dsizei height); | |
| 146 virtual void cullFace(WGC3Denum mode); | |
| 147 virtual void depthFunc(WGC3Denum func); | |
| 148 virtual void depthMask(WGC3Dboolean flag); | |
| 149 virtual void depthRange(WGC3Dclampf zNear, WGC3Dclampf zFar); | |
| 150 virtual void detachShader(WebGLId program, WebGLId shader); | |
| 151 virtual void disable(WGC3Denum cap); | |
| 152 virtual void disableVertexAttribArray(WGC3Duint index); | |
| 153 virtual void drawArrays(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count); | |
| 154 virtual void drawElements( | |
| 155 WGC3Denum mode, | |
| 156 WGC3Dsizei count, | |
| 157 WGC3Denum type, | |
| 158 WGC3Dintptr offset); | |
| 159 | |
| 160 virtual void enable(WGC3Denum cap); | |
| 161 virtual void enableVertexAttribArray(WGC3Duint index); | |
| 162 virtual void finish(); | |
| 163 virtual void flush(); | |
| 164 virtual void framebufferRenderbuffer( | |
| 165 WGC3Denum target, | |
| 166 WGC3Denum attachment, | |
| 167 WGC3Denum renderbuffertarget, | |
| 168 WebGLId renderbuffer); | |
| 169 virtual void framebufferTexture2D( | |
| 170 WGC3Denum target, | |
| 171 WGC3Denum attachment, | |
| 172 WGC3Denum textarget, | |
| 173 WebGLId texture, | |
| 174 WGC3Dint level); | |
| 175 virtual void frontFace(WGC3Denum mode); | |
| 176 virtual void generateMipmap(WGC3Denum target); | |
| 177 | |
| 178 virtual bool getActiveAttrib(WebGLId program, WGC3Duint index, ActiveInfo&); | |
| 179 virtual bool getActiveUniform(WebGLId program, WGC3Duint index, ActiveInfo&); | |
| 180 | |
| 181 virtual void getAttachedShaders(WebGLId program, WGC3Dsizei maxCount, | |
| 182 WGC3Dsizei* count, WebGLId* shaders); | |
| 183 | |
| 184 virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name); | |
| 185 | |
| 186 virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value); | |
| 187 | |
| 188 virtual void getBufferParameteriv( | |
| 189 WGC3Denum target, WGC3Denum pname, WGC3Dint* value); | |
| 190 | |
| 191 virtual Attributes getContextAttributes(); | |
| 192 | |
| 193 virtual WGC3Denum getError(); | |
| 194 | |
| 195 virtual bool isContextLost(); | |
| 196 | |
| 197 virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value); | |
| 198 | |
| 199 virtual void getFramebufferAttachmentParameteriv( | |
| 200 WGC3Denum target, | |
| 201 WGC3Denum attachment, | |
| 202 WGC3Denum pname, | |
| 203 WGC3Dint* value); | |
| 204 | |
| 205 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value); | |
| 206 | |
| 207 virtual void getProgramiv( | |
| 208 WebGLId program, WGC3Denum pname, WGC3Dint* value); | |
| 209 | |
| 210 virtual WebString getProgramInfoLog(WebGLId program); | |
| 211 | |
| 212 virtual void getRenderbufferParameteriv( | |
| 213 WGC3Denum target, WGC3Denum pname, WGC3Dint* value); | |
| 214 | |
| 215 virtual void getShaderiv( | |
| 216 WebGLId shader, WGC3Denum pname, WGC3Dint* value); | |
| 217 | |
| 218 virtual WebString getShaderInfoLog(WebGLId shader); | |
| 219 | |
| 220 // TBD | |
| 221 // void glGetShaderPrecisionFormat( | |
| 222 // GLenum shadertype, GLenum precisiontype, | |
| 223 // GLint* range, GLint* precision); | |
| 224 | |
| 225 virtual WebString getShaderSource(WebGLId shader); | |
| 226 virtual WebString getString(WGC3Denum name); | |
| 227 | |
| 228 virtual void getTexParameterfv( | |
| 229 WGC3Denum target, WGC3Denum pname, WGC3Dfloat* value); | |
| 230 virtual void getTexParameteriv( | |
| 231 WGC3Denum target, WGC3Denum pname, WGC3Dint* value); | |
| 232 | |
| 233 virtual void getUniformfv( | |
| 234 WebGLId program, WGC3Dint location, WGC3Dfloat* value); | |
| 235 virtual void getUniformiv( | |
| 236 WebGLId program, WGC3Dint location, WGC3Dint* value); | |
| 237 | |
| 238 virtual WGC3Dint getUniformLocation(WebGLId program, const WGC3Dchar* name); | |
| 239 | |
| 240 virtual void getVertexAttribfv( | |
| 241 WGC3Duint index, WGC3Denum pname, WGC3Dfloat* value); | |
| 242 virtual void getVertexAttribiv( | |
| 243 WGC3Duint index, WGC3Denum pname, WGC3Dint* value); | |
| 244 | |
| 245 virtual WGC3Dsizeiptr getVertexAttribOffset( | |
| 246 WGC3Duint index, WGC3Denum pname); | |
| 247 | |
| 248 virtual void hint(WGC3Denum target, WGC3Denum mode); | |
| 249 virtual WGC3Dboolean isBuffer(WebGLId buffer); | |
| 250 virtual WGC3Dboolean isEnabled(WGC3Denum cap); | |
| 251 virtual WGC3Dboolean isFramebuffer(WebGLId framebuffer); | |
| 252 virtual WGC3Dboolean isProgram(WebGLId program); | |
| 253 virtual WGC3Dboolean isRenderbuffer(WebGLId renderbuffer); | |
| 254 virtual WGC3Dboolean isShader(WebGLId shader); | |
| 255 virtual WGC3Dboolean isTexture(WebGLId texture); | |
| 256 virtual void lineWidth(WGC3Dfloat width); | |
| 257 virtual void linkProgram(WebGLId program); | |
| 258 virtual void pixelStorei(WGC3Denum pname, WGC3Dint param); | |
| 259 virtual void polygonOffset(WGC3Dfloat factor, WGC3Dfloat units); | |
| 260 | |
| 261 virtual void readPixels( | |
| 262 WGC3Dint x, WGC3Dint y, | |
| 263 WGC3Dsizei width, WGC3Dsizei height, | |
| 264 WGC3Denum format, | |
| 265 WGC3Denum type, | |
| 266 void* pixels); | |
| 267 | |
| 268 virtual void releaseShaderCompiler(); | |
| 269 virtual void renderbufferStorage( | |
| 270 WGC3Denum target, | |
| 271 WGC3Denum internalformat, | |
| 272 WGC3Dsizei width, | |
| 273 WGC3Dsizei height); | |
| 274 virtual void sampleCoverage(WGC3Dclampf value, WGC3Dboolean invert); | |
| 275 virtual void scissor( | |
| 276 WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height); | |
| 277 virtual void shaderSource(WebGLId shader, const WGC3Dchar* source); | |
| 278 virtual void stencilFunc(WGC3Denum func, WGC3Dint ref, WGC3Duint mask); | |
| 279 virtual void stencilFuncSeparate( | |
| 280 WGC3Denum face, WGC3Denum func, WGC3Dint ref, WGC3Duint mask); | |
| 281 virtual void stencilMask(WGC3Duint mask); | |
| 282 virtual void stencilMaskSeparate(WGC3Denum face, WGC3Duint mask); | |
| 283 virtual void stencilOp(WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass); | |
| 284 virtual void stencilOpSeparate( | |
| 285 WGC3Denum face, | |
| 286 WGC3Denum fail, | |
| 287 WGC3Denum zfail, | |
| 288 WGC3Denum zpass); | |
| 289 | |
| 290 virtual void texImage2D( | |
| 291 WGC3Denum target, | |
| 292 WGC3Dint level, | |
| 293 WGC3Denum internalformat, | |
| 294 WGC3Dsizei width, | |
| 295 WGC3Dsizei height, | |
| 296 WGC3Dint border, | |
| 297 WGC3Denum format, | |
| 298 WGC3Denum type, | |
| 299 const void* pixels); | |
| 300 | |
| 301 virtual void texParameterf( | |
| 302 WGC3Denum target, WGC3Denum pname, WGC3Dfloat param); | |
| 303 virtual void texParameteri( | |
| 304 WGC3Denum target, WGC3Denum pname, WGC3Dint param); | |
| 305 | |
| 306 virtual void texSubImage2D( | |
| 307 WGC3Denum target, | |
| 308 WGC3Dint level, | |
| 309 WGC3Dint xoffset, | |
| 310 WGC3Dint yoffset, | |
| 311 WGC3Dsizei width, | |
| 312 WGC3Dsizei height, | |
| 313 WGC3Denum format, | |
| 314 WGC3Denum type, | |
| 315 const void* pixels); | |
| 316 | |
| 317 virtual void uniform1f(WGC3Dint location, WGC3Dfloat x); | |
| 318 virtual void uniform1fv(WGC3Dint location, WGC3Dsizei count, | |
| 319 const WGC3Dfloat* v); | |
| 320 virtual void uniform1i(WGC3Dint location, WGC3Dint x); | |
| 321 virtual void uniform1iv(WGC3Dint location, WGC3Dsizei count, | |
| 322 const WGC3Dint* v); | |
| 323 virtual void uniform2f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y); | |
| 324 virtual void uniform2fv(WGC3Dint location, WGC3Dsizei count, | |
| 325 const WGC3Dfloat* v); | |
| 326 virtual void uniform2i(WGC3Dint location, WGC3Dint x, WGC3Dint y); | |
| 327 virtual void uniform2iv(WGC3Dint location, WGC3Dsizei count, | |
| 328 const WGC3Dint* v); | |
| 329 virtual void uniform3f(WGC3Dint location, | |
| 330 WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z); | |
| 331 virtual void uniform3fv(WGC3Dint location, WGC3Dsizei count, | |
| 332 const WGC3Dfloat* v); | |
| 333 virtual void uniform3i(WGC3Dint location, WGC3Dint x, WGC3Dint y, WGC3Dint z); | |
| 334 virtual void uniform3iv(WGC3Dint location, WGC3Dsizei count, | |
| 335 const WGC3Dint* v); | |
| 336 virtual void uniform4f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, | |
| 337 WGC3Dfloat z, WGC3Dfloat w); | |
| 338 virtual void uniform4fv(WGC3Dint location, WGC3Dsizei count, | |
| 339 const WGC3Dfloat* v); | |
| 340 virtual void uniform4i(WGC3Dint location, WGC3Dint x, WGC3Dint y, | |
| 341 WGC3Dint z, WGC3Dint w); | |
| 342 virtual void uniform4iv(WGC3Dint location, WGC3Dsizei count, | |
| 343 const WGC3Dint* v); | |
| 344 virtual void uniformMatrix2fv( | |
| 345 WGC3Dint location, WGC3Dsizei count, | |
| 346 WGC3Dboolean transpose, const WGC3Dfloat* value); | |
| 347 virtual void uniformMatrix3fv( | |
| 348 WGC3Dint location, WGC3Dsizei count, | |
| 349 WGC3Dboolean transpose, const WGC3Dfloat* value); | |
| 350 virtual void uniformMatrix4fv( | |
| 351 WGC3Dint location, WGC3Dsizei count, | |
| 352 WGC3Dboolean transpose, const WGC3Dfloat* value); | |
| 353 | |
| 354 virtual void useProgram(WebGLId program); | |
| 355 virtual void validateProgram(WebGLId program); | |
| 356 | |
| 357 virtual void vertexAttrib1f(WGC3Duint index, WGC3Dfloat x); | |
| 358 virtual void vertexAttrib1fv(WGC3Duint index, const WGC3Dfloat* values); | |
| 359 virtual void vertexAttrib2f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y); | |
| 360 virtual void vertexAttrib2fv(WGC3Duint index, const WGC3Dfloat* values); | |
| 361 virtual void vertexAttrib3f( | |
| 362 WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z); | |
| 363 virtual void vertexAttrib3fv(WGC3Duint index, const WGC3Dfloat* values); | |
| 364 virtual void vertexAttrib4f( | |
| 365 WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w); | |
| 366 virtual void vertexAttrib4fv(WGC3Duint index, const WGC3Dfloat* values); | |
| 367 virtual void vertexAttribPointer( | |
| 368 WGC3Duint index, | |
| 369 WGC3Dint size, | |
| 370 WGC3Denum type, | |
| 371 WGC3Dboolean normalized, | |
| 372 WGC3Dsizei stride, | |
| 373 WGC3Dintptr offset); | |
| 374 | |
| 375 virtual void viewport( | |
| 376 WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height); | |
| 377 | |
| 378 // Support for buffer creation and deletion | |
| 379 virtual WebGLId createBuffer(); | |
| 380 virtual WebGLId createFramebuffer(); | |
| 381 virtual WebGLId createProgram(); | |
| 382 virtual WebGLId createRenderbuffer(); | |
| 383 virtual WebGLId createShader(WGC3Denum); | |
| 384 virtual WebGLId createTexture(); | |
| 385 | |
| 386 virtual void deleteBuffer(WebGLId); | |
| 387 virtual void deleteFramebuffer(WebGLId); | |
| 388 virtual void deleteProgram(WebGLId); | |
| 389 virtual void deleteRenderbuffer(WebGLId); | |
| 390 virtual void deleteShader(WebGLId); | |
| 391 virtual void deleteTexture(WebGLId); | |
| 392 | |
| 393 private: | |
| 394 // ANGLE related. | |
| 395 struct ShaderSourceEntry { | |
| 396 explicit ShaderSourceEntry(WGC3Denum shader_type) | |
| 397 : type(shader_type), | |
| 398 is_valid(false) { | |
| 399 } | |
| 400 | |
| 401 WGC3Denum type; | |
| 402 scoped_array<char> source; | |
| 403 scoped_array<char> log; | |
| 404 scoped_array<char> translated_source; | |
| 405 bool is_valid; | |
| 406 }; | |
| 407 | |
| 408 typedef base::hash_map<WebGLId, ShaderSourceEntry*> ShaderSourceMap; | |
| 409 | |
| 410 #ifdef FLIP_FRAMEBUFFER_VERTICALLY | |
| 411 void FlipVertically(unsigned char* framebuffer, | |
| 412 unsigned int width, | |
| 413 unsigned int height); | |
| 414 #endif | |
| 415 | |
| 416 // Take into account the user's requested context creation attributes, in | |
| 417 // particular stencil and antialias, and determine which could or could | |
| 418 // not be honored based on the capabilities of the OpenGL implementation. | |
| 419 void ValidateAttributes(); | |
| 420 | |
| 421 // Resolve the given rectangle of the multisampled framebuffer if necessary. | |
| 422 void ResolveMultisampledFramebuffer( | |
| 423 WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height); | |
| 424 | |
| 425 bool AngleCreateCompilers(); | |
| 426 void AngleDestroyCompilers(); | |
| 427 bool AngleValidateShaderSource(ShaderSourceEntry* entry); | |
| 428 | |
| 429 WebGraphicsContext3D::Attributes attributes_; | |
| 430 bool initialized_; | |
| 431 bool render_directly_to_web_view_; | |
| 432 bool is_gles2_; | |
| 433 bool have_ext_framebuffer_object_; | |
| 434 bool have_ext_framebuffer_multisample_; | |
| 435 bool have_angle_framebuffer_multisample_; | |
| 436 | |
| 437 WebGLId texture_; | |
| 438 WebGLId fbo_; | |
| 439 WebGLId depth_stencil_buffer_; | |
| 440 int cached_width_, cached_height_; | |
| 441 | |
| 442 // For multisampling | |
| 443 WebGLId multisample_fbo_; | |
| 444 WebGLId multisample_depth_stencil_buffer_; | |
| 445 WebGLId multisample_color_buffer_; | |
| 446 | |
| 447 // For tracking which FBO is bound | |
| 448 WebGLId bound_fbo_; | |
| 449 | |
| 450 // For tracking which texture is bound | |
| 451 WebGLId bound_texture_; | |
| 452 | |
| 453 // FBO used for copying child texture to parent texture. | |
| 454 WebGLId copy_texture_to_parent_texture_fbo_; | |
| 455 | |
| 456 #ifdef FLIP_FRAMEBUFFER_VERTICALLY | |
| 457 unsigned char* scanline_; | |
| 458 #endif | |
| 459 | |
| 460 // Errors raised by synthesizeGLError(). | |
| 461 std::list<WGC3Denum> synthetic_errors_list_; | |
| 462 std::set<WGC3Denum> synthetic_errors_set_; | |
| 463 | |
| 464 scoped_ptr<gfx::GLContext> gl_context_; | |
| 465 | |
| 466 ShaderSourceMap shader_source_map_; | |
| 467 | |
| 468 ShHandle fragment_compiler_; | |
| 469 ShHandle vertex_compiler_; | |
| 470 }; | |
| 471 | |
| 472 #else // USE_WGC3D_TYPES | |
| 473 | |
| 32 class WebGraphicsContext3DInProcessImpl : public WebKit::WebGraphicsContext3D { | 474 class WebGraphicsContext3DInProcessImpl : public WebKit::WebGraphicsContext3D { |
| 33 public: | 475 public: |
| 34 WebGraphicsContext3DInProcessImpl(); | 476 WebGraphicsContext3DInProcessImpl(); |
| 35 virtual ~WebGraphicsContext3DInProcessImpl(); | 477 virtual ~WebGraphicsContext3DInProcessImpl(); |
| 36 | 478 |
| 37 //---------------------------------------------------------------------- | 479 //---------------------------------------------------------------------- |
| 38 // WebGraphicsContext3D methods | 480 // WebGraphicsContext3D methods |
| 39 virtual bool initialize( | 481 virtual bool initialize( |
| 40 WebGraphicsContext3D::Attributes attributes, WebKit::WebView*, bool); | 482 WebGraphicsContext3D::Attributes attributes, WebKit::WebView*, bool); |
| 41 virtual bool makeContextCurrent(); | 483 virtual bool makeContextCurrent(); |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 std::set<unsigned long> synthetic_errors_set_; | 901 std::set<unsigned long> synthetic_errors_set_; |
| 460 | 902 |
| 461 scoped_ptr<gfx::GLContext> gl_context_; | 903 scoped_ptr<gfx::GLContext> gl_context_; |
| 462 | 904 |
| 463 ShaderSourceMap shader_source_map_; | 905 ShaderSourceMap shader_source_map_; |
| 464 | 906 |
| 465 ShHandle fragment_compiler_; | 907 ShHandle fragment_compiler_; |
| 466 ShHandle vertex_compiler_; | 908 ShHandle vertex_compiler_; |
| 467 }; | 909 }; |
| 468 | 910 |
| 911 #endif // USE_WGC3D_TYPES | |
| 912 | |
| 469 } // namespace gpu | 913 } // namespace gpu |
| 470 } // namespace webkit | 914 } // namespace webkit |
| 471 | 915 |
| 472 #endif // WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_IMPL_H_ | 916 #endif // WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_IMPL_H_ |
| 473 | 917 |
| OLD | NEW |