Skip to content

Commit ce1adf2

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

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

libopenage/renderer/opengl/render_target.cpp

Lines changed: 8 additions & 2 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,9 +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
2625
this->size = this->textures.value().at(0)->get_info().get_size();
2726

27+
// Check if the textures are all the same size
28+
for (const auto &tex : this->textures.value()) {
29+
if (tex->get_info().get_size() != this->size) {
30+
throw Error{ERR << "All texture targets must be the same size."};
31+
}
32+
}
33+
2834
log::log(MSG(dbg) << "Created OpenGL render target for textures");
2935
}
3036

0 commit comments

Comments
 (0)