Skip to content

Commit

Permalink
VIDEO: FrameBuffer::shutdown didn't handle every member
Browse files Browse the repository at this point in the history
  • Loading branch information
mgerhardy committed May 17, 2020
1 parent 019e4a9 commit 1a38c65
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
25 changes: 16 additions & 9 deletions src/modules/video/FrameBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,26 @@ glm::vec4 FrameBuffer::uv() const {
}

void FrameBuffer::shutdown() {
video::deleteFramebuffer(_fbo);
for (auto& e : _colorAttachments) {
if (!e) {
continue;
for (int i = 0; i < lengthof(_colorAttachments); ++i) {
if (_colorAttachments[i]) {
_colorAttachments[i]->shutdown();
_colorAttachments[i] = TexturePtr();
}
e->shutdown();
}
for (auto& e : _bufferAttachments) {
if (!e) {
continue;
for (int i = 0; i < lengthof(_bufferAttachments); ++i) {
if (_bufferAttachments[i]) {
_bufferAttachments[i]->shutdown();
_bufferAttachments[i] = RenderBufferPtr();
}
e->shutdown();
}

video::deleteFramebuffer(_fbo);
_clearFlag = ClearFlag::None;
_oldFramebuffer = InvalidId;
for (int i = 0; i < lengthof(_viewport); ++i) {
_viewport[i] = 0;
}
_dimension = glm::ivec2(0);
}

TexturePtr FrameBuffer::texture(FrameBufferAttachment attachment) const {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/video/FrameBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class FrameBuffer {
TexturePtr _colorAttachments[core::enumVal(FrameBufferAttachment::Max)];
RenderBufferPtr _bufferAttachments[core::enumVal(FrameBufferAttachment::Max)];

glm::ivec2 _dimension;
glm::ivec2 _dimension { 0 };

int32_t _viewport[4] = {0, 0, 0, 0};

Expand Down

0 comments on commit 1a38c65

Please sign in to comment.