void CChildView::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize(nType, cx, cy); if (m_hWnd && cx && cy) { TRACE("OnSize: width == %d, height == %d\n", cx, cy); // Initialize screen format // First time init with an hwnd if (m_eSurf == eNone) { CClientDC dc(this); int pixels; bool bWarnDepth = false; bool bWarnDebug = false; SetTimer(m_kTimerID, m_kTimerDelay, NULL); pixels = dc.GetDeviceCaps(BITSPIXEL) * dc.GetDeviceCaps(PLANES); switch (pixels) { case 16: m_eSurf = IsSSE2() ? e16BitSSE2Intrin : IsMMX() ? e16BitMMXIntrin : e16BitGeneric; break; case 24: m_eSurf = IsSSE2() ? e24BitSSE2Intrin : IsMMX() ? e24BitMMXIntrin : e24BitGeneric; break; case 32: m_eSurf = IsSSE2() ? e32BitSSE2Intrin : IsMMX() ? e32BitMMXIntrin : e32BitGeneric; break; default: bWarnDepth = true; m_eSurf = IsSSE2() ? e32BitSSE2Intrin : IsMMX() ? e32BitMMXIntrin : e32BitGeneric; break; } #ifdef _DEBUG bWarnDebug = true; #endif if (bWarnDepth || bWarnDebug) { CString fmt; if (bWarnDepth) { fmt.LoadString(IDS_WARNING_BITDEPTH); } if (bWarnDepth && bWarnDebug) { fmt += "\n"; } if (bWarnDebug) { CString temp; temp.LoadString(IDS_WARNING_DEBUG); fmt += temp; } ::AfxMessageBox(fmt, MB_ICONINFORMATION); } } m_bSizeChanged = true; CreateSurface(); } }
int Sys_GetProcessorId( void ) { #if defined _M_ALPHA return CPUID_AXP; #elif !defined _M_IX86 return CPUID_GENERIC; #else // verify we're at least a Pentium or 486 w/ CPUID support if ( !IsPentium() ) { return CPUID_INTEL_UNSUPPORTED; } // check for MMX if ( !IsMMX() ) { // Pentium or PPro return CPUID_INTEL_PENTIUM; } // see if we're an AMD 3DNOW! processor if ( Is3DNOW() ) { return CPUID_AMD_3DNOW; } // see if we're an Intel Katmai if ( IsKNI() ) { return CPUID_INTEL_KATMAI; } // by default we're functionally a vanilla Pentium/MMX or P2/MMX return CPUID_INTEL_MMX; #endif }
void CChildView::OnUpdateImageFormats(CCmdUI* pCmdUI) { BOOL bEnable = TRUE; switch (pCmdUI->m_nID) { case IDD_16BIT_MMXINTRINSICS: case IDD_24BIT_MMXINTRINSICS: case IDD_32BIT_MMXINTRINSICS: bEnable = IsMMX(); break; case IDD_16BIT_SSE2INTRINSICS: case IDD_24BIT_SSE2INTRINSICS: case IDD_32BIT_SSE2INTRINSICS: bEnable = IsSSE2(); break; default: break; } if (ESurface(pCmdUI->m_nID) == m_eSurf) pCmdUI->SetCheck(1); else pCmdUI->SetCheck(0); pCmdUI->Enable(bEnable); }