[host] dxgi: add option to enable RGB24 packing support

This commit is contained in:
Geoffrey McRae 2023-11-07 21:14:01 +11:00
parent d6519c4486
commit fd79bb1333
2 changed files with 14 additions and 1 deletions

View File

@ -119,6 +119,7 @@ struct DXGIInterface
LG_Lock deviceContextLock; LG_Lock deviceContextLock;
bool debug; bool debug;
bool useAcquireLock; bool useAcquireLock;
bool allowRGB24;
bool dwmFlush; bool dwmFlush;
bool disableDamage; bool disableDamage;
D3D_FEATURE_LEVEL featureLevel; D3D_FEATURE_LEVEL featureLevel;
@ -260,6 +261,13 @@ static void dxgi_initOptions(void)
.type = OPTION_TYPE_BOOL, .type = OPTION_TYPE_BOOL,
.value.x_bool = false .value.x_bool = false
}, },
{
.module = "dxgi",
.name = "allowRGB24",
.description = "Losslessly pack 32-bit RGBA8 into 24-bit RGB (saves bandwidth)",
.type = OPTION_TYPE_BOOL,
.value.x_bool = false
},
{0} {0}
}; };
@ -291,6 +299,7 @@ static bool dxgi_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostP
this->debug = option_get_bool("dxgi", "debug"); this->debug = option_get_bool("dxgi", "debug");
this->useAcquireLock = option_get_bool("dxgi", "useAcquireLock"); this->useAcquireLock = option_get_bool("dxgi", "useAcquireLock");
this->allowRGB24 = option_get_bool("dxgi", "allowRGB24");
this->dwmFlush = option_get_bool("dxgi", "dwmFlush"); this->dwmFlush = option_get_bool("dxgi", "dwmFlush");
this->disableDamage = option_get_bool("dxgi", "disableDamage"); this->disableDamage = option_get_bool("dxgi", "disableDamage");
this->texture = calloc(this->maxTextures, sizeof(*this->texture)); this->texture = calloc(this->maxTextures, sizeof(*this->texture));
@ -842,7 +851,7 @@ static bool dxgi_init(void)
} }
//If not HDR, pack to RGB24 //If not HDR, pack to RGB24
if (!this->hdr) if (!this->hdr && this->allowRGB24)
{ {
if (!ppInit(&DXGIPP_RGB24, shareable)) if (!ppInit(&DXGIPP_RGB24, shareable))
DEBUG_WARN("Failed to initialize the RGB24 post processor"); DEBUG_WARN("Failed to initialize the RGB24 post processor");

View File

@ -141,6 +141,10 @@ static bool rgb24_configure(void * opaque,
} }
comRef_toGlobal(this.pshader, pshader); comRef_toGlobal(this.pshader, pshader);
DEBUG_INFO("RGBA to RGB packing enabled, %.2f MiB per frame saved",
(float)((*width * *height - this.width * this.height) * 4) / 1048576
);
} }
// This texture is actually going to contain the packed BGR24 output // This texture is actually going to contain the packed BGR24 output