mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-21 21:17:19 +00:00
[host] d12: fix damage tracking with RGB24 enabled
This commit is contained in:
parent
2f3ca443cf
commit
4408359597
@ -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); }
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user