2014-03-04 11:14:35 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2015-03-17 07:32:52 +03:00
|
|
|
#include "WebGLFramebufferAttachable.h"
|
2015-03-25 02:00:28 +03:00
|
|
|
|
2014-03-04 11:14:35 +04:00
|
|
|
#include "WebGLFramebuffer.h"
|
|
|
|
|
2015-03-25 02:00:28 +03:00
|
|
|
namespace mozilla {
|
2014-03-04 11:14:35 +04:00
|
|
|
|
|
|
|
void
|
2015-07-15 03:37:28 +03:00
|
|
|
WebGLFramebufferAttachable::MarkAttachment(const WebGLFBAttachPoint& attachment)
|
2014-03-04 11:14:35 +04:00
|
|
|
{
|
2015-03-25 02:00:28 +03:00
|
|
|
if (mAttachmentPoints.Contains(&attachment))
|
2014-03-04 11:14:35 +04:00
|
|
|
return; // Already attached. Ignore.
|
|
|
|
|
2015-03-25 02:00:28 +03:00
|
|
|
mAttachmentPoints.AppendElement(&attachment);
|
2014-03-04 11:14:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-07-15 03:37:28 +03:00
|
|
|
WebGLFramebufferAttachable::UnmarkAttachment(const WebGLFBAttachPoint& attachment)
|
2014-03-04 11:14:35 +04:00
|
|
|
{
|
2015-03-25 02:00:28 +03:00
|
|
|
const size_t i = mAttachmentPoints.IndexOf(&attachment);
|
2014-07-30 23:52:06 +04:00
|
|
|
if (i == mAttachmentPoints.NoIndex) {
|
2014-03-04 11:14:35 +04:00
|
|
|
MOZ_ASSERT(false, "Is not attached to FB");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-07-30 23:52:06 +04:00
|
|
|
mAttachmentPoints.RemoveElementAt(i);
|
2014-03-04 11:14:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-03-25 02:00:28 +03:00
|
|
|
WebGLFramebufferAttachable::InvalidateStatusOfAttachedFBs() const
|
2014-03-04 11:14:35 +04:00
|
|
|
{
|
2015-03-25 02:00:28 +03:00
|
|
|
const size_t count = mAttachmentPoints.Length();
|
|
|
|
for (size_t i = 0; i < count; ++i) {
|
|
|
|
MOZ_ASSERT(mAttachmentPoints[i]->mFB);
|
|
|
|
mAttachmentPoints[i]->mFB->InvalidateFramebufferStatus();
|
2014-07-30 23:52:07 +04:00
|
|
|
}
|
2014-03-04 11:14:35 +04:00
|
|
|
}
|
2015-03-25 02:00:28 +03:00
|
|
|
|
|
|
|
} // namespace mozilla
|