mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 06:47:19 +00:00
[host] dxgi: allow copy backend selection
This commit is contained in:
parent
68e5b812a9
commit
cf7d501bc4
@ -195,6 +195,7 @@ static void d3d11_preRelease(void)
|
||||
|
||||
struct DXGICopyBackend copyBackendD3D11 = {
|
||||
.name = "Direct3D 11",
|
||||
.code = "d3d11",
|
||||
.create = d3d11_create,
|
||||
.free = d3d11_free,
|
||||
.copyFrame = d3d11_copyFrame,
|
||||
|
@ -446,6 +446,7 @@ static void d3d12_preRelease(void)
|
||||
|
||||
struct DXGICopyBackend copyBackendD3D12 = {
|
||||
.name = "Direct3D 12",
|
||||
.code = "d3d12",
|
||||
.create = d3d12_create,
|
||||
.free = d3d12_free,
|
||||
.copyFrame = d3d12_copyFrame,
|
||||
|
@ -106,6 +106,13 @@ static void dxgi_initOptions(void)
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = false
|
||||
},
|
||||
{
|
||||
.module = "dxgi",
|
||||
.name = "copyBackend",
|
||||
.description = "The copy backend to use, i.e. d3d11 or d3d12",
|
||||
.type = OPTION_TYPE_STRING,
|
||||
.value.x_string = "d3d11",
|
||||
},
|
||||
{0}
|
||||
};
|
||||
|
||||
@ -487,10 +494,17 @@ static bool dxgi_init(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
const char * copyBackend = option_get_string("dxgi", "copyBackend");
|
||||
for (int i = 0; i < ARRAY_LENGTH(backends); ++i)
|
||||
{
|
||||
if (backends[i]->create(this))
|
||||
if (!strcasecmp(copyBackend, backends[i]->code))
|
||||
{
|
||||
if (!backends[i]->create(this))
|
||||
{
|
||||
DEBUG_ERROR("Failed to initialize selected capture backend: %s", backends[i]->name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
this->backend = backends[i];
|
||||
break;
|
||||
}
|
||||
@ -498,12 +512,12 @@ static bool dxgi_init(void)
|
||||
|
||||
if (!this->backend)
|
||||
{
|
||||
DEBUG_ERROR("Could not find a usable copy backend");
|
||||
DEBUG_ERROR("Could not find copy backend: %s", copyBackend);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
DEBUG_INFO("Copy backend : %s", this->backend->name);
|
||||
DEBUG_INFO("AcquireLock : %s", this->useAcquireLock ? "enabled" : "disabled");
|
||||
DEBUG_INFO("Copy backend : %s", this->backend->name);
|
||||
DEBUG_INFO("AcquireLock : %s", this->useAcquireLock ? "enabled" : "disabled");
|
||||
|
||||
for (int i = 0; i < this->maxTextures; ++i)
|
||||
this->texture[i].texDamageCount = -1;
|
||||
|
@ -108,6 +108,7 @@ struct DXGIInterface
|
||||
struct DXGICopyBackend
|
||||
{
|
||||
const char * name;
|
||||
const char * code;
|
||||
bool (*create)(struct DXGIInterface * intf);
|
||||
void (*free)(void);
|
||||
bool (*copyFrame)(Texture * tex, ID3D11Texture2D * src);
|
||||
|
Loading…
Reference in New Issue
Block a user