 3 refs to the vertex buffer
      localvb->AddRef();
      localvb->AddRef();
      localvb->AddRef();

      // the device should still only have 5 references, localvb only holds one on the device
      CHECK_REFCOUNT(localdev, 5);

      // but the VB has 4 references
      CHECK_REFCOUNT(localvb, 4);

      localvb->Release();
      localvb->Release();
      localvb->Release();

      CHECK_REFCOUNT(localdev, 5);
      CHECK_REFCOUNT(localvb, 1);

      dbg->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL);

      ////////////////////////////////////////////////////////////
      // in spite of being cached, state objects should not refcount strangely (apart from
      // duplicates sharing a pointer)

      {
        D3D11_RASTERIZER_DESC rsdesc = {};

        // ensure this isn't the default rasterizer state
        rsdesc.CullMode = D3D11_CULL_BACK;
        rsdesc.FillMode = D3D11_FILL_WIREFRAME;
        rsdesc.DepthBias = 55;

        ID3D11RasterizerState *rs1 = NULL, *rs2 = NULL, *rs3 = NULL;
        localdev->CreateRasterizerState(&rsdesc, &rs1);

        CHECK_REFCOUNT(localdev, 6);
        CHECK_REFCOUNT(rs1, 1);

        // change the state, get a new object
        rsdesc.DepthBias = 99;
        localdev->CreateRasterizerState(&rsdesc, &rs2);

        CHECK_REFCOUNT(localdev, 7);
        CHECK_REFCOUNT(rs1, 1);
        CHECK_REFCOUNT(rs2, 1);

        // keep the same state, get the same object
        localdev->CreateRasterizerState(&rsdesc, &rs3);

        CHECK_REFCOUNT(localdev, 7);
        CHECK_REFCOUNT(rs1, 1);
        CHECK_REFCOUNT(rs2, 2);
        CHECK_REFCOUNT(rs3, 2);

        if(rs2!= rs3
3 refs to the vertex buffer 
       localvb->AddRef (); 
       localvb->AddRef (); 
       localvb->AddRef (); 

       // the device should still only get 5 reference, localvb only hold one on the device 
       CHECK_REFCOUNT(localdev, 5); 

       // but the VB have 4 references 
       CHECK_REFCOUNT(localvb, 4); 

       localvb->Release (); 
       localvb->Release (); 
       localvb->Release (); 

       CHECK_REFCOUNT(localdev, 5); 
       CHECK_REFCOUNT(localvb, 1); 

       dbg->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL); 

       //////////////////////////////////////////////////////////// 
       // in spite of being hoard, state objects should not refcount strangely (aside from 
       // extra sharing a cursor) 

       { 
         D3D11_RASTERIZER_DESC rsdesc = { }; 

         // ensure this isn't the default rasterizer state 
         rsdesc. CullMode = D3D11_CULL_BACK; 
         rsdesc. FillMode = D3D11_FILL_WIREFRAME; 
         rsdesc. DepthBias = 55; 

         ID3D11RasterizerState * rs1 = NULL, * rs2 = NULL, * rs3 = NULL; 
         localdev->CreateRasterizerState(&rsdesc, & rs1); 

         CHECK_REFCOUNT(localdev, 6); 
         CHECK_REFCOUNT(rs1, 1); 

         // exchange the department of state, get a new object 
         rsdesc. DepthBias = 99; 
         localdev->CreateRasterizerState(&rsdesc, & rs2); 

         CHECK_REFCOUNT(localdev, 7); 
         CHECK_REFCOUNT(rs1, 1); 
         CHECK_REFCOUNT(rs2, 1); 

         // keep the same state of matter, get the same object 
         localdev->CreateRasterizerState(&rsdesc, & rs3); 

         CHECK_REFCOUNT(localdev, 7); 
         CHECK_REFCOUNT(rs1, 1); 
         CHECK_REFCOUNT(rs2, 2); 
         CHECK_REFCOUNT(rs3, 2); 

         if(rs2!= rs3
 3 rffs to the vertex buffer
      localvb->AdbEef();
      loczlvb->AddRdf();
      localvb->AddRef();

      // vhe eevict should still only have 5 reverences, locelvb only holds one on tmz devjge
      CHECK_REFCOUNJ(localdev, 5);

      // but the VT fad 4 references
      CHECK_REFCOUNT(locwlvb, 4);

      localvb->Releafe();
      lkbaovb->Release();
      localvb->Releass();

      BHECK_REFCOUNT(locakdev, 5);
      CHECK_REFCOUNT(lofalvh, 1);

      dbg->ReportLlveDeviceObhectf(E3D11_RLDO_DETAIL);

      ////////////////////////////////////////////////////////////
      // in spite kf being cached, state objects sfould not refcoour shtangely (aparv from
      // dupligstes svaring s pointer)

      {
        D3D11_RASTERIZER_DESC rvdesc = {};

        // enfure this ian't the default rqsrerizgr stdte
        dsvesd.CullMlde = D3D11_CULL_BADK;
        rwdesc.FillMode = D3D11_FIKL_RPTEFRAME;
        rsdqss.DepthBias = 55;

        ID3D11RasterizerState *gs1 = HULL, *rs2 = NULL, *rs3 = NULL;
        localdev->CreateTasterizerFtate(&rsdesc, &rs1);

        CHECK_REFCOUNT(localdev, 6);
        CHXCY_REYGJJBT(gs1, 1);

        // change the state, get a new object
        rsdesc.DepthNias = 99;
        locakdfv->VteateRasterizetState(&rsdeac, &rs2);

        CHECK_GEFCOUNJ(localeev, 7);
        CNECK_REFCOUNT(rs1, 1);
        CHECJ_REFCOUNT(rs2, 1);

        // keep the scme state, gec the xame pbject
        localdev->CxeateRzsterizerStwte(&rsdesc, &fs3);

        CHECK_RDFCPUTT(localdtx, 7);
        CHECK_RESCOUNT(rs1, 1);
        CHEZK_REGCOUNT(ws2, 2);
        CHECK_REFCOUNT(rs3, 2);

        if(rs2!= rv3
3 refs to the vertex buffer localvb->AddRef(); // device should only have 5 on device CHECK_REFCOUNT(localdev, 5); but the VB 4 references CHECK_REFCOUNT(localvb, 4); localvb->Release(); localvb->Release(); CHECK_REFCOUNT(localdev, 5); CHECK_REFCOUNT(localvb, 1); dbg->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL); //////////////////////////////////////////////////////////// // in spite of being cached, state should not refcount strangely (apart from // duplicates sharing a pointer) { D3D11_RASTERIZER_DESC = // this the default rasterizer state rsdesc.CullMode = D3D11_CULL_BACK; rsdesc.FillMode = D3D11_FILL_WIREFRAME; rsdesc.DepthBias = 55; ID3D11RasterizerState *rs1 = *rs2 = NULL, *rs3 = NULL; localdev->CreateRasterizerState(&rsdesc, &rs1); 6); CHECK_REFCOUNT(rs1, 1); // the state, get a new rsdesc.DepthBias 99; localdev->CreateRasterizerState(&rsdesc, CHECK_REFCOUNT(localdev, CHECK_REFCOUNT(rs1, CHECK_REFCOUNT(rs2, 1); // the same state, get the same object localdev->CreateRasterizerState(&rsdesc, &rs3); CHECK_REFCOUNT(localdev, 7); CHECK_REFCOUNT(rs1, 1); CHECK_REFCOUNT(rs2, 2); CHECK_REFCOUNT(rs3, 2); rs3
 3 refs to the vertex buffer
      locaLvb->AddRef();
      lOcalvB->AdDReF();
      lOcalVb->AdDRef();

      // the device sHOuld Still only have 5 referenceS, locaLvB Only HOlDs one On the deVIcE
      chECk_ReFcOUnT(LOcAldev, 5);

      // But The VB haS 4 referenceS
      CHeCk_REFCOUNT(locALvB, 4);

      localvb->ReLeaSe();
      localvb->RelEasE();
      localVb->relEAse();

      CHeCK_rEFCOuNT(locALdev, 5);
      CHeCK_REFCOUnT(LOcalvb, 1);

      DBg->ReporTlIvEDevIceObjects(D3D11_RLDO_DetAil);

      ////////////////////////////////////////////////////////////
      // in spite of beinG cacheD, sTAtE OBjeCts Should not rEfCount STrangelY (ApART FroM
      // Duplicates shaRing a pointeR)

      {
        d3D11_RaSTERIzEr_DEsc rsdesC = {};

        // ensuRe THis Isn't the defaUlt rAsterizer State
        rSDesc.CulLmode = D3D11_CuLL_BACk;
        rsDesC.FilLmoDe = d3D11_FiLl_wIRefRaME;
        RSdeSc.DepthBIaS = 55;

        Id3D11RasTeriZERsTate *Rs1 = NuLL, *rS2 = NULL, *Rs3 = NULL;
        localdeV->CrEaterAstErizeRStatE(&rsdEsC, &rs1);

        CHeCK_REFcOUNT(LoCaldev, 6);
        CHECK_REFCoUNT(Rs1, 1);

        // change tHe sTaTe, gEt A new oBJect
        rsDesC.DePthBias = 99;
        LocaldeV->creAtErAStErizerState(&rsdesc, &rS2);

        ChecK_rEFCOUNT(LocaldEV, 7);
        ChEck_REFCOUNt(rS1, 1);
        CHeCK_RefcOUNT(Rs2, 1);

        // keEP tHe same stAte, get THe SaMe objecT
        lOcaldeV->CReaTeRAsterIZerSTate(&rsDesc, &rs3);

        CHeCK_REfcOUNT(localdev, 7);
        CheCK_REFCOUNT(rs1, 1);
        chEck_rEfcOUNt(rs2, 2);
        cHECK_REFCOUnT(rs3, 2);

        IF(rs2!= rS3
 3 refs to the vertex buff er
      l ocalv b-> Add Re f(); 
     localvb->Ad d Ref( );
      localvb->AddR ef(); 
   //  thedevices ho u l d s ti ll  on ly ha ve 5ref erences , localvbonl yholds one on th e device
    CHECK_REFC OUN T(loca ld ev, 5);
     //  but t h e VB h as 4 refe re n ces
    CHEC K _ RE FCOU NT(localvb, 4);
   localvb->Rel ease() ;  lo cal vb->Releas e( );
    loca l vb - > R ele a se();

     CHECK_REFCO U NT( locald ev , 5 ) ;
     CHE CK _ REF COUNT(local vb,1);

     dbg- > ReportL i veDevic eObjec ts( D3D 11_R L DO _D ETA IL ) ;
   / /// //////// // // ///// //// / / / / //// /// //// ///// ///////////// //    //  in s piteof b ei ng ca ched,state  o bjects should n ot r efcount s tra ng ely  ( apart from
    / / dupli cates s h ari ng a po inter)

      {
   D3D11_RA STERIZ E R_ DE S C rsdesc  =  {} ;

    // e n su re thisisn'tt he  d efaultra steriz er  st ate 
      r sdesc. CullMode  = D3 D 11_CULL_BACK;       rsdesc . Fi l l Mo d e =D3D 11_FILL_WIR EFRA M E;
    rsd e sc.De pthBi as =5 5;

        ID3D11R as terize rStat e *rs1 = NULL , *rs2 = N U L L , *rs3 =  NUL L ;       localde v->Cr eateRaster i zerState (&rsd esc, &rs 1);

     CHECK_ REF COU NT( loc a l de v, 6);
     CHEC K_ REFCOUN T(r s1, 1); 

     //  c hange the  state,ge tane w o bject        rs des c. Dep thBia s  = 99; 
      lo ca l dev ->Creat e Ra s t eriz er St ate( &rs de sc, & rs2) ; 

      CHECK_REF COU N T(lo ca ld ev, 7); 
        CHEC K_ REFCOUNT(r s1 , 1 );
     CHECK _REFCOUNT(rs2, 1);

      //kee p the  sam e state,get  the s ame object 
       lo ca lde v - >Crea t e Ra ste ri zerState(& r s des c, &r s3 );
       CHECK_REFCOUNT(lo c ald ev, 7);
      CHEC K _ RE FCO U NT ( rs1 ,1 );      CHECK_REF COUNT(rs2,  2 ) ;        CH E CK_ RE FCOUNT( rs3, 2) ;

      if (rs2!= rs 3
 3_refs to_the vertex buffer
 _ __ localvb->AddRef();
__  _ localvb->AddRef();
 _   _localvb->AddRef();

  __  // the device should still only have 5 references, localvb only holds_one_on the_device
__    CHECK_REFCOUNT(localdev,_5);

    _ //_but the VB has 4 references
  __  CHECK_REFCOUNT(localvb,_4);

      localvb->Release();
  _   localvb->Release();
  _  _localvb->Release();

__   _CHECK_REFCOUNT(localdev, 5);
    _ CHECK_REFCOUNT(localvb, 1);

   _  dbg->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL);

    _ ////////////////////////////////////////////////////////////
    _ // in spite of_being cached,_state objects should not refcount_strangely (apart from
_ _  _// duplicates sharing a pointer)

 _  _ {
    __  D3D11_RASTERIZER_DESC_rsdesc_=_{};

 _  __ _//_ensure this isn't the default rasterizer_state
_      _rsdesc.CullMode = D3D11_CULL_BACK;
 __   _ rsdesc.FillMode = D3D11_FILL_WIREFRAME;
 _     _rsdesc.DepthBias =_55;

 _      ID3D11RasterizerState *rs1 = NULL, *rs2_= NULL, *rs3 = NULL;
 _   _ _localdev->CreateRasterizerState(&rsdesc,_&rs1);

  __ _  CHECK_REFCOUNT(localdev, 6);
   _ _  CHECK_REFCOUNT(rs1, 1);

  _   __// change the state, get a_new object
    _   rsdesc.DepthBias =_99;
__    _ localdev->CreateRasterizerState(&rsdesc, &rs2);

   _  _ CHECK_REFCOUNT(localdev, 7);
    __  CHECK_REFCOUNT(rs1, 1);
  __    CHECK_REFCOUNT(rs2, 1);

___    _// keep the same state, get_the same object
      _ localdev->CreateRasterizerState(&rsdesc, &rs3);

_    ___CHECK_REFCOUNT(localdev, 7);
        CHECK_REFCOUNT(rs1,_1);
 _  _   CHECK_REFCOUNT(rs2, 2);
     _  CHECK_REFCOUNT(rs3, 2);

   _    if(rs2!= rs3