@@ -440,6 +440,8 @@ void ReplaceRegexes(string &src, const std::map<string,string> &replace)
440440}
441441static std::map<std::string,std::string> useCompilerPath;
442442
443+ static bool checkedCompilerPath=false ;
444+
443445extern void CalcCompilerPathToUse (const SfxConfig &sfxConfig,const SfxOptions &sfxOptions)
444446{
445447 std::string usePath=" " ;
@@ -657,7 +659,7 @@ bool RewriteOutput(const SfxConfig &sfxConfig
657659 (*log)<< str.c_str ();
658660 return has_errors;
659661}
660-
662+ # pragma optimize("",off)
661663bool IsShaderUnchanged (std::string sourceFilename,std::string outputFilename,const std::string &src)
662664{
663665 if (!std::filesystem::exists (outputFilename))
@@ -676,7 +678,6 @@ bool IsShaderUnchanged(std::string sourceFilename,std::string outputFilename,con
676678 return true ;
677679}
678680
679-
680681int Compile (std::shared_ptr<ShaderInstance> shaderInstance
681682 ,const string &sourceFile
682683 ,string targetFile
@@ -869,7 +870,7 @@ int Compile(std::shared_ptr<ShaderInstance> shaderInstance
869870 string src = preamble;
870871 src += sharedSource;
871872 src+=shaderInstance->m_augmentedSource ;
872- ReplaceRegexes (src, sfxConfig. replace );
873+
873874 const char *strSrc=src.c_str ();
874875
875876 wstring targetDir=StringToWString (GetDirectoryFromFilename (targetFile));
@@ -893,8 +894,8 @@ int Compile(std::shared_ptr<ShaderInstance> shaderInstance
893894#else
894895 ofstream ofs (WStringToUtf8 (generatedSourceFilename).c_str ());
895896#endif
896- ofs.write (strSrc, strlen (strSrc));
897- ofs.close ();
897+ ofs.write (strSrc, strlen (strSrc));
898+ ofs.close ();
898899 }
899900#ifdef _MSC_VER
900901 // Now delete the corresponding sdb's
@@ -933,52 +934,52 @@ int Compile(std::shared_ptr<ShaderInstance> shaderInstance
933934 if (!unchanged)
934935 {
935936 compile_command=BuildCompileCommand
936- (
937- shaderInstance,
938- sfxConfig,
939- sfxOptions,
940- targetDir,
941- outputFile,
937+ (
938+ shaderInstance,
939+ sfxConfig,
940+ sfxOptions,
941+ targetDir,
942+ outputFile,
942943 generatedSourceFilename,
943- t,
944- pixelOutputFormat
945- );
946- // If no compiler provided, we can return now (perhaps we are only interested in
947- // the shader source)
948- if (compile_command.empty ())
949- {
950- if (sfxOptions.verbose )
944+ t,
945+ pixelOutputFormat
946+ );
947+ // If no compiler provided, we can return now (perhaps we are only interested in
948+ // the shader source)
949+ if (compile_command.empty ())
950+ {
951+ if (sfxOptions.verbose )
951952 std::cout<<WStringToUtf8 (generatedSourceFilename).c_str ()<<" \n " ;
952- // But let's in that case, wrap up the GENERATED SOURCE in sfxb:
953- if (sfxOptions.wrapOutput )
954- {
955- // concatenate
956- #ifdef _MSC_VER
953+ // But let's in that case, wrap up the GENERATED SOURCE in sfxb:
954+ if (sfxOptions.wrapOutput )
955+ {
956+ // concatenate
957+ #ifdef _MSC_VER
957958 std::ifstream if_c (generatedSourceFilename.c_str (), std::ios_base::binary);
958- #else
959+ #else
959960 std::ifstream if_c (WStringToUtf8 (generatedSourceFilename).c_str (), std::ios_base::binary);
960- #endif
961- if (!if_c.good ())
962- {
963- SFX_BREAK (" Failed to load generated shader source" );
964- exit (1002 );
965- }
966- std::streampos startp = combinedBinary.tellp ();
967- combinedBinary << if_c.rdbuf ();
968- std::streampos endp = combinedBinary.tellp ();
969- size_t sz=endp - startp;
970- if (!sz)
971- {
972- SFX_BREAK (" Empty output shader " );
961+ #endif
962+ if (!if_c.good ())
963+ {
964+ SFX_BREAK (" Failed to load generated shader source" );
965+ exit (1002 );
966+ }
967+ std::streampos startp = combinedBinary.tellp ();
968+ combinedBinary << if_c.rdbuf ();
969+ std::streampos endp = combinedBinary.tellp ();
970+ size_t sz=endp - startp;
971+ if (!sz)
972+ {
973+ SFX_BREAK (" Empty output shader " );
973974 std::cerr<<" Empty output shader " <<WStringToUtf8 (generatedSourceFilename)<<" \n " ;
974- exit (1001 );
975- }
976- binaryMap[sbf] = std::make_tuple (startp, sz);
975+ exit (1001 );
977976 }
978- return true ;
977+ binaryMap[sbf] = std::make_tuple (startp, sz) ;
979978 }
980- if (sfxOptions.verbose )
981- std::cout<<WStringToUtf8 (compile_command).c_str ()<<std::endl;
979+ return true ;
980+ }
981+ if (sfxOptions.verbose )
982+ std::cout<<WStringToUtf8 (compile_command).c_str ()<<std::endl;
982983 }
983984
984985 // Run the provided .exe!
@@ -1036,7 +1037,7 @@ int Compile(std::shared_ptr<ShaderInstance> shaderInstance
10361037 {
10371038 if (terminate_command)
10381039 exit (2000 );
1039- Sleep (10 );
1040+ sleep (10 );
10401041 }
10411042 if (!if_c.good ())
10421043 {
0 commit comments