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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h

Issue 2535173002: Prevent implicit framebuffer clear from clobbering alpha in emulated RGB (Closed)
Patch Set: fix Created 4 years 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 class WebGLSharedObject; 104 class WebGLSharedObject;
105 class WebGLUniformLocation; 105 class WebGLUniformLocation;
106 class WebGLVertexArrayObjectBase; 106 class WebGLVertexArrayObjectBase;
107 107
108 class WebGLRenderingContextErrorMessageCallback; 108 class WebGLRenderingContextErrorMessageCallback;
109 109
110 // This class uses the color mask to prevent drawing to the alpha channel, if 110 // This class uses the color mask to prevent drawing to the alpha channel, if
111 // the DrawingBuffer requires RGB emulation. 111 // the DrawingBuffer requires RGB emulation.
112 class ScopedRGBEmulationColorMask { 112 class ScopedRGBEmulationColorMask {
113 public: 113 public:
114 ScopedRGBEmulationColorMask(gpu::gles2::GLES2Interface*, 114 ScopedRGBEmulationColorMask(WebGLRenderingContextBase*,
115 GLboolean* colorMask, 115 GLboolean* colorMask,
116 DrawingBuffer*); 116 DrawingBuffer*);
117 ~ScopedRGBEmulationColorMask(); 117 ~ScopedRGBEmulationColorMask();
118 118
119 private: 119 private:
120 gpu::gles2::GLES2Interface* m_contextGL; 120 WeakPersistent<WebGLRenderingContextBase> m_context;
Ken Russell (switch to Gerrit) 2016/12/01 07:20:43 I'm concerned about the performance impact of allo
Ken Russell (switch to Gerrit) 2016/12/01 08:36:47 I just learned from looking at another CL ( https:
Kai Ninomiya 2016/12/01 23:30:20 Done.
121 GLboolean m_colorMask[4]; 121 GLboolean m_colorMask[4];
122 const bool m_requiresEmulation; 122 const bool m_requiresEmulation;
123 }; 123 };
124 124
125 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext, 125 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
126 public DrawingBuffer::Client { 126 public DrawingBuffer::Client {
127 WTF_MAKE_NONCOPYABLE(WebGLRenderingContextBase); 127 WTF_MAKE_NONCOPYABLE(WebGLRenderingContextBase);
128 128
129 public: 129 public:
130 ~WebGLRenderingContextBase() override; 130 ~WebGLRenderingContextBase() override;
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 585
586 PassRefPtr<Image> getImage(AccelerationHint, SnapshotReason) const override; 586 PassRefPtr<Image> getImage(AccelerationHint, SnapshotReason) const override;
587 ImageData* toImageData(SnapshotReason) const override; 587 ImageData* toImageData(SnapshotReason) const override;
588 void setFilterQuality(SkFilterQuality) override; 588 void setFilterQuality(SkFilterQuality) override;
589 bool isWebGL2OrHigher() { return version() >= 2; } 589 bool isWebGL2OrHigher() { return version() >= 2; }
590 590
591 void getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffscreenCanvas&) const; 591 void getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffscreenCanvas&) const;
592 592
593 void commit(ScriptState*, ExceptionState&); 593 void commit(ScriptState*, ExceptionState&);
594 594
595 std::list<ScopedRGBEmulationColorMask*> activeScopedRGBEmulationColorMasks;
Ken Russell (switch to Gerrit) 2016/12/01 07:20:43 Please put all of this in the private section and
Kai Ninomiya 2016/12/01 23:30:20 Done.
596 void pushActiveScopedRGBEmulationColorMask(ScopedRGBEmulationColorMask* val) {
597 activeScopedRGBEmulationColorMasks.push_back(val);
598 }
599 ScopedRGBEmulationColorMask* popActiveScopedRGBEmulationColorMask() {
600 auto removed = activeScopedRGBEmulationColorMasks.back();
601 activeScopedRGBEmulationColorMasks.pop_back();
602 return removed;
603 }
604
595 protected: 605 protected:
596 friend class EXTDisjointTimerQuery; 606 friend class EXTDisjointTimerQuery;
597 friend class EXTDisjointTimerQueryWebGL2; 607 friend class EXTDisjointTimerQueryWebGL2;
598 friend class WebGLDrawBuffers; 608 friend class WebGLDrawBuffers;
599 friend class WebGLFramebuffer; 609 friend class WebGLFramebuffer;
600 friend class WebGLObject; 610 friend class WebGLObject;
601 friend class WebGLContextObject; 611 friend class WebGLContextObject;
602 friend class OESVertexArrayObject; 612 friend class OESVertexArrayObject;
603 friend class WebGLDebugShaders; 613 friend class WebGLDebugShaders;
604 friend class WebGLCompressedTextureASTC; 614 friend class WebGLCompressedTextureASTC;
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 context, 1678 context,
1669 context->is3d(), 1679 context->is3d(),
1670 context.is3d()); 1680 context.is3d());
1671 1681
1672 } // namespace blink 1682 } // namespace blink
1673 1683
1674 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( 1684 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(
1675 blink::WebGLRenderingContextBase::TextureUnitState); 1685 blink::WebGLRenderingContextBase::TextureUnitState);
1676 1686
1677 #endif // WebGLRenderingContextBase_h 1687 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698