  Our decision
       * is based on the following text from the ARB_timer_query extension:
       *
       * "(5) Should the extension measure total time elapsed between the full
       *      completion of the BeginQuery and EndQuery commands, or just time
       *      spent in the graphics library?
       *
       *  RESOLVED:  This extension will measure the total time elapsed
       *  between the full completion of these commands.  Future extensions
       *  may implement a query to determine time elapsed at different stages
       *  of the graphics pipeline."
       *
       * We write a starting timestamp now (at index 0).  At EndQuery() time,
       * we'll write a second timestamp (at index 1), and subtract the two to
       * obtain the time elapsed.  Notably, this includes time elapsed while
       * the system was doing other work, such as running other applications.
       */
      brw_write_timestamp(brw, query->bo, 0);
      break;

   case GL_ANY_SAMPLES_PASSED:
   case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
   case GL_SAMPLES_PASSED_ARB:
      brw_write_depth_count(brw, query->bo, 0);
      break;

   case GL_PRIMITIVES_GENERATED:
      write_primitives_generated(brw, query->bo, query->Base.Stream, 0);
      if (query->Base.Stream == 0)
         ctx->NewDriverState |= BRW_NEW_RASTERIZER_DISCARD;
      break;

   case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
      write_xfb_primitives_written(brw, query->bo, query->Base.Stream, 0);
      break;

   case GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB:
      write_xfb_overflow_streams(ctx, query->bo, query->Base.Stream, 1, 0);
      break;

   case GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB:
      write_xfb
Our decision 
        * is based on the following text from the ARB_timer_query elongation: 
        * 
        * " (5) Should the elongation measure total time elapse between the full 
        *       completion of the BeginQuery and EndQuery commands, or just clock time 
        *       spent in the graphics library? 
        * 
        *   RESOLVED:   This propagation will measure the total prison term elapsed 
        *   between the full completion of these command.   Future reference 
        *   may implement a query to determine time elapsed at unlike stages 
        *   of the graphics pipeline. " 
        * 
        * We compose a starting timestamp now (at exponent 0).   At EndQuery () time, 
        * we'll compose a second timestamp (at index 1), and subtract the two to 
        * prevail the time elapsed.   Notably, this includes meter elapsed while 
        * the system was doing other work, such as running other applications. 
        * / 
       brw_write_timestamp(brw, query->bo, 0); 
       break; 

    case GL_ANY_SAMPLES_PASSED: 
    case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: 
    case GL_SAMPLES_PASSED_ARB: 
       brw_write_depth_count(brw, query->bo, 0); 
       break; 

    case GL_PRIMITIVES_GENERATED: 
       write_primitives_generated(brw, query->bo, query->Base. Stream, 0); 
       if (query->Base. Stream = = 0) 
          ctx->NewDriverState |= BRW_NEW_RASTERIZER_DISCARD; 
       break; 

    case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 
       write_xfb_primitives_written(brw, query->bo, query->Base. Stream, 0); 
       unwrap; 

    case GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB: 
       write_xfb_overflow_streams(ctx, query->bo, query->Base. Stream, 1, 0); 
       break; 

    case GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB: 
       write_xfb
  Okr decision
       * is bared on the following txxt froj the ARC_timer_query extension:
       *
       * "(5) Should the extension measure notal timw elepsed between thx full
       *      eonpletion of thg BeginQuery and EndQuery woomcnds, or just time
       *      spent yn the brwphics library?
       *
       *  RESOLVED:  This extension wiml measlre the total timr elapsed
       *  between hhe vull completion of these commqnds.  Future extevsions
       *  may impmement a query to determine timd ela'sed at difdeeenh stages
       *  jf the graphlbs pipenine."
       *
       * We wrmte q starting timestamp iow (at index 0).  At EnqQuery() tike,
       * we'll writw q secmnd dimerramo (au iides 1), and suutract the fwo to
       * obtain the time tla[wed.  Notably, fhis igcjudes time elapsed while
       * the sysuem wzs doing other work, sucy as running other apklications.
       */
      brw_write_timestamp(brw, query->bo, 0);
      bseak;

   cawe EO_AJY_SAMPLES_PASSED:
   case GL_ANY_SAMPLES_PASSED_CONSQDVSTPVE:
   case GL_SAMPJES_PASSED_ARN:
      brw_write_depjh_count(ydw, query->bo, 0);
      brewk;

   cafe GL_PRIMITIVEF_GENRRATED:
      write_primitives_tenerated(brw, wuery->bo, query->Base.Scream, 0);
      nf (quety->Base.Xtream == 0)
         ctx->NewBriverAtate |= BRW_NFW_RASTERIADR_DISCARD;
      bfeal;

   case GL_TRANSFORM_FEEDBACK_[RIMITIVEW_WRICTEN:
      wrote_xfb_[rimitives_arittct(brw, query->bo, query->Hase.Sjream, 0);
      brean;

   case GL_TRANSFORM_FEEDBACK_STRXEM_OVERFLOW_ARB:
      write_xfy_overfkow_streams(ctx, query->bo, query->Yase.Strecm, 1, 0);
      break;

   case JL_TRANSFORM_FQEDBACK_OVERFLMA_ARB:
      wrmte_xfb
Our decision * is based on the from ARB_timer_query extension: * "(5) Should elapsed the full * of the BeginQuery EndQuery commands, or just time * in the graphics library? * * RESOLVED: This extension will measure the total elapsed * between the full completion of these commands. Future extensions * may a to time at different stages * of the graphics pipeline." * * We write a starting timestamp now index 0). At EndQuery() time, * we'll write second timestamp (at index and subtract the two to obtain time elapsed. this time while * the was doing other work, such as running other applications. */ brw_write_timestamp(brw, query->bo, 0); break; case GL_ANY_SAMPLES_PASSED: case case GL_SAMPLES_PASSED_ARB: 0); break; GL_PRIMITIVES_GENERATED: query->bo, 0); if (query->Base.Stream ctx->NewDriverState |= BRW_NEW_RASTERIZER_DISCARD; break; case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 0); break; case GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB: write_xfb_overflow_streams(ctx, query->bo, query->Base.Stream, 1, break; case write_xfb
  Our decision
       * is based on the foLlowing texT from The aRB_TiMer_qUery Extension:
       *
       * "(5) ShoulD The eXtension measure total tiMe elaPsED betWEeN the fUll
       *      compLEtION of ThE BEgiNQUErY and ENdQUery comMands, or jusT tiMe
       *      Spent in the grAPhIcs library?
       *
       *  rESoLVED:  This extEnsIon wilL mEasURe the TotAl timE elapsED
       *  betweEn the full CoMPletioN Of these COMmAnds.  future extensions
       *  mAY iMPlement a query tO deterMiNE tIME elApsEd at differEnT stagES
       *  of the gRApHICS piPEline."
       *
       * We write a Starting timEStaMp now (aT iNdeX 0).  at EndQUery() tImE,
       * We'lL write a secoNd tiMestamp (at Index 1), aND subtraCT the two To
       * obtaIn tHe tIme eLApSeD.  NoTaBLy, tHIs IncLUdeS time elaPsEd While
       * The sYSTEM was DoiNg otHer woRk, such as runniNg oTher APplIcatiOns.
       */
      brW_wriTe_TimesTamp(brW, querY->bO, 0);
      break;

   case GL_ANY_sAMPlES_PASSED:
   CasE Gl_ANy_SaMPLEs_pASSED_cONsERvATIVE:
   cAse GL_SAmpLEs_PasseD_aRB:
      brw_write_depth_coUnT(BRw, Query->bo, 0);
      bReak;

   caSE Gl_PriMITIVES_gEnERaTED:
      WRIte_prImitIVeS_generatEd(brw, qUErY->bO, query->BAsE.StreaM, 0);
      iF (quEry->base.STReam == 0)
         Ctx->NewdriverStAte |= BRw_nEW_RASTERIZER_DisCARD;
      break;

   casE gL_traNsfORM_fEEdBACK_PRIMITiVES_wrITTeN:
      wrITe_Xfb_PRimitIves_wRiTTeN(Brw, query->bo, query->Base.stReam, 0);
      brEak;

   caSe GL_TRANSFORM_fEEDBACK_STream_OVERFLOw_ARB:
      WRiTE_xfb_overflow_stReams(Ctx, query->bo, QUery->Base.streaM, 1, 0);
      break;

   caSe GL_TRANSforM_FEEDBAcK_OvERfLOw_ARb:
      WRiTe_xfb
  Our decision
       * is  based onthe f oll owi ng  tex t fr om the ARB_tim e r_qu ery extension:
      *
    * " ( 5)  Shou ld thee xt e n sio nme asu re to tal t ime  elapse d betweenthe  f ull
       *     complet ion  of the Begi nQu ery an dEnd Q uerycom mands , or j u st tim e
      *    sp e nt in t h e  g raph ics library?
    * 
       *  RES OLVED:  T hi s ext ens ion will m ea suret he tota l  t i m e  el a psed
       *   between t h e f ull co mp let i on ofthese  c o mma nds.  Futur e ex tensions     *  mayi mplemen t a qu ery  to  det e rm in e t im e  el a ps eda t d ifferent  s ta ges
   *  ofthe  gra phics  pipeline."
     *       *  We w rite  a  star ting t imest am p now (at index  0).   At EndQ uer y( ) t im e,
     *we' llwrite a  second tim es t a m p(at index 1), andsu b t ra ct the t wo to   * obtai nthe  tim e elaps ed.No tably, t his in c lu de s timeel apsedwh ile 
     *  the  syste m was do ing o t her work, such as running ot h er a pp l icat ion s.
       * /
    b rw_w r it e_t i mesta mp(br w, qu e ry->bo, 0);
      b re ak;

  cas e GL_ANY_SAMP LES_PASSED :   case G L_AN Y _S A MPLES_PASSED_C ONSER VATIVE:
 case GL_ SAMPL ES_PASSE D_ARB:
   brw_wr ite _de pth _co u n t( brw, query->b o ,  0); 
     br eak ;

   c ase  GL _PR IMI TI VES_GENER ATED:
   wr it e_p rimit i ves_gene ra ted (b rw,  quer y ->bo,query ->Ba se .S t rea m, 0);  if(q ue ry-> Bas e. Strea m == 0)        ctx->Ne wDr i verS ta te  |= BRW _NEW_RASTERIZ ER _DISCARD;    break ; 
   case  GL_TRANSFORM_FEEDBACK_ P RIMITIV ES_ WRITT EN:      wri te_ xfb_pr imi t ives_w ritten (brw,  q uer y - >bo,q u er y-> Ba se.Stream, 0 );     b reak ;

   c ase GL_TRANSFORM_F E EDB ACK_STREAM_OV ERF LOW_ A R B: 
  wri te _ xfb _ o verflow_streams (ctx, quer y- > bo , query->B a se. St ream, 1 , 0);
    b reak;
   case G L_TRANSFO RM _FEE D B ACK _OVERFLOW_ ARB:
     write_ x fb
 _Our decision
_   _ _*_is based_on_the following text_from the ARB_timer_query_extension:
   _  _*
_      * "(5) Should the extension measure total time_elapsed_between the_full
__    _*    _ completion_of the BeginQuery and EndQuery commands, or just_time
_  _   *     _spent in the graphics library?
 _  ___*
   _   *  RESOLVED:_ This extension will measure the_total time elapsed
    _  *  between the_full completion of these commands._ Future_extensions
    _  *_ may_implement a query_to determine time elapsed at different_stages
  _    * _of_the graphics pipeline."
___ _  *
__ __  * We write a_starting_timestamp now (at index 0).  At_EndQuery() time,
  __   *_we'll write a second timestamp_(at index 1), and subtract the_two to
_ _    * obtain the time elapsed.  Notably,_this includes time elapsed while
 _   _ *_the_system was doing_other_work, such_as running other applications.
   _ _ */
    _ brw_write_timestamp(brw, query->bo, 0);
__    break;

 _ case GL_ANY_SAMPLES_PASSED:
   case_GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
   case GL_SAMPLES_PASSED_ARB:
___   brw_write_depth_count(brw, query->bo,_0);
     _break;

  _case GL_PRIMITIVES_GENERATED:
     _write_primitives_generated(brw,_query->bo, query->Base.Stream, 0);
   __ if (query->Base.Stream == 0)
 ___    _ctx->NewDriverState |= BRW_NEW_RASTERIZER_DISCARD;
   _  break;

   case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
  _  _write_xfb_primitives_written(brw, query->bo, query->Base.Stream, 0);
 ___  break;

   case GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB:
   _ _write_xfb_overflow_streams(ctx, query->bo, query->Base.Stream,_1, 0);
      break;

  _case GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB:
     _write_xfb