Home | History | Annotate | Download | only in nine
      1 /*
      2  * Copyright 2011 Joakim Sindholt <opensource (at) zhasha.com>
      3  *
      4  * Permission is hereby granted, free of charge, to any person obtaining a
      5  * copy of this software and associated documentation files (the "Software"),
      6  * to deal in the Software without restriction, including without limitation
      7  * on the rights to use, copy, modify, merge, publish, distribute, sub
      8  * license, and/or sell copies of the Software, and to permit persons to whom
      9  * the Software is furnished to do so, subject to the following conditions:
     10  *
     11  * The above copyright notice and this permission notice (including the next
     12  * paragraph) shall be included in all copies or substantial portions of the
     13  * Software.
     14  *
     15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
     18  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
     19  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
     20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
     21  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
     22 
     23 #ifndef _NINE_QUERY9_H_
     24 #define _NINE_QUERY9_H_
     25 
     26 #include "iunknown.h"
     27 
     28 enum nine_query_state
     29 {
     30     NINE_QUERY_STATE_FRESH = 0,
     31     NINE_QUERY_STATE_RUNNING,
     32     NINE_QUERY_STATE_ENDED,
     33 };
     34 
     35 struct NineQuery9
     36 {
     37     struct NineUnknown base;
     38     struct pipe_query *pq;
     39     DWORD result_size;
     40     D3DQUERYTYPE type;
     41     enum nine_query_state state;
     42     boolean instant; /* true if D3DISSUE_BEGIN is not needed / invalid */
     43     unsigned counter; /* Number of pending Begin/End (0 if internal multithreading off) */
     44 };
     45 static inline struct NineQuery9 *
     46 NineQuery9( void *data )
     47 {
     48     return (struct NineQuery9 *)data;
     49 }
     50 
     51 HRESULT
     52 nine_is_query_supported(struct pipe_screen *screen, D3DQUERYTYPE);
     53 
     54 HRESULT
     55 NineQuery9_new( struct NineDevice9 *Device,
     56                 struct NineQuery9 **ppOut,
     57                 D3DQUERYTYPE);
     58 
     59 HRESULT
     60 NineQuery9_ctor( struct NineQuery9 *,
     61                  struct NineUnknownParams *pParams,
     62                  D3DQUERYTYPE Type );
     63 
     64 void
     65 NineQuery9_dtor( struct NineQuery9 * );
     66 
     67 D3DQUERYTYPE NINE_WINAPI
     68 NineQuery9_GetType( struct NineQuery9 *This );
     69 
     70 DWORD NINE_WINAPI
     71 NineQuery9_GetDataSize( struct NineQuery9 *This );
     72 
     73 HRESULT NINE_WINAPI
     74 NineQuery9_Issue( struct NineQuery9 *This,
     75                   DWORD dwIssueFlags );
     76 
     77 HRESULT NINE_WINAPI
     78 NineQuery9_GetData( struct NineQuery9 *This,
     79                     void *pData,
     80                     DWORD dwSize,
     81                     DWORD dwGetDataFlags );
     82 
     83 #endif /* _NINE_QUERY9_H_ */
     84