diff --git a/host/platform/Windows/capture/D12/backend.h b/host/platform/Windows/capture/D12/backend.h index 7e7b7c80..e9dc4b80 100644 --- a/host/platform/Windows/capture/D12/backend.h +++ b/host/platform/Windows/capture/D12/backend.h @@ -58,10 +58,11 @@ struct D12Backend CaptureResult (*sync)(D12Backend * instance, ID3D12CommandQueue * commandQueue); - ID3D12Resource * (*fetch)(D12Backend * instance, - unsigned frameBufferIndex, - const RECT ** dirtyRects, - unsigned * nbDirtyRects); + ID3D12Resource * (*fetch)( + D12Backend * instance, + unsigned frameBufferIndex, + RECT ** dirtyRects, + unsigned * nbDirtyRects); }; static inline bool d12_backendCreate(const D12Backend * backend, @@ -96,8 +97,7 @@ static inline CaptureResult d12_backendSync(D12Backend * instance, { return instance->sync(instance, commandQueue); } static inline ID3D12Resource * d12_backendFetch(D12Backend * instance, - unsigned frameBufferIndex, const RECT ** dirtyRects, - unsigned * nbDirtyRects) + unsigned frameBufferIndex, RECT ** dirtyRects, unsigned * nbDirtyRects) { return instance->fetch(instance, frameBufferIndex, dirtyRects, nbDirtyRects); } diff --git a/host/platform/Windows/capture/D12/backend/dd.c b/host/platform/Windows/capture/D12/backend/dd.c index a07f107d..e874f351 100644 --- a/host/platform/Windows/capture/D12/backend/dd.c +++ b/host/platform/Windows/capture/D12/backend/dd.c @@ -419,7 +419,7 @@ static CaptureResult d12_dd_sync(D12Backend * instance, } static ID3D12Resource * d12_dd_fetch(D12Backend * instance, - unsigned frameBufferIndex, const RECT * dirtyRects[static D12_MAX_DIRTY_RECTS], + unsigned frameBufferIndex, RECT * dirtyRects[static D12_MAX_DIRTY_RECTS], unsigned * nbDirtyRects) { DDInstance * this = UPCAST(DDInstance, instance); diff --git a/host/platform/Windows/capture/D12/d12.c b/host/platform/Windows/capture/D12/d12.c index ac1c438b..ee959f8f 100644 --- a/host/platform/Windows/capture/D12/d12.c +++ b/host/platform/Windows/capture/D12/d12.c @@ -428,7 +428,7 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex, CaptureResult result = CAPTURE_RESULT_ERROR; comRef_scopePush(1); - const RECT * dirtyRects; + RECT * dirtyRects; unsigned nbDirtyRects; comRef_defineLocal(ID3D12Resource, src); @@ -543,7 +543,7 @@ static CaptureResult d12_getFrame(unsigned frameBufferIndex, CaptureResult result = CAPTURE_RESULT_ERROR; comRef_scopePush(3); - const RECT * dirtyRects; + RECT * dirtyRects; unsigned nbDirtyRects; comRef_defineLocal(ID3D12Resource, src); @@ -572,7 +572,8 @@ static CaptureResult d12_getFrame(unsigned frameBufferIndex, if (this->allowRGB24) { next = d12_effectRun( - this->effectRGB24, *this->device, *this->computeCommand.gfxList, next); + this->effectRGB24, *this->device, *this->computeCommand.gfxList, next, + dirtyRects, &nbDirtyRects); } // copy into the framebuffer resource diff --git a/host/platform/Windows/capture/D12/effect.h b/host/platform/Windows/capture/D12/effect.h index f9357ffd..64ae4898 100644 --- a/host/platform/Windows/capture/D12/effect.h +++ b/host/platform/Windows/capture/D12/effect.h @@ -41,8 +41,11 @@ struct D12Effect D3D12_RESOURCE_DESC * dst); ID3D12Resource * (*run)(D12Effect * effect, - ID3D12Device3 * device, ID3D12GraphicsCommandList * commandList, - ID3D12Resource * src); + ID3D12Device3 * device, + ID3D12GraphicsCommandList * commandList, + ID3D12Resource * src, + RECT dirtyRects[], + unsigned * nbDirtyRects); }; static inline bool d12_effectCreate(const D12Effect * effect, @@ -68,9 +71,13 @@ static inline bool d12_effectSetFormat(D12Effect * effect, { return effect->setFormat(effect, device, src, dst); } static inline ID3D12Resource * d12_effectRun(D12Effect * effect, - ID3D12Device3 * device, ID3D12GraphicsCommandList * commandList, - ID3D12Resource * src) - { return effect->run(effect, device, commandList, src); } + ID3D12Device3 * device, + ID3D12GraphicsCommandList * commandList, + ID3D12Resource * src, + RECT dirtyRects[], + unsigned * nbDirtyRects) + { return effect->run(effect, device, commandList, src, + dirtyRects, nbDirtyRects); } // effect defines diff --git a/host/platform/Windows/capture/D12/effect/rgb24.c b/host/platform/Windows/capture/D12/effect/rgb24.c index d325b20a..7f32ca25 100644 --- a/host/platform/Windows/capture/D12/effect/rgb24.c +++ b/host/platform/Windows/capture/D12/effect/rgb24.c @@ -278,7 +278,7 @@ exit: static ID3D12Resource * d12_effect_rgb24Run(D12Effect * effect, ID3D12Device3 * device, ID3D12GraphicsCommandList * commandList, - ID3D12Resource * src) + ID3D12Resource * src, RECT dirtyRects[], unsigned * nbDirtyRects) { TestInstance * this = UPCAST(TestInstance, effect); @@ -365,6 +365,14 @@ static ID3D12Resource * d12_effect_rgb24Run(D12Effect * effect, ID3D12GraphicsCommandList_ResourceBarrier(commandList, 1, &barrier); } + // adjust the dirty rects + for(RECT * rect = dirtyRects; rect < dirtyRects + *nbDirtyRects; ++rect) + { + unsigned width = rect->right - rect->left; + rect->left = (rect->left * 3) / 4; + rect->right = rect->left + (width * 3 + 3) / 4; + } + // return the output buffer return *this->dst; }