mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[host] dxgi: fix HDR content downsampling
This commit is contained in:
parent
561c45bcb9
commit
09b6fee360
@ -739,27 +739,28 @@ static bool dxgi_init(void)
|
|||||||
if (!initVertexShader())
|
if (!initVertexShader())
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!ppInit(&DXGIPP_Downsample,
|
bool shareable = this->backend != ©BackendD3D11;
|
||||||
this->backend != ©BackendD3D11 && !this->hdr))
|
|
||||||
{
|
|
||||||
DEBUG_ERROR("Failed to intiailize the downsample post processor");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if HDR add the SDRWhiteLevel post processor to correct the output
|
|
||||||
if (this->hdr)
|
if (this->hdr)
|
||||||
{
|
{
|
||||||
if (!ppInit(&DXGIPP_SDRWhiteLevel, this->backend != ©BackendD3D11))
|
//HDR content needs to be corrected and converted to HDR10
|
||||||
|
if (!ppInit(&DXGIPP_SDRWhiteLevel, shareable))
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to initialize the SDRWhiteLevel post processor");
|
DEBUG_ERROR("Failed to initialize the SDRWhiteLevel post processor");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
//Downsampling must happen before conversion to RGB24
|
||||||
|
if (!ppInit(&DXGIPP_Downsample, shareable))
|
||||||
{
|
{
|
||||||
// only support DX11 for this atm
|
DEBUG_ERROR("Failed to intiailize the downsample post processor");
|
||||||
if (this->backend == ©BackendD3D11)
|
goto fail;
|
||||||
if (!ppInit(&DXGIPP_RGB24, false))
|
}
|
||||||
|
|
||||||
|
//If not HDR, pack to RGB24
|
||||||
|
if (!this->hdr)
|
||||||
|
{
|
||||||
|
if (!ppInit(&DXGIPP_RGB24, shareable))
|
||||||
DEBUG_WARN("Failed to initialize the RGB24 post processor");
|
DEBUG_WARN("Failed to initialize the RGB24 post processor");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ static bool downsample_configure(void * opaque,
|
|||||||
.SampleDesc.Count = 1,
|
.SampleDesc.Count = 1,
|
||||||
.SampleDesc.Quality = 0,
|
.SampleDesc.Quality = 0,
|
||||||
.Usage = D3D11_USAGE_DEFAULT,
|
.Usage = D3D11_USAGE_DEFAULT,
|
||||||
.Format = DXGI_FORMAT_B8G8R8A8_UNORM,
|
.Format = getDXGIFormat(*format),
|
||||||
.BindFlags = D3D11_BIND_RENDER_TARGET |
|
.BindFlags = D3D11_BIND_RENDER_TARGET |
|
||||||
D3D11_BIND_SHADER_RESOURCE,
|
D3D11_BIND_SHADER_RESOURCE,
|
||||||
.CPUAccessFlags = 0,
|
.CPUAccessFlags = 0,
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
|
|
||||||
#include <d3d11.h>
|
#include <d3d11.h>
|
||||||
@ -320,3 +321,30 @@ float getSDRWhiteLevel(const DISPLAYCONFIG_PATH_INFO * displayPathInfo)
|
|||||||
|
|
||||||
return nits;
|
return nits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DXGI_FORMAT getDXGIFormat(CaptureFormat format)
|
||||||
|
{
|
||||||
|
switch(format)
|
||||||
|
{
|
||||||
|
case CAPTURE_FMT_RGBA:
|
||||||
|
return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||||
|
|
||||||
|
case CAPTURE_FMT_BGRA:
|
||||||
|
return DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||||
|
|
||||||
|
case CAPTURE_FMT_RGBA10:
|
||||||
|
return DXGI_FORMAT_R10G10B10A2_UNORM;
|
||||||
|
|
||||||
|
case CAPTURE_FMT_RGBA16F:
|
||||||
|
return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
||||||
|
|
||||||
|
case CAPTURE_FMT_BGR:
|
||||||
|
return DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG_ASSERT("Invalid capture format for DXGI");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -19,8 +19,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <d3dcommon.h>
|
||||||
#include <dxgi.h>
|
#include <dxgi.h>
|
||||||
|
|
||||||
|
#include "interface/capture.h"
|
||||||
|
|
||||||
const char * getDXGIFormatStr(DXGI_FORMAT format);
|
const char * getDXGIFormatStr(DXGI_FORMAT format);
|
||||||
const char * getDXGIColorSpaceTypeStr(DXGI_COLOR_SPACE_TYPE type);
|
const char * getDXGIColorSpaceTypeStr(DXGI_COLOR_SPACE_TYPE type);
|
||||||
|
|
||||||
@ -30,3 +33,5 @@ bool compileShader(ID3DBlob ** dst, const char * entry, const char * target,
|
|||||||
bool getDisplayPathInfo(HMONITOR monitor, DISPLAYCONFIG_PATH_INFO * info);
|
bool getDisplayPathInfo(HMONITOR monitor, DISPLAYCONFIG_PATH_INFO * info);
|
||||||
|
|
||||||
float getSDRWhiteLevel(const DISPLAYCONFIG_PATH_INFO * displayPathInfo);
|
float getSDRWhiteLevel(const DISPLAYCONFIG_PATH_INFO * displayPathInfo);
|
||||||
|
|
||||||
|
DXGI_FORMAT getDXGIFormat(CaptureFormat format);
|
||||||
|
Loading…
Reference in New Issue
Block a user