fix a memory corruption introduced recently

fixes #3844
This commit is contained in:
Mathias Agopian
2021-04-23 15:08:24 -07:00
committed by Mathias Agopian
parent 820717df0e
commit bcd4b65f7d
3 changed files with 4 additions and 5 deletions

View File

@@ -59,8 +59,6 @@ public:
COLOR = COLOR0, //!< identifies the 1st color attachment
};
static constexpr size_t ATTACHMENT_COUNT = backend::MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT + 1;
//! Use Builder to construct a RenderTarget object instance
class Builder : public BuilderBase<BuilderDetails> {
friend struct BuilderDetails;

View File

@@ -28,7 +28,7 @@ namespace filament {
using namespace backend;
struct RenderTarget::BuilderDetails {
FRenderTarget::Attachment mAttachments[RenderTarget::ATTACHMENT_COUNT] = {};
FRenderTarget::Attachment mAttachments[FRenderTarget::ATTACHMENT_COUNT] = {};
uint32_t mWidth{};
uint32_t mHeight{};
uint8_t mSamples = 1; // currently not settable in the public facing API
@@ -127,7 +127,7 @@ FRenderTarget::FRenderTarget(FEngine& engine, const RenderTarget::Builder& build
}
};
for (size_t i = 0; i < ATTACHMENT_COUNT; i++) {
for (size_t i = 0; i < MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT; i++) {
if (mAttachments[i].texture) {
mAttachmentMask |= getMRTColorFlag(i);
setAttachment(mrt[i], (AttachmentPoint)i);

View File

@@ -57,7 +57,8 @@ public:
private:
friend class RenderTarget;
Attachment mAttachments[RenderTarget::ATTACHMENT_COUNT];
static constexpr size_t ATTACHMENT_COUNT = backend::MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT + 1;
Attachment mAttachments[ATTACHMENT_COUNT];
HwHandle mHandle{};
backend::TargetBufferFlags mAttachmentMask = {};
};