Skip to content

Commit

Permalink
[host] d12: added downsampler
Browse files Browse the repository at this point in the history
  • Loading branch information
gnif committed Feb 28, 2024
1 parent 97d91a3 commit 4463ca1
Show file tree
Hide file tree
Showing 6 changed files with 548 additions and 9 deletions.
1 change: 1 addition & 0 deletions host/platform/Windows/capture/D12/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ add_library(capture_D12 STATIC
backend/dd.c
effect/rgb24.c
effect/hdr16to10.c
effect/downsample.c
)

target_link_libraries(capture_D12
Expand Down
9 changes: 7 additions & 2 deletions host/platform/Windows/capture/D12/d12.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,11 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,
frame->hdrPQ = false;
frame->rotation = desc.rotation;

D12Effect * effect;
vector_forEach(effect, &this->effects)
if (effect->enabled)
d12_effectAdjustDamage(effect, desc.dirtyRects, &desc.nbDirtyRects);

{
// create a clean list of rects
FrameDamageRect allRects[desc.nbDirtyRects];
Expand All @@ -594,8 +599,8 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,
allRects[count++] = (FrameDamageRect){
.x = rect->left,
.y = rect->top,
.width = rect->right - rect->left,
.height = rect->bottom - rect->top
.width = (rect->right - rect->left),
.height = (rect->bottom - rect->top)
};

count = rectsMergeOverlapping(allRects, count);
Expand Down
10 changes: 10 additions & 0 deletions host/platform/Windows/capture/D12/effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ struct D12Effect
const D12FrameFormat * src,
D12FrameFormat * dst);

void (*adjustDamage)(D12Effect * effect,
RECT dirtyRects[],
unsigned * nbDirtyRects);

ID3D12Resource * (*run)(D12Effect * effect,
ID3D12Device3 * device,
ID3D12GraphicsCommandList * commandList,
Expand Down Expand Up @@ -90,6 +94,12 @@ static inline D12EffectStatus d12_effectSetFormat(D12Effect * effect,
D12FrameFormat * dst)
{ return effect->setFormat(effect, device, src, dst); }

static inline void d12_effectAdjustDamage(D12Effect * effect,
RECT dirtyRects[],
unsigned * nbDirtyRects)
{ if (effect->adjustDamage)
effect->adjustDamage(effect, dirtyRects, nbDirtyRects); }

static inline ID3D12Resource * d12_effectRun(D12Effect * effect,
ID3D12Device3 * device,
ID3D12GraphicsCommandList * commandList,
Expand Down
Loading

0 comments on commit 4463ca1

Please sign in to comment.