diff --git a/host/platform/Windows/capture/DXGI/src/dxgi.c b/host/platform/Windows/capture/DXGI/src/dxgi.c index 5d68ec5c..d5cbef76 100644 --- a/host/platform/Windows/capture/DXGI/src/dxgi.c +++ b/host/platform/Windows/capture/DXGI/src/dxgi.c @@ -119,6 +119,7 @@ struct DXGIInterface LG_Lock deviceContextLock; bool debug; bool useAcquireLock; + bool allowRGB24; bool dwmFlush; bool disableDamage; D3D_FEATURE_LEVEL featureLevel; @@ -260,6 +261,13 @@ static void dxgi_initOptions(void) .type = OPTION_TYPE_BOOL, .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} }; @@ -291,6 +299,7 @@ static bool dxgi_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostP this->debug = option_get_bool("dxgi", "debug"); this->useAcquireLock = option_get_bool("dxgi", "useAcquireLock"); + this->allowRGB24 = option_get_bool("dxgi", "allowRGB24"); this->dwmFlush = option_get_bool("dxgi", "dwmFlush"); this->disableDamage = option_get_bool("dxgi", "disableDamage"); this->texture = calloc(this->maxTextures, sizeof(*this->texture)); @@ -842,7 +851,7 @@ static bool dxgi_init(void) } //If not HDR, pack to RGB24 - if (!this->hdr) + if (!this->hdr && this->allowRGB24) { if (!ppInit(&DXGIPP_RGB24, shareable)) DEBUG_WARN("Failed to initialize the RGB24 post processor"); diff --git a/host/platform/Windows/capture/DXGI/src/pp/rgb24.c b/host/platform/Windows/capture/DXGI/src/pp/rgb24.c index 2544585b..7ddf25ca 100644 --- a/host/platform/Windows/capture/DXGI/src/pp/rgb24.c +++ b/host/platform/Windows/capture/DXGI/src/pp/rgb24.c @@ -141,6 +141,10 @@ static bool rgb24_configure(void * opaque, } 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