| OLD | NEW |
| 1 /* | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 * | 3 // found in the LICENSE file. |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions | |
| 6 * are met: | |
| 7 * 1. Redistributions of source code must retain the above copyright | |
| 8 * notice, this list of conditions and the following disclaimer. | |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | |
| 10 * notice, this list of conditions and the following disclaimer in the | |
| 11 * documentation and/or other materials provided with the distribution. | |
| 12 * | |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 24 */ | |
| 25 | 4 |
| 26 #ifndef WebGLRenderingContext_h | 5 #ifndef WebGLRenderingContextBase_h |
| 27 #define WebGLRenderingContext_h | 6 #define WebGLRenderingContextBase_h |
| 28 | 7 |
| 29 #include "core/dom/ActiveDOMObject.h" | 8 #include "core/dom/ActiveDOMObject.h" |
| 30 #include "core/html/canvas/CanvasRenderingContext.h" | 9 #include "core/html/canvas/CanvasRenderingContext.h" |
| 10 #include "core/html/canvas/WebGLExtensionName.h" |
| 31 #include "core/html/canvas/WebGLGetInfo.h" | 11 #include "core/html/canvas/WebGLGetInfo.h" |
| 32 #include "core/page/Page.h" | 12 #include "core/page/Page.h" |
| 33 #include "platform/Timer.h" | 13 #include "platform/Timer.h" |
| 34 #include "platform/graphics/GraphicsTypes3D.h" | 14 #include "platform/graphics/GraphicsTypes3D.h" |
| 35 #include "platform/graphics/ImageBuffer.h" | 15 #include "platform/graphics/ImageBuffer.h" |
| 36 #include "platform/graphics/gpu/Extensions3DUtil.h" | 16 #include "platform/graphics/gpu/Extensions3DUtil.h" |
| 37 #include "platform/graphics/gpu/WebGLImageConversion.h" | 17 #include "platform/graphics/gpu/WebGLImageConversion.h" |
| 38 #include "public/platform/WebGraphicsContext3D.h" | 18 #include "public/platform/WebGraphicsContext3D.h" |
| 39 #include "wtf/Float32Array.h" | 19 #include "wtf/Float32Array.h" |
| 40 #include "wtf/Int32Array.h" | 20 #include "wtf/Int32Array.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 class WebGLShader; | 65 class WebGLShader; |
| 86 class WebGLShaderPrecisionFormat; | 66 class WebGLShaderPrecisionFormat; |
| 87 class WebGLSharedObject; | 67 class WebGLSharedObject; |
| 88 class WebGLTexture; | 68 class WebGLTexture; |
| 89 class WebGLUniformLocation; | 69 class WebGLUniformLocation; |
| 90 class WebGLVertexArrayObjectOES; | 70 class WebGLVertexArrayObjectOES; |
| 91 | 71 |
| 92 class WebGLRenderingContextLostCallback; | 72 class WebGLRenderingContextLostCallback; |
| 93 class WebGLRenderingContextErrorMessageCallback; | 73 class WebGLRenderingContextErrorMessageCallback; |
| 94 | 74 |
| 95 class WebGLRenderingContext FINAL : public CanvasRenderingContext, public Active
DOMObject, private Page::MultisamplingChangedObserver { | 75 class WebGLRenderingContextBase : public CanvasRenderingContext, public ActiveDO
MObject, private Page::MultisamplingChangedObserver { |
| 96 public: | 76 public: |
| 97 static PassOwnPtr<WebGLRenderingContext> create(HTMLCanvasElement*, WebGLCon
textAttributes*); | 77 virtual ~WebGLRenderingContextBase(); |
| 98 virtual ~WebGLRenderingContext(); | |
| 99 | 78 |
| 100 virtual bool is3d() const OVERRIDE { return true; } | 79 virtual bool is3d() const OVERRIDE { return true; } |
| 101 virtual bool isAccelerated() const OVERRIDE { return true; } | 80 virtual bool isAccelerated() const OVERRIDE { return true; } |
| 81 virtual unsigned version() const = 0; |
| 82 virtual String contextName() const = 0; |
| 83 virtual void registerContextExtensions() = 0; |
| 84 |
| 85 static unsigned getWebGLVersion(CanvasRenderingContext*); |
| 102 | 86 |
| 103 int drawingBufferWidth() const; | 87 int drawingBufferWidth() const; |
| 104 int drawingBufferHeight() const; | 88 int drawingBufferHeight() const; |
| 105 | 89 |
| 106 void activeTexture(GLenum texture); | 90 void activeTexture(GLenum texture); |
| 107 void attachShader(WebGLProgram*, WebGLShader*); | 91 void attachShader(WebGLProgram*, WebGLShader*); |
| 108 void bindAttribLocation(WebGLProgram*, GLuint index, const String& name); | 92 void bindAttribLocation(WebGLProgram*, GLuint index, const String& name); |
| 109 void bindBuffer(GLenum target, WebGLBuffer*); | 93 void bindBuffer(GLenum target, WebGLBuffer*); |
| 110 void bindFramebuffer(GLenum target, WebGLFramebuffer*); | 94 void bindFramebuffer(GLenum target, WebGLFramebuffer*); |
| 111 void bindRenderbuffer(GLenum target, WebGLRenderbuffer*); | 95 void bindRenderbuffer(GLenum target, WebGLRenderbuffer*); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 | 315 |
| 332 void removeSharedObject(WebGLSharedObject*); | 316 void removeSharedObject(WebGLSharedObject*); |
| 333 void removeContextObject(WebGLContextObject*); | 317 void removeContextObject(WebGLContextObject*); |
| 334 | 318 |
| 335 unsigned maxVertexAttribs() const { return m_maxVertexAttribs; } | 319 unsigned maxVertexAttribs() const { return m_maxVertexAttribs; } |
| 336 | 320 |
| 337 // ActiveDOMObject notifications | 321 // ActiveDOMObject notifications |
| 338 virtual bool hasPendingActivity() const OVERRIDE; | 322 virtual bool hasPendingActivity() const OVERRIDE; |
| 339 virtual void stop() OVERRIDE; | 323 virtual void stop() OVERRIDE; |
| 340 | 324 |
| 341 private: | 325 protected: |
| 342 friend class WebGLDrawBuffers; | 326 friend class WebGLDrawBuffers; |
| 343 friend class WebGLFramebuffer; | 327 friend class WebGLFramebuffer; |
| 344 friend class WebGLObject; | 328 friend class WebGLObject; |
| 345 friend class OESVertexArrayObject; | 329 friend class OESVertexArrayObject; |
| 346 friend class WebGLDebugShaders; | 330 friend class WebGLDebugShaders; |
| 347 friend class WebGLCompressedTextureATC; | 331 friend class WebGLCompressedTextureATC; |
| 348 friend class WebGLCompressedTexturePVRTC; | 332 friend class WebGLCompressedTexturePVRTC; |
| 349 friend class WebGLCompressedTextureS3TC; | 333 friend class WebGLCompressedTextureS3TC; |
| 350 friend class WebGLRenderingContextErrorMessageCallback; | 334 friend class WebGLRenderingContextErrorMessageCallback; |
| 351 friend class WebGLVertexArrayObjectOES; | 335 friend class WebGLVertexArrayObjectOES; |
| 352 | 336 |
| 353 WebGLRenderingContext(HTMLCanvasElement*, PassOwnPtr<blink::WebGraphicsConte
xt3D>, WebGLContextAttributes*); | 337 WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<blink::WebGraphicsC
ontext3D>, WebGLContextAttributes*); |
| 354 void initializeNewContext(); | 338 void initializeNewContext(); |
| 355 void setupFlags(); | 339 void setupFlags(); |
| 356 | 340 |
| 357 void addSharedObject(WebGLSharedObject*); | 341 void addSharedObject(WebGLSharedObject*); |
| 358 void addContextObject(WebGLContextObject*); | 342 void addContextObject(WebGLContextObject*); |
| 359 void detachAndRemoveAllObjects(); | 343 void detachAndRemoveAllObjects(); |
| 360 | 344 |
| 361 void destroyContext(); | 345 void destroyContext(); |
| 362 void markContextChanged(); | 346 void markContextChanged(); |
| 363 | 347 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 390 | 374 |
| 391 // Structure for rendering to a DrawingBuffer, instead of directly | 375 // Structure for rendering to a DrawingBuffer, instead of directly |
| 392 // to the back-buffer of m_context. | 376 // to the back-buffer of m_context. |
| 393 RefPtr<DrawingBuffer> m_drawingBuffer; | 377 RefPtr<DrawingBuffer> m_drawingBuffer; |
| 394 | 378 |
| 395 // Dispatches a context lost event once it is determined that one is needed. | 379 // Dispatches a context lost event once it is determined that one is needed. |
| 396 // This is used both for synthetic and real context losses. For real ones, i
t's | 380 // This is used both for synthetic and real context losses. For real ones, i
t's |
| 397 // likely that there's no JavaScript on the stack, but that might be depende
nt | 381 // likely that there's no JavaScript on the stack, but that might be depende
nt |
| 398 // on how exactly the platform discovers that the context was lost. For bett
er | 382 // on how exactly the platform discovers that the context was lost. For bett
er |
| 399 // portability we always defer the dispatch of the event. | 383 // portability we always defer the dispatch of the event. |
| 400 Timer<WebGLRenderingContext> m_dispatchContextLostEventTimer; | 384 Timer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer; |
| 401 bool m_restoreAllowed; | 385 bool m_restoreAllowed; |
| 402 Timer<WebGLRenderingContext> m_restoreTimer; | 386 Timer<WebGLRenderingContextBase> m_restoreTimer; |
| 403 | 387 |
| 404 bool m_needsUpdate; | 388 bool m_needsUpdate; |
| 405 bool m_markedCanvasDirty; | 389 bool m_markedCanvasDirty; |
| 406 HashSet<WebGLContextObject*> m_contextObjects; | 390 HashSet<WebGLContextObject*> m_contextObjects; |
| 407 | 391 |
| 408 OwnPtr<WebGLRenderingContextLostCallback> m_contextLostCallbackAdapter; | 392 OwnPtr<WebGLRenderingContextLostCallback> m_contextLostCallbackAdapter; |
| 409 OwnPtr<WebGLRenderingContextErrorMessageCallback> m_errorMessageCallbackAdap
ter; | 393 OwnPtr<WebGLRenderingContextErrorMessageCallback> m_errorMessageCallbackAdap
ter; |
| 410 | 394 |
| 411 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER a
nd stored values for ELEMENT_ARRAY_BUFFER | 395 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER a
nd stored values for ELEMENT_ARRAY_BUFFER |
| 412 RefPtr<WebGLBuffer> m_boundArrayBuffer; | 396 RefPtr<WebGLBuffer> m_boundArrayBuffer; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 502 |
| 519 bool m_multisamplingAllowed; | 503 bool m_multisamplingAllowed; |
| 520 bool m_multisamplingObserverRegistered; | 504 bool m_multisamplingObserverRegistered; |
| 521 | 505 |
| 522 GLuint m_onePlusMaxEnabledAttribIndex; | 506 GLuint m_onePlusMaxEnabledAttribIndex; |
| 523 unsigned long m_onePlusMaxNonDefaultTextureUnit; | 507 unsigned long m_onePlusMaxNonDefaultTextureUnit; |
| 524 | 508 |
| 525 bool m_preserveDrawingBuffer; | 509 bool m_preserveDrawingBuffer; |
| 526 OwnPtr<Extensions3DUtil> m_extensionsUtil; | 510 OwnPtr<Extensions3DUtil> m_extensionsUtil; |
| 527 | 511 |
| 528 // Enabled extension objects. | |
| 529 RefPtr<ANGLEInstancedArrays> m_angleInstancedArrays; | |
| 530 RefPtr<EXTFragDepth> m_extFragDepth; | |
| 531 RefPtr<EXTTextureFilterAnisotropic> m_extTextureFilterAnisotropic; | |
| 532 RefPtr<OESTextureFloat> m_oesTextureFloat; | |
| 533 RefPtr<OESTextureFloatLinear> m_oesTextureFloatLinear; | |
| 534 RefPtr<OESTextureHalfFloat> m_oesTextureHalfFloat; | |
| 535 RefPtr<OESTextureHalfFloatLinear> m_oesTextureHalfFloatLinear; | |
| 536 RefPtr<OESStandardDerivatives> m_oesStandardDerivatives; | |
| 537 RefPtr<OESVertexArrayObject> m_oesVertexArrayObject; | |
| 538 RefPtr<OESElementIndexUint> m_oesElementIndexUint; | |
| 539 RefPtr<WebGLLoseContext> m_webglLoseContext; | |
| 540 RefPtr<WebGLDebugRendererInfo> m_webglDebugRendererInfo; | |
| 541 RefPtr<WebGLDebugShaders> m_webglDebugShaders; | |
| 542 RefPtr<WebGLDrawBuffers> m_webglDrawBuffers; | |
| 543 RefPtr<WebGLCompressedTextureATC> m_webglCompressedTextureATC; | |
| 544 RefPtr<WebGLCompressedTexturePVRTC> m_webglCompressedTexturePVRTC; | |
| 545 RefPtr<WebGLCompressedTextureS3TC> m_webglCompressedTextureS3TC; | |
| 546 RefPtr<WebGLDepthTexture> m_webglDepthTexture; | |
| 547 | |
| 548 enum ExtensionFlags { | 512 enum ExtensionFlags { |
| 549 ApprovedExtension = 0x00, | 513 ApprovedExtension = 0x00, |
| 550 DraftExtension = 0x01, | 514 DraftExtension = 0x01, |
| 551 PrivilegedExtension = 0x02, | 515 PrivilegedExtension = 0x02, |
| 552 PrefixedExtension = 0x04, | 516 PrefixedExtension = 0x04, |
| 553 WebGLDebugRendererInfoExtension = 0x08, | 517 WebGLDebugRendererInfoExtension = 0x08, |
| 554 }; | 518 }; |
| 555 | 519 |
| 556 class ExtensionTracker { | 520 class ExtensionTracker { |
| 557 public: | 521 public: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 583 return m_draft; | 547 return m_draft; |
| 584 } | 548 } |
| 585 | 549 |
| 586 bool webglDebugRendererInfo() const | 550 bool webglDebugRendererInfo() const |
| 587 { | 551 { |
| 588 return m_webglDebugRendererInfo; | 552 return m_webglDebugRendererInfo; |
| 589 } | 553 } |
| 590 | 554 |
| 591 bool matchesNameWithPrefixes(const String&) const; | 555 bool matchesNameWithPrefixes(const String&) const; |
| 592 | 556 |
| 593 virtual PassRefPtr<WebGLExtension> getExtension(WebGLRenderingContext*)
const = 0; | 557 virtual PassRefPtr<WebGLExtension> getExtension(WebGLRenderingContextBas
e*) = 0; |
| 594 virtual bool supported(WebGLRenderingContext*) const = 0; | 558 virtual bool supported(WebGLRenderingContextBase*) const = 0; |
| 595 virtual const char* extensionName() const = 0; | 559 virtual const char* extensionName() const = 0; |
| 596 virtual void loseExtension() = 0; | 560 virtual void loseExtension() = 0; |
| 597 | 561 |
| 598 private: | 562 private: |
| 599 bool m_privileged; | 563 bool m_privileged; |
| 600 bool m_draft; | 564 bool m_draft; |
| 601 bool m_prefixed; | 565 bool m_prefixed; |
| 602 bool m_webglDebugRendererInfo; | 566 bool m_webglDebugRendererInfo; |
| 603 const char* const* m_prefixes; | 567 const char* const* m_prefixes; |
| 604 }; | 568 }; |
| 605 | 569 |
| 606 template <typename T> | 570 template <typename T> |
| 607 class TypedExtensionTracker FINAL : public ExtensionTracker { | 571 class TypedExtensionTracker FINAL : public ExtensionTracker { |
| 608 public: | 572 public: |
| 609 TypedExtensionTracker(RefPtr<T>& extensionField, ExtensionFlags flags, c
onst char* const* prefixes) | 573 TypedExtensionTracker(RefPtr<T>& extensionField, ExtensionFlags flags, c
onst char* const* prefixes) |
| 610 : ExtensionTracker(flags, prefixes) | 574 : ExtensionTracker(flags, prefixes) |
| 611 , m_extensionField(extensionField) | 575 , m_extensionField(extensionField) |
| 576 , m_extension(0) |
| 612 { | 577 { |
| 613 } | 578 } |
| 614 | 579 |
| 615 ~TypedExtensionTracker() | 580 ~TypedExtensionTracker() |
| 616 { | 581 { |
| 617 if (m_extensionField) { | 582 if (m_extension) { |
| 618 m_extensionField->lose(true); | 583 m_extension->lose(true); |
| 619 m_extensionField = 0; | 584 m_extension = 0; |
| 620 } | 585 } |
| 621 } | 586 } |
| 622 | 587 |
| 623 virtual PassRefPtr<WebGLExtension> getExtension(WebGLRenderingContext* c
ontext) const OVERRIDE | 588 virtual PassRefPtr<WebGLExtension> getExtension(WebGLRenderingContextBas
e* context) OVERRIDE |
| 624 { | 589 { |
| 625 if (!m_extensionField) | 590 if (!m_extension) { |
| 626 m_extensionField = T::create(context); | 591 m_extension = T::create(context); |
| 592 m_extensionField = m_extension; |
| 593 } |
| 627 | 594 |
| 628 return m_extensionField; | 595 return m_extension; |
| 629 } | 596 } |
| 630 | 597 |
| 631 virtual bool supported(WebGLRenderingContext* context) const OVERRIDE | 598 virtual bool supported(WebGLRenderingContextBase* context) const OVERRID
E |
| 632 { | 599 { |
| 633 return T::supported(context); | 600 return T::supported(context); |
| 634 } | 601 } |
| 635 | 602 |
| 636 virtual const char* extensionName() const OVERRIDE | 603 virtual const char* extensionName() const OVERRIDE |
| 637 { | 604 { |
| 638 return T::extensionName(); | 605 return T::extensionName(); |
| 639 } | 606 } |
| 640 | 607 |
| 641 virtual void loseExtension() OVERRIDE | 608 virtual void loseExtension() OVERRIDE |
| 642 { | 609 { |
| 643 if (m_extensionField) { | 610 if (m_extension) { |
| 644 m_extensionField->lose(false); | 611 m_extension->lose(false); |
| 645 if (m_extensionField->isLost()) | 612 if (m_extension->isLost()) |
| 646 m_extensionField = 0; | 613 m_extension = 0; |
| 647 } | 614 } |
| 648 } | 615 } |
| 649 | 616 |
| 650 private: | 617 private: |
| 651 RefPtr<T>& m_extensionField; | 618 RefPtr<T>& m_extensionField; |
| 619 // ExtensionTracker holds it's own reference to the extension to ensure |
| 620 // that it is not deleted before this object's destructor is called |
| 621 RefPtr<T> m_extension; |
| 652 }; | 622 }; |
| 653 | 623 |
| 624 bool m_extensionEnabled[WebGLExtensionNameCount]; |
| 654 Vector<ExtensionTracker*> m_extensions; | 625 Vector<ExtensionTracker*> m_extensions; |
| 655 | 626 |
| 656 template <typename T> | 627 template <typename T> |
| 657 void registerExtension(RefPtr<T>& extensionPtr, ExtensionFlags flags = Appro
vedExtension, const char* const* prefixes = 0) | 628 void registerExtension(RefPtr<T>& extensionPtr, ExtensionFlags flags = Appro
vedExtension, const char* const* prefixes = 0) |
| 658 { | 629 { |
| 659 m_extensions.append(new TypedExtensionTracker<T>(extensionPtr, flags, pr
efixes)); | 630 m_extensions.append(new TypedExtensionTracker<T>(extensionPtr, flags, pr
efixes)); |
| 660 } | 631 } |
| 661 | 632 |
| 633 inline bool extensionEnabled(WebGLExtensionName name) |
| 634 { |
| 635 return m_extensionEnabled[name]; |
| 636 } |
| 637 |
| 662 // Errors raised by synthesizeGLError() while the context is lost. | 638 // Errors raised by synthesizeGLError() while the context is lost. |
| 663 Vector<GLenum> m_lostContextErrors; | 639 Vector<GLenum> m_lostContextErrors; |
| 664 | 640 |
| 665 // Helpers for getParameter and others | 641 // Helpers for getParameter and others |
| 666 WebGLGetInfo getBooleanParameter(GLenum); | 642 WebGLGetInfo getBooleanParameter(GLenum); |
| 667 WebGLGetInfo getBooleanArrayParameter(GLenum); | 643 WebGLGetInfo getBooleanArrayParameter(GLenum); |
| 668 WebGLGetInfo getFloatParameter(GLenum); | 644 WebGLGetInfo getFloatParameter(GLenum); |
| 669 WebGLGetInfo getIntParameter(GLenum); | 645 WebGLGetInfo getIntParameter(GLenum); |
| 670 WebGLGetInfo getUnsignedIntParameter(GLenum); | 646 WebGLGetInfo getUnsignedIntParameter(GLenum); |
| 671 WebGLGetInfo getWebGLFloatArrayParameter(GLenum); | 647 WebGLGetInfo getWebGLFloatArrayParameter(GLenum); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 | 829 |
| 854 // Helper function for delete* (deleteBuffer, deleteProgram, etc) functions. | 830 // Helper function for delete* (deleteBuffer, deleteProgram, etc) functions. |
| 855 // Return false if caller should return without further processing. | 831 // Return false if caller should return without further processing. |
| 856 bool deleteObject(WebGLObject*); | 832 bool deleteObject(WebGLObject*); |
| 857 | 833 |
| 858 // Helper function for bind* (bindBuffer, bindTexture, etc) and useProgram. | 834 // Helper function for bind* (bindBuffer, bindTexture, etc) and useProgram. |
| 859 // If the object has already been deleted, set deleted to true upon return. | 835 // If the object has already been deleted, set deleted to true upon return. |
| 860 // Return false if caller should return without further processing. | 836 // Return false if caller should return without further processing. |
| 861 bool checkObjectToBeBound(const char* functionName, WebGLObject*, bool& dele
ted); | 837 bool checkObjectToBeBound(const char* functionName, WebGLObject*, bool& dele
ted); |
| 862 | 838 |
| 863 void dispatchContextLostEvent(Timer<WebGLRenderingContext>*); | 839 void dispatchContextLostEvent(Timer<WebGLRenderingContextBase>*); |
| 864 // Helper for restoration after context lost. | 840 // Helper for restoration after context lost. |
| 865 void maybeRestoreContext(Timer<WebGLRenderingContext>*); | 841 void maybeRestoreContext(Timer<WebGLRenderingContextBase>*); |
| 866 | 842 |
| 867 // Determine if we are running privileged code in the browser, for example, | 843 // Determine if we are running privileged code in the browser, for example, |
| 868 // a Safari or Chrome extension. | 844 // a Safari or Chrome extension. |
| 869 bool allowPrivilegedExtensions() const; | 845 bool allowPrivilegedExtensions() const; |
| 870 | 846 |
| 871 // Determine if WEBGL_debug_renderer_info extension is enabled. For the | 847 // Determine if WEBGL_debug_renderer_info extension is enabled. For the |
| 872 // moment it can be enabled either through a chromium finch experiment | 848 // moment it can be enabled either through a chromium finch experiment |
| 873 // or for privileged code in the browser. | 849 // or for privileged code in the browser. |
| 874 bool allowWebGLDebugRendererInfo() const; | 850 bool allowWebGLDebugRendererInfo() const; |
| 875 | 851 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 906 void restoreCurrentTexture2D(); | 882 void restoreCurrentTexture2D(); |
| 907 | 883 |
| 908 virtual void multisamplingChanged(bool) OVERRIDE; | 884 virtual void multisamplingChanged(bool) OVERRIDE; |
| 909 | 885 |
| 910 void findNewMaxEnabledAttribIndex(); | 886 void findNewMaxEnabledAttribIndex(); |
| 911 void findNewMaxNonDefaultTextureUnit(); | 887 void findNewMaxNonDefaultTextureUnit(); |
| 912 | 888 |
| 913 friend class WebGLStateRestorer; | 889 friend class WebGLStateRestorer; |
| 914 friend class WebGLRenderingContextEvictionManager; | 890 friend class WebGLRenderingContextEvictionManager; |
| 915 | 891 |
| 916 static Vector<WebGLRenderingContext*>& activeContexts(); | 892 static Vector<WebGLRenderingContextBase*>& activeContexts(); |
| 917 static Vector<WebGLRenderingContext*>& forciblyEvictedContexts(); | 893 static Vector<WebGLRenderingContextBase*>& forciblyEvictedContexts(); |
| 918 | 894 |
| 919 static void activateContext(WebGLRenderingContext*); | 895 static void activateContext(WebGLRenderingContextBase*); |
| 920 static void deactivateContext(WebGLRenderingContext*, bool addToInactiveList
); | 896 static void deactivateContext(WebGLRenderingContextBase*, bool addToInactive
List); |
| 921 static void willDestroyContext(WebGLRenderingContext*); | 897 static void willDestroyContext(WebGLRenderingContextBase*); |
| 922 static void forciblyLoseOldestContext(const String& reason); | 898 static void forciblyLoseOldestContext(const String& reason); |
| 923 // Return the least recently used context's position in the active context v
ector. | 899 // Return the least recently used context's position in the active context v
ector. |
| 924 // If the vector is empty, return the maximum allowed active context number. | 900 // If the vector is empty, return the maximum allowed active context number. |
| 925 static size_t oldestContextIndex(); | 901 static size_t oldestContextIndex(); |
| 926 static IntSize oldestContextSize(); | 902 static IntSize oldestContextSize(); |
| 927 }; | 903 }; |
| 928 | 904 |
| 929 DEFINE_TYPE_CASTS(WebGLRenderingContext, CanvasRenderingContext, context, contex
t->is3d(), context.is3d()); | 905 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); |
| 930 | 906 |
| 931 } // namespace WebCore | 907 } // namespace WebCore |
| 932 | 908 |
| 933 #endif | 909 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |