Merge branch 'master' into jgrpp
# Conflicts: # .github/workflows/ci-build.yml # .github/workflows/commit-checker.yml # src/command.cpp # src/company_cmd.cpp # src/company_gui.cpp # src/crashlog.cpp # src/economy.cpp # src/lang/english.txt # src/lang/german.txt # src/lang/korean.txt # src/misc_gui.cpp # src/newgrf_config.cpp # src/openttd.cpp # src/settings_gui.cpp # src/ship_cmd.cpp # src/table/settings/gui_settings.ini
This commit is contained in:
@@ -18,11 +18,12 @@ class VideoDriver_CocoaOpenGL : public VideoDriver_Cocoa {
|
||||
CGLContextObj gl_context;
|
||||
|
||||
uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end.
|
||||
std::string driver_info; ///< Information string about selected driver.
|
||||
|
||||
const char *AllocateContext(bool allow_software);
|
||||
|
||||
public:
|
||||
VideoDriver_CocoaOpenGL() : gl_context(nullptr), anim_buffer(nullptr) {}
|
||||
VideoDriver_CocoaOpenGL() : gl_context(nullptr), anim_buffer(nullptr), driver_info(this->GetName()) {}
|
||||
|
||||
const char *Start(const StringList ¶m) override;
|
||||
void Stop() override;
|
||||
@@ -41,6 +42,8 @@ public:
|
||||
/** Return driver name */
|
||||
const char *GetName() const override { return "cocoa-opengl"; }
|
||||
|
||||
const char *GetInfoString() const override { return this->driver_info.c_str(); }
|
||||
|
||||
void AllocateBackingStore(bool force = false) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -201,6 +201,11 @@ const char *VideoDriver_CocoaOpenGL::Start(const StringList ¶m)
|
||||
return err;
|
||||
}
|
||||
|
||||
this->driver_info = GetName();
|
||||
this->driver_info += " (";
|
||||
this->driver_info += OpenGLBackend::Get()->GetDriverName();
|
||||
this->driver_info += ")";
|
||||
|
||||
bool fullscreen = _fullscreen;
|
||||
if (!this->MakeWindow(_cur_resolution.width, _cur_resolution.height)) {
|
||||
this->Stop();
|
||||
|
||||
@@ -745,6 +745,16 @@ void OpenGLBackend::PrepareContext()
|
||||
_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
std::string OpenGLBackend::GetDriverName()
|
||||
{
|
||||
std::string res{};
|
||||
/* Skipping GL_VENDOR as it tends to be "obvious" from the renderer and version data, and just makes the string pointlessly longer */
|
||||
res += reinterpret_cast<const char *>(_glGetString(GL_RENDERER));
|
||||
res += ", ";
|
||||
res += reinterpret_cast<const char *>(_glGetString(GL_VERSION));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a shader for compilation errors and log them if necessary.
|
||||
* @param shader Shader to check.
|
||||
|
||||
@@ -92,6 +92,8 @@ public:
|
||||
|
||||
void PrepareContext();
|
||||
|
||||
std::string GetDriverName();
|
||||
|
||||
void UpdatePalette(const Colour *pal, uint first, uint length);
|
||||
bool Resize(int w, int h, bool force = false);
|
||||
void Paint();
|
||||
|
||||
@@ -68,6 +68,10 @@ const char *VideoDriver_SDL_OpenGL::Start(const StringList ¶m)
|
||||
return error;
|
||||
}
|
||||
|
||||
this->driver_info += " (";
|
||||
this->driver_info += OpenGLBackend::Get()->GetDriverName();
|
||||
this->driver_info += ")";
|
||||
|
||||
/* Now we have a OpenGL context, force a client-size-changed event,
|
||||
* so all buffers are allocated correctly. */
|
||||
int w, h;
|
||||
|
||||
@@ -872,6 +872,11 @@ const char *VideoDriver_SDL_Base::Start(const StringList ¶m)
|
||||
const char *dname = SDL_GetCurrentVideoDriver();
|
||||
DEBUG(driver, 1, "SDL2: using driver '%s'", dname);
|
||||
|
||||
this->driver_info = this->GetName();
|
||||
this->driver_info += " (";
|
||||
this->driver_info += dname;
|
||||
this->driver_info += ")";
|
||||
|
||||
MarkWholeScreenDirty();
|
||||
|
||||
SDL_StopTextInput();
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/** The SDL video driver. */
|
||||
class VideoDriver_SDL_Base : public VideoDriver {
|
||||
public:
|
||||
VideoDriver_SDL_Base() : sdl_window(nullptr), buffer_locked(false) {}
|
||||
VideoDriver_SDL_Base() : sdl_window(nullptr), buffer_locked(false), driver_info(this->GetName()) {}
|
||||
|
||||
const char *Start(const StringList ¶m) override;
|
||||
|
||||
@@ -46,11 +46,14 @@ public:
|
||||
|
||||
const char *GetName() const override { return "sdl"; }
|
||||
|
||||
const char *GetInfoString() const override { return this->driver_info.c_str(); }
|
||||
|
||||
protected:
|
||||
struct SDL_Window *sdl_window; ///< Main SDL window.
|
||||
Palette local_palette; ///< Copy of _cur_palette.
|
||||
bool buffer_locked; ///< Video buffer was locked by the main thread.
|
||||
Rect dirty_rect; ///< Rectangle encompassing the dirty area of the video buffer.
|
||||
std::string driver_info; ///< Information string about selected driver.
|
||||
|
||||
Dimension GetScreenSize() const override;
|
||||
void InputLoop() override;
|
||||
|
||||
@@ -183,6 +183,11 @@ public:
|
||||
return ZOOM_LVL_OUT_4X;
|
||||
}
|
||||
|
||||
virtual const char *GetInfoString() const
|
||||
{
|
||||
return this->GetName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a function to be called on the main thread with game state
|
||||
* lock held and video buffer locked. Queued functions will be
|
||||
|
||||
@@ -1322,6 +1322,11 @@ const char *VideoDriver_Win32OpenGL::Start(const StringList ¶m)
|
||||
return err;
|
||||
}
|
||||
|
||||
this->driver_info = GetName();
|
||||
this->driver_info += " (";
|
||||
this->driver_info += OpenGLBackend::Get()->GetDriverName();
|
||||
this->driver_info += ")";
|
||||
|
||||
this->ClientSizeChanged(this->width, this->height, true);
|
||||
/* We should have a valid screen buffer now. If not, something went wrong and we should abort. */
|
||||
if (_screen.dst_ptr == nullptr) {
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
/** The OpenGL video driver for windows. */
|
||||
class VideoDriver_Win32OpenGL : public VideoDriver_Win32Base {
|
||||
public:
|
||||
VideoDriver_Win32OpenGL() : dc(nullptr), gl_rc(nullptr), anim_buffer(nullptr) {}
|
||||
VideoDriver_Win32OpenGL() : dc(nullptr), gl_rc(nullptr), anim_buffer(nullptr), driver_info(this->GetName()) {}
|
||||
|
||||
const char *Start(const StringList ¶m) override;
|
||||
|
||||
@@ -146,10 +146,13 @@ public:
|
||||
|
||||
const char *GetName() const override { return "win32-opengl"; }
|
||||
|
||||
const char *GetInfoString() const override { return this->driver_info.c_str(); }
|
||||
|
||||
protected:
|
||||
HDC dc; ///< Window device context.
|
||||
HGLRC gl_rc; ///< OpenGL context.
|
||||
uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end.
|
||||
std::string driver_info; ///< Information string about selected driver.
|
||||
|
||||
uint8 GetFullscreenBpp() override { return 32; } // OpenGL is always 32 bpp.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user