cluster_group_t *initClusterGroup(LPWSTR groupName, CLUSTER_GROUP_STATE groupState) { cluster_group_t *pGroupClust; pGroupClust = LocalAlloc(LPTR, sizeof(cluster_group_t)); wcsncpy(pGroupClust->name, groupName, BUFFER_SIZE - 1); pGroupClust->state = groupState; pGroupClust->bbState = USE_GREEN; pGroupClust->hasSavedNode = I_FALSE; switch (groupState) { case ClusterGroupFailed : case ClusterGroupPending : case ClusterGroupPartialOnline : case ClusterGroupOffline : pGroupClust->bbState = USE_YELLOW; break ; default : break ; } pGroupClust->nodeHasChanged = I_FALSE; if (getTempPath((LPWSTR)pGroupClust->nodeChangedFilePath) == 0) fatalError(ERROR_GETTING_TEMP_PATH); wcscat((LPWSTR)pGroupClust->nodeChangedFilePath, CLUSTER_NODE_HAS_CHANGED_FILE); wcscat((LPWSTR)pGroupClust->nodeChangedFilePath, groupName); return pGroupClust; }
RelocMap reloc_map(Volume& v, const scrubbing::ScrubReply& scrub_reply) { const auto scrub_res(get_scrub_result(v, scrub_reply)); std::map<ClusterAddress, ClusterLocation> relocmap; auto treader(CombinedTLogReader::create(getTempPath(testName_).string(), scrub_res.relocs, v.getBackendInterface()->clone())); const Entry* e = nullptr; while ((e = treader->nextLocation())) { const Entry* f = treader->nextLocation(); EXPECT_TRUE(f != nullptr); EXPECT_EQ(e->clusterAddress(), f->clusterAddress()); auto r(relocmap.insert(std::make_pair(f->clusterAddress(), f->clusterLocation()))); EXPECT_TRUE(r.second); } return relocmap; }
TEST_F(FileUtilsTest, truncate) { const fs::path tmpDir = getTempPath("someDir"); fs::create_directories(tmpDir); ALWAYS_CLEANUP_DIRECTORY(tmpDir); EXPECT_THROW(FileUtils::truncate(tmpDir, 4096), fs::filesystem_error); // non-existing files neither const fs::path tmpFile = tmpDir / "someFile"; EXPECT_THROW(FileUtils::truncate(tmpFile, 4096), fs::filesystem_error); // existing files cannot grow with truncate FileUtils::touch(tmpFile); EXPECT_THROW(FileUtils::truncate(tmpFile, 4096), fungi::IOException); std::ofstream f(tmpFile.string().c_str()); const std::string s = "some nonsensical string"; f << s; f.close(); EXPECT_EQ(s.size(), fs::file_size(tmpFile)); EXPECT_NO_THROW(FileUtils::truncate(tmpFile, s.size() - 1)); EXPECT_EQ(s.size() - 1, fs::file_size(tmpFile)); }
/* * extract from the archive * and copy to the filesystem * relative to the directory the archive's in */ int extract2fs(TOC *ptoc) { #ifdef WIN32 char *p; #endif FILE *out; unsigned char *data = extract(ptoc); if (!f_workpath) { getTempPath(f_temppath); #ifdef WIN32 strcpy(f_temppathraw, f_temppath); for ( p=f_temppath; *p; p++ ) if (*p == '\\') *p = '/'; #endif f_workpath = f_temppath; } out = openTarget(f_workpath, ptoc->name); if (out == NULL) { FATALERROR(ptoc->name); FATALERROR(" could not be extracted!\n"); } else { fwrite(data, ntohl(ptoc->ulen), 1, out); #ifndef WIN32 fchmod(fileno(out), S_IRUSR | S_IWUSR | S_IXUSR); #endif fclose(out); } free(data); return 0; }
void msg_send(int sockfd, char *data, int flag,char *destIP, int destPort) { pckData aPacket; socklen_t destAddrLen, pckLen; struct sockaddr_un destAddr; char filePath[256]; int i; bzero(filePath,256); bzero(&destAddr,sizeof(destAddr)); bzero(&aPacket.data,sizeof(PAYLOAD)); aPacket.port=destPort; aPacket.flag=flag; memcpy(aPacket.data,data,strlen(data)); aPacket.data[strlen(aPacket.data)]='\0'; memcpy(aPacket.canonicalIP,destIP,strlen(destIP)); aPacket.canonicalIP[strlen(aPacket.canonicalIP)]='\0'; bzero(&destAddr,sizeof(destAddr)); destAddr.sun_family=AF_LOCAL; getTempPath(filePath,ODR_TEMP_FILE,0); strcpy(destAddr.sun_path,filePath); printf("\n path received:%s",filePath); destAddrLen=sizeof(destAddr); pckLen=sizeof(aPacket); if((i=sendto(sockfd, &aPacket, pckLen, 0, (struct sockaddr*)&destAddr, destAddrLen))<0) { printf("\n Error in sendinf or Domain socket!"); } printf("\nMSG sent"); }
bool InvokeJavascript_NoArgs(NPObject *npobj, const char *methodName, NPVariant *&result) { bool success = false; if (!strcmp(methodName, "getPlatform")) { //getPlatform() : string #if defined(OS_WIN) success = SetReturnValue("windows", 7, *result); #elif defined(OS_LINUX) success = SetReturnValue("linux", 5, *result); #endif } else if (!strcmp(methodName, "getTempPath") || !strcmp(methodName, "getTmpPath")) { char *value = NULL; size_t len = 0; if (getTempPath(value, len)) { success = SetReturnValue(value, len, *result); delete[] value; } } else if (!strcmp(methodName,"getHomeDir")) { char *value = NULL; size_t len=0; getHomeDir(value, len); success = SetReturnValue(value, len, *result); } return success; }
void CConfigGenEngine::createFakePlugins(StringBuffer& destFilePath) const { String destFilePathStr(destFilePath); String* tmpstr = destFilePathStr.toLowerCase(); if (!tmpstr->endsWith("plugins.xml")) { int index = tmpstr->indexOf("plugins.xml"); destFilePath.remove(index + 11, destFilePath.length() - (index + 11)); } delete tmpstr; StringBuffer tmpoutbuf("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Plugins/>"); if (m_instances.ordinality() > 1 && strcmp(m_process.queryName(), XML_TAG_ESPPROCESS)) destFilePath.replaceString("@temp"PATHSEPSTR, m_cachePath); else { char tempPath[_MAX_PATH]; getTempPath(tempPath, sizeof(tempPath), m_name); ensurePath(tempPath); destFilePath.replaceString("@temp"PATHSEPSTR, tempPath); } Owned<IFile> pTargetFile = createIFile(destFilePath.str()); if (pTargetFile->exists() && pTargetFile->isReadOnly()) pTargetFile->setReadOnly(false); Owned<IFileIO> pTargetFileIO = pTargetFile->open(IFOcreate); pTargetFileIO->write( 0, tmpoutbuf.length(), tmpoutbuf.str()); m_envDepEngine.addTempFile(destFilePath.str()); }
TEST_F(FileUtilsTest, touch) { fs::path tmp = getTempPath("help"); FileUtils::touch(tmp); ASSERT_TRUE(fs::exists(tmp)); fs::remove(tmp); ASSERT_FALSE(fs::exists(tmp)); }
void Shader::compileToHLSL(void *compiler) { // ensure we don't pass a NULL source to the compiler const char *source = "\0"; if (mSource) { source = mSource; } // ensure the compiler is loaded initializeCompiler(); int compileOptions = SH_OBJECT_CODE; std::string sourcePath; if (perfActive()) { sourcePath = getTempPath(); writeFile(sourcePath.c_str(), source, strlen(source)); compileOptions |= SH_LINE_DIRECTIVES; } int result; if (sourcePath.empty()) { result = ShCompile(compiler, &source, 1, compileOptions); } else { const char* sourceStrings[2] = { sourcePath.c_str(), source }; result = ShCompile(compiler, sourceStrings, 2, compileOptions | SH_SOURCE_PATH); } if (result) { size_t objCodeLen = 0; ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &objCodeLen); mHlsl = new char[objCodeLen]; ShGetObjectCode(compiler, mHlsl); void *activeUniforms; ShGetInfoPointer(compiler, SH_ACTIVE_UNIFORMS_ARRAY, &activeUniforms); mActiveUniforms = *(sh::ActiveUniforms*)activeUniforms; } else { size_t infoLogLen = 0; ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &infoLogLen); mInfoLog = new char[infoLogLen]; ShGetInfoLog(compiler, mInfoLog); TRACE("\n%s", mInfoLog); } }
string getTempFile() { getTempPath(); char tempFile[MAX_PATH]; if (GetTempFileName(tempPath.c_str(), "ix", 0, tempFile)) { tempFiles.insert(tempFile); return tempFile; } else throw std::exception("Failed to create temporary file."); }
/** * Puush capture area screenshot. * @brief Systray::selectAreaScreenshot */ void Systray::selectAreaScreenshot() { if (!isLoggedIn()) return; QString fileName = getTempPath(); Screenshot *ss = new Screenshot(fileName); connect(ss, SIGNAL(finished(int, QString, QString)), this, SLOT(screenshotDone(int, QString, QString))); ss->selectArea(); }
scrubbing::ScrubReply scrub(const scrubbing::ScrubWork& work, double fill_ratio = 1.0) { return scrubbing::ScrubberAdapter::scrub(work, getTempPath(testName_), 5, // region_size_exponent fill_ratio, // fill ratio false, // apply immediately true); // verbose }
void Shader::compileToHLSL(void *compiler) { if (isCompiled() || !mSource) { return; } delete[] mInfoLog; mInfoLog = NULL; int compileOptions = SH_OBJECT_CODE; std::string sourcePath; if (perfActive()) { sourcePath = getTempPath(); writeFile(sourcePath.c_str(), mSource, strlen(mSource)); compileOptions |= SH_LINE_DIRECTIVES; } int result; if (sourcePath.empty()) { result = ShCompile(compiler, &mSource, 1, compileOptions); } else { const char* sourceStrings[2] = { sourcePath.c_str(), mSource }; result = ShCompile(compiler, sourceStrings, 2, compileOptions | SH_SOURCE_PATH); } if (result) { int objCodeLen = 0; ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &objCodeLen); mHlsl = new char[objCodeLen]; ShGetObjectCode(compiler, mHlsl); } else { int infoLogLen = 0; ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &infoLogLen); mInfoLog = new char[infoLogLen]; ShGetInfoLog(compiler, mInfoLog); TRACE("\n%s", mInfoLog); } }
bool MpkManip::cleanupFragment(const char* mpkFilename) { bool bOk = false; HANDLE hMpk = 0; char tempFilename[MAX_PATH]; if(SFileCreateArchiveEx(mpkFilename,OPEN_EXISTING,8000,&hMpk)) { uint nTotal = SFileGetFileInfo(hMpk,SFILE_INFO_NUM_FILES); uint nFiles = 0; char tempPath[MAX_PATH]; getTempPath(MAX_PATH, tempPath); getTempFileName(tempPath,tempFilename); HANDLE hTargetMpk = 0; if(SFileCreateArchiveEx(tempFilename,CREATE_ALWAYS,8000,&hTargetMpk)) { SFILE_FIND_DATA fileFindData; HANDLE hFind = SFileFindFirstFile(hMpk,"*",&fileFindData,0); if(hFind) { do { const char* pFilename = fileFindData.cFileName; char tempFilename[MAX_PATH]; getTempFileName(tempPath,tempFilename); if(SFileExtractFile(hMpk,pFilename,tempFilename)) { if(SFileAddFile(hTargetMpk,tempFilename,pFilename,MPK_FILE_REPLACEEXISTING | MPK_FILE_COMPRESS_PKWARE)) { nFiles++; } } } while(SFileFindNextFile(hFind,&fileFindData)); if(nTotal == nFiles)bOk = true; } SFileCloseArchive(hTargetMpk); } SFileCloseArchive(hMpk); } if(bOk && copyFile(tempFilename,mpkFilename,FALSE)) { bOk = true; } return bOk; }
int saveNodeName(LPWSTR lpszNodeName, LPWSTR groupName) { FILE *fp; static TCHAR lpPath[BUFFER_SIZE]; if (getTempPath((LPWSTR)lpPath) == 0) fatalError(ERROR_GETTING_TEMP_PATH); wcscat((LPWSTR)lpPath, SAVE_NODE_FILENAME); wcscat((LPWSTR)lpPath, groupName); wcscat((LPWSTR)lpPath, SAVE_NODE_FILENAME_EXTENSION); if ((fp = _wfopen(lpPath, L"w")) == NULL) { warnError(L"Warning : can't open %s.", lpPath); return 1; } fwprintf(fp, L"%s", lpszNodeName); fclose(fp); return 0; }
/* Function that creates a temporany directory if it doesn't exists * and properly sets the ARCHIVE_STATUS members. */ static int createTempPath(ARCHIVE_STATUS *status) { #ifdef WIN32 char *p; #endif if (status->temppath[0] == '\0') { if (!getTempPath(status->temppath)) { FATALERROR("INTERNAL ERROR: cannot create temporary directory!\n"); return -1; } #ifdef WIN32 strcpy(status->temppathraw, status->temppath); for ( p=status->temppath; *p; p++ ) if (*p == '\\') *p = '/'; #endif } return 0; }
int ShaderD3D::prepareSourceAndReturnOptions(std::stringstream *shaderSourceStream) { uncompile(); int additionalOptions = 0; const std::string &source = mData.getSource(); #if !defined(ANGLE_ENABLE_WINDOWS_STORE) if (gl::DebugAnnotationsActive()) { std::string sourcePath = getTempPath(); writeFile(sourcePath.c_str(), source.c_str(), source.length()); additionalOptions |= SH_LINE_DIRECTIVES | SH_SOURCE_PATH; *shaderSourceStream << sourcePath; } #endif *shaderSourceStream << source; return additionalOptions; }
TEST_F(FileUtilsTest, renameAndSyncFile) { const fs::path tmpDir = getTempPath("renameAndSyncFileTest"); FileUtils::removeAllNoThrow(tmpDir); fs::create_directories(tmpDir); ALWAYS_CLEANUP_DIRECTORY(tmpDir); const fs::path file1 = tmpDir / "file1"; const fs::path file2 = tmpDir / "file2"; EXPECT_FALSE(fs::exists(file1)); EXPECT_FALSE(fs::exists(file2)); EXPECT_THROW(FileUtils::syncAndRename(file1, file2), std::exception); EXPECT_FALSE(fs::exists(file1)); EXPECT_FALSE(fs::exists(file2)); FileUtils::touch(file1); EXPECT_TRUE(fs::exists(file1)); EXPECT_FALSE(fs::exists(file2)); EXPECT_NO_THROW(FileUtils::syncAndRename(file1, file2)); EXPECT_FALSE(fs::exists(file1)); EXPECT_TRUE(fs::exists(file2)); EXPECT_THROW(FileUtils::syncAndRename(file1, file2), std::exception); EXPECT_FALSE(fs::exists(file1)); EXPECT_TRUE(fs::exists(file2)); FileUtils::touch(file1); EXPECT_TRUE(fs::exists(file1)); EXPECT_TRUE(fs::exists(file2)); EXPECT_NO_THROW(FileUtils::syncAndRename(file1, file2)); EXPECT_FALSE(fs::exists(file1)); EXPECT_TRUE(fs::exists(file2)); fs::remove(file2); fs::remove(tmpDir); }
//--------------------------------------------------------------------------- // beforeDeploy //--------------------------------------------------------------------------- void CConfigGenEngine::beforeDeploy() { m_installFiles.clear(); char tempPath[_MAX_PATH]; getTempPath(tempPath, sizeof(tempPath), m_name); m_envDepEngine.addTempDirectory( tempPath ); if (m_instances.ordinality() > 1) { strcat(tempPath, "Cache"); char* pszEnd = tempPath + strlen(tempPath); Owned<IFile> pFile = createIFile(tempPath); int i = 1; while (pFile->exists()) { //dir/file exists itoa(++i, pszEnd, 10); pFile.setown( createIFile(tempPath) ); } strcat(tempPath, PATHSEPSTR); m_cachePath.set( tempPath ); } else m_cachePath.set( tempPath ); ensurePath(tempPath); determineInstallFiles(m_process, m_installFiles); getCallback().installFileListChanged(); if (m_instances.ordinality() > 1) { EnvMachineOS os = m_envDepEngine.lookupMachineOS( m_instances.item(0) ); m_curInstance = "Cache"; copyInstallFiles("Cache", -1, tempPath, os); } }
std::string getFolder(std::string key) { std::string default_value = getBasePath().string(); if (key == "certificate-path") { default_value = CERT_FOLDER; } else if (key == "module-path") { default_value = MODULE_FOLDER; } else if (key == "web-path") { default_value = WEB_FOLDER; } else if (key == "scripts") { default_value = SCRIPTS_FOLDER; } else if (key == CACHE_FOLDER_KEY) { default_value = DEFAULT_CACHE_PATH; } else if (key == CRASH_ARCHIVE_FOLDER_KEY) { default_value = CRASH_ARCHIVE_FOLDER; } else if (key == "base-path") { default_value = getBasePath().string(); } else if (key == "temp") { default_value = getTempPath().string(); } else if (key == "shared-path" || key == "base-path" || key == "exe-path") { default_value = getBasePath().string(); } #ifdef WIN32 else if (key == "common-appdata") { wchar_t buf[MAX_PATH + 1]; if (_SHGetSpecialFolderPath(NULL, buf, CSIDL_COMMON_APPDATA, FALSE)) default_value = utf8::cvt<std::string>(buf); else default_value = getBasePath().string(); } #else else if (key == "etc") { default_value = "/etc"; } #endif return default_value; }
void ShaderD3D::compileToHLSL(ShHandle compiler, const std::string &source) { int compileOptions = (SH_OBJECT_CODE | SH_VARIABLES); // D3D11 Feature Level 9_3 and below do not support non-constant loop indexers in fragment // shaders. // Shader compilation will fail. To provide a better error message we can instruct the // compiler to pre-validate. if (mRenderer->getRendererLimitations().shadersRequireIndexedLoopValidation) { compileOptions |= SH_VALIDATE_LOOP_INDEXING; } std::string sourcePath; #if !defined (ANGLE_ENABLE_WINDOWS_STORE) if (gl::DebugAnnotationsActive()) { sourcePath = getTempPath(); writeFile(sourcePath.c_str(), source.c_str(), source.length()); compileOptions |= SH_LINE_DIRECTIVES; } #endif int result; if (sourcePath.empty()) { const char* sourceStrings[] = { source.c_str(), }; result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions); } else { const char* sourceStrings[] = { sourcePath.c_str(), source.c_str(), }; result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions | SH_SOURCE_PATH); } mShaderVersion = ShGetShaderVersion(compiler); if (result) { mTranslatedSource = ShGetObjectCode(compiler); #ifdef _DEBUG // Prefix hlsl shader with commented out glsl shader // Useful in diagnostics tools like pix which capture the hlsl shaders std::ostringstream hlslStream; hlslStream << "// GLSL\n"; hlslStream << "//\n"; size_t curPos = 0; while (curPos != std::string::npos) { size_t nextLine = source.find("\n", curPos); size_t len = (nextLine == std::string::npos) ? std::string::npos : (nextLine - curPos + 1); hlslStream << "// " << source.substr(curPos, len); curPos = (nextLine == std::string::npos) ? std::string::npos : (nextLine + 1); } hlslStream << "\n\n"; hlslStream << mTranslatedSource; mTranslatedSource = hlslStream.str(); #endif mUniforms = *GetShaderVariables(ShGetUniforms(compiler)); for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); uniformIndex++) { const sh::Uniform &uniform = mUniforms[uniformIndex]; if (uniform.staticUse && !uniform.isBuiltIn()) { unsigned int index = static_cast<unsigned int>(-1); bool getUniformRegisterResult = ShGetUniformRegister(compiler, uniform.name, &index); UNUSED_ASSERTION_VARIABLE(getUniformRegisterResult); ASSERT(getUniformRegisterResult); mUniformRegisterMap[uniform.name] = index; } } mInterfaceBlocks = *GetShaderVariables(ShGetInterfaceBlocks(compiler)); for (size_t blockIndex = 0; blockIndex < mInterfaceBlocks.size(); blockIndex++) { const sh::InterfaceBlock &interfaceBlock = mInterfaceBlocks[blockIndex]; if (interfaceBlock.staticUse) { unsigned int index = static_cast<unsigned int>(-1); bool blockRegisterResult = ShGetInterfaceBlockRegister(compiler, interfaceBlock.name, &index); UNUSED_ASSERTION_VARIABLE(blockRegisterResult); ASSERT(blockRegisterResult); mInterfaceBlockRegisterMap[interfaceBlock.name] = index; } } } else { mInfoLog = ShGetInfoLog(compiler); TRACE("\n%s", mInfoLog.c_str()); } }
// Compiles HLSL code into executable binaries ShaderBlob *Renderer::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile, UINT optimizationFlags, bool alternateFlags) { if (!hlsl) { return NULL; } HRESULT result = S_OK; UINT flags = 0; std::string sourceText; if (gl::perfActive()) { flags |= D3DCOMPILE_DEBUG; #ifdef NDEBUG flags |= optimizationFlags; #else flags |= D3DCOMPILE_SKIP_OPTIMIZATION; #endif std::string sourcePath = getTempPath(); sourceText = std::string("#line 2 \"") + sourcePath + std::string("\"\n\n") + std::string(hlsl); writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size()); } else { flags |= optimizationFlags; sourceText = hlsl; } // Sometimes D3DCompile will fail with the default compilation flags for complicated shaders when it would otherwise pass with alternative options. // Try the default flags first and if compilation fails, try some alternatives. const static UINT extraFlags[] = { 0, D3DCOMPILE_AVOID_FLOW_CONTROL, D3DCOMPILE_PREFER_FLOW_CONTROL }; const static char * const extraFlagNames[] = { "default", "avoid flow control", "prefer flow control" }; int attempts = alternateFlags ? ArraySize(extraFlags) : 1; pD3DCompile compileFunc = reinterpret_cast<pD3DCompile>(mD3DCompileFunc); for (int i = 0; i < attempts; ++i) { ID3DBlob *errorMessage = NULL; ID3DBlob *binary = NULL; result = compileFunc(hlsl, strlen(hlsl), gl::g_fakepath, NULL, NULL, "main", profile, flags | extraFlags[i], 0, &binary, &errorMessage); if (errorMessage) { const char *message = (const char*)errorMessage->GetBufferPointer(); infoLog.appendSanitized(message); TRACE("\n%s", hlsl); TRACE("\n%s", message); errorMessage->Release(); errorMessage = NULL; } if (SUCCEEDED(result)) { return (ShaderBlob*)binary; } else { #if defined(ANGLE_PLATFORM_WINRT) if (result == E_OUTOFMEMORY) #else if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY) #endif // #if defined(ANGLE_PLATFORM_WINRT) { return gl::error(GL_OUT_OF_MEMORY, (ShaderBlob*) NULL); } infoLog.append("Warning: D3D shader compilation failed with "); infoLog.append(extraFlagNames[i]); infoLog.append(" flags."); if (i + 1 < attempts) { infoLog.append(" Retrying with "); infoLog.append(extraFlagNames[i + 1]); infoLog.append(".\n"); } } } return NULL; }
int main() { int sockfd; struct sockaddr_un cliAddr,servAddr; char data[512],filePath[1024],servIP[1024],cliIP[1024], cliVM; memset(data,'\0',512); memset(filePath,'\0',1024); memset(servIP,'\0',1024); memset(cliIP,'\0',1024); socklen_t servAddrLen,cliAddrLen; getTempPath(filePath,CLI_TEMP_FILE,1); sockfd=createDomaimDGramSock(filePath); //getTempPath(filePath,CLI_TEMP_FILE); cliVM=getHostVMNo(); getVMsIP(cliIP); printf("\nClient is running on %s in VM %d ",cliIP,cliVM); while(1) { int n, servPort,i; int forceDiscovery=0; int timeOut,count=0; char servIP[1024], inputVM[10]; char *Vmno; signal(SIGALRM, sig_handler); //alarm(1); while(1){ printf("Choose a server VM among 1 to 10:"); scanf("%s",inputVM); if(strcmp(inputVM,"quit")==0) { printf("Program Terminating!"); exit(0); } if(inputVM[0]>= '1' && inputVM[0]<= '9') { n=atoi(inputVM); if(n>=1 && n<=10) break; else continue; } else { for(i=0;i<3;i++) inputVM[i]=tolower(inputVM[i]); if(inputVM[0]=='v') { if(inputVM[1]=='m') { Vmno=inputVM+2; n=atoi(Vmno); if(n>=1 && n<=10) break; } else continue; } else continue; } } getVMsIP(servIP); getVMIPaddressbyNode(servIP,n); servPort=SERVER_PORT; //strcpy(servIP,"127.0.0.1"); printf("\nSYN sent to server"); retransmit: memset(data,'\0',512); strcpy(data,"Send me the time"); msg_send(sockfd, data,forceDiscovery,servIP, servPort); printf("\n client at node vm %d sending request to server at vm %d \n",cliVM,n); alarm(CLIENT_TIMEOUT); if (sigsetjmp(retransmit, 1) != 0) { if(count==1) { printf("\n Server Not reachable!!! \n"); alarm(0); goto client; //exit(0); } forceDiscovery=1; count++; goto retransmit; } memset(data,'\0',512); msg_recv(sockfd, data, servIP, &servPort); printf("\n Data from server:%s \n", data); client: alarm(0); } unlink(cliAddr.sun_path); remove(cliAddr.sun_path); close(sockfd); }
//--------------------------------------------------------------------------- // determineInstallFiles //--------------------------------------------------------------------------- int CConfigGenEngine::determineInstallFiles(IPropertyTree& processNode, CInstallFiles& installFiles) const { try { m_pCallback->printStatus(STATUS_NORMAL, NULL, NULL, NULL, "Determining files to install for %s", processNode.queryProp("@name")); StringBuffer compListPath(CONFIGGEN_COMP_LIST); if (m_inDir.length()) compListPath.clear().append(m_inDir).append(PATHSEPCHAR).append(CONFIGGEN_COMP_LIST); Owned<IPropertyTree> deployNode = createPTreeFromXMLFile(compListPath.str(), ipt_caseInsensitive); StringBuffer srcFilePath; srcFilePath.ensureCapacity(_MAX_PATH); const bool bFindStartable = &m_process == &processNode && m_startable == unknown; const bool bFindStoppable = &m_process == &processNode && m_stoppable == unknown; StringBuffer xpath; xpath.appendf("Component[@name=\"%s\"]",processNode.queryProp("@buildSet")); IPropertyTree* pComponent = deployNode->queryPropTree(xpath.str()); if (!pComponent) { m_pCallback->printStatus(STATUS_NORMAL, NULL, NULL, NULL, "Cannot find files to install for %s", processNode.queryProp("@buildSet")); return 0; } Owned<IPropertyTreeIterator> iter = pComponent->getElements("File"); ForEach(*iter) { IPropertyTree* pFile = &iter->query(); const char* name = pFile->queryProp("@name"); if (!stricmp(name, "deploy_map.xml")) continue; if (bFindStartable && !strnicmp(name, "startup", sizeof("startup")-1)) m_startable = yes; if (bFindStoppable && !strnicmp(name, "stop", sizeof("stop")-1)) m_stoppable = yes; const char* method = pFile->queryProp("@method"); if (method && !stricmp(method, "schema")) continue; //if we are not deploying build files and method is copy then ignore this file if (!(m_deployFlags & DEFLAGS_BUILDFILES) && (!method || !stricmp(method, "copy"))) continue; const char* srcPath = pFile->queryProp("@srcPath"); const char* destPath= pFile->queryProp("@destPath"); const char* destName= pFile->queryProp("@destName"); bool bCacheable = pFile->getPropBool("@cache", false); // Get source filespec if (srcPath && !strcmp(srcPath, "@temp")) { char tempfile[_MAX_PATH]; getTempPath(tempfile, sizeof(tempfile), m_name); srcFilePath.clear().append(tempfile).append(name); } else { srcFilePath.clear().append(m_inDir); //adjust source paths if (srcPath && 0!=strcmp(srcPath, ".")) { if (!strncmp(srcPath, "..", 2) && (*(srcPath+2)=='/' || *(srcPath+2)=='\\')) { StringBuffer reldir(srcPath); reldir.replace('/', '\\'); while (!strncmp(reldir.str(), "..\\", 3)) { srcFilePath.setLength( srcFilePath.length() - 1 ); //remove last char PATHSEPCHAR const char* tail = pathTail(srcFilePath.str()); srcFilePath.setLength( tail - srcFilePath.str() ); reldir.remove(0, 3); } srcFilePath.append(reldir).append(PATHSEPCHAR); } else srcFilePath.append(srcPath).append(PATHSEPCHAR); } srcFilePath.append(name); } std::string sDestName; if (method && (!stricmp(method, "esp_service_module") || !stricmp(method, "esp_plugin"))) { //if this is xsl transformation and we are not generating config files then ignore // if (!(m_deployFlags & DEFLAGS_CONFIGFILES) && !stricmp(method, "esp_service_module")) continue; //if this file is an esp service module, encode name of service in the dest file name //so the esp deployment can figure out which service this file belongs to // const char* serviceName = processNode.queryProp("@name"); //if destination name is specified then use it otherwise use <service-name>[index of module].xml sDestName = serviceName; if (destName) { sDestName += '_'; sDestName += destName; } else { int espServiceModules = m_envDepEngine.incrementEspModuleCount(); if (espServiceModules > 1) { char achNum[16]; itoa(espServiceModules, achNum, 10); sDestName += achNum; } sDestName += ".xml"; } //encode name of service herein - this is needed by and removed by CEspDeploymentEngine::processServiceModules() sDestName += '+'; sDestName += processNode.queryProp("@name");//encode the name of service } else if (method && (!stricmp(method, "xsl") || !stricmp(method, "xslt")) && !(m_deployFlags & DEFLAGS_CONFIGFILES)) continue;//ignore xsl transformations if we are not generating config files else { if (!method || !*method) method = "copy"; // Get destination filespec if (destName && *destName) { //we now support attribute names within the destination file names like delimted by @ and + (optional) //for e.g. segment_@attrib1+_file_@attrib2 would produce segment_attribval1_file_attrib2value //+ not necessary if the attribute name ends with the word, for e.g. file_@attrib1 //for instnace, suite_@eclServer+.bat would expand to suite_myeclserver.bat //if this process has an @eclServer with value "myeclserver" // if (strchr(destName, '@') || strchr(destName, '+')) { char* pszParts = strdup(destName); char *saveptr; const char* pszPart = strtok_r(pszParts, "+", &saveptr); while (pszPart) { const char* p = pszPart; if (*p) { if (strchr(p, '@'))//xpath for an attribute? { // find name of attribute and replace it with its value const char* value = m_process.queryProp( p ); if (value) sDestName.append(value); } else sDestName.append(p); //no attribute so copy verbatim } pszPart = strtok_r(NULL, "+", &saveptr); } free(pszParts); } else sDestName = destName; if (sDestName.empty()) throw MakeStringException(-1, "The destination file name '%s' for source file '%s' " "translates to an empty string!", destName, name); } } StringBuffer destFilePath; destFilePath.ensureCapacity(_MAX_PATH); bool bTempFile = (destPath && !stricmp(destPath, "@temp")) || !strnicmp(name, "@temp", 5); //@name starts with @temp or @tmp if (bTempFile) { if (sDestName.empty())//dest name not specified { if (!strcmp(method, "copy")) sDestName = name; else { StringBuffer dir; const char* pszFileName = splitDirTail(name, dir); const char* pExt = findFileExtension(pszFileName); if (pExt) sDestName.append(pszFileName, pExt-pszFileName); else sDestName.append(pszFileName); char index[16]; itoa(m_envDepEngine.incrementTempFileCount(), index, 10); sDestName.append(index); if (pExt) sDestName.append(pExt); } } destFilePath.append("@temp" PATHSEPSTR); } else { if (destPath && *destPath) { destFilePath.append(destPath); if (destPath[strlen(destPath)-1] != PATHSEPCHAR) destFilePath.append(PATHSEPCHAR); } if (sDestName.empty()) sDestName = name; } if (!bTempFile) destFilePath.append(processNode.queryProp("@name")).append(PATHSEPCHAR); destFilePath.append(sDestName.c_str()); //For oss, plugins to be handled globally, per Richard. //esp plugins also end with plugins.xml but they should be handled above. String destFilePathStr(destFilePath); String* tmpstr = destFilePathStr.toLowerCase(); if (tmpstr->indexOf("plugins.xml") > 0) { delete tmpstr; createFakePlugins(destFilePath); continue; } delete tmpstr; //find all occurrences of this destination file in the map and resove any conflicts //like size mismatch etc. bool bAddToFileMap = installFiles.resolveConflicts(processNode, method, srcFilePath.str(), destFilePath.str(), m_name, m_curInstance, NULL); //resolve conflicts if method is not schema or exec if (0 != stricmp(method, "schema") && 0 != stricmp(method, "exec") && 0 != strnicmp(method, "del", 3)) { } else if (!strnicmp(method, "del", 3))//treat files to be deleted as temp files - to be deleted AFTER we are done! { bTempFile = true; bAddToFileMap = false; m_envDepEngine.addTempFile(destFilePath.str()); } if (bAddToFileMap) { if (bTempFile) m_envDepEngine.addTempFile(destFilePath.str()); //enable caching for files to be copied unless expressly asked not to do so // if (!bCacheable && !strcmp(method, "copy")) bCacheable = pFile->getPropBool("@cache", true); installFiles.addInstallFile(method, srcFilePath.str(), destFilePath.str(), bCacheable, NULL); } } } catch (IException* e) { StringBuffer msg; e->errorMessage(msg); e->Release(); throw MakeStringException(0, "Error creating file list for process %s: %s", m_name.get(), msg.str()); } catch (...) { throw MakeErrnoException("Error creating file list for process %s", m_name.get()); } m_pCallback->printStatus(STATUS_NORMAL, NULL, NULL, NULL, NULL); return installFiles.getInstallFileList().size(); }
void TempFile::init(const PathName& directory, const PathName& prefix) { // set up temporary directory, if not specified filename = directory; if (filename.empty()) { filename = getTempPath(); } PathUtils::ensureSeparator(filename); #if defined(WIN_NT) _timeb t; _ftime(&t); __int64 randomness = t.time; randomness *= 1000; randomness += t.millitm; PathName suffix = NAME_PATTERN; for (int tries = 0; tries < MAX_TRIES; tries++) { PathName name = filename + prefix; __int64 temp = randomness; for (FB_SIZE_T i = 0; i < suffix.length(); i++) { suffix[i] = NAME_LETTERS[temp % (strlen(NAME_LETTERS))]; temp /= strlen(NAME_LETTERS); } name += suffix; DWORD attributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_TEMPORARY; if (doUnlink) { attributes |= FILE_FLAG_DELETE_ON_CLOSE; } handle = CreateFile(name.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, attributes, NULL); if (handle != INVALID_HANDLE_VALUE) { filename = name; break; } randomness++; } if (handle == INVALID_HANDLE_VALUE) { system_error::raise("CreateFile"); } #else filename += prefix; filename += NAME_PATTERN; #ifdef HAVE_MKSTEMP handle = (IPTR) mkstemp(filename.begin()); #else if (!mktemp(filename.begin())) { system_error::raise("mktemp"); } handle = os_utils::open(filename.c_str(), O_RDWR | O_EXCL | O_CREAT); #endif if (handle == -1) { system_error::raise("open"); } if (doUnlink) { ::unlink(filename.c_str()); } #endif doUnlink = false; }
void Shader::compileToHLSL(void *compiler) { // ensure the compiler is loaded initializeCompiler(); int compileOptions = SH_OBJECT_CODE; std::string sourcePath; if (perfActive()) { sourcePath = getTempPath(); writeFile(sourcePath.c_str(), mSource.c_str(), mSource.length()); compileOptions |= SH_LINE_DIRECTIVES; } int result; if (sourcePath.empty()) { const char* sourceStrings[] = { mSource.c_str(), }; result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions); } else { const char* sourceStrings[] = { sourcePath.c_str(), mSource.c_str(), }; result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions | SH_SOURCE_PATH); } size_t shaderVersion = 100; ShGetInfo(compiler, SH_SHADER_VERSION, &shaderVersion); mShaderVersion = static_cast<int>(shaderVersion); if (shaderVersion == 300 && mRenderer->getCurrentClientVersion() < 3) { mInfoLog = "GLSL ES 3.00 is not supported by OpenGL ES 2.0 contexts"; TRACE("\n%s", mInfoLog.c_str()); } else if (result) { size_t objCodeLen = 0; ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &objCodeLen); char* outputHLSL = new char[objCodeLen]; ShGetObjectCode(compiler, outputHLSL); #ifdef _DEBUG std::ostringstream hlslStream; hlslStream << "// GLSL\n"; hlslStream << "//\n"; size_t curPos = 0; while (curPos != std::string::npos) { size_t nextLine = mSource.find("\n", curPos); size_t len = (nextLine == std::string::npos) ? std::string::npos : (nextLine - curPos + 1); hlslStream << "// " << mSource.substr(curPos, len); curPos = (nextLine == std::string::npos) ? std::string::npos : (nextLine + 1); } hlslStream << "\n\n"; hlslStream << outputHLSL; mHlsl = hlslStream.str(); #else mHlsl = outputHLSL; #endif delete[] outputHLSL; void *activeUniforms; ShGetInfoPointer(compiler, SH_ACTIVE_UNIFORMS_ARRAY, &activeUniforms); mActiveUniforms = *(std::vector<Uniform>*)activeUniforms; void *activeInterfaceBlocks; ShGetInfoPointer(compiler, SH_ACTIVE_INTERFACE_BLOCKS_ARRAY, &activeInterfaceBlocks); mActiveInterfaceBlocks = *(std::vector<InterfaceBlock>*)activeInterfaceBlocks; } else { size_t infoLogLen = 0; ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &infoLogLen); char* infoLog = new char[infoLogLen]; ShGetInfoLog(compiler, infoLog); mInfoLog = infoLog; TRACE("\n%s", mInfoLog.c_str()); } }
gl::Error HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string &hlsl, const std::string &profile, const std::vector<CompileConfig> &configs, const D3D_SHADER_MACRO *overrideMacros, ID3DBlob **outCompiledBlob, std::string *outDebugInfo) { ASSERT(mInitialized); #if !defined(ANGLE_ENABLE_WINDOWS_STORE) ASSERT(mD3DCompilerModule); #endif ASSERT(mD3DCompileFunc); #if !defined(ANGLE_ENABLE_WINDOWS_STORE) if (gl::DebugAnnotationsActive()) { std::string sourcePath = getTempPath(); std::string sourceText = FormatString("#line 2 \"%s\"\n\n%s", sourcePath.c_str(), hlsl.c_str()); writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size()); } #endif const D3D_SHADER_MACRO *macros = overrideMacros ? overrideMacros : nullptr; for (size_t i = 0; i < configs.size(); ++i) { ID3DBlob *errorMessage = nullptr; ID3DBlob *binary = nullptr; HRESULT result = S_OK; { TRACE_EVENT0("gpu.angle", "D3DCompile"); SCOPED_ANGLE_HISTOGRAM_TIMER("GPU.ANGLE.D3DCompileMS"); result = mD3DCompileFunc(hlsl.c_str(), hlsl.length(), gl::g_fakepath, macros, nullptr, "main", profile.c_str(), configs[i].flags, 0, &binary, &errorMessage); } if (errorMessage) { std::string message = reinterpret_cast<const char*>(errorMessage->GetBufferPointer()); SafeRelease(errorMessage); infoLog.appendSanitized(message.c_str()); TRACE("\n%s", hlsl.c_str()); TRACE("\n%s", message.c_str()); if ((message.find("error X3531:") != std::string::npos || // "can't unroll loops marked with loop attribute" message.find("error X4014:") != std::string::npos) && // "cannot have gradient operations inside loops with divergent flow control", // even though it is counter-intuitive to disable unrolling for this error, // some very long shaders have trouble deciding which loops to unroll and // turning off forced unrolls allows them to compile properly. macros != nullptr) { macros = nullptr; // Disable [loop] and [flatten] // Retry without changing compiler flags i--; continue; } } if (SUCCEEDED(result)) { *outCompiledBlob = binary; (*outDebugInfo) += "// COMPILER INPUT HLSL BEGIN\n\n" + hlsl + "\n// COMPILER INPUT HLSL END\n"; #if ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED (*outDebugInfo) += "\n\n// ASSEMBLY BEGIN\n\n"; (*outDebugInfo) += "// Compiler configuration: " + configs[i].name + "\n// Flags:\n"; for (size_t fIx = 0; fIx < ArraySize(CompilerFlagInfos); ++fIx) { if (IsCompilerFlagSet(configs[i].flags, CompilerFlagInfos[fIx].mFlag)) { (*outDebugInfo) += std::string("// ") + CompilerFlagInfos[fIx].mName + "\n"; } } (*outDebugInfo) += "// Macros:\n"; if (macros == nullptr) { (*outDebugInfo) += "// - : -\n"; } else { for (const D3D_SHADER_MACRO *mIt = macros; mIt->Name != nullptr; ++mIt) { (*outDebugInfo) += std::string("// ") + mIt->Name + " : " + mIt->Definition + "\n"; } } std::string disassembly; ANGLE_TRY(disassembleBinary(binary, &disassembly)); (*outDebugInfo) += "\n" + disassembly + "\n// ASSEMBLY END\n"; #endif // ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED return gl::NoError(); } if (result == E_OUTOFMEMORY) { *outCompiledBlob = nullptr; return gl::Error(GL_OUT_OF_MEMORY, "HLSL compiler had an unexpected failure, result: 0x%X.", result); } infoLog << "Warning: D3D shader compilation failed with " << configs[i].name << " flags. (" << profile << ")"; if (i + 1 < configs.size()) { infoLog << " Retrying with " << configs[i + 1].name; } } // None of the configurations succeeded in compiling this shader but the compiler is still intact *outCompiledBlob = nullptr; return gl::NoError(); }
void ShaderD3D::compileToHLSL(void *compiler, const std::string &source) { // ensure the compiler is loaded initializeCompiler(); int compileOptions = (SH_OBJECT_CODE | SH_VARIABLES); std::string sourcePath; #if !defined (ANGLE_ENABLE_WINDOWS_STORE) if (gl::perfActive()) { sourcePath = getTempPath(); writeFile(sourcePath.c_str(), source.c_str(), source.length()); compileOptions |= SH_LINE_DIRECTIVES; } #endif int result; if (sourcePath.empty()) { const char* sourceStrings[] = { source.c_str(), }; result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions); } else { const char* sourceStrings[] = { sourcePath.c_str(), source.c_str(), }; result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions | SH_SOURCE_PATH); } mShaderVersion = ShGetShaderVersion(compiler); if (mShaderVersion == 300 && mRenderer->getCurrentClientVersion() < 3) { mInfoLog = "GLSL ES 3.00 is not supported by OpenGL ES 2.0 contexts"; TRACE("\n%s", mInfoLog.c_str()); } else if (result) { mHlsl = ShGetObjectCode(compiler); #ifdef _DEBUG // Prefix hlsl shader with commented out glsl shader // Useful in diagnostics tools like pix which capture the hlsl shaders std::ostringstream hlslStream; hlslStream << "// GLSL\n"; hlslStream << "//\n"; size_t curPos = 0; while (curPos != std::string::npos) { size_t nextLine = source.find("\n", curPos); size_t len = (nextLine == std::string::npos) ? std::string::npos : (nextLine - curPos + 1); hlslStream << "// " << source.substr(curPos, len); curPos = (nextLine == std::string::npos) ? std::string::npos : (nextLine + 1); } hlslStream << "\n\n"; hlslStream << mHlsl; mHlsl = hlslStream.str(); #endif mUniforms = *GetShaderVariables(ShGetUniforms(compiler)); for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); uniformIndex++) { const sh::Uniform &uniform = mUniforms[uniformIndex]; if (uniform.staticUse) { unsigned int index = -1; bool result = ShGetUniformRegister(compiler, uniform.name, &index); UNUSED_ASSERTION_VARIABLE(result); ASSERT(result); mUniformRegisterMap[uniform.name] = index; } } mInterfaceBlocks = *GetShaderVariables(ShGetInterfaceBlocks(compiler)); for (size_t blockIndex = 0; blockIndex < mInterfaceBlocks.size(); blockIndex++) { const sh::InterfaceBlock &interfaceBlock = mInterfaceBlocks[blockIndex]; if (interfaceBlock.staticUse) { unsigned int index = -1; bool result = ShGetInterfaceBlockRegister(compiler, interfaceBlock.name, &index); UNUSED_ASSERTION_VARIABLE(result); ASSERT(result); mInterfaceBlockRegisterMap[interfaceBlock.name] = index; } } } else { mInfoLog = ShGetInfoLog(compiler); TRACE("\n%s", mInfoLog.c_str()); } }
gl::Error HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string &hlsl, const std::string &profile, const std::vector<CompileConfig> &configs, const D3D_SHADER_MACRO *overrideMacros, ID3DBlob **outCompiledBlob, std::string *outDebugInfo) const { #if !defined(ANGLE_ENABLE_WINDOWS_STORE) ASSERT(mD3DCompilerModule); #endif ASSERT(mD3DCompileFunc); #if !defined(ANGLE_ENABLE_WINDOWS_STORE) if (gl::perfActive()) { std::string sourcePath = getTempPath(); std::string sourceText = FormatString("#line 2 \"%s\"\n\n%s", sourcePath.c_str(), hlsl.c_str()); writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size()); } #endif const D3D_SHADER_MACRO *macros = overrideMacros ? overrideMacros : NULL; for (size_t i = 0; i < configs.size(); ++i) { ID3DBlob *errorMessage = NULL; ID3DBlob *binary = NULL; HRESULT result = mD3DCompileFunc(hlsl.c_str(), hlsl.length(), gl::g_fakepath, macros, NULL, "main", profile.c_str(), configs[i].flags, 0, &binary, &errorMessage); if (errorMessage) { std::string message = reinterpret_cast<const char*>(errorMessage->GetBufferPointer()); SafeRelease(errorMessage); infoLog.appendSanitized(message.c_str()); TRACE("\n%s", hlsl.c_str()); TRACE("\n%s", message.c_str()); if (message.find("error X3531:") != std::string::npos) // "can't unroll loops marked with loop attribute" { macros = NULL; // Disable [loop] and [flatten] // Retry without changing compiler flags i--; continue; } } if (SUCCEEDED(result)) { *outCompiledBlob = binary; #if ANGLE_SHADER_DEBUG_INFO == ANGLE_ENABLED (*outDebugInfo) += "// COMPILER INPUT HLSL BEGIN\n\n" + hlsl + "\n// COMPILER INPUT HLSL END\n"; (*outDebugInfo) += "\n\n// ASSEMBLY BEGIN\n\n"; (*outDebugInfo) += "// Compiler configuration: " + configs[i].name + "\n// Flags:\n"; for (size_t fIx = 0; fIx < ArraySize(CompilerFlagInfos); ++fIx) { const char *flagName = GetCompilerFlagName(configs[i].flags, fIx); if (flagName != nullptr) { (*outDebugInfo) += std::string("// ") + flagName + "\n"; } } (*outDebugInfo) += "// Macros:\n"; if (macros == nullptr) { (*outDebugInfo) += "// - : -\n"; } else { for (const D3D_SHADER_MACRO *mIt = macros; mIt->Name != nullptr; ++mIt) { (*outDebugInfo) += std::string("// ") + mIt->Name + " : " + mIt->Definition + "\n"; } } (*outDebugInfo) += "\n" + disassembleBinary(binary) + "\n// ASSEMBLY END\n"; #endif return gl::Error(GL_NO_ERROR); } else { if (result == E_OUTOFMEMORY) { *outCompiledBlob = NULL; return gl::Error(GL_OUT_OF_MEMORY, "HLSL compiler had an unexpected failure, result: 0x%X.", result); } infoLog.append("Warning: D3D shader compilation failed with %s flags.", configs[i].name.c_str()); if (i + 1 < configs.size()) { infoLog.append(" Retrying with %s.\n", configs[i + 1].name.c_str()); } } } // None of the configurations succeeded in compiling this shader but the compiler is still intact *outCompiledBlob = NULL; return gl::Error(GL_NO_ERROR); }