Browse Source

engine: hdr to ldr conversion for HDR_TYPE_NONE

ssdk2013
nillerusr 3 years ago
parent
commit
24366ef9a8
  1. 4
      engine/buildcubemaps.cpp
  2. 2
      engine/cmodel_bsp.cpp
  3. 6
      engine/l_studio.cpp
  4. 14
      engine/modelloader.cpp
  5. 6
      materialsystem/cmaterial.cpp
  6. 6
      materialsystem/shaderapidx9/shaderdevicedx8.cpp
  7. 2
      public/shaderapi/ishaderdynamic.h
  8. 1
      public/togles/linuxwin/dxabstract_types.h
  9. 1
      togles/linuxwin/dxabstract.cpp

4
engine/buildcubemaps.cpp

@ -1042,7 +1042,7 @@ void R_BuildCubemapSamples( int numIterations ) @@ -1042,7 +1042,7 @@ void R_BuildCubemapSamples( int numIterations )
}
}
bool bSupportsHDR = g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE;
bool bSupportsHDR = true; //g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE;
for( i = 0; i < pWorldModel->brush.pShared->m_nCubemapSamples; i++ )
{
@ -1080,7 +1080,7 @@ void R_BuildCubemapSamples( int numIterations ) @@ -1080,7 +1080,7 @@ void R_BuildCubemapSamples( int numIterations )
return;
}
iBSPPack->SetHDRMode( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE );
iBSPPack->SetHDRMode( true /*g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE*/ );
iBSPPack->LoadBSPFile( g_pFileSystem, cl.m_szLevelFileName );

2
engine/cmodel_bsp.cpp

@ -1110,7 +1110,7 @@ void CollisionBSPData_LoadDispInfo( CCollisionBSPData *pBSPData ) @@ -1110,7 +1110,7 @@ void CollisionBSPData_LoadDispInfo( CCollisionBSPData *pBSPData )
// get face data
//
int face_lump_to_load = LUMP_FACES;
if ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE &&
if ( /*g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE &&*/
CMapLoadHelper::LumpSize( LUMP_FACES_HDR ) > 0 )
{
face_lump_to_load = LUMP_FACES_HDR;

6
engine/l_studio.cpp

@ -3637,12 +3637,12 @@ void CModelRender::ValidateStaticPropColorData( ModelInstanceHandle_t handle ) @@ -3637,12 +3637,12 @@ void CModelRender::ValidateStaticPropColorData( ModelInstanceHandle_t handle )
// fetch the header
CUtlBuffer utlBuf;
char fileName[MAX_PATH];
if ( g_pMaterialSystemHardwareConfig->GetHDRType() == HDR_TYPE_NONE || g_bBakedPropLightingNoSeparateHDR )
if ( g_bBakedPropLightingNoSeparateHDR )
{
Q_snprintf( fileName, sizeof( fileName ), "sp_%d%s.vhv", StaticPropMgr()->GetStaticPropIndex( pProp ), GetPlatformExt() );
}
else
{
{
Q_snprintf( fileName, sizeof( fileName ), "sp_hdr_%d%s.vhv", StaticPropMgr()->GetStaticPropIndex( pProp ), GetPlatformExt() );
}
@ -3930,7 +3930,7 @@ bool CModelRender::LoadStaticPropColorData( IHandleEntity *pProp, DataCacheHandl @@ -3930,7 +3930,7 @@ bool CModelRender::LoadStaticPropColorData( IHandleEntity *pProp, DataCacheHandl
// each static prop has its own compiled color mesh
char fileName[MAX_PATH];
if ( g_pMaterialSystemHardwareConfig->GetHDRType() == HDR_TYPE_NONE || g_bBakedPropLightingNoSeparateHDR )
if ( g_bBakedPropLightingNoSeparateHDR )
{
Q_snprintf( fileName, sizeof( fileName ), "sp_%d%s.vhv", StaticPropMgr()->GetStaticPropIndex( pProp ), GetPlatformExt() );
}

14
engine/modelloader.cpp

@ -1856,8 +1856,7 @@ void Mod_LoadFaces( void ) @@ -1856,8 +1856,7 @@ void Mod_LoadFaces( void )
int ti, di;
int face_lump_to_load = LUMP_FACES;
if ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE &&
CMapLoadHelper::LumpSize( LUMP_FACES_HDR ) > 0 )
if ( CMapLoadHelper::LumpSize( LUMP_FACES_HDR ) > 0 )
{
face_lump_to_load = LUMP_FACES_HDR;
}
@ -2289,8 +2288,7 @@ void Mod_LoadLeafs( void ) @@ -2289,8 +2288,7 @@ void Mod_LoadLeafs( void )
Mod_LoadLeafs_Version_0( lh );
break;
case 1:
if( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE &&
CMapLoadHelper::LumpSize( LUMP_LEAF_AMBIENT_LIGHTING_HDR ) > 0 )
if( CMapLoadHelper::LumpSize( LUMP_LEAF_AMBIENT_LIGHTING_HDR ) > 0 )
{
CMapLoadHelper mlh( LUMP_LEAF_AMBIENT_LIGHTING_HDR );
CMapLoadHelper mlhTable( LUMP_LEAF_AMBIENT_INDEX_HDR );
@ -2385,7 +2383,7 @@ void Mod_LoadCubemapSamples( void ) @@ -2385,7 +2383,7 @@ void Mod_LoadCubemapSamples( void )
lh.GetMap()->m_pCubemapSamples = out;
lh.GetMap()->m_nCubemapSamples = count;
bool bHDR = g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE;
bool bHDR = true; //g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE;
int nCreateFlags = bHDR ? 0 : TEXTUREFLAGS_SRGB;
// We have separate HDR versions of the textures. In order to deal with this,
@ -4453,8 +4451,7 @@ void CModelLoader::Map_LoadModel( model_t *mod ) @@ -4453,8 +4451,7 @@ void CModelLoader::Map_LoadModel( model_t *mod )
// Until BSP version 19, this must occur after loading texinfo
COM_TimestampedLog( " Mod_LoadLighting" );
if ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE &&
CMapLoadHelper::LumpSize( LUMP_LIGHTING_HDR ) > 0 )
if ( CMapLoadHelper::LumpSize( LUMP_LIGHTING_HDR ) > 0 )
{
CMapLoadHelper mlh( LUMP_LIGHTING_HDR );
Mod_LoadLighting( mlh );
@ -4546,8 +4543,7 @@ void CModelLoader::Map_LoadModel( model_t *mod ) @@ -4546,8 +4543,7 @@ void CModelLoader::Map_LoadModel( model_t *mod )
&m_worldBrushData.m_nAreas );
COM_TimestampedLog( " Mod_LoadWorldlights" );
if ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE &&
CMapLoadHelper::LumpSize( LUMP_WORLDLIGHTS_HDR ) > 0 )
if ( CMapLoadHelper::LumpSize( LUMP_WORLDLIGHTS_HDR ) > 0 )
{
CMapLoadHelper mlh( LUMP_WORLDLIGHTS_HDR );
Mod_LoadWorldlights( mlh, true );

6
materialsystem/cmaterial.cpp

@ -1177,7 +1177,7 @@ bool CMaterial::ShouldSkipVar( KeyValues *pVar, bool *pWasConditional ) @@ -1177,7 +1177,7 @@ bool CMaterial::ShouldSkipVar( KeyValues *pVar, bool *pWasConditional )
}
else if ( ! stricmp( pCond, "hdr" ) )
{
bShouldSkip = ( HardwareConfig()->GetHDRType() == HDR_TYPE_NONE );
bShouldSkip = false; //( HardwareConfig()->GetHDRType() == HDR_TYPE_NONE );
}
else if ( ! stricmp( pCond, "srgb" ) )
{
@ -1400,7 +1400,7 @@ static KeyValues *FindBuiltinFallbackBlock( char const *pShaderName, KeyValues * @@ -1400,7 +1400,7 @@ static KeyValues *FindBuiltinFallbackBlock( char const *pShaderName, KeyValues *
if ( pRet )
return pRet;
}
if ( HardwareConfig()->GetHDRType() != HDR_TYPE_NONE )
// if ( HardwareConfig()->GetHDRType() != HDR_TYPE_NONE )
{
KeyValues *pRet = CheckConditionalFakeShaderName( pShaderName,"hdr_dx9", pKeyValues );
if ( pRet )
@ -1409,7 +1409,7 @@ static KeyValues *FindBuiltinFallbackBlock( char const *pShaderName, KeyValues * @@ -1409,7 +1409,7 @@ static KeyValues *FindBuiltinFallbackBlock( char const *pShaderName, KeyValues *
if ( pRet )
return pRet;
}
else
if( HardwareConfig()->GetHDRType() == HDR_TYPE_NONE )
{
KeyValues *pRet = CheckConditionalFakeShaderName( pShaderName,"ldr", pKeyValues );
if ( pRet )

6
materialsystem/shaderapidx9/shaderdevicedx8.cpp

@ -939,6 +939,10 @@ bool CShaderDeviceMgrDx8::ComputeCapsFromD3D( HardwareCaps_t *pCaps, int nAdapte @@ -939,6 +939,10 @@ 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,
@ -1072,7 +1076,7 @@ bool CShaderDeviceMgrDx8::ComputeCapsFromD3D( HardwareCaps_t *pCaps, int nAdapte @@ -1072,7 +1076,7 @@ bool CShaderDeviceMgrDx8::ComputeCapsFromD3D( HardwareCaps_t *pCaps, int nAdapte
else
if ( bSupportsIntegerHDR )
pCaps->m_MaxHDRType = HDR_TYPE_INTEGER;
if ( bSupportsFloatHDR && ( mat_hdr_level.GetInt() == 3 ) )
{
pCaps->m_HDRType = HDR_TYPE_FLOAT;

2
public/shaderapi/ishaderdynamic.h

@ -36,8 +36,8 @@ struct LightState_t @@ -36,8 +36,8 @@ struct LightState_t
{
int m_nNumLights;
bool m_bAmbientLight;
bool m_bStaticLight;
bool m_bStaticLightVertex;
bool m_bStaticLightTexel;
inline int HasDynamicLight() { return (m_bAmbientLight || (m_nNumLights > 0)) ? 1 : 0; }
};

1
public/togles/linuxwin/dxabstract_types.h

@ -1339,6 +1339,7 @@ typedef struct _D3DCAPS9 @@ -1339,6 +1339,7 @@ typedef struct _D3DCAPS9
DWORD FakeSRGBWrite; // 1 for parts which can't support SRGB writes due to driver issues - 0 for others
DWORD MixedSizeTargets; // 1 for parts which can mix attachment sizes (RT's color vs depth)
DWORD CanDoSRGBReadFromRTs; // 0 when we're on Leopard, 1 when on Snow Leopard
DWORD SupportInt16Format;
} D3DCAPS9;
typedef struct _D3DDISPLAYMODE

1
togles/linuxwin/dxabstract.cpp

@ -1204,6 +1204,7 @@ static void FillD3DCaps9( const GLMRendererInfoFields &glmRendererInfo, D3DCAPS9 @@ -1204,6 +1204,7 @@ static void FillD3DCaps9( const GLMRendererInfoFields &glmRendererInfo, D3DCAPS9
pCaps->FakeSRGBWrite = true;//!glmRendererInfo.m_hasGammaWrites;
pCaps->CanDoSRGBReadFromRTs = true;//!glmRendererInfo.m_cantAttachSRGB;
pCaps->MixedSizeTargets = glmRendererInfo.m_hasMixedAttachmentSizes;
pCaps->SupportInt16Format = gGL->m_bHave_GL_EXT_texture_norm16;
#endif
}

Loading…
Cancel
Save