Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #include "WebGLFramebufferAttachable.h"
7 :
8 : #include "WebGLFramebuffer.h"
9 :
10 : namespace mozilla {
11 :
12 : void
13 0 : WebGLFramebufferAttachable::MarkAttachment(const WebGLFBAttachPoint& attachment)
14 : {
15 0 : if (mAttachmentPoints.Contains(&attachment))
16 0 : return; // Already attached. Ignore.
17 :
18 0 : mAttachmentPoints.AppendElement(&attachment);
19 : }
20 :
21 : void
22 0 : WebGLFramebufferAttachable::UnmarkAttachment(const WebGLFBAttachPoint& attachment)
23 : {
24 0 : const size_t i = mAttachmentPoints.IndexOf(&attachment);
25 0 : if (i == mAttachmentPoints.NoIndex) {
26 0 : MOZ_ASSERT(false, "Is not attached to FB");
27 : return;
28 : }
29 :
30 0 : mAttachmentPoints.RemoveElementAt(i);
31 0 : }
32 :
33 : void
34 0 : WebGLFramebufferAttachable::InvalidateStatusOfAttachedFBs(const char* funcName) const
35 : {
36 0 : const size_t count = mAttachmentPoints.Length();
37 0 : for (size_t i = 0; i < count; ++i) {
38 0 : MOZ_ASSERT(mAttachmentPoints[i]->mFB);
39 0 : mAttachmentPoints[i]->mFB->InvalidateFramebufferStatus(funcName);
40 : }
41 0 : }
42 :
43 : } // namespace mozilla
|