-------------------------------------------------------------------------------------- Compares a shaders hash with the has file on disk --------------------------------------------------------------------------------------
| 2901 | // Compares a shaders hash with the has file on disk |
| 2902 | //-------------------------------------------------------------------------------------- |
| 2903 | BOOL 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 | //-------------------------------------------------------------------------------------- |
nothing calls this directly
no outgoing calls
no test coverage detected