mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 08:05:18 +02:00
Driver: Handle errors during texture creation (#16565)
The OpenGL drivers do accept 'nullptr' textures, however the recent Mip-Mapping change did not respect that. Furthermore, errors during texture creation for the pipeline are now properly handled and shown as an error to the user.
This commit is contained in:
@@ -2672,7 +2672,8 @@ bool COpenGLDriver::setRenderTargetEx(IRenderTarget *target, u16 clearFlag, SCol
|
||||
// Update mip-map of the generated texture, if enabled.
|
||||
auto textures = CurrentRenderTarget->getTexture();
|
||||
for (size_t i = 0; i < textures.size(); ++i)
|
||||
textures[i]->regenerateMipMapLevels();
|
||||
if (textures[i])
|
||||
textures[i]->regenerateMipMapLevels();
|
||||
}
|
||||
|
||||
bool supportForFBO = (Feature.ColorAttachment > 0);
|
||||
|
@@ -1704,8 +1704,10 @@ bool COpenGL3DriverBase::setRenderTargetEx(IRenderTarget *target, u16 clearFlag,
|
||||
if (CurrentRenderTarget) {
|
||||
// Update mip-map of the generated texture, if enabled.
|
||||
auto textures = CurrentRenderTarget->getTexture();
|
||||
for (size_t i = 0; i < textures.size(); ++i)
|
||||
textures[i]->regenerateMipMapLevels();
|
||||
for (size_t i = 0; i < textures.size(); ++i) {
|
||||
if (textures[i])
|
||||
textures[i]->regenerateMipMapLevels();
|
||||
}
|
||||
}
|
||||
|
||||
core::dimension2d<u32> destRenderTargetSize(0, 0);
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include "pipeline.h"
|
||||
#include "client/client.h"
|
||||
#include "client/hud.h"
|
||||
#include "gettext.h"
|
||||
#include "IRenderTarget.h"
|
||||
#include "SColor.h"
|
||||
|
||||
@@ -85,7 +86,12 @@ void TextureBuffer::reset(PipelineContext &context)
|
||||
for (u32 i = 0; i < m_definitions.size(); i++) {
|
||||
video::ITexture **ptr = &m_textures[i];
|
||||
|
||||
ensureTexture(ptr, m_definitions[i], context);
|
||||
if (!ensureTexture(ptr, m_definitions[i], context)) {
|
||||
throw ShaderException(
|
||||
fmtgettext("Failed to create the texture \"%s\" for the rendering pipeline.",
|
||||
m_definitions[i].name.c_str()) +
|
||||
strgettext("\nCheck debug.txt for details."));
|
||||
}
|
||||
m_definitions[i].dirty = false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user