mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-02 08:55:45 +00:00
AGS: Engine: OpenGL, Software drivers also try 24bit display modes for 32bit
This is mostly a cosmetic fix, as graphic mode was created successfully anyway. But the engine was incorrectly reporting no suitable modes available. From upstream 4399d6448c579c648fe7e0c157a6d5f1adc74a6c
This commit is contained in:
parent
808f8f679e
commit
887f156f73
@ -79,9 +79,15 @@ int ScummVMRendererGraphicsDriver::GetDisplayDepthForNativeDepth(int native_colo
|
||||
return native_color_depth;
|
||||
}
|
||||
|
||||
IGfxModeList *ScummVMRendererGraphicsDriver::GetSupportedModeList(int /*color_depth*/) {
|
||||
IGfxModeList *ScummVMRendererGraphicsDriver::GetSupportedModeList(int color_depth) {
|
||||
std::vector<DisplayMode> modes;
|
||||
sys_get_desktop_modes(modes);
|
||||
sys_get_desktop_modes(modes, color_depth);
|
||||
if ((modes.size() == 0) && color_depth == 32) {
|
||||
// Pretend that 24-bit are 32-bit
|
||||
sys_get_desktop_modes(modes, 24);
|
||||
for (auto &m : modes)
|
||||
m.ColorDepth = 32;
|
||||
}
|
||||
return new ScummVMRendererGfxModeList(modes);
|
||||
}
|
||||
|
||||
|
@ -113,9 +113,6 @@ bool find_nearest_supported_mode(const IGfxModeList &modes, const Size &wanted_s
|
||||
if (!modes.GetMode(i, mode)) {
|
||||
continue;
|
||||
}
|
||||
if (mode.ColorDepth != color_depth) {
|
||||
continue;
|
||||
}
|
||||
if (wanted_ratio > 0) {
|
||||
uint32_t mode_ratio = (mode.Height << kShift) / mode.Width;
|
||||
if (mode_ratio != wanted_ratio) {
|
||||
@ -217,7 +214,7 @@ bool try_init_compatible_mode(const DisplayMode &dm) {
|
||||
Debug::Printf("Maximal allowed window size: %d x %d", device_size.Width, device_size.Height);
|
||||
DisplayMode dm_compat = dm;
|
||||
|
||||
std::unique_ptr<IGfxModeList> modes(_G(gfxDriver)->GetSupportedModeList(dm.ColorDepth)); // TODO: use unique_ptr when available
|
||||
std::unique_ptr<IGfxModeList> modes(_G(gfxDriver)->GetSupportedModeList(dm.ColorDepth));
|
||||
|
||||
// Windowed mode
|
||||
if (dm.IsWindowed()) {
|
||||
@ -282,8 +279,7 @@ void log_out_driver_modes(const int color_depth) {
|
||||
DisplayMode mode;
|
||||
String mode_str;
|
||||
for (int i = 0, in_str = 0; i < mode_count; ++i) {
|
||||
if (!modes->GetMode(i, mode) || mode.ColorDepth != color_depth)
|
||||
continue;
|
||||
modes->GetMode(i, mode);
|
||||
mode_str.Append(String::FromFormat("%dx%d;", mode.Width, mode.Height));
|
||||
if (++in_str % 8 == 0)
|
||||
mode_str.Append("\n\t");
|
||||
|
@ -61,7 +61,7 @@ int sys_get_desktop_resolution(int &width, int &height) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sys_get_desktop_modes(std::vector<AGS::Engine::DisplayMode> &dms) {
|
||||
void sys_get_desktop_modes(std::vector<AGS::Engine::DisplayMode> &dms, int color_depth) {
|
||||
#ifdef TODO
|
||||
SDL_DisplayMode mode;
|
||||
const int display_id = DEFAULT_DISPLAY_INDEX;
|
||||
@ -72,10 +72,14 @@ void sys_get_desktop_modes(std::vector<AGS::Engine::DisplayMode> &dms) {
|
||||
SDL_Log("SDL_GetDisplayMode failed: %s", SDL_GetError());
|
||||
continue;
|
||||
}
|
||||
const int bitsdepth = SDL_BITSPERPIXEL(mode.format);
|
||||
if ((color_depth == 0) || (bitsdepth != color_depth)) {
|
||||
continue;
|
||||
}
|
||||
AGS::Engine::DisplayMode dm;
|
||||
dm.Width = mode.w;
|
||||
dm.Height = mode.h;
|
||||
dm.ColorDepth = SDL_BITSPERPIXEL(mode.format);
|
||||
dm.ColorDepth = bitsdepth;
|
||||
dm.RefreshRate = mode.refresh_rate;
|
||||
dms.push_back(dm);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void sys_set_background_mode(bool on);
|
||||
// Queries current desktop resolution.
|
||||
int sys_get_desktop_resolution(int &width, int &height);
|
||||
// Queries supported desktop modes.
|
||||
void sys_get_desktop_modes(std::vector<AGS::Engine::DisplayMode> &dms);
|
||||
void sys_get_desktop_modes(std::vector<AGS::Engine::DisplayMode> &dms, int color_depth = 0);
|
||||
// Sets output driver for the backend's renderer
|
||||
void sys_renderer_set_output(const AGS::Shared::String &name);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user