mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-24 21:40:10 +00:00
VideoBackends:Metal: Headless render support
This commit is contained in:
parent
1d07332657
commit
83ca1ad8a6
@ -54,6 +54,7 @@ static bool WindowSystemTypeSupportsMetal(WindowSystemType type)
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case WindowSystemType::MacOS:
|
case WindowSystemType::MacOS:
|
||||||
|
case WindowSystemType::Headless:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -64,7 +65,8 @@ bool Metal::VideoBackend::Initialize(const WindowSystemInfo& wsi)
|
|||||||
{
|
{
|
||||||
@autoreleasepool
|
@autoreleasepool
|
||||||
{
|
{
|
||||||
if (!WindowSystemTypeSupportsMetal(wsi.type) || !wsi.render_surface)
|
const bool surface_ok = wsi.type == WindowSystemType::Headless || wsi.render_surface;
|
||||||
|
if (!WindowSystemTypeSupportsMetal(wsi.type) || !surface_ok)
|
||||||
{
|
{
|
||||||
PanicAlertFmt("Bad WindowSystemInfo for Metal renderer.");
|
PanicAlertFmt("Bad WindowSystemInfo for Metal renderer.");
|
||||||
return false;
|
return false;
|
||||||
@ -100,6 +102,8 @@ bool Metal::VideoBackend::Initialize(const WindowSystemInfo& wsi)
|
|||||||
[layer setPixelFormat:MTLPixelFormatBGRA8Unorm];
|
[layer setPixelFormat:MTLPixelFormatBGRA8Unorm];
|
||||||
CGSize size = [layer bounds].size;
|
CGSize size = [layer bounds].size;
|
||||||
float scale = [layer contentsScale];
|
float scale = [layer contentsScale];
|
||||||
|
if (!layer) // headless
|
||||||
|
scale = 1.0;
|
||||||
|
|
||||||
ObjectCache::Initialize(std::move(adapter));
|
ObjectCache::Initialize(std::move(adapter));
|
||||||
g_state_tracker = std::make_unique<StateTracker>();
|
g_state_tracker = std::make_unique<StateTracker>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user