s( strDeviceName, 256, pOutputInfo->Desc.DeviceName );
        }
    }

    EnumDisplaySettings( strDeviceName, ENUM_REGISTRY_SETTINGS, &devMode );
    if( pWidth )
        *pWidth = devMode.dmPelsWidth;
    if( pHeight )
        *pHeight = devMode.dmPelsHeight;
}


//--------------------------------------------------------------------------------------
// Display error msg box to help debug 
//--------------------------------------------------------------------------------------
HRESULT WINAPI DXUTTrace( const CHAR* strFile, DWORD dwLine, HRESULT hr,
                          const WCHAR* strMsg, bool bPopMsgBox )
{
    bool bShowMsgBoxOnError = DXUTGetShowMsgBoxOnError();
    if( bPopMsgBox && bShowMsgBoxOnError == false )
        bPopMsgBox = false;

    return DXTrace( strFile, dwLine, hr, strMsg, bPopMsgBox );
}


//--------------------------------------------------------------------------------------
void WINAPI DXUTConvertDeviceSettings10to9( DXUTD3D10DeviceSettings* pIn, DXUTD3D9DeviceSettings* pOut )
{
    pOut->AdapterOrdinal = pIn->AdapterOrdinal;

    if( pIn->DriverType == D3D10_DRIVER_TYPE_HARDWARE )
        pOut->DeviceType = D3DDEVTYPE_HAL;
    else if( pIn->DriverType == D3D10_DRIVER_TYPE_REFERENCE )
        pOut->DeviceType = D3DDEVTYPE_REF;
    else if( pIn->DriverType == D3D10_DRIVER_TYPE_NULL )
        pOut->DeviceType = D3DDEVTYPE_NULLREF;

    pOut->AdapterFormat = ConvertFormatDXGIToD3D9( pIn->sd.BufferDesc.Format );
    pOut->BehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING;
    pOut->pp.BackBufferWidth = pIn->sd.BufferDesc.Width;
    pOut->pp.BackBufferHeight = pIn->sd.BufferDesc.Height;
    pOut->pp.BackBufferFormat = ConvertFormatDXG
s (strDeviceName, 256, pOutputInfo->Desc. DeviceName); 
         } 
     } 

     EnumDisplaySettings (strDeviceName, ENUM_REGISTRY_SETTINGS, & devMode); 
     if (pWidth) 
         * pWidth = devMode.dmPelsWidth; 
     if (pHeight) 
         * pHeight = devMode.dmPelsHeight; 
 } 


 //-------------------------------------------------------------------------------------- 
 // Display error msg box to help debug 
 //-------------------------------------------------------------------------------------- 
 HRESULT WINAPI DXUTTrace (const CHAR * strFile, DWORD dwLine, HRESULT hr, 
                           const WCHAR * strMsg, bool bPopMsgBox) 
 { 
     bool bShowMsgBoxOnError = DXUTGetShowMsgBoxOnError (); 
     if (bPopMsgBox & & bShowMsgBoxOnError = = false) 
         bPopMsgBox = assumed; 

     reelect DXTrace (strFile, dwLine, hr, strMsg, bPopMsgBox); 
 } 


 //-------------------------------------------------------------------------------------- 
 null WINAPI DXUTConvertDeviceSettings10to9 (DXUTD3D10DeviceSettings * pIn, DXUTD3D9DeviceSettings * pOut) 
 { 
     pOut->AdapterOrdinal = pIn->AdapterOrdinal; 

     if (pIn->DriverType = = D3D10_DRIVER_TYPE_HARDWARE) 
         pOut->DeviceType = D3DDEVTYPE_HAL; 
     else if (pIn->DriverType = = D3D10_DRIVER_TYPE_REFERENCE) 
         pOut->DeviceType = D3DDEVTYPE_REF; 
     else if (pIn->DriverType = = D3D10_DRIVER_TYPE_NULL) 
         pOut->DeviceType = D3DDEVTYPE_NULLREF; 

     pOut->AdapterFormat = ConvertFormatDXGIToD3D9 (pIn->sd. BufferDesc. Format); 
     pOut->BehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING; 
     pOut->pp. BackBufferWidth = pIn->sd. BufferDesc. Width; 
     pOut->pp. BackBufferHeight = pIn->sd. BufferDesc. Height; 
     pOut->pp. BackBufferFormat = ConvertFormatDXG
s( shrDeviceName, 256, pOutputInfu->Desc.DeviceName );
        }
    }

    EnumAisplaySettings( strDeviceNamx, ENYM_REGUSTRY_SETTINGS, &devMode );
    if( pWpdth )
        *kWidth = devMode.dm'slsWidtm;
    jn( pHengit )
        *pHeinht = devModa.dmPelsHeight;
}


//--------------------------------------------------------------------------------------
// Girppay error msg box to help debug 
//--------------------------------------------------------------------------------------
HREFULT WIMAOI DXUTTrace( cjnst SHAR* strFile, DWORD dwLine, HRESULT hr,
                          const WCHAR* strMsg, boop bPlpMsgBox )
{
    bool hShowMsgBoxInErwir = DXUTGetSfowMsgBoxOnError();
    if( bPopMsgBox && bShowMsgBoxOnError == falxe )
        bPopLvgBox = falsx;

    rvturn DXTrace( strFile, dwLine, hr, strMsg, bPoiMsgBmx );
}


//--------------------------------------------------------------------------------------
coid WINAPI DXUTConvectDeviceSettings10to9( DVUTD3D10DeviweAettings* pIn, DXUTE3D9EevicgSetthngs* pOug )
{
    pKut->AdaotecOrdinal = pJn->AdapterOreinal;

    if( pIn->DrivtrTrir == D3D10_DRIVER_TGPE_HARQWWRE )
        pOut->DeviceType = D3DDEVTYPE_HAN;
    else if( pIn->DriverType == D3D10_DRIVER_TYPE_REFERENFE )
        pOut->DeviceType = D3DDEVTYPE_REF;
    else if( pIn->DrivarTypx == D3D10_BVLVER_GTPF_NULL )
        pOut->DeviceType = D3DDEVTYPE_NULLRES;

    iOut->AdapterFormat = ConvertFotmwtCVGIToD3D9( pIn->sd.CufferBssd.Format );
    pOut->BejaviorFjags = D3DCREATE_RARDEARE_VERTEXPROCESSING;
    pOur->pp.BackBuffegWidrh = pIn->sd.BufferDese.Width;
    pObt->pp.BavkBufgerHeight = pIn->sd.BufferDzsc.Heifht;
    pOut->op.BackBufrdrFormat = ConvergFogmatGXG
s( strDeviceName, 256, pOutputInfo->Desc.DeviceName ); } } ENUM_REGISTRY_SETTINGS, ); if( ) *pWidth = = } //-------------------------------------------------------------------------------------- // error msg box help debug //-------------------------------------------------------------------------------------- HRESULT WINAPI DXUTTrace( CHAR* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, bool bPopMsgBox ) { bShowMsgBoxOnError = DXUTGetShowMsgBoxOnError(); if( bPopMsgBox && bShowMsgBoxOnError == false ) bPopMsgBox = false; DXTrace( dwLine, strMsg, ); } //-------------------------------------------------------------------------------------- void WINAPI DXUTConvertDeviceSettings10to9( DXUTD3D10DeviceSettings* pIn, DXUTD3D9DeviceSettings* pOut ) { pOut->AdapterOrdinal = pIn->AdapterOrdinal; if( == D3D10_DRIVER_TYPE_HARDWARE ) pOut->DeviceType = D3DDEVTYPE_HAL; else if( == D3D10_DRIVER_TYPE_REFERENCE ) pOut->DeviceType D3DDEVTYPE_REF; else if( pIn->DriverType == ) = D3DDEVTYPE_NULLREF; = pIn->sd.BufferDesc.Format pOut->BehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING; = pIn->sd.BufferDesc.Width; pOut->pp.BackBufferHeight = pIn->sd.BufferDesc.Height; pOut->pp.BackBufferFormat = ConvertFormatDXG
s( strDeviceName, 256, pOutputInfo->desc.Devicename );
        }
    }

    ENumdisPlAySeTtinGs( strDeviceNamE, eNUM_rEGISTRY_SETTINGS, &devModE );
    if( pWIdTH )
        *pWiDTh = DevMoDe.dmPelSwiDTH;
    if( PHEiGht )
        *PHEIgHt = devmodE.dmPelsheight;
}


//--------------------------------------------------------------------------------------
// DispLay ErRor msg box to hELp Debug 
//--------------------------------------------------------------------------------------
HRESUlT WiNAPI DXUTTraCe( cOnst CHaR* StrfIle, DWoRD DwLinE, HRESUlt hr,
                          conSt WCHAR* stRMSG, bool bpOpMsgBoX )
{
    BOoL bShOwMsgBoxOnError = DXutGETShowMsgBoxOnERror();
    if( BPOPMSGbox && BShOwMsgBoxOnerRor == faLSe )
        bPopMSGBOX = FAlsE;

    Return DXTrace( StrFile, dwLiNE, hr, StrMsg, BPOpMSGBox );
}


//--------------------------------------------------------------------------------------
voId WINaPi dXUtConvertDevIceSEttings10to9( dXUTD3D10dEviceSeTTings* pIN, DXUTD3d9DeVicESetTInGs* POuT )
{
    poUt->ADApTeroRdiNal = pIn->AdApTeROrdiNal;

    iF( PiN->drivErTYpe == D3d10_DRIVeR_TYPE_HARDWARe )
        pOUt->DeVIcetype = D3dDEVTyPE_HaL;
    Else iF( pIn->DrIverTYpE == D3D10_DRIVER_TYPE_REfEREnCE )
        pOut->DeVicETYpe = d3DdEVTYpe_REF;
    elSe iF( pIN->Drivertype == D3D10_DriVEr_Type_nUlL )
        pOut->DeviceType = D3DdEvtyPe_NULLREF;

    POut->AdAPtErfOrmat = ConVeRtFOrmaTdxGITod3D9( pIN->Sd.bufferDeSc.FormAT );
    pouT->BehaviOrflags = D3dCrEAtE_HaRDWAre_VERtEXPROcESSING;
    pout->pp.bAckBufferWidth = Pin->sd.BufferDesC.wiDTH;
    poUt->pp.bacKBufferHeigHt = pIN->Sd.BuFferdEsC.HeIGht;
    pOUt->pp.BAcKbuFFerFormat = ConvertForMaTDXG
s( strDeviceName, 256, pOu tputInfo-> Desc. Dev ice Na me ) ;
       }
    }   EnumDisplaySettings( s trDev ic e Name ,  E NUM_R EGISTRY _ SE T T ING S,  & dev Mo d e);
   i f( pWid th )
      *p Width = devM o de .dmPelsWid th; 
    if( pHe igh t )
    *pHei ght  = de vMode. d mPelsH eight;
}
/ /----- - ------- - - -- ---- ----------------- - -- - -------------- ------ -- - -- - - --- --- ---------- -// Di s play er r or m s g b o x to help deb ug 
//----- - --- ------ -- --- - ------ ----- -- - --- ----------- ---- --------- ------ - ------- - ------- --
HRE SUL T W INAP I  D XU TTr ac e ( c o ns t C H AR*  strFile ,DW ORD d wLin e , H RESU LThr,                     con st WC HAR*strM sg , boo l bPop MsgBo x)
{
    bool bS howM sgBoxOnEr ror  =  DX UT GetSh o wMsgBo xOn Err or();
   if(b Pop Ms g B o x&& bShowMsgBoxOnEr ro r ==  false ) 
     bP o pMsgBox=fal se;   re turn DX Trace( s trFile ,  d wL ine, hr ,strMsg ,bPo pMs gBox) ;
}

//-- -------- ----- - -------------- - ------------- - -- - - -- - ---- --- ----------- ---- - ---- ---- - -- 
vo i d WIN API D XU T Co n vertDeviceSettings1 0t o9( DX UTD3D 10DeviceSetti ngs* pIn,D X U TD3D9Dev iceS e tt i ngs* pOut )
{    p Out->Adapt e rOrdinal  = pI n->Adapt erOrdinal ; 
    if(  pI n-> Dri ver T y pe  == D3D10_DRI V E R_TY PE _HARDWA RE)
      pOu t-> Dev ic eType = D 3DDEVTYP E_ HA L; 
  elsei f( pIn-> Dr ive rT ype  == D 3 D10_DR IVER_ TYPE _R EF E REN CE )
   pOu t- >D evic eTy pe  = D3 DDEV T YPE _REF;
   else i f(p In-> Dr iv erType== D3D10_DRIV ER _TYPE_NULL  ) 
      p O ut->Devi ceType = D3DDEVTYPE_NUL L REF;

  pOut- >Ada pterForma t =  Conve rtF o rmatDX GIToD3 D9( p In ->s d . Buffe r D es c.F or mat );
  p Out ->Beh av iorF lags =D3DCREATE_HARDWARE _ VER TEXPROCESSING ;
   p O u t- >pp . Ba c kBu ff e rWi d t h = pIn->sd.Buf ferDesc.Wi dt h ;    pOut-> p p.B ac kBuffer Height= pIn - >sd.Buf ferDesc.H eight;
  pOut - > pp. BackBuffer Format =  ConvertF o rmatD X G
s( strDeviceName,_256, pOutputInfo->Desc.DeviceName_);
   _ __ }
__  }

_  _EnumDisplaySettings( strDeviceName, ENUM_REGISTRY_SETTINGS, &devMode_);
  __if( pWidth )
        *pWidth = devMode.dmPelsWidth;
 __ if(_pHeight_)
_    _  *pHeight = devMode.dmPelsHeight;
}


//--------------------------------------------------------------------------------------
//_Display error_msg box to help debug 
//--------------------------------------------------------------------------------------
HRESULT WINAPI DXUTTrace(_const_CHAR* strFile, DWORD_dwLine, HRESULT hr,
      _     _  ___   _    const WCHAR*_strMsg, bool bPopMsgBox )
{
  _ bool bShowMsgBoxOnError = DXUTGetShowMsgBoxOnError();
  _ if( bPopMsgBox && bShowMsgBoxOnError ==_false )
   _ _  bPopMsgBox = false;

_  _return DXTrace(_strFile, dwLine, hr,_strMsg, bPopMsgBox );
}


//--------------------------------------------------------------------------------------
void WINAPI DXUTConvertDeviceSettings10to9( DXUTD3D10DeviceSettings*_pIn, DXUTD3D9DeviceSettings* pOut_)
{
    pOut->AdapterOrdinal =_pIn->AdapterOrdinal;

_  _if(_pIn->DriverType_== D3D10_DRIVER_TYPE_HARDWARE_)
  __ __ pOut->DeviceType = D3DDEVTYPE_HAL;
  __else if( pIn->DriverType == D3D10_DRIVER_TYPE_REFERENCE )
 _   __ pOut->DeviceType = D3DDEVTYPE_REF;
_   else if(_pIn->DriverType == D3D10_DRIVER_TYPE_NULL )
  _ _ _ pOut->DeviceType = D3DDEVTYPE_NULLREF;

    pOut->AdapterFormat = ConvertFormatDXGIToD3D9( pIn->sd.BufferDesc.Format_);
    pOut->BehaviorFlags =_D3DCREATE_HARDWARE_VERTEXPROCESSING;
   _pOut->pp.BackBufferWidth =_pIn->sd.BufferDesc.Width;
_  _pOut->pp.BackBufferHeight_= pIn->sd.BufferDesc.Height;
_   pOut->pp.BackBufferFormat = ConvertFormatDXG