HRESULT STDMETHODCALLTYPE my_CreateSwapChain( IDXGIFactory* This, IUnknown* ifDevice, DXGI_SWAP_CHAIN_DESC* pdesc, IDXGISwapChain** ppSwapChain ) { log_frame( "dxgi", u::info ) << log_var(ifDevice) << log_var(pdesc->OutputWindow) << log_var(pdesc->BufferCount) << log_var(pdesc->BufferDesc.Width) << log_var(pdesc->BufferDesc.Height) << u::endh; HRESULT result = (*stub_CreateSwapChain)( This, ifDevice, pdesc, ppSwapChain ); frame << log_ret(result); return result; }
int WINAPI my_ReleaseDC( HWND hwnd, HDC hdc ) { log_frame( "user", u::info ) << log_var(hwnd) << log_var(hdc) << u::endh; int result = (*stub_ReleaseDC)( hwnd, hdc ); frame << log_ret(result); return result; }
int WINAPI my_BitBlt( HDC hdc, int x, int y, int cx, int cy, HDC hdcSrc, int x1, int y1, DWORD rop ) { log_frame( "gdi", u::info ) << log_var(hdc) << log_var(x) << log_var(y) << log_var(cx) << log_var(cy) << log_var(rop) << u::endh; BOOL result = (*stub_BitBlt)( hdc, x, y, cx, cy, hdcSrc, x1, y1, rop ); frame << log_ret(result); return result; }
void STDMETHODCALLTYPE my_DrawGlyphRun( ID2D1RenderTarget* This, D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN* glyphRun, ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ) { log_frame( "d2d1", u::info ) << log_var(This) << log_var(baselineOrigin.x) << log_var(baselineOrigin.y) << log_var(glyphRun->glyphCount) << u::endh; g_currentRtWithGlyph = This; (*stub_DrawGlyphRun)( This, baselineOrigin, glyphRun, foregroundBrush, measuringMode ); return; }
BOOL WINAPI my_UpdateLayeredWindow( HWND hwnd, HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags ) { log_frame( "gdi", u::info ) << log_var(hwnd) << u::endh; BOOL result = (*stub_UpdateLayeredWindow)( hwnd, hdcDst, pptDst, psize, hdcSrc, pptSrc, crKey, pblend, dwFlags ); frame << log_ret(result); return result; }
HRESULT STDMETHODCALLTYPE my_Present( IDXGISwapChain* This, UINT SyncInterval, UINT Flags ) { log_frame( "dxgi", u::info ) << log_var(This) << u::endh; HRESULT hr; DXGI_SWAP_CHAIN_DESC desc; hr = This->GetDesc( &desc ); frame << log_var(desc.BufferDesc.Width) << log_var(desc.BufferDesc.Height) << log_var(desc.OutputWindow); CComPtr<IDXGIDevice> dxgiDevice; hr = This->GetDevice( __uuidof(IDXGIDevice), (void**)&dxgiDevice ); frame << log_var(dxgiDevice); HRESULT result = stub_Present(This, SyncInterval, Flags ); frame << log_ret(result); return result; }
HDC WINAPI my_GetDC( HWND hwnd ) { log_frame( "user", u::info ) << log_var(hwnd) << u::endh; HDC hdc = (*stub_GetDC)( hwnd ); frame << log_ret(hdc); return hdc; }
HRESULT STDMETHODCALLTYPE my_Present1( IDXGISwapChain1* This, UINT SyncInterval, UINT PresentFlags, const DXGI_PRESENT_PARAMETERS *pPresentParameters ) { log_frame( "dxgi", u::info ) << log_var(This) << u::endh; HRESULT hr; DXGI_SWAP_CHAIN_DESC1 desc; hr = This->GetDesc1( &desc ); frame << log_var(desc.Width) << log_var(desc.Height); HWND hwnd; hr = This->GetHwnd( &hwnd ); frame << log_var(hwnd); CComPtr<IDXGIDevice> dxgiDevice; hr = This->GetDevice( __uuidof(IDXGIDevice), (void**)&dxgiDevice ); frame << log_var(dxgiDevice); HRESULT result = (*stub_Present1)(This, SyncInterval, PresentFlags, pPresentParameters ); frame << log_ret(result); return result; }
HRESULT STDMETHODCALLTYPE my_CreateSwapChainForHwnd( IDXGIFactory2* This, IUnknown* pDevice, HWND hWnd, const DXGI_SWAP_CHAIN_DESC1* pDesc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc, IDXGIOutput* pRestrictToOutput, IDXGISwapChain1** ppSwapChain ) { log_frame( "dxgi", u::info ) << log_var(pDevice) << log_var(hWnd) << log_var(pDesc->Width) << log_var(pDesc->Height) << log_var(pDesc->BufferCount) << u::endh; HRESULT result = (*stub_CreateSwapChainForHwnd)( This, pDevice, hWnd, pDesc, pFullscreenDesc, pRestrictToOutput, ppSwapChain ); frame << log_var(*ppSwapChain) << log_ret(result); return result; }
HRESULT STDMETHODCALLTYPE my_CreateBitmapFromWicBitmap( ID2D1RenderTarget* This, IWICBitmapSource* wicBitmapSource, const D2D1_BITMAP_PROPERTIES* bitmapProperties, ID2D1Bitmap** bitmap ) { log_frame( "d2d1", u::info ) << log_var(This) << log_var(wicBitmapSource); double dpix, dpiy; UINT width, height; wicBitmapSource->GetResolution( &dpix, &dpiy ); wicBitmapSource->GetSize( &width, &height ); frame << log_var(dpix) << log_var(dpiy) << log_var(width) << log_var(height) << u::endh; HRESULT result = (*stub_CreateBitmapFromWicBitmap)( This, wicBitmapSource, bitmapProperties, bitmap ); frame << log_var(*bitmap) << log_ret(result); return result; }
LRESULT WINAPI my_DispatchMessage( const MSG *pmsg ) { log_frame( "user", u::info ) << log_var(pmsg->hwnd) << log_var_f(pmsg->message, "%x") << u::endh; LRESULT result = (*stub_DispatchMessage)(pmsg); if( pmsg->message == 0x401 ) { CPlug* pplug = CPlug::inst(); if( pplug ) { CSubclsWnd* pwnd = pplug->getSubclsWnd(); if( pwnd ) { //CPlug::inst()->getSubclsWnd()->highlight(); } } } frame << log_ret(result); return result; }
HRESULT STDMETHODCALLTYPE my_CreateWicBitmapRenderTarget( ID2D1Factory* This, IWICBitmap* target, const D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties, ID2D1RenderTarget** renderTarget ) { log_frame( "d2d1", u::info ) << log_var(This) << log_var(target) << u::endh; // Some data about the bitmap UINT width, height; double dpix, dpiy; target->GetSize( &width, &height ); target->GetResolution( &dpix, &dpiy ); frame << log_var(width) << log_var(height); frame << log_var(dpix) << log_var(dpiy); HRESULT result = (*stub_CreateWicBitmapRenderTarget)( This, target, renderTargetProperties, renderTarget ); frame << log_var(*renderTarget) << log_ret(result); return result; }
void CrystalEditorFrame::OnMouseMove(wxMouseEvent& event) { if (!dragging) return; // Turn mouse movement to a movement of a virtual trackball (which is as big as the window). Vector3 currentMousePos(event.GetX(), event.GetY(), 0); int width, height; GetSize(&width, &height); log_var(CRYSTAL_EDITOR_MOUSE_MOVE, width); log_var(CRYSTAL_EDITOR_MOUSE_MOVE, height); double windowSize = std::min(width, height); log_var(CRYSTAL_EDITOR_MOUSE_MOVE, windowSize); Vector3 center(0.5 * width, 0.5 * height, 0); log_var(CRYSTAL_EDITOR_MOUSE_MOVE, center); Vector3 normPrevPos = (prevMousePos - center) / windowSize; log_var(CRYSTAL_EDITOR_MOUSE_MOVE, normPrevPos); Vector3 normPos = (currentMousePos - center) / windowSize; log_var(CRYSTAL_EDITOR_MOUSE_MOVE, normPos); // Invert vertical axis, because in camera space Y grow upward. normPrevPos.y = -normPrevPos.y; normPos.y = -normPos.y; // Calculate the Z position on the trackball normPrevPos.z = normPrevPos * normPrevPos <= 1 ? sqrt(1.0 - normPrevPos * normPrevPos) : 0; normPos.z = normPos * normPos <= 1 ? sqrt(1.0 - normPos * normPos) : 0; log_var(CRYSTAL_EDITOR_MOUSE_MOVE, normPrevPos); log_var(CRYSTAL_EDITOR_MOUSE_MOVE, normPos); // Calculate the rotation axis Vector3 rotAxis = normPrevPos % normPos; double rotAxisLength = ~rotAxis; if (rotAxisLength == 0) { // No rotation. return; } rotAxis /= rotAxisLength; log_var(CRYSTAL_EDITOR_MOUSE_MOVE, rotAxis); // Calculate the real rotation axis and the angle. double rotAngle = acos((normPrevPos * normPos)/(~normPrevPos * ~normPos)); log_var(CRYSTAL_EDITOR_MOUSE_MOVE, rotAngle); Vector3 realRotAxis = rotAxis.x * right + rotAxis.y * upward + rotAxis.z * backward; // Create the true rotation axis (in camera space). log_var(CRYSTAL_EDITOR_MOUSE_MOVE, realRotAxis); Matrix rotation = createRotationMatrix(realRotAxis, -rotAngle); // Negative as we rotate the view, not the object log_var(CRYSTAL_EDITOR_MOUSE_MOVE, rotation); backward = transformVector(rotation, backward); right = transformVector(rotation, right); upward = transformVector(rotation, upward); log_var(CRYSTAL_EDITOR_MOUSE_MOVE, backward); log_var(CRYSTAL_EDITOR_MOUSE_MOVE, right); log_var(CRYSTAL_EDITOR_MOUSE_MOVE, upward); fix3VectorSystem(right, upward, backward); prevMousePos.x = event.GetX(); prevMousePos.y = event.GetY(); prevMousePos.z = 0; // Calculate ray path updateRayPaths(); mainPanel->Refresh(); log_printf(CRYSTAL_EDITOR_MOUSE_MOVE, "========================\n"); }
/* * We could load gres state or validate it using various mechanisms here. * This only validates that the configuration was specified in gres.conf. * In the general case, no code would need to be changed. */ extern int node_config_load(List gres_conf_list, node_config_load_t *config) { int rc = SLURM_SUCCESS; log_level_t log_lvl; List gpu_conf_list, mps_conf_list; bool have_fake_gpus = _test_gpu_list_fake(); /* Assume this state is caused by an scontrol reconfigure */ debug_flags = slurm_get_debug_flags(); if (gres_devices) { debug("Resetting gres_devices"); FREE_NULL_LIST(gres_devices); } FREE_NULL_LIST(mps_info); if (debug_flags & DEBUG_FLAG_GRES) log_lvl = LOG_LEVEL_VERBOSE; else log_lvl = LOG_LEVEL_DEBUG; log_var(log_lvl, "%s: Initalized gres.conf list:", plugin_name); print_gres_list(gres_conf_list, log_lvl); /* * Ensure that every GPU device file is listed as a MPS file. * Any MPS entry that we need to add will have a "Count" of zero. * Every MPS "Type" will be made to match the GPU "Type". The order * of MPS records (by "File") must match the order in which GPUs are * defined for the GRES bitmaps in slurmctld to line up. * * First, convert all GPU records to a new entries in a list where * each File is a unique device (i.e. convert a record with * "File=nvidia[0-3]" into 4 separate records). */ gpu_conf_list = _build_gpu_list(gres_conf_list); /* Now move MPS records to new List, each with unique device file */ mps_conf_list = _build_mps_list(gres_conf_list); /* * Merge MPS records back to original list, updating and reordering * as needed. */ _merge_lists(gres_conf_list, gpu_conf_list, mps_conf_list); FREE_NULL_LIST(gpu_conf_list); FREE_NULL_LIST(mps_conf_list); rc = common_node_config_load(gres_conf_list, gres_name, &gres_devices); if (rc != SLURM_SUCCESS) fatal("%s failed to load configuration", plugin_name); if (_build_mps_dev_info(gres_conf_list) == 0) _remove_mps_recs(gres_conf_list); log_var(log_lvl, "%s: Final gres.conf list:", plugin_name); print_gres_list(gres_conf_list, log_lvl); // Print in parsable format for tests if fake system is in use if (have_fake_gpus) { info("Final normalized gres.conf list (parsable):"); print_gres_list_parsable(gres_conf_list); } return rc; }
void STDMETHODCALLTYPE my_BeginDraw( ID2D1RenderTarget* This ) { log_frame( "d2d1", u::info ) << log_var(This) << u::endh; (*stub_BeginDraw)( This ); return; }
HRESULT STDMETHODCALLTYPE my_EndDraw( ID2D1RenderTarget* This, D2D1_TAG *tag1, D2D1_TAG *tag2 ) { HRESULT hr; log_frame( "d2d1", u::info ) << log_var(This) << u::endh; if( g_currentRtWithGlyph == This ) { CComPtr<ID2D1SolidColorBrush> ifBrushBlack; CComPtr<ID2D1SolidColorBrush> ifBrushRed; CComPtr<ID2D1SolidColorBrush> ifBrushGreen; CComPtr<ID2D1SolidColorBrush> ifBrushBlue; CComPtr<ID2D1SolidColorBrush> ifBrushOrange; hr = This->CreateSolidColorBrush( D2D1::ColorF( D2D1::ColorF::Black ), &ifBrushBlack ); hr = This->CreateSolidColorBrush( D2D1::ColorF( D2D1::ColorF::Red ), &ifBrushRed ); hr = This->CreateSolidColorBrush( D2D1::ColorF( D2D1::ColorF::Green ), &ifBrushGreen ); hr = This->CreateSolidColorBrush( D2D1::ColorF( D2D1::ColorF::Blue ), &ifBrushBlue ); hr = This->CreateSolidColorBrush( D2D1::ColorF( D2D1::ColorF::OrangeRed, 0.5f ), &ifBrushOrange ); D2D1_RECT_F rect; rect.left = 0; rect.top = 0; rect.right = 1024; rect.bottom = 2014; //This->PushAxisAlignedClip( &rect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE ); //This->DrawLine( D2D1::Point2F(0.0f, 0.0f), D2D1::Point2F(480.0f, 480.0f), ifBrush ); if( CPlug::inst()->IsDoingGrid() ) { for( int i=0; i<20; ++i ) { for( int j=0; j<20; ++j ) { float cy = i * 50.0f; float cx = j * 50.0f; ID2D1SolidColorBrush* ifBrush = ( i<10 && j < 10 ) ? ifBrushBlack : ( i<10 ) ? ifBrushRed : ( j<10 ) ? ifBrushGreen : ifBrushBlue; This->DrawLine( D2D1::Point2F( cx - 5.0f, cy - 5.0f ), D2D1::Point2F( cx + 5.0f, cy + 5.0f ), ifBrush ); This->DrawLine( D2D1::Point2F( cx + 5.0f, cy - 5.0f ), D2D1::Point2F( cx - 5.0f, cy + 5.0f ), ifBrush ); } } //This->PopAxisAlignedClip(); } if( CPlug::inst()->IsDoingRosebud() ) { CPlug* pplug = CPlug::inst(); if( pplug ) { int num; int i; num = pplug->numRosebuds( ); for( i = 0; i < num; ++i ) { int ileft, itop, iright, ibottom; bool f = pplug->enumRosebud( i, &ileft, &itop, &iright, &ibottom ); if( f ) { float left = (float)ileft; float top = (float)itop; float right = (float)iright; float bottom = (float)ibottom; //This->DrawLine( D2D1::Point2F( left, top ), D2D1::Point2F( right, top ), ifBrushBlack ); //This->DrawLine( D2D1::Point2F( right, top ), D2D1::Point2F( right, bottom ), ifBrushBlack ); //This->DrawLine( D2D1::Point2F( right, bottom ), D2D1::Point2F( left, bottom ), ifBrushBlack ); //This->DrawLine( D2D1::Point2F( left, bottom ), D2D1::Point2F( left, top ), ifBrushBlack ); D2D1_RECT_F rc = D2D1::RectF( left, top, right, bottom ); This->FillRectangle( &rc, ifBrushOrange ); } } } } g_currentRtWithGlyph = NULL; } HRESULT result = stub_EndDraw(This, tag1, tag2 ); frame << log_ret(result); return result; }
void STDMETHODCALLTYPE my_DrawBitmap( ID2D1RenderTarget* This, ID2D1Bitmap* bitmap, const D2D1_RECT_F* destRc, FLOAT opacity, D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F* srcRc ) { log_frame( "d2d1", u::info ) << log_var(This) << log_var(bitmap) << log_var(opacity); D2D1_SIZE_F bitmapSize = bitmap->GetSize( ); frame << log_var(bitmapSize.width) << log_var(bitmapSize.height); if( destRc ) { frame << log_var(destRc->left) << log_var(destRc->top) << log_var(destRc->right) << log_var(destRc->bottom); } if( srcRc ) { frame << log_var(srcRc->left) << log_var(srcRc->top) << log_var(srcRc->right) << log_var(srcRc->bottom); } frame << u::endh; (*stub_DrawBitmap)(This, bitmap, destRc, opacity, interpolationMode, srcRc ); return; }