[host] d12: correct the pitch when HDR16 is in use

This commit is contained in:
Geoffrey McRae 2024-02-28 12:23:41 +11:00
parent ad7ac6540f
commit a894348530

View File

@ -522,8 +522,6 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,
goto exit; goto exit;
} }
D12FrameFormat dstFormat = this->dstFormat;
// if the input format changed, reconfigure the effects // if the input format changed, reconfigure the effects
if (srcFormat.desc.Width == 0 || if (srcFormat.desc.Width == 0 ||
srcFormat.desc.Width != this->captureFormat.desc.Width || srcFormat.desc.Width != this->captureFormat.desc.Width ||
@ -531,6 +529,7 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,
srcFormat.desc.Format != this->captureFormat.desc.Format || srcFormat.desc.Format != this->captureFormat.desc.Format ||
srcFormat.colorSpace != this->captureFormat.colorSpace) srcFormat.colorSpace != this->captureFormat.colorSpace)
{ {
D12FrameFormat dstFormat = this->dstFormat;
this->captureFormat = srcFormat; this->captureFormat = srcFormat;
D12Effect * effect; D12Effect * effect;
@ -571,7 +570,7 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,
D3D12_PLACED_SUBRESOURCE_FOOTPRINT layout; D3D12_PLACED_SUBRESOURCE_FOOTPRINT layout;
ID3D12Device3_GetCopyableFootprints(*this->device, ID3D12Device3_GetCopyableFootprints(*this->device,
&dstFormat.desc, &this->dstFormat.desc,
0 , // FirstSubresource 0 , // FirstSubresource
1 , // NumSubresources 1 , // NumSubresources
0 , // BaseOffset, 0 , // BaseOffset,
@ -581,20 +580,21 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,
NULL); // pTotalBytes NULL); // pTotalBytes
this->pitch = layout.Footprint.RowPitch; 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->formatVer = this->formatVer;
frame->screenWidth = srcFormat.width; frame->screenWidth = srcFormat.width;
frame->screenHeight = srcFormat.height; frame->screenHeight = srcFormat.height;
frame->dataWidth = dstFormat.desc.Width; frame->dataWidth = this->dstFormat.desc.Width;
frame->dataHeight = min(maxRows, dstFormat.desc.Height); frame->dataHeight = min(maxRows, this->dstFormat.desc.Height);
frame->frameWidth = dstFormat.width; frame->frameWidth = this->dstFormat.width;
frame->frameHeight = dstFormat.height; frame->frameHeight = this->dstFormat.height;
frame->truncated = maxRows < dstFormat.desc.Height; frame->truncated = maxRows < this->dstFormat.desc.Height;
frame->pitch = layout.Footprint.RowPitch; frame->pitch = this->pitch;
frame->stride = layout.Footprint.RowPitch / 4; frame->stride = this->pitch / bpp;
frame->format = dstFormat.format; frame->format = this->dstFormat.format;
frame->hdr = dstFormat.colorSpace == frame->hdr = this->dstFormat.colorSpace ==
DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020; DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020;
frame->hdrPQ = false; frame->hdrPQ = false;
frame->rotation = desc.rotation; frame->rotation = desc.rotation;