@@ -923,6 +923,15 @@ namespace TC
923
923
{
924
924
pClangArgs->options .assign (pOptions);
925
925
}
926
+ #if defined(IGC_DEBUG_VARIABLES)
927
+ char debugOptions[1024 ];
928
+ if (FCL::FCLReadIGCRegistry (" ExtraOCLOptions" , debugOptions, sizeof (debugOptions)))
929
+ {
930
+ if (!pClangArgs->options .empty ())
931
+ pClangArgs->options += ' ' ;
932
+ pClangArgs->options += debugOptions;
933
+ }
934
+ #endif
926
935
927
936
GetOclCVersionFromOptions (pOptions, pInternalOptions, pClangArgs->oclVersion , exceptString);
928
937
EnsureProperPCH (pClangArgs, pInternalOptions, exceptString);
@@ -967,7 +976,7 @@ namespace TC
967
976
if (pData != NULL )
968
977
{
969
978
assert (pData[uiDataSize - 1 ] == ' \0 ' && " Program source is not null terminated" );
970
- pClangArgs->pszProgramSource = ( const char *) pData;
979
+ pClangArgs->pszProgramSource = pData;
971
980
}
972
981
}
973
982
@@ -1008,27 +1017,25 @@ namespace TC
1008
1017
1009
1018
if (!extensions.empty ())
1010
1019
{
1011
- output << " -cl-ext=-all," ;
1012
- output << " +" << extensions[0 ];
1020
+ output << " -cl-ext=-all" ;
1021
+ for (const std::string &extension : extensions)
1022
+ output << " ,+" << extension;
1013
1023
}
1014
1024
1015
- for (unsigned i = 1 ; i < extensions.size (); i++)
1016
- output << " ,+" << extensions[i];
1017
-
1018
1025
output.flush ();
1019
1026
return output.str ();
1020
1027
}
1021
1028
1022
1029
std::string GetListOfExtensionsFromInternalOptions (const std::string& internalOptions) {
1023
- size_t start_pos = 0 , end_pos = 0 ;
1024
- std::string clextString = " " ;
1030
+ size_t start_pos = 0 , end_pos = 0 ;
1031
+ std::string clextString = " " ;
1025
1032
1026
- while ((start_pos = internalOptions.find (" -cl-ext=" , end_pos)) != std::string::npos) {
1027
- end_pos = internalOptions.find (" " , start_pos);
1028
- clextString += internalOptions.substr (start_pos, end_pos - start_pos) + " " ;
1029
- }
1033
+ while ((start_pos = internalOptions.find (" -cl-ext=" , end_pos)) != std::string::npos) {
1034
+ end_pos = internalOptions.find (' ' , start_pos);
1035
+ clextString += internalOptions.substr (start_pos, end_pos - start_pos) + " " ;
1036
+ }
1030
1037
1031
- return clextString;
1038
+ return clextString;
1032
1039
}
1033
1040
1034
1041
std::string GetCDefinesFromInternalOptions (const char *pInternalOptions) {
@@ -1761,15 +1768,14 @@ namespace TC
1761
1768
bool successTC = TranslateClang (&args, pOutputArgs, exceptString, pInputArgs->pInternalOptions );
1762
1769
1763
1770
#if defined(IGC_DEBUG_VARIABLES)
1764
- if (pInputArgs->pOptions != NULL )
1771
+ if (pInputArgs->pOptions != nullptr )
1765
1772
{
1766
- const std::string& igc_optsName = " -igc_opts" ;
1767
- const std::string& optionsWithFlags = (const char *)pInputArgs->pOptions ;
1768
- std::size_t found = optionsWithFlags.find (igc_optsName);
1773
+ const std::string optionsWithFlags = pInputArgs->pOptions ;
1774
+ std::size_t found = optionsWithFlags.find (" -igc_opts" );
1769
1775
if (found != std::string::npos)
1770
1776
{
1771
- std::size_t foundFirstSingleQuote = optionsWithFlags.find (" ' " , found);
1772
- std::size_t foundSecondSingleQuote = optionsWithFlags.find (" ' " , foundFirstSingleQuote + 1 );
1777
+ std::size_t foundFirstSingleQuote = optionsWithFlags.find (' \' ' , found);
1778
+ std::size_t foundSecondSingleQuote = optionsWithFlags.find (' \' ' , foundFirstSingleQuote + 1 );
1773
1779
if (foundFirstSingleQuote != std::string::npos && foundSecondSingleQuote != std::string::npos)
1774
1780
{
1775
1781
FCL::RegKeysFlagsFromOptions = optionsWithFlags.substr (foundFirstSingleQuote + 1 , foundSecondSingleQuote - foundFirstSingleQuote - 1 );
@@ -1783,12 +1789,12 @@ namespace TC
1783
1789
// Works for all OSes. Creates dir if necessary.
1784
1790
const char *pOutputFolder = FCL::GetShaderOutputFolder ();
1785
1791
stringstream ss;
1786
- char * pBuffer = ( char *) pInputArgs->pInput ;
1792
+ const char * pBuffer = pInputArgs->pInput ;
1787
1793
UINT bufferSize = pInputArgs->InputSize ;
1788
1794
1789
1795
// Create hash based on cclang binary output (currently llvm binary; later also spirv).
1790
1796
// Hash computed in fcl needs to be same as the one computed in igc.
1791
- // This is to ensure easy matching .cl files dumped in fcl with .ll/.dat/.asm/... files dumoed in igc.
1797
+ // This is to ensure easy matching .cl files dumped in fcl with .ll/.dat/.asm/... files dumped in igc.
1792
1798
QWORD hash = iSTD::Hash (reinterpret_cast <const DWORD *>(pOutputArgs->pOutput ), (DWORD)(pOutputArgs->OutputSize ) / 4 );
1793
1799
1794
1800
ss << pOutputFolder;
0 commit comments