Skip to content

Commit

Permalink
Merge pull request #511 from romkal/hdr
Browse files Browse the repository at this point in the history
Fix HDR flashing
  • Loading branch information
psieg committed Jan 3, 2022
2 parents 0de02ba + 09ac72c commit c6b0a43
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ See #280 for details.
* [Qt SDK](http://qt-project.org/downloads), you may need to set `%QTDIR%` (sysdm.cpl → Advanced → Environment Variables → New) to something like `C:\Qt\x.xx.x\msvc_xxxx\`.
* Visual Studio, [Windows SDK](https://msdn.microsoft.com/en-us/windows/desktop/ff851942.aspx) or [Microsoft DirectX SDK](http://www.microsoft.com/en-us/download/details.aspx?id=6812)
* optional (if you want to create an installer) POSIX shell utilities [MSYS for example](http://www.mingw.org/wiki/MSYS).
* optional [any](https://wiki.openssl.org/index.php/Binaries) [OpenSSL binaries](https://slproweb.com/products/Win32OpenSSL.html) to include them in the setup. If you just want to build, you can skip them in `build-vars.prf` (this will render the update check ineffective).
* optional [any 1.1](https://wiki.openssl.org/index.php/Binaries) [OpenSSL binaries](https://slproweb.com/products/Win32OpenSSL.html) to include them in the setup. If you just want to build, you can skip them in `build-vars.prf` (this will render the update check ineffective).
* optional [BASS and BASSWASAPI](http://www.un4seen.com/) for the Sound Visualizer. You can skip them in `build-vars.prf`.

#### Build Process:
Expand Down
18 changes: 14 additions & 4 deletions Software/grab/DDuplGrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,11 @@ GrabResult DDuplGrabber::grabScreens()
qCritical(Q_FUNC_INFO " Failed to AcquireNextFrame: 0x%X", hr);
return GrabResultError;
}
anyUpdate = true;

if (frameInfo.LastPresentTime.QuadPart == 0) {
// No update since last aquisition. Consider it done.
screenData->duplication->ReleaseFrame();
continue;
}
ID3D11Texture2DPtr texture;
hr = resource->QueryInterface(IID_ID3D11Texture2D, (void**)&texture);
if (FAILED(hr))
Expand All @@ -647,7 +650,14 @@ GrabResult DDuplGrabber::grabScreens()
desc.Height);
return GrabResultError;
}

BufferFormat bufferFormat = mapDXGIFormatToBufferFormat(desc.Format);
if (bufferFormat == BufferFormat::BufferFormatUnknown) {
qWarning() << "Unsupported format " << desc.Format << " on frame " << grabScreensCount;
screenData->duplication->ReleaseFrame();
// This is not a good format. Drop it.
continue;
}
anyUpdate = true;
D3D11_TEXTURE2D_DESC texDesc;
ZeroMemory(&texDesc, sizeof(texDesc));
texDesc.Width = desc.Width >> DownscaleMipLevel;
Expand Down Expand Up @@ -734,7 +744,7 @@ GrabResult DDuplGrabber::grabScreens()

screen.imgData = screenData->surfaceMap.pBits;
screen.imgDataSize = texDesc.Height * screenData->surfaceMap.Pitch;
screen.imgFormat = mapDXGIFormatToBufferFormat(desc.Format);
screen.imgFormat = bufferFormat;
screen.scale = 1.0 / (1 << DownscaleMipLevel);
screen.bytesPerRow = screenData->surfaceMap.Pitch;

Expand Down

0 comments on commit c6b0a43

Please sign in to comment.