MCPcopy Create free account
hub / github.com/GPUOpen-Effects/GeometryFX / CompareHash

Method CompareHash

framework/d3d11/amd_sdk/src/ShaderCache.cpp:2903–2933  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Compares a shaders hash with the has file on disk --------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2901// Compares a shaders hash with the has file on disk
2902//--------------------------------------------------------------------------------------
2903BOOL ShaderCache::CompareHash( Shader* pShader )
2904{
2905 FILE* pFile = NULL;
2906 wchar_t wsShaderPathName[m_uPATHNAME_MAX_LENGTH];
2907
2908 CreateFullPathFromOutputFilename( wsShaderPathName, pShader->m_wsHashFile );
2909
2910 _wfopen_s( &pFile, wsShaderPathName, L"rb" );
2911
2912 if (pFile)
2913 {
2914 fseek( pFile, 0, SEEK_END );
2915 int iFileSize = ftell( pFile );
2916 rewind( pFile );
2917 BYTE* pFileBuf = new BYTE[iFileSize];
2918
2919 fread( pFileBuf, 1, iFileSize, pFile );
2920
2921 fclose( pFile );
2922
2923 if (!memcmp( pShader->m_pHash, pFileBuf, pShader->m_uHashLength ))
2924 {
2925 delete [] pFileBuf;
2926 return TRUE;
2927 }
2928
2929 delete [] pFileBuf;
2930 }
2931
2932 return FALSE;
2933}
2934
2935
2936//--------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected