Skip to content

Commit a71a890

Browse files
committed
renderer: Check if all textures of render target have the same size.
1 parent 9d06bd6 commit a71a890

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

libopenage/renderer/opengl/render_target.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017-2024 the openage authors. See copying.md for legal info.
1+
// Copyright 2017-2025 the openage authors. See copying.md for legal info.
22

33
#include "render_target.h"
44

@@ -22,8 +22,15 @@ GlRenderTarget::GlRenderTarget(const std::shared_ptr<GlContext> &context,
2222
type(gl_render_target_t::framebuffer),
2323
framebuffer({context, textures}),
2424
textures(textures) {
25-
// TODO: Check if the textures are all the same size
26-
this->size = this->textures.value().at(0)->get_info().get_size();
25+
// Check if the textures are all the same size
26+
auto size = this->textures.value().at(0)->get_info().get_size();
27+
for (const auto &tex : this->textures.value()) {
28+
if (tex->get_info().get_size() != size) {
29+
throw Error{ERR << "All texture targets must be the same size."};
30+
}
31+
}
32+
33+
this->size = size;
2734

2835
log::log(MSG(dbg) << "Created OpenGL render target for textures");
2936
}

0 commit comments

Comments
 (0)