Skip to content

Commit

Permalink
[host] d12: correct the pitch when HDR16 is in use
Browse files Browse the repository at this point in the history
  • Loading branch information
gnif committed Feb 28, 2024
1 parent ad7ac65 commit a894348
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions host/platform/Windows/capture/D12/d12.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,16 +522,15 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,
goto exit;
}

D12FrameFormat dstFormat = this->dstFormat;

// if the input format changed, reconfigure the effects
if (srcFormat.desc.Width == 0 ||
srcFormat.desc.Width != this->captureFormat.desc.Width ||
srcFormat.desc.Height != this->captureFormat.desc.Height ||
srcFormat.desc.Format != this->captureFormat.desc.Format ||
srcFormat.colorSpace != this->captureFormat.colorSpace)
{
this->captureFormat = srcFormat;
D12FrameFormat dstFormat = this->dstFormat;
this->captureFormat = srcFormat;

D12Effect * effect;
D12FrameFormat curFormat = srcFormat;
Expand Down Expand Up @@ -571,7 +570,7 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,

D3D12_PLACED_SUBRESOURCE_FOOTPRINT layout;
ID3D12Device3_GetCopyableFootprints(*this->device,
&dstFormat.desc,
&this->dstFormat.desc,
0 , // FirstSubresource
1 , // NumSubresources
0 , // BaseOffset,
Expand All @@ -581,20 +580,21 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,
NULL); // pTotalBytes
this->pitch = layout.Footprint.RowPitch;

const unsigned int maxRows = maxFrameSize / layout.Footprint.RowPitch;
const unsigned maxRows = maxFrameSize / layout.Footprint.RowPitch;
const unsigned bpp = this->dstFormat.format == CAPTURE_FMT_RGBA16F ? 8 : 4;

frame->formatVer = this->formatVer;
frame->screenWidth = srcFormat.width;
frame->screenHeight = srcFormat.height;
frame->dataWidth = dstFormat.desc.Width;
frame->dataHeight = min(maxRows, dstFormat.desc.Height);
frame->frameWidth = dstFormat.width;
frame->frameHeight = dstFormat.height;
frame->truncated = maxRows < dstFormat.desc.Height;
frame->pitch = layout.Footprint.RowPitch;
frame->stride = layout.Footprint.RowPitch / 4;
frame->format = dstFormat.format;
frame->hdr = dstFormat.colorSpace ==
frame->dataWidth = this->dstFormat.desc.Width;
frame->dataHeight = min(maxRows, this->dstFormat.desc.Height);
frame->frameWidth = this->dstFormat.width;
frame->frameHeight = this->dstFormat.height;
frame->truncated = maxRows < this->dstFormat.desc.Height;
frame->pitch = this->pitch;
frame->stride = this->pitch / bpp;
frame->format = this->dstFormat.format;
frame->hdr = this->dstFormat.colorSpace ==
DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020;
frame->hdrPQ = false;
frame->rotation = desc.rotation;
Expand Down

0 comments on commit a894348

Please sign in to comment.