diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dummy/rasterizer_dummy.h | 2 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 3 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_storage_gles2.cpp | 10 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_storage_gles2.h | 2 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_gles3.cpp | 3 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 10 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.h | 2 | ||||
-rw-r--r-- | drivers/unix/os_unix.cpp | 32 |
8 files changed, 52 insertions, 12 deletions
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index 167159c7e9..00758a73a4 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -742,6 +742,8 @@ public: int get_captured_render_info(VS::RenderInfo p_info) { return 0; } int get_render_info(VS::RenderInfo p_info) { return 0; } + String get_video_adapter_name() const { return String(); } + String get_video_adapter_vendor() const { return String(); } static RasterizerStorage *base_singleton; diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index cac124ff5f..c4e9541a36 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -263,8 +263,7 @@ void RasterizerGLES2::initialize() { #endif // GLES_OVER_GL #endif // CAN_DEBUG - const GLubyte *renderer = glGetString(GL_RENDERER); - print_line("OpenGL ES 2.0 Renderer: " + String((const char *)renderer)); + print_line("OpenGL ES 2.0 Renderer: " + VisualServer::get_singleton()->get_video_adapter_name()); storage->initialize(); canvas->initialize(); scene->initialize(); diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 94a7d4e1b5..bb087a7f47 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -5766,6 +5766,16 @@ int RasterizerStorageGLES2::get_render_info(VS::RenderInfo p_info) { } } +String RasterizerStorageGLES2::get_video_adapter_name() const { + + return (const char *)glGetString(GL_RENDERER); +} + +String RasterizerStorageGLES2::get_video_adapter_vendor() const { + + return (const char *)glGetString(GL_VENDOR); +} + void RasterizerStorageGLES2::initialize() { RasterizerStorageGLES2::system_fbo = 0; diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h index 62926ce713..83697b9872 100644 --- a/drivers/gles2/rasterizer_storage_gles2.h +++ b/drivers/gles2/rasterizer_storage_gles2.h @@ -1307,6 +1307,8 @@ public: virtual int get_captured_render_info(VS::RenderInfo p_info); virtual int get_render_info(VS::RenderInfo p_info); + virtual String get_video_adapter_name() const; + virtual String get_video_adapter_vendor() const; RasterizerStorageGLES2(); }; diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index d428fe33ee..ef2c318807 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -186,8 +186,7 @@ void RasterizerGLES3::initialize() { } */ - const GLubyte *renderer = glGetString(GL_RENDERER); - print_line("OpenGL ES 3.0 Renderer: " + String((const char *)renderer)); + print_line("OpenGL ES 3.0 Renderer: " + VisualServer::get_singleton()->get_video_adapter_name()); storage->initialize(); canvas->initialize(); scene->initialize(); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index bf742f4d25..c02f17ab95 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -8095,6 +8095,16 @@ int RasterizerStorageGLES3::get_render_info(VS::RenderInfo p_info) { } } +String RasterizerStorageGLES3::get_video_adapter_name() const { + + return (const char *)glGetString(GL_RENDERER); +} + +String RasterizerStorageGLES3::get_video_adapter_vendor() const { + + return (const char *)glGetString(GL_VENDOR); +} + void RasterizerStorageGLES3::initialize() { RasterizerStorageGLES3::system_fbo = 0; diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 833cdb4a94..bd853852fe 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -1467,6 +1467,8 @@ public: virtual int get_captured_render_info(VS::RenderInfo p_info); virtual int get_render_info(VS::RenderInfo p_info); + virtual String get_video_adapter_name() const; + virtual String get_video_adapter_vendor() const; RasterizerStorageGLES3(); }; diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 731c089c83..c5eb343cc8 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -59,6 +59,7 @@ #include <poll.h> #include <signal.h> #include <stdarg.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> @@ -554,23 +555,38 @@ void UnixTerminalLogger::log_error(const char *p_function, const char *p_file, i else err_details = p_code; + // Disable color codes if stdout is not a TTY. + // This prevents Godot from writing ANSI escape codes when redirecting + // stdout and stderr to a file. + const bool tty = isatty(fileno(stdout)); + const char *red = tty ? "\E[0;31m" : ""; + const char *red_bold = tty ? "\E[1;31m" : ""; + const char *yellow = tty ? "\E[0;33m" : ""; + const char *yellow_bold = tty ? "\E[1;33m" : ""; + const char *magenta = tty ? "\E[0;35m" : ""; + const char *magenta_bold = tty ? "\E[1;35m" : ""; + const char *cyan = tty ? "\E[0;36m" : ""; + const char *cyan_bold = tty ? "\E[1;36m" : ""; + const char *reset = tty ? "\E[0m" : ""; + const char *bold = tty ? "\E[1m" : ""; + switch (p_type) { case ERR_WARNING: - logf_error("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n", p_function, err_details); - logf_error("\E[0;33m At: %s:%i.\E[0m\n", p_file, p_line); + logf_error("%sWARNING: %s: %s%s%s\n", yellow_bold, p_function, reset, bold, err_details); + logf_error("%s At: %s:%i.%s\n", yellow, p_file, p_line, reset); break; case ERR_SCRIPT: - logf_error("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details); - logf_error("\E[0;35m At: %s:%i.\E[0m\n", p_file, p_line); + logf_error("%sSCRIPT ERROR: %s: %s%s%s\n", magenta_bold, p_function, reset, bold, err_details); + logf_error("%s At: %s:%i.%s\n", magenta, p_file, p_line, reset); break; case ERR_SHADER: - logf_error("\E[1;36mSHADER ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details); - logf_error("\E[0;36m At: %s:%i.\E[0m\n", p_file, p_line); + logf_error("%sSHADER ERROR: %s: %s%s%s\n", cyan_bold, p_function, reset, bold, err_details); + logf_error("%s At: %s:%i.%s\n", cyan, p_file, p_line, reset); break; case ERR_ERROR: default: - logf_error("\E[1;31mERROR: %s: \E[0m\E[1m%s\n", p_function, err_details); - logf_error("\E[0;31m At: %s:%i.\E[0m\n", p_file, p_line); + logf_error("%sERROR: %s: %s%s%s\n", red_bold, p_function, reset, bold, err_details); + logf_error("%s At: %s:%i.%s\n", red, p_file, p_line, reset); break; } } |