| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 static unsigned getWebGLVersion(const CanvasRenderingContext*); | 164 static unsigned getWebGLVersion(const CanvasRenderingContext*); |
| 165 | 165 |
| 166 static PassOwnPtr<WebGraphicsContext3D> createWebGraphicsContext3D(HTMLCanva
sElement*, WebGLContextAttributes, unsigned webGLVersion); | 166 static PassOwnPtr<WebGraphicsContext3D> createWebGraphicsContext3D(HTMLCanva
sElement*, WebGLContextAttributes, unsigned webGLVersion); |
| 167 static void forceNextWebGLContextCreationToFail(); | 167 static void forceNextWebGLContextCreationToFail(); |
| 168 | 168 |
| 169 int drawingBufferWidth() const; | 169 int drawingBufferWidth() const; |
| 170 int drawingBufferHeight() const; | 170 int drawingBufferHeight() const; |
| 171 | 171 |
| 172 void activeTexture(GLenum texture); | 172 void activeTexture(GLenum texture); |
| 173 void attachShader(WebGLProgram*, WebGLShader*); | 173 void attachShader(ScriptState*, WebGLProgram*, WebGLShader*); |
| 174 void bindAttribLocation(WebGLProgram*, GLuint index, const String& name); | 174 void bindAttribLocation(WebGLProgram*, GLuint index, const String& name); |
| 175 void bindBuffer(GLenum target, WebGLBuffer*); | 175 void bindBuffer(ScriptState*, GLenum target, WebGLBuffer*); |
| 176 virtual void bindFramebuffer(GLenum target, WebGLFramebuffer*); | 176 virtual void bindFramebuffer(ScriptState*, GLenum target, WebGLFramebuffer*)
; |
| 177 void bindRenderbuffer(GLenum target, WebGLRenderbuffer*); | 177 void bindRenderbuffer(ScriptState*, GLenum target, WebGLRenderbuffer*); |
| 178 void bindTexture(GLenum target, WebGLTexture*); | 178 void bindTexture(ScriptState*, GLenum target, WebGLTexture*); |
| 179 void blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); | 179 void blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); |
| 180 void blendEquation(GLenum mode); | 180 void blendEquation(GLenum mode); |
| 181 void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); | 181 void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); |
| 182 void blendFunc(GLenum sfactor, GLenum dfactor); | 182 void blendFunc(GLenum sfactor, GLenum dfactor); |
| 183 void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum
dstAlpha); | 183 void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum
dstAlpha); |
| 184 | 184 |
| 185 void bufferData(GLenum target, long long size, GLenum usage); | 185 void bufferData(GLenum target, long long size, GLenum usage); |
| 186 void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage); | 186 void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage); |
| 187 void bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage); | 187 void bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage); |
| 188 void bufferSubData(GLenum target, long long offset, DOMArrayBuffer* data); | 188 void bufferSubData(GLenum target, long long offset, DOMArrayBuffer* data); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 214 void deleteBuffer(WebGLBuffer*); | 214 void deleteBuffer(WebGLBuffer*); |
| 215 virtual void deleteFramebuffer(WebGLFramebuffer*); | 215 virtual void deleteFramebuffer(WebGLFramebuffer*); |
| 216 void deleteProgram(WebGLProgram*); | 216 void deleteProgram(WebGLProgram*); |
| 217 void deleteRenderbuffer(WebGLRenderbuffer*); | 217 void deleteRenderbuffer(WebGLRenderbuffer*); |
| 218 void deleteShader(WebGLShader*); | 218 void deleteShader(WebGLShader*); |
| 219 void deleteTexture(WebGLTexture*); | 219 void deleteTexture(WebGLTexture*); |
| 220 | 220 |
| 221 void depthFunc(GLenum); | 221 void depthFunc(GLenum); |
| 222 void depthMask(GLboolean); | 222 void depthMask(GLboolean); |
| 223 void depthRange(GLfloat zNear, GLfloat zFar); | 223 void depthRange(GLfloat zNear, GLfloat zFar); |
| 224 void detachShader(WebGLProgram*, WebGLShader*); | 224 void detachShader(ScriptState*, WebGLProgram*, WebGLShader*); |
| 225 void disable(GLenum cap); | 225 void disable(GLenum cap); |
| 226 void disableVertexAttribArray(GLuint index); | 226 void disableVertexAttribArray(GLuint index); |
| 227 void drawArrays(GLenum mode, GLint first, GLsizei count); | 227 void drawArrays(GLenum mode, GLint first, GLsizei count); |
| 228 void drawElements(GLenum mode, GLsizei count, GLenum type, long long offset)
; | 228 void drawElements(GLenum mode, GLsizei count, GLenum type, long long offset)
; |
| 229 | 229 |
| 230 void drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsiz
ei primcount); | 230 void drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsiz
ei primcount); |
| 231 void drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, lon
g long offset, GLsizei primcount); | 231 void drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, lon
g long offset, GLsizei primcount); |
| 232 | 232 |
| 233 void enable(GLenum cap); | 233 void enable(GLenum cap); |
| 234 void enableVertexAttribArray(GLuint index); | 234 void enableVertexAttribArray(GLuint index); |
| 235 void finish(); | 235 void finish(); |
| 236 void flush(); | 236 void flush(); |
| 237 void framebufferRenderbuffer(GLenum target, GLenum attachment, GLenum render
buffertarget, WebGLRenderbuffer*); | 237 void framebufferRenderbuffer(ScriptState*, GLenum target, GLenum attachment,
GLenum renderbuffertarget, WebGLRenderbuffer*); |
| 238 void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget
, WebGLTexture*, GLint level); | 238 void framebufferTexture2D(ScriptState*, GLenum target, GLenum attachment, GL
enum textarget, WebGLTexture*, GLint level); |
| 239 void frontFace(GLenum mode); | 239 void frontFace(GLenum mode); |
| 240 void generateMipmap(GLenum target); | 240 void generateMipmap(GLenum target); |
| 241 | 241 |
| 242 WebGLActiveInfo* getActiveAttrib(WebGLProgram*, GLuint index); | 242 WebGLActiveInfo* getActiveAttrib(WebGLProgram*, GLuint index); |
| 243 WebGLActiveInfo* getActiveUniform(WebGLProgram*, GLuint index); | 243 WebGLActiveInfo* getActiveUniform(WebGLProgram*, GLuint index); |
| 244 bool getAttachedShaders(WebGLProgram*, HeapVector<Member<WebGLShader>>&); | 244 bool getAttachedShaders(WebGLProgram*, HeapVector<Member<WebGLShader>>&); |
| 245 Nullable<HeapVector<Member<WebGLShader>>> getAttachedShaders(WebGLProgram*); | 245 Nullable<HeapVector<Member<WebGLShader>>> getAttachedShaders(WebGLProgram*); |
| 246 GLint getAttribLocation(WebGLProgram*, const String& name); | 246 GLint getAttribLocation(WebGLProgram*, const String& name); |
| 247 ScriptValue getBufferParameter(ScriptState*, GLenum target, GLenum pname); | 247 ScriptValue getBufferParameter(ScriptState*, GLenum target, GLenum pname); |
| 248 void getContextAttributes(Nullable<WebGLContextAttributes>&); | 248 void getContextAttributes(Nullable<WebGLContextAttributes>&); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 void uniform4i(const WebGLUniformLocation*, GLint x, GLint y, GLint z, GLint
w); | 341 void uniform4i(const WebGLUniformLocation*, GLint x, GLint y, GLint z, GLint
w); |
| 342 void uniform4iv(const WebGLUniformLocation*, const FlexibleInt32ArrayView&); | 342 void uniform4iv(const WebGLUniformLocation*, const FlexibleInt32ArrayView&); |
| 343 void uniform4iv(const WebGLUniformLocation*, Vector<GLint>&); | 343 void uniform4iv(const WebGLUniformLocation*, Vector<GLint>&); |
| 344 void uniformMatrix2fv(const WebGLUniformLocation*, GLboolean transpose, DOMF
loat32Array* value); | 344 void uniformMatrix2fv(const WebGLUniformLocation*, GLboolean transpose, DOMF
loat32Array* value); |
| 345 void uniformMatrix2fv(const WebGLUniformLocation*, GLboolean transpose, Vect
or<GLfloat>& value); | 345 void uniformMatrix2fv(const WebGLUniformLocation*, GLboolean transpose, Vect
or<GLfloat>& value); |
| 346 void uniformMatrix3fv(const WebGLUniformLocation*, GLboolean transpose, DOMF
loat32Array* value); | 346 void uniformMatrix3fv(const WebGLUniformLocation*, GLboolean transpose, DOMF
loat32Array* value); |
| 347 void uniformMatrix3fv(const WebGLUniformLocation*, GLboolean transpose, Vect
or<GLfloat>& value); | 347 void uniformMatrix3fv(const WebGLUniformLocation*, GLboolean transpose, Vect
or<GLfloat>& value); |
| 348 void uniformMatrix4fv(const WebGLUniformLocation*, GLboolean transpose, DOMF
loat32Array* value); | 348 void uniformMatrix4fv(const WebGLUniformLocation*, GLboolean transpose, DOMF
loat32Array* value); |
| 349 void uniformMatrix4fv(const WebGLUniformLocation*, GLboolean transpose, Vect
or<GLfloat>& value); | 349 void uniformMatrix4fv(const WebGLUniformLocation*, GLboolean transpose, Vect
or<GLfloat>& value); |
| 350 | 350 |
| 351 void useProgram(WebGLProgram*); | 351 void useProgram(ScriptState*, WebGLProgram*); |
| 352 void validateProgram(WebGLProgram*); | 352 void validateProgram(WebGLProgram*); |
| 353 | 353 |
| 354 void vertexAttrib1f(GLuint index, GLfloat x); | 354 void vertexAttrib1f(GLuint index, GLfloat x); |
| 355 void vertexAttrib1fv(GLuint index, const DOMFloat32Array* values); | 355 void vertexAttrib1fv(GLuint index, const DOMFloat32Array* values); |
| 356 void vertexAttrib1fv(GLuint index, const Vector<GLfloat>& values); | 356 void vertexAttrib1fv(GLuint index, const Vector<GLfloat>& values); |
| 357 void vertexAttrib2f(GLuint index, GLfloat x, GLfloat y); | 357 void vertexAttrib2f(GLuint index, GLfloat x, GLfloat y); |
| 358 void vertexAttrib2fv(GLuint index, const DOMFloat32Array* values); | 358 void vertexAttrib2fv(GLuint index, const DOMFloat32Array* values); |
| 359 void vertexAttrib2fv(GLuint index, const Vector<GLfloat>& values); | 359 void vertexAttrib2fv(GLuint index, const Vector<GLfloat>& values); |
| 360 void vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); | 360 void vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); |
| 361 void vertexAttrib3fv(GLuint index, const DOMFloat32Array* values); | 361 void vertexAttrib3fv(GLuint index, const DOMFloat32Array* values); |
| 362 void vertexAttrib3fv(GLuint index, const Vector<GLfloat>& values); | 362 void vertexAttrib3fv(GLuint index, const Vector<GLfloat>& values); |
| 363 void vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w
); | 363 void vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w
); |
| 364 void vertexAttrib4fv(GLuint index, const DOMFloat32Array* values); | 364 void vertexAttrib4fv(GLuint index, const DOMFloat32Array* values); |
| 365 void vertexAttrib4fv(GLuint index, const Vector<GLfloat>& values); | 365 void vertexAttrib4fv(GLuint index, const Vector<GLfloat>& values); |
| 366 void vertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean no
rmalized, | 366 void vertexAttribPointer(ScriptState*, GLuint index, GLint size, GLenum type
, GLboolean normalized, |
| 367 GLsizei stride, long long offset); | 367 GLsizei stride, long long offset); |
| 368 | 368 |
| 369 void vertexAttribDivisorANGLE(GLuint index, GLuint divisor); | 369 void vertexAttribDivisorANGLE(GLuint index, GLuint divisor); |
| 370 | 370 |
| 371 void viewport(GLint x, GLint y, GLsizei width, GLsizei height); | 371 void viewport(GLint x, GLint y, GLsizei width, GLsizei height); |
| 372 | 372 |
| 373 // WEBGL_lose_context support | 373 // WEBGL_lose_context support |
| 374 enum AutoRecoveryMethod { | 374 enum AutoRecoveryMethod { |
| 375 // Don't restore automatically. | 375 // Don't restore automatically. |
| 376 Manual, | 376 Manual, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 Member<WebGLTexture> m_textureCubeMapBinding; | 425 Member<WebGLTexture> m_textureCubeMapBinding; |
| 426 Member<WebGLTexture> m_texture3DBinding; | 426 Member<WebGLTexture> m_texture3DBinding; |
| 427 Member<WebGLTexture> m_texture2DArrayBinding; | 427 Member<WebGLTexture> m_texture2DArrayBinding; |
| 428 | 428 |
| 429 DECLARE_TRACE(); | 429 DECLARE_TRACE(); |
| 430 }; | 430 }; |
| 431 | 431 |
| 432 void setFilterQuality(SkFilterQuality) override; | 432 void setFilterQuality(SkFilterQuality) override; |
| 433 bool isWebGL2OrHigher() { return version() >= 2; } | 433 bool isWebGL2OrHigher() { return version() >= 2; } |
| 434 | 434 |
| 435 // Ensures that the JavaScript wrappers for objects that are |
| 436 // latched into the context's state, or which are implicitly |
| 437 // linked together (like programs and their attached shaders), are |
| 438 // not garbage collected. |
| 439 static void preserveObjectWrapper(ScriptState*, ScriptWrappable* sourceObjec
t, const char* baseName, unsigned long index, ScriptWrappable* targetObject); |
| 440 |
| 435 protected: | 441 protected: |
| 436 friend class EXTDisjointTimerQuery; | 442 friend class EXTDisjointTimerQuery; |
| 437 friend class WebGLDrawBuffers; | 443 friend class WebGLDrawBuffers; |
| 438 friend class WebGLFramebuffer; | 444 friend class WebGLFramebuffer; |
| 439 friend class WebGLObject; | 445 friend class WebGLObject; |
| 440 friend class WebGLContextObject; | 446 friend class WebGLContextObject; |
| 441 friend class OESVertexArrayObject; | 447 friend class OESVertexArrayObject; |
| 442 friend class WebGLDebugShaders; | 448 friend class WebGLDebugShaders; |
| 443 friend class WebGLCompressedTextureASTC; | 449 friend class WebGLCompressedTextureASTC; |
| 444 friend class WebGLCompressedTextureATC; | 450 friend class WebGLCompressedTextureATC; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 #endif | 530 #endif |
| 525 | 531 |
| 526 PersistentWillBeMember<WebGLRenderingContextLostCallback> m_contextLostCallb
ackAdapter; | 532 PersistentWillBeMember<WebGLRenderingContextLostCallback> m_contextLostCallb
ackAdapter; |
| 527 PersistentWillBeMember<WebGLRenderingContextErrorMessageCallback> m_errorMes
sageCallbackAdapter; | 533 PersistentWillBeMember<WebGLRenderingContextErrorMessageCallback> m_errorMes
sageCallbackAdapter; |
| 528 | 534 |
| 529 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER a
nd stored values for ELEMENT_ARRAY_BUFFER | 535 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER a
nd stored values for ELEMENT_ARRAY_BUFFER |
| 530 PersistentWillBeMember<WebGLBuffer> m_boundArrayBuffer; | 536 PersistentWillBeMember<WebGLBuffer> m_boundArrayBuffer; |
| 531 | 537 |
| 532 PersistentWillBeMember<WebGLVertexArrayObjectBase> m_defaultVertexArrayObjec
t; | 538 PersistentWillBeMember<WebGLVertexArrayObjectBase> m_defaultVertexArrayObjec
t; |
| 533 PersistentWillBeMember<WebGLVertexArrayObjectBase> m_boundVertexArrayObject; | 539 PersistentWillBeMember<WebGLVertexArrayObjectBase> m_boundVertexArrayObject; |
| 534 void setBoundVertexArrayObject(WebGLVertexArrayObjectBase* arrayObject) | 540 bool m_preservedDefaultVAOObjectWrapper; |
| 535 { | 541 void setBoundVertexArrayObject(ScriptState*, WebGLVertexArrayObjectBase*); |
| 536 if (arrayObject) | |
| 537 m_boundVertexArrayObject = arrayObject; | |
| 538 else | |
| 539 m_boundVertexArrayObject = m_defaultVertexArrayObject; | |
| 540 } | |
| 541 | 542 |
| 542 enum VertexAttribValueType { | 543 enum VertexAttribValueType { |
| 543 Float32ArrayType, | 544 Float32ArrayType, |
| 544 Int32ArrayType, | 545 Int32ArrayType, |
| 545 Uint32ArrayType, | 546 Uint32ArrayType, |
| 546 }; | 547 }; |
| 547 | 548 |
| 548 class VertexAttribValue { | 549 class VertexAttribValue { |
| 549 public: | 550 public: |
| 550 VertexAttribValue() | 551 VertexAttribValue() |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 | 1098 |
| 1098 virtual void restoreCurrentFramebuffer(); | 1099 virtual void restoreCurrentFramebuffer(); |
| 1099 void restoreCurrentTexture2D(); | 1100 void restoreCurrentTexture2D(); |
| 1100 | 1101 |
| 1101 void multisamplingChanged(bool) override; | 1102 void multisamplingChanged(bool) override; |
| 1102 | 1103 |
| 1103 void findNewMaxNonDefaultTextureUnit(); | 1104 void findNewMaxNonDefaultTextureUnit(); |
| 1104 | 1105 |
| 1105 virtual void renderbufferStorageImpl(GLenum target, GLsizei samples, GLenum
internalformat, GLsizei width, GLsizei height, const char* functionName); | 1106 virtual void renderbufferStorageImpl(GLenum target, GLsizei samples, GLenum
internalformat, GLsizei width, GLsizei height, const char* functionName); |
| 1106 | 1107 |
| 1108 void maybePreserveDefaultVAOObjectWrapper(ScriptState*); |
| 1109 |
| 1107 friend class WebGLStateRestorer; | 1110 friend class WebGLStateRestorer; |
| 1108 friend class WebGLRenderingContextEvictionManager; | 1111 friend class WebGLRenderingContextEvictionManager; |
| 1109 | 1112 |
| 1110 static Vector<WebGLRenderingContextBase*>& activeContexts(); | 1113 static Vector<WebGLRenderingContextBase*>& activeContexts(); |
| 1111 static Vector<WebGLRenderingContextBase*>& forciblyEvictedContexts(); | 1114 static Vector<WebGLRenderingContextBase*>& forciblyEvictedContexts(); |
| 1112 | 1115 |
| 1113 static void activateContext(WebGLRenderingContextBase*); | 1116 static void activateContext(WebGLRenderingContextBase*); |
| 1114 static void deactivateContext(WebGLRenderingContextBase*); | 1117 static void deactivateContext(WebGLRenderingContextBase*); |
| 1115 static void addToEvictedList(WebGLRenderingContextBase*); | 1118 static void addToEvictedList(WebGLRenderingContextBase*); |
| 1116 static void removeFromEvictedList(WebGLRenderingContextBase*); | 1119 static void removeFromEvictedList(WebGLRenderingContextBase*); |
| 1117 static void willDestroyContext(WebGLRenderingContextBase*); | 1120 static void willDestroyContext(WebGLRenderingContextBase*); |
| 1118 static void forciblyLoseOldestContext(const String& reason); | 1121 static void forciblyLoseOldestContext(const String& reason); |
| 1119 // Return the least recently used context's position in the active context v
ector. | 1122 // Return the least recently used context's position in the active context v
ector. |
| 1120 // If the vector is empty, return the maximum allowed active context number. | 1123 // If the vector is empty, return the maximum allowed active context number. |
| 1121 static size_t oldestContextIndex(); | 1124 static size_t oldestContextIndex(); |
| 1122 static IntSize oldestContextSize(); | 1125 static IntSize oldestContextSize(); |
| 1123 }; | 1126 }; |
| 1124 | 1127 |
| 1125 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); | 1128 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); |
| 1126 | 1129 |
| 1127 } // namespace blink | 1130 } // namespace blink |
| 1128 | 1131 |
| 1129 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); | 1132 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); |
| 1130 | 1133 |
| 1131 #endif // WebGLRenderingContextBase_h | 1134 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |