mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 13:55:38 +00:00
GPUDevice: Don't recreate device on SW switch in GLES:
This commit is contained in:
parent
2a5b3aa695
commit
9517638bcb
|
@ -1954,7 +1954,8 @@ bool System::CreateGPU(GPURenderer renderer, bool is_switching)
|
|||
{
|
||||
const RenderAPI api = Settings::GetRenderAPIForRenderer(renderer);
|
||||
|
||||
if (!g_gpu_device || (renderer != GPURenderer::Software && g_gpu_device->GetRenderAPI() != api))
|
||||
if (!g_gpu_device ||
|
||||
(renderer != GPURenderer::Software && !GPUDevice::IsSameRenderAPI(g_gpu_device->GetRenderAPI(), api)))
|
||||
{
|
||||
if (g_gpu_device)
|
||||
{
|
||||
|
|
|
@ -108,8 +108,7 @@ bool GPUPipeline::InputLayout::operator==(const InputLayout& rhs) const
|
|||
|
||||
bool GPUPipeline::InputLayout::operator!=(const InputLayout& rhs) const
|
||||
{
|
||||
return (vertex_stride != rhs.vertex_stride ||
|
||||
vertex_attributes.size() != rhs.vertex_attributes.size() ||
|
||||
return (vertex_stride != rhs.vertex_stride || vertex_attributes.size() != rhs.vertex_attributes.size() ||
|
||||
std::memcmp(vertex_attributes.data(), rhs.vertex_attributes.data(),
|
||||
sizeof(VertexAttribute) * rhs.vertex_attributes.size()) != 0);
|
||||
}
|
||||
|
@ -199,7 +198,6 @@ RenderAPI GPUDevice::GetPreferredAPI()
|
|||
|
||||
const char* GPUDevice::RenderAPIToString(RenderAPI api)
|
||||
{
|
||||
// TODO: Combine ES
|
||||
switch (api)
|
||||
{
|
||||
// clang-format off
|
||||
|
@ -218,6 +216,12 @@ const char* GPUDevice::RenderAPIToString(RenderAPI api)
|
|||
}
|
||||
}
|
||||
|
||||
bool GPUDevice::IsSameRenderAPI(RenderAPI lhs, RenderAPI rhs)
|
||||
{
|
||||
return (lhs == rhs || ((lhs == RenderAPI::OpenGL || lhs == RenderAPI::OpenGLES) &&
|
||||
(rhs == RenderAPI::OpenGL || rhs == RenderAPI::OpenGLES)));
|
||||
}
|
||||
|
||||
bool GPUDevice::Create(const std::string_view& adapter, const std::string_view& shader_cache_path,
|
||||
u32 shader_cache_version, bool debug_device, bool vsync, bool threaded_presentation)
|
||||
{
|
||||
|
|
|
@ -472,6 +472,9 @@ public:
|
|||
/// Returns a new device for the specified API.
|
||||
static std::unique_ptr<GPUDevice> CreateDeviceForAPI(RenderAPI api);
|
||||
|
||||
/// Returns true if the render API is the same (e.g. GLES and GL).
|
||||
static bool IsSameRenderAPI(RenderAPI lhs, RenderAPI rhs);
|
||||
|
||||
/// Parses a fullscreen mode into its components (width * height @ refresh hz)
|
||||
static bool GetRequestedExclusiveFullscreenMode(u32* width, u32* height, float* refresh_rate);
|
||||
|
||||
|
|
Loading…
Reference in a new issue