mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Return to the main menu if a shader compilation fails (#14256)
Before this change, if the shaders are broken, only an error message is shown and the player enters the world nonetheless, where he/she sees broken graphics.
This commit is contained in:
parent
432988a4ad
commit
f08e4bb27d
@ -278,6 +278,10 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
|
|||||||
error_message = gettext("Connection error (timed out?)");
|
error_message = gettext("Connection error (timed out?)");
|
||||||
errorstream << error_message << std::endl;
|
errorstream << error_message << std::endl;
|
||||||
}
|
}
|
||||||
|
catch (ShaderException &e) {
|
||||||
|
error_message = e.what();
|
||||||
|
errorstream << error_message << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
catch (std::exception &e) {
|
catch (std::exception &e) {
|
||||||
|
@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <IShaderConstantSetCallBack.h>
|
#include <IShaderConstantSetCallBack.h>
|
||||||
#include "client/renderingengine.h"
|
#include "client/renderingengine.h"
|
||||||
#include "EShaderTypes.h"
|
#include "EShaderTypes.h"
|
||||||
|
#include "gettext.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "gamedef.h"
|
#include "gamedef.h"
|
||||||
#include "client/tile.h"
|
#include "client/tile.h"
|
||||||
@ -588,8 +589,8 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
|
|||||||
|
|
||||||
video::IVideoDriver *driver = RenderingEngine::get_video_driver();
|
video::IVideoDriver *driver = RenderingEngine::get_video_driver();
|
||||||
if (!driver->queryFeature(video::EVDF_ARB_GLSL)) {
|
if (!driver->queryFeature(video::EVDF_ARB_GLSL)) {
|
||||||
errorstream << "Shaders are enabled but GLSL is not supported by the driver\n";
|
throw ShaderException(gettext("Shaders are enabled but GLSL is not "
|
||||||
return shaderinfo;
|
"supported by the driver."));
|
||||||
}
|
}
|
||||||
video::IGPUProgrammingServices *gpu = driver->getGPUProgrammingServices();
|
video::IGPUProgrammingServices *gpu = driver->getGPUProgrammingServices();
|
||||||
|
|
||||||
@ -792,7 +793,9 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
|
|||||||
dumpShaderProgram(warningstream, "Vertex", vertex_shader);
|
dumpShaderProgram(warningstream, "Vertex", vertex_shader);
|
||||||
dumpShaderProgram(warningstream, "Fragment", fragment_shader);
|
dumpShaderProgram(warningstream, "Fragment", fragment_shader);
|
||||||
dumpShaderProgram(warningstream, "Geometry", geometry_shader);
|
dumpShaderProgram(warningstream, "Geometry", geometry_shader);
|
||||||
return shaderinfo;
|
throw ShaderException(
|
||||||
|
fmtgettext("Failed to compile the \"%s\" shader.", name.c_str()) +
|
||||||
|
strgettext("\nCheck debug.txt for details."));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the newly created material type
|
// Apply the newly created material type
|
||||||
|
@ -92,6 +92,11 @@ public:
|
|||||||
PrngException(const std::string &s): BaseException(s) {}
|
PrngException(const std::string &s): BaseException(s) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ShaderException : public BaseException {
|
||||||
|
public:
|
||||||
|
ShaderException(const std::string &s): BaseException(s) {}
|
||||||
|
};
|
||||||
|
|
||||||
class ModError : public BaseException {
|
class ModError : public BaseException {
|
||||||
public:
|
public:
|
||||||
ModError(const std::string &s): BaseException(s) {}
|
ModError(const std::string &s): BaseException(s) {}
|
||||||
|
Loading…
Reference in New Issue
Block a user