Merge branch 'stenzek:master' into master
This commit is contained in:
commit
6e4c839d1f
|
@ -459,7 +459,13 @@ void Host::UpdateDisplayWindow(bool fullscreen)
|
||||||
|
|
||||||
// if surfaceless, just leave it
|
// if surfaceless, just leave it
|
||||||
if (wi->IsSurfaceless())
|
if (wi->IsSurfaceless())
|
||||||
|
{
|
||||||
|
DEV_LOG("Switching to surfaceless device");
|
||||||
|
if (!g_gpu_device->SwitchToSurfacelessRendering(&error))
|
||||||
|
ERROR_LOG("Failed to switch to surfaceless, rendering commands may fail: {}", error.GetDescription());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!g_gpu_device->RecreateMainSwapChain(wi.value(), vsync_mode, allow_present_throttle,
|
if (!g_gpu_device->RecreateMainSwapChain(wi.value(), vsync_mode, allow_present_throttle,
|
||||||
fullscreen_mode.has_value() ? &fullscreen_mode.value() : nullptr,
|
fullscreen_mode.has_value() ? &fullscreen_mode.value() : nullptr,
|
||||||
|
|
|
@ -5762,7 +5762,7 @@ void System::DisplayWindowResized()
|
||||||
|
|
||||||
void System::UpdateGTEAspectRatio()
|
void System::UpdateGTEAspectRatio()
|
||||||
{
|
{
|
||||||
if (!IsValid())
|
if (!IsValidOrInitializing())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DisplayAspectRatio gte_ar = g_settings.display_aspect_ratio;
|
DisplayAspectRatio gte_ar = g_settings.display_aspect_ratio;
|
||||||
|
|
|
@ -472,6 +472,12 @@ void GPUDevice::Destroy()
|
||||||
DestroyDevice();
|
DestroyDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GPUDevice::SwitchToSurfacelessRendering(Error* error)
|
||||||
|
{
|
||||||
|
// noop on everything except GL because of it's context nonsense
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool GPUDevice::RecreateMainSwapChain(const WindowInfo& wi, GPUVSyncMode vsync_mode, bool allow_present_throttle,
|
bool GPUDevice::RecreateMainSwapChain(const WindowInfo& wi, GPUVSyncMode vsync_mode, bool allow_present_throttle,
|
||||||
const ExclusiveFullscreenMode* exclusive_fullscreen_mode,
|
const ExclusiveFullscreenMode* exclusive_fullscreen_mode,
|
||||||
std::optional<bool> exclusive_fullscreen_control, Error* error)
|
std::optional<bool> exclusive_fullscreen_control, Error* error)
|
||||||
|
@ -723,8 +729,7 @@ void GPUDevice::RenderImGui(GPUSwapChain* swap_chain)
|
||||||
0.0f, 0.0f, static_cast<float>(swap_chain->GetWidth()), static_cast<float>(swap_chain->GetHeight()), 0.0f, 1.0f);
|
0.0f, 0.0f, static_cast<float>(swap_chain->GetWidth()), static_cast<float>(swap_chain->GetHeight()), 0.0f, 1.0f);
|
||||||
if (swap_chain->GetPreRotation() != WindowInfo::PreRotation::Identity)
|
if (swap_chain->GetPreRotation() != WindowInfo::PreRotation::Identity)
|
||||||
{
|
{
|
||||||
mproj =
|
mproj = GSMatrix4x4::RotationZ(WindowInfo::GetZRotationForPreRotation(swap_chain->GetPreRotation())) * mproj;
|
||||||
GSMatrix4x4::RotationZ(WindowInfo::GetZRotationForPreRotation(swap_chain->GetPreRotation())) * mproj;
|
|
||||||
}
|
}
|
||||||
PushUniformBuffer(&mproj, sizeof(mproj));
|
PushUniformBuffer(&mproj, sizeof(mproj));
|
||||||
|
|
||||||
|
|
|
@ -720,6 +720,7 @@ public:
|
||||||
const ExclusiveFullscreenMode* exclusive_fullscreen_mode,
|
const ExclusiveFullscreenMode* exclusive_fullscreen_mode,
|
||||||
std::optional<bool> exclusive_fullscreen_control,
|
std::optional<bool> exclusive_fullscreen_control,
|
||||||
Error* error) = 0;
|
Error* error) = 0;
|
||||||
|
virtual bool SwitchToSurfacelessRendering(Error* error);
|
||||||
|
|
||||||
bool RecreateMainSwapChain(const WindowInfo& wi, GPUVSyncMode vsync_mode, bool allow_present_throttle,
|
bool RecreateMainSwapChain(const WindowInfo& wi, GPUVSyncMode vsync_mode, bool allow_present_throttle,
|
||||||
const ExclusiveFullscreenMode* exclusive_fullscreen_mode,
|
const ExclusiveFullscreenMode* exclusive_fullscreen_mode,
|
||||||
|
|
|
@ -1358,9 +1358,12 @@ void InputManager::UpdateRelativeMouseMode()
|
||||||
if (s_relative_mouse_mode == has_relative_mode_bindings && s_hide_host_mouse_cursor == hide_mouse_cursor)
|
if (s_relative_mouse_mode == has_relative_mode_bindings && s_hide_host_mouse_cursor == hide_mouse_cursor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifndef __ANDROID__
|
||||||
s_relative_mouse_mode = has_relative_mode_bindings;
|
s_relative_mouse_mode = has_relative_mode_bindings;
|
||||||
s_hide_host_mouse_cursor = hide_mouse_cursor;
|
s_hide_host_mouse_cursor = hide_mouse_cursor;
|
||||||
UpdateRelativeMouseMode();
|
#endif
|
||||||
|
|
||||||
|
UpdateHostMouseMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputManager::UpdateHostMouseMode()
|
void InputManager::UpdateHostMouseMode()
|
||||||
|
|
|
@ -96,6 +96,14 @@ static void DisableBrokenExtensions(const char* gl_vendor, const char* gl_render
|
||||||
VERBOSE_LOG("Keeping GL_EXT_shader_framebuffer_fetch on Adreno version {}", major_version);
|
VERBOSE_LOG("Keeping GL_EXT_shader_framebuffer_fetch on Adreno version {}", major_version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (std::strstr(gl_vendor, "Imagination Technologies") && std::strstr(gl_renderer, "PowerVR"))
|
||||||
|
{
|
||||||
|
// Framebuffer fetch is apparently also broken on older PowerVR drivers.
|
||||||
|
// No clue what the range is, so just disable all of them...
|
||||||
|
GLAD_GL_EXT_shader_framebuffer_fetch = 0;
|
||||||
|
GLAD_GL_ARM_shader_framebuffer_fetch = 0;
|
||||||
|
VERBOSE_LOG("Disabling GL_EXT_shader_framebuffer_fetch on PowerVR driver.");
|
||||||
|
}
|
||||||
|
|
||||||
// If we're missing GLES 3.2, but have OES_draw_elements_base_vertex, redirect the function pointers.
|
// If we're missing GLES 3.2, but have OES_draw_elements_base_vertex, redirect the function pointers.
|
||||||
if (!glad_glDrawElementsBaseVertex && GLAD_GL_OES_draw_elements_base_vertex && !GLAD_GL_ES_VERSION_3_2)
|
if (!glad_glDrawElementsBaseVertex && GLAD_GL_OES_draw_elements_base_vertex && !GLAD_GL_ES_VERSION_3_2)
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "common/error.h"
|
#include "common/error.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
|
||||||
|
#include "glad/gl.h"
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
@ -164,7 +166,7 @@ EGLSurface OpenGLContextEGL::CreatePlatformSurface(EGLConfig config, const Windo
|
||||||
|
|
||||||
bool OpenGLContextEGL::SupportsSurfaceless() const
|
bool OpenGLContextEGL::SupportsSurfaceless() const
|
||||||
{
|
{
|
||||||
return GLAD_EGL_KHR_surfaceless_context;
|
return (!IsGLES() || GLAD_GL_OES_surfaceless_context) && GLAD_EGL_KHR_surfaceless_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLDisplay OpenGLContextEGL::TryGetPlatformDisplay(void* display, EGLenum platform, const char* platform_ext)
|
EGLDisplay OpenGLContextEGL::TryGetPlatformDisplay(void* display, EGLenum platform, const char* platform_ext)
|
||||||
|
@ -294,7 +296,7 @@ void OpenGLContextEGL::DestroySurface(SurfaceHandle handle)
|
||||||
EGLSurface surface = (EGLSurface)handle;
|
EGLSurface surface = (EGLSurface)handle;
|
||||||
if (m_current_surface == surface)
|
if (m_current_surface == surface)
|
||||||
{
|
{
|
||||||
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, SupportsSurfaceless() ? m_context : EGL_NO_CONTEXT);
|
||||||
m_current_surface = EGL_NO_SURFACE;
|
m_current_surface = EGL_NO_SURFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -637,6 +637,12 @@ std::unique_ptr<GPUSwapChain> OpenGLDevice::CreateSwapChain(const WindowInfo& wi
|
||||||
return std::make_unique<OpenGLSwapChain>(wi_copy, vsync_mode, allow_present_throttle, surface_handle);
|
return std::make_unique<OpenGLSwapChain>(wi_copy, vsync_mode, allow_present_throttle, surface_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OpenGLDevice::SwitchToSurfacelessRendering(Error* error)
|
||||||
|
{
|
||||||
|
// We need to switch to surfaceless if we're temporarily destroying, otherwise we can't issue GL commands.
|
||||||
|
return m_gl_context->MakeCurrent(nullptr, error);
|
||||||
|
}
|
||||||
|
|
||||||
std::string OpenGLDevice::GetDriverInfo() const
|
std::string OpenGLDevice::GetDriverInfo() const
|
||||||
{
|
{
|
||||||
const char* gl_vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
|
const char* gl_vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
|
||||||
|
|
|
@ -52,6 +52,7 @@ public:
|
||||||
const ExclusiveFullscreenMode* exclusive_fullscreen_mode,
|
const ExclusiveFullscreenMode* exclusive_fullscreen_mode,
|
||||||
std::optional<bool> exclusive_fullscreen_control,
|
std::optional<bool> exclusive_fullscreen_control,
|
||||||
Error* error) override;
|
Error* error) override;
|
||||||
|
bool SwitchToSurfacelessRendering(Error* error) override;
|
||||||
std::unique_ptr<GPUTexture> CreateTexture(u32 width, u32 height, u32 layers, u32 levels, u32 samples,
|
std::unique_ptr<GPUTexture> CreateTexture(u32 width, u32 height, u32 layers, u32 levels, u32 samples,
|
||||||
GPUTexture::Type type, GPUTexture::Format format, GPUTexture::Flags flags,
|
GPUTexture::Type type, GPUTexture::Format format, GPUTexture::Flags flags,
|
||||||
const void* data = nullptr, u32 data_stride = 0,
|
const void* data = nullptr, u32 data_stride = 0,
|
||||||
|
|
Loading…
Reference in New Issue