1/*
2 * Copyright 2011 Joakim Sindholt <opensource@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
28enum nine_query_state
29{
30    NINE_QUERY_STATE_FRESH = 0,
31    NINE_QUERY_STATE_RUNNING,
32    NINE_QUERY_STATE_ENDED,
33};
34
35struct 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};
45static inline struct NineQuery9 *
46NineQuery9( void *data )
47{
48    return (struct NineQuery9 *)data;
49}
50
51HRESULT
52nine_is_query_supported(struct pipe_screen *screen, D3DQUERYTYPE);
53
54HRESULT
55NineQuery9_new( struct NineDevice9 *Device,
56                struct NineQuery9 **ppOut,
57                D3DQUERYTYPE);
58
59HRESULT
60NineQuery9_ctor( struct NineQuery9 *,
61                 struct NineUnknownParams *pParams,
62                 D3DQUERYTYPE Type );
63
64void
65NineQuery9_dtor( struct NineQuery9 * );
66
67D3DQUERYTYPE NINE_WINAPI
68NineQuery9_GetType( struct NineQuery9 *This );
69
70DWORD NINE_WINAPI
71NineQuery9_GetDataSize( struct NineQuery9 *This );
72
73HRESULT NINE_WINAPI
74NineQuery9_Issue( struct NineQuery9 *This,
75                  DWORD dwIssueFlags );
76
77HRESULT NINE_WINAPI
78NineQuery9_GetData( struct NineQuery9 *This,
79                    void *pData,
80                    DWORD dwSize,
81                    DWORD dwGetDataFlags );
82
83#endif /* _NINE_QUERY9_H_ */
84