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

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContextBase.h

Issue 205903004: WebGL: Return both unprefixed and prefixed supported names from getSupportedExtensions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Explain meaning of EnabledDraftExtension better Created 6 years, 9 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
OLDNEW
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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 526
527 bool m_multisamplingAllowed; 527 bool m_multisamplingAllowed;
528 bool m_multisamplingObserverRegistered; 528 bool m_multisamplingObserverRegistered;
529 529
530 GLuint m_onePlusMaxEnabledAttribIndex; 530 GLuint m_onePlusMaxEnabledAttribIndex;
531 unsigned long m_onePlusMaxNonDefaultTextureUnit; 531 unsigned long m_onePlusMaxNonDefaultTextureUnit;
532 532
533 OwnPtr<Extensions3DUtil> m_extensionsUtil; 533 OwnPtr<Extensions3DUtil> m_extensionsUtil;
534 534
535 enum ExtensionFlags { 535 enum ExtensionFlags {
536 ApprovedExtension = 0x00, 536 ApprovedExtension = 0x00,
537 DraftExtension = 0x01, 537 // Extension that is behind the draft extensions runtime flag:
538 PrivilegedExtension = 0x02, 538 DraftExtension = 0x01,
539 PrefixedExtension = 0x04, 539 PrivilegedExtension = 0x02,
540 // Extension that is still in draft state, but has been selectively enab led by default under a prefix. Do not use
541 // this for enabling new draft extensions; use the DraftExtension flag i nstead, and do not use vendor prefixes:
542 EnabledDraftExtension = 0x04,
540 WebGLDebugRendererInfoExtension = 0x08, 543 WebGLDebugRendererInfoExtension = 0x08,
541 }; 544 };
542 545
543 class ExtensionTracker { 546 class ExtensionTracker {
544 public: 547 public:
545 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) 548 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes)
546 : m_privileged(flags & PrivilegedExtension) 549 : m_privileged(flags & PrivilegedExtension)
547 , m_draft(flags & DraftExtension) 550 , m_draft(flags & DraftExtension)
548 , m_prefixed(flags & PrefixedExtension)
549 , m_webglDebugRendererInfo(flags & WebGLDebugRendererInfoExtension) 551 , m_webglDebugRendererInfo(flags & WebGLDebugRendererInfoExtension)
550 , m_prefixes(prefixes) 552 , m_prefixes(prefixes)
551 { 553 {
552 } 554 }
553 555
554 virtual ~ExtensionTracker() 556 virtual ~ExtensionTracker()
555 { 557 {
556 } 558 }
557 559
558 bool prefixed() const
559 {
560 return m_prefixed;
561 }
562
563 bool privileged() const 560 bool privileged() const
564 { 561 {
565 return m_privileged; 562 return m_privileged;
566 } 563 }
567 564
568 bool draft() const 565 bool draft() const
569 { 566 {
570 return m_draft; 567 return m_draft;
571 } 568 }
572 569
573 bool webglDebugRendererInfo() const 570 bool webglDebugRendererInfo() const
574 { 571 {
575 return m_webglDebugRendererInfo; 572 return m_webglDebugRendererInfo;
576 } 573 }
577 574
575 const char* const* prefixes() const;
578 bool matchesNameWithPrefixes(const String&) const; 576 bool matchesNameWithPrefixes(const String&) const;
579 577
580 virtual PassRefPtr<WebGLExtension> getExtension(WebGLRenderingContextBas e*) = 0; 578 virtual PassRefPtr<WebGLExtension> getExtension(WebGLRenderingContextBas e*) = 0;
581 virtual bool supported(WebGLRenderingContextBase*) const = 0; 579 virtual bool supported(WebGLRenderingContextBase*) const = 0;
582 virtual const char* extensionName() const = 0; 580 virtual const char* extensionName() const = 0;
583 virtual void loseExtension() = 0; 581 virtual void loseExtension() = 0;
584 582
585 private: 583 private:
586 bool m_privileged; 584 bool m_privileged;
587 bool m_draft; 585 bool m_draft;
588 bool m_prefixed;
589 bool m_webglDebugRendererInfo; 586 bool m_webglDebugRendererInfo;
590 const char* const* m_prefixes; 587 const char* const* m_prefixes;
591 }; 588 };
592 589
593 template <typename T> 590 template <typename T>
594 class TypedExtensionTracker FINAL : public ExtensionTracker { 591 class TypedExtensionTracker FINAL : public ExtensionTracker {
595 public: 592 public:
596 TypedExtensionTracker(RefPtr<T>& extensionField, ExtensionFlags flags, c onst char* const* prefixes) 593 TypedExtensionTracker(RefPtr<T>& extensionField, ExtensionFlags flags, c onst char* const* prefixes)
597 : ExtensionTracker(flags, prefixes) 594 : ExtensionTracker(flags, prefixes)
598 , m_extensionField(extensionField) 595 , m_extensionField(extensionField)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 643
647 bool m_extensionEnabled[WebGLExtensionNameCount]; 644 bool m_extensionEnabled[WebGLExtensionNameCount];
648 Vector<ExtensionTracker*> m_extensions; 645 Vector<ExtensionTracker*> m_extensions;
649 646
650 template <typename T> 647 template <typename T>
651 void registerExtension(RefPtr<T>& extensionPtr, ExtensionFlags flags = Appro vedExtension, const char* const* prefixes = 0) 648 void registerExtension(RefPtr<T>& extensionPtr, ExtensionFlags flags = Appro vedExtension, const char* const* prefixes = 0)
652 { 649 {
653 m_extensions.append(new TypedExtensionTracker<T>(extensionPtr, flags, pr efixes)); 650 m_extensions.append(new TypedExtensionTracker<T>(extensionPtr, flags, pr efixes));
654 } 651 }
655 652
653 bool extensionSupportedAndAllowed(const ExtensionTracker*);
654
656 inline bool extensionEnabled(WebGLExtensionName name) 655 inline bool extensionEnabled(WebGLExtensionName name)
657 { 656 {
658 return m_extensionEnabled[name]; 657 return m_extensionEnabled[name];
659 } 658 }
660 659
661 // Errors raised by synthesizeGLError() while the context is lost. 660 // Errors raised by synthesizeGLError() while the context is lost.
662 Vector<GLenum> m_lostContextErrors; 661 Vector<GLenum> m_lostContextErrors;
663 662
664 // Helpers for getParameter and others 663 // Helpers for getParameter and others
665 WebGLGetInfo getBooleanParameter(GLenum); 664 WebGLGetInfo getBooleanParameter(GLenum);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 // If the vector is empty, return the maximum allowed active context number. 916 // If the vector is empty, return the maximum allowed active context number.
918 static size_t oldestContextIndex(); 917 static size_t oldestContextIndex();
919 static IntSize oldestContextSize(); 918 static IntSize oldestContextSize();
920 }; 919 };
921 920
922 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 921 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
923 922
924 } // namespace WebCore 923 } // namespace WebCore
925 924
926 #endif // WebGLRenderingContextBase_h 925 #endif // WebGLRenderingContextBase_h
OLDNEW
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.cpp ('k') | Source/core/html/canvas/WebGLRenderingContextBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698