WebGLFramebufferAttachable.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #include "WebGLFramebufferAttachable.h"
  6. #include "WebGLFramebuffer.h"
  7. namespace mozilla {
  8. void
  9. WebGLFramebufferAttachable::MarkAttachment(const WebGLFBAttachPoint& attachment)
  10. {
  11. if (mAttachmentPoints.Contains(&attachment))
  12. return; // Already attached. Ignore.
  13. mAttachmentPoints.AppendElement(&attachment);
  14. }
  15. void
  16. WebGLFramebufferAttachable::UnmarkAttachment(const WebGLFBAttachPoint& attachment)
  17. {
  18. const size_t i = mAttachmentPoints.IndexOf(&attachment);
  19. if (i == mAttachmentPoints.NoIndex) {
  20. MOZ_ASSERT(false, "Is not attached to FB");
  21. return;
  22. }
  23. mAttachmentPoints.RemoveElementAt(i);
  24. }
  25. void
  26. WebGLFramebufferAttachable::InvalidateStatusOfAttachedFBs() const
  27. {
  28. const size_t count = mAttachmentPoints.Length();
  29. for (size_t i = 0; i < count; ++i) {
  30. MOZ_ASSERT(mAttachmentPoints[i]->mFB);
  31. mAttachmentPoints[i]->mFB->InvalidateFramebufferStatus();
  32. }
  33. }
  34. } // namespace mozilla