wxGISLocalServerConnection::~wxGISLocalServerConnection(void) { DestroyThreads(); if(m_pNetService) { m_pNetService->RemoveConnection(this); } }
bool wxGISLocalClientConnection::Disconnect(void) { if(!m_bIsConnected) return true; m_bIsConnected = false; m_bIsConnecting = false; DestroyThreads(); return true; }
int threads_tests() { int status = 0; status = InitThreads(2); printf("InitThreads returned %d\n", status); task_info tasks[] = { {test_routine1, (void*)1}, {test_routine1, (void*)2}, {test_routine1, (void*)3}, {test_routine1, (void*)4}, {test_routine1, (void*)5} }; status = AddTasks(tasks, sizeof(tasks) / sizeof(task_info)); printf("AddTasks returned %d\n", status); status = JoinTasks(); printf("JoinTasks returned %d\n", status); status = DestroyThreads(); printf("DestroyTreads returned %d\n", status); return status; }
// Handles the GUI events void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext ) { switch( nControlID ) { case IDC_TOGGLEFULLSCREEN: { DXUTToggleFullScreen(); break; } case IDC_TOGGLEREF: { DXUTToggleREF(); break; } case IDC_CHANGEDEVICE: { gD3DSettingsDlg.SetActive( !gD3DSettingsDlg.IsActive() ); break; } case IDC_TEXT: case IDC_EXPOSURE: { gLog2Exposure = (gSampleUI.GetSlider(IDC_EXPOSURE)->GetValue() / 100.0f - 0.5f) * 33.33333; WCHAR wstr[MAX_PATH]; swprintf_s(wstr, MAX_PATH, L"Texture Size: %d x %d\n" L"logRGB L1: %.2f%%\n" //L"logRGB RMSE: %.4f\n" //L"Relative error: %.2f%%\n" //L"mPSNR: %.2f%%\n" L"Exposure: %.2f\n" L"Compression Time: %0.2f ms\n" L"Compression Rate: %0.2f Mp/s\n", gTexWidth, gTexHeight, gError, gLog2Exposure, gCompTime, gCompRate); gSampleUI.GetStatic(IDC_TEXT)->SetText(wstr); break; } case IDC_MT: { // Shut down all previous threading abilities. DestroyThreads(); gMultithreaded = gSampleUI.GetCheckBox(IDC_MT)->GetChecked(); if (gMultithreaded) { InitWin32Threads(); } // Recompress the texture. RecompressTexture(); gSampleUI.SendEvent(IDC_TEXT, true, gSampleUI.GetStatic(IDC_TEXT)); break; } case IDC_PROFILE: { gCompressionFunc = (CompressionFunc*)gSampleUI.GetComboBox(IDC_PROFILE)->GetSelectedData(); // Recompress the texture. RecompressTexture(); gSampleUI.SendEvent(IDC_TEXT, true, gSampleUI.GetStatic(IDC_TEXT)); break; } case IDC_LOAD_TEXTURE: { // Store the current working directory. TCHAR workingDirectory[MAX_PATH]; GetCurrentDirectory(MAX_PATH, workingDirectory); // Open a file dialog. OPENFILENAME openFileName; WCHAR file[MAX_PATH]; file[0] = 0; ZeroMemory(&openFileName, sizeof(OPENFILENAME)); openFileName.lStructSize = sizeof(OPENFILENAME); openFileName.lpstrFile = file; openFileName.nMaxFile = MAX_PATH; openFileName.lpstrFilter = L"DDS\0*.dds\0\0"; openFileName.nFilterIndex = 1; openFileName.lpstrInitialDir = NULL; openFileName.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; if(GetOpenFileName(&openFileName)) { //CreateTextures(openFileName.lpstrFile); SAFE_RELEASE(gUncompressedSRV); LoadTexture(openFileName.lpstrFile); } // Restore the working directory. GetOpenFileName changes the current working directory which causes problems with relative paths to assets. SetCurrentDirectory(workingDirectory); RecompressTexture(); gSampleUI.SendEvent(IDC_TEXT, true, gSampleUI.GetStatic(IDC_TEXT)); break; } case IDC_RECOMPRESS: { // Recompress the texture. RecompressTexture(); gSampleUI.SendEvent(IDC_TEXT, true, gSampleUI.GetStatic(IDC_TEXT)); break; } case IDC_SAVE_TEXTURE: { // Store the current working directory. TCHAR workingDirectory[MAX_PATH]; GetCurrentDirectory(MAX_PATH, workingDirectory); // Open a file dialog. OPENFILENAME openFileName; WCHAR file[MAX_PATH]; file[0] = 0; ZeroMemory(&openFileName, sizeof(OPENFILENAME)); openFileName.lStructSize = sizeof(OPENFILENAME); openFileName.lpstrFile = file; openFileName.nMaxFile = MAX_PATH; openFileName.lpstrFilter = L"DDS\0*.dds\0\0"; openFileName.lpstrDefExt = L"dds"; openFileName.nFilterIndex = 1; openFileName.lpstrInitialDir = NULL; openFileName.Flags = OFN_PATHMUSTEXIST; if(GetSaveFileName(&openFileName)) { SaveTexture(gCompressedSRV,openFileName.lpstrFile); } // Restore the working directory. GetOpenFileName changes the current working directory which causes problems with relative paths to assets. SetCurrentDirectory(workingDirectory); break; } case IDC_IMAGEVIEW: { gImageView = (EImageView)(INT_PTR)gSampleUI.GetComboBox(IDC_IMAGEVIEW)->GetSelectedData(); break; } } }
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif Initialize(); // Set DXUT callbacks DXUTSetCallbackDeviceChanging( ModifyDeviceSettings ); DXUTSetCallbackMsgProc( MsgProc ); DXUTSetCallbackKeyboard( OnKeyboard ); DXUTSetCallbackMouse( OnMouse, true ); DXUTSetCallbackD3D11DeviceAcceptable( IsD3D11DeviceAcceptable ); DXUTSetCallbackD3D11DeviceCreated( OnD3D11CreateDevice ); DXUTSetCallbackD3D11SwapChainResized( OnD3D11ResizedSwapChain ); DXUTSetCallbackD3D11FrameRender( OnD3D11FrameRender ); DXUTSetCallbackD3D11SwapChainReleasing( OnD3D11ReleasingSwapChain ); DXUTSetCallbackD3D11DeviceDestroyed( OnD3D11DestroyDevice ); InitApp(); if (gMultithreaded) { InitWin32Threads(); } DXUTInit( true, true, NULL ); DXUTSetCursorSettings( true, true ); DXUTCreateWindow( L"ISPC HDR Texture Compressor" ); // Try to create a device with DX11 feature set DXUTCreateDevice (D3D_FEATURE_LEVEL_11_0, true, 1280, 1024 ); BOOL DX11Available = false; // If we don't have an adequate driver, then we revert to DX10 feature set... DXUTDeviceSettings settings = DXUTGetDeviceSettings(); if(settings.d3d11.DriverType == D3D_DRIVER_TYPE_UNKNOWN || settings.d3d11.DriverType == D3D_DRIVER_TYPE_NULL) { DXUTCreateDevice(D3D_FEATURE_LEVEL_10_1, true, 1280, 1024); // !HACK! Force enumeration here in order to relocate hardware with new feature level DXUTGetD3D11Enumeration(true); DXUTCreateDevice(D3D_FEATURE_LEVEL_10_1, true, 1280, 1024); const TCHAR *noDx11msg = _T("Your hardware does not seem to support DX11. BC7 Compression is disabled."); MessageBox(NULL, noDx11msg, _T("Error"), MB_OK); } else { DX11Available = true; } FillProfiles(DX11Available); DXUTMainLoop(); // Destroy all of the threads... DestroyThreads(); return DXUTGetExitCode(); }
wxGISLocalClientConnection::~wxGISLocalClientConnection(void) { DestroyThreads(); }