[host] dxgi: add option to disable damage-aware copies

This commit is contained in:
Quantum 2022-01-09 22:28:01 -05:00 committed by Geoffrey McRae
parent cf7d501bc4
commit c69b19e68f
2 changed files with 14 additions and 1 deletions

View File

@ -113,6 +113,13 @@ static void dxgi_initOptions(void)
.type = OPTION_TYPE_STRING,
.value.x_string = "d3d11",
},
{
.module = "dxgi",
.name = "disableDamage",
.description = "Do not do damage-aware copies, i.e. always do full frame copies",
.type = OPTION_TYPE_BOOL,
.value.x_bool = false
},
{0}
};
@ -143,6 +150,7 @@ static bool dxgi_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostP
this->useAcquireLock = option_get_bool("dxgi", "useAcquireLock");
this->dwmFlush = option_get_bool("dxgi", "dwmFlush");
this->disableDamage = option_get_bool("dxgi", "disableDamage");
this->texture = calloc(this->maxTextures, sizeof(*this->texture));
this->getPointerBufferFn = getPointerBufferFn;
this->postPointerBufferFn = postPointerBufferFn;
@ -517,7 +525,8 @@ static bool dxgi_init(void)
}
DEBUG_INFO("Copy backend : %s", this->backend->name);
DEBUG_INFO("AcquireLock : %s", this->useAcquireLock ? "enabled" : "disabled");
DEBUG_INFO("AcquireLock : %s", this->useAcquireLock ? "enabled" : "disabled");
DEBUG_INFO("Damage-aware copy : %s", this->disableDamage ? "disabled" : "enabled" );
for (int i = 0; i < this->maxTextures; ++i)
this->texture[i].texDamageCount = -1;
@ -669,6 +678,9 @@ static void computeFrameDamage(Texture * tex)
// By default, damage the full frame.
tex->damageRectsCount = 0;
if (this->disableDamage)
return;
const int maxDamageRectsCount = ARRAY_LENGTH(tex->damageRects);
// Compute dirty rectangles.

View File

@ -75,6 +75,7 @@ struct DXGIInterface
LG_Lock deviceContextLock;
bool useAcquireLock;
bool dwmFlush;
bool disableDamage;
D3D_FEATURE_LEVEL featureLevel;
IDXGIOutputDuplication * dup;
int maxTextures;