mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-25 15:15:40 +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);
|
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)
|
if (g_gpu_device)
|
||||||
{
|
{
|
||||||
|
|
|
@ -108,10 +108,9 @@ bool GPUPipeline::InputLayout::operator==(const InputLayout& rhs) const
|
||||||
|
|
||||||
bool GPUPipeline::InputLayout::operator!=(const InputLayout& rhs) const
|
bool GPUPipeline::InputLayout::operator!=(const InputLayout& rhs) const
|
||||||
{
|
{
|
||||||
return (vertex_stride != rhs.vertex_stride ||
|
return (vertex_stride != rhs.vertex_stride || vertex_attributes.size() != rhs.vertex_attributes.size() ||
|
||||||
vertex_attributes.size() != rhs.vertex_attributes.size() ||
|
std::memcmp(vertex_attributes.data(), rhs.vertex_attributes.data(),
|
||||||
std::memcmp(vertex_attributes.data(), rhs.vertex_attributes.data(),
|
sizeof(VertexAttribute) * rhs.vertex_attributes.size()) != 0);
|
||||||
sizeof(VertexAttribute) * rhs.vertex_attributes.size()) != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUPipeline::RasterizationState GPUPipeline::RasterizationState::GetNoCullState()
|
GPUPipeline::RasterizationState GPUPipeline::RasterizationState::GetNoCullState()
|
||||||
|
@ -199,7 +198,6 @@ RenderAPI GPUDevice::GetPreferredAPI()
|
||||||
|
|
||||||
const char* GPUDevice::RenderAPIToString(RenderAPI api)
|
const char* GPUDevice::RenderAPIToString(RenderAPI api)
|
||||||
{
|
{
|
||||||
// TODO: Combine ES
|
|
||||||
switch (api)
|
switch (api)
|
||||||
{
|
{
|
||||||
// clang-format off
|
// 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,
|
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)
|
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.
|
/// Returns a new device for the specified API.
|
||||||
static std::unique_ptr<GPUDevice> CreateDeviceForAPI(RenderAPI 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)
|
/// Parses a fullscreen mode into its components (width * height @ refresh hz)
|
||||||
static bool GetRequestedExclusiveFullscreenMode(u32* width, u32* height, float* refresh_rate);
|
static bool GetRequestedExclusiveFullscreenMode(u32* width, u32* height, float* refresh_rate);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue