engine: fix hdr to ldr conversion

This commit is contained in:
nillerusr
2022-04-16 12:54:00 +03:00
parent 58873c35c7
commit 0feeab91dd
11 changed files with 31 additions and 28 deletions

View File

@@ -24,6 +24,8 @@
static CHardwareConfig s_HardwareConfig;
CHardwareConfig *g_pHardwareConfig = &s_HardwareConfig;
extern ConVar mat_hdr_level;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CHardwareConfig, IMaterialSystemHardwareConfig,
MATERIALSYSTEM_HARDWARECONFIG_INTERFACE_VERSION, s_HardwareConfig )
@@ -1238,12 +1240,12 @@ int CHardwareConfig::GetMaxVertexTextureDimension() const
HDRType_t CHardwareConfig::GetHDRType() const
{
bool enabled = m_bHDREnabled;
bool enabled = (mat_hdr_level.GetInt() >= 2) && GetHDREnabled();
int dxlev = GetDXSupportLevel();
int dxsupp = dxlev >= 90;
HDRType_t caps_hdr = m_Caps.m_HDRType;
HDRType_t result = HDR_TYPE_NONE;
//printf("\nCHardwareConfig::GetHDRType...");
if (enabled)
{

View File

@@ -939,10 +939,6 @@ bool CShaderDeviceMgrDx8::ComputeCapsFromD3D( HardwareCaps_t *pCaps, int nAdapte
D3DFMT_X8R8G8B8, D3DUSAGE_QUERY_FILTER,
D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16 ) == S_OK );
#ifdef TOGLES
bSupportsInteger16Textures = caps.SupportInt16Format;
#endif
// Does the device support filterable fp16 textures?
bool bSupportsFloat16Textures =
( D3D()->CheckDeviceFormat( nAdapter, DX8_DEVTYPE,
@@ -1051,6 +1047,11 @@ bool CShaderDeviceMgrDx8::ComputeCapsFromD3D( HardwareCaps_t *pCaps, int nAdapte
}
}
#ifdef TOGLES
bSupportsInteger16Textures = caps.SupportInt16Format;
#endif
// Do we have everything necessary to run with integer HDR? Note that
// even if we don't support integer 16-bit/component textures, we
// can still run in this mode if fp16 textures are supported.
@@ -1058,7 +1059,7 @@ bool CShaderDeviceMgrDx8::ComputeCapsFromD3D( HardwareCaps_t *pCaps, int nAdapte
pCaps->m_SupportsVertexShaders_2_0 &&
// (caps.Caps3 & D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD) &&
// (caps.PrimitiveMiscCaps & D3DPMISCCAPS_SEPARATEALPHABLEND) &&
( bSupportsInteger16Textures || bSupportsFloat16Textures ) &&
bSupportsInteger16Textures &&
pCaps->m_SupportsSRGB;
// Do we have everything necessary to run with float HDR?