HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
RV_Query.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* NAME: RV_Query.h ( RV Library, C++)
7
*
8
* COMMENTS:
9
* Higher level Class to handle Vulkan Queries
10
*/
11
12
#ifndef RV_Query_h
13
#define RV_Query_h
14
15
#include "
RV_API.h
"
16
17
#include <
SYS/SYS_Types.h
>
18
#include <
UT/UT_UniquePtr.h
>
19
20
class
RV_Render
;
21
class
RV_VKBuffer
;
22
class
RV_VKQuery;
23
24
enum
RV_OcclusionResult
25
{
26
RV_OCCLUSION_BOOLEAN
,
27
RV_OCCLUSION_NUM_SAMPLES
28
};
29
30
/// Occlusion query object
31
class
RV_API
RV_OcclusionQuery
32
{
33
public
:
34
/// Initialize the query (create it)
35
void
init(
RV_Render
*
r
);
36
/// Start the query
37
bool
begin
(
RV_Render
* r);
38
/// End the query
39
void
end
(
RV_Render
* r);
40
41
protected
:
42
exint
sumQueries(
RV_Render
* r,
bool
wait
=
false
);
43
44
UT_UniquePtr<RV_VKQuery>
myQuery
;
45
int
myCurIdx
;
46
int
myCurResult
;
47
48
bool
myIsBoolean
;
49
bool
myIsGPUOnly
;
50
51
RV_OcclusionQuery
(
RV_OcclusionResult
t
,
bool
gpu_exclusive);
52
virtual
~
RV_OcclusionQuery
();
53
};
54
55
// RV_OcclusionQueryCPU
56
// Intenally uses RV_VKQuery
57
//
58
59
/// Query to get occlusion results on the CPU -- useful for Debugging
60
/// more performant code should use the GPU version (RV_OcclusionQueryGPU)
61
/// and use conditional rendering in the command buffer
62
class
RV_API
RV_OcclusionQueryCPU
:
public
RV_OcclusionQuery
63
{
64
public
:
65
66
RV_OcclusionQueryCPU
(
RV_OcclusionResult
t
=
RV_OCCLUSION_NUM_SAMPLES
);
67
~
RV_OcclusionQueryCPU
()
override
;
68
69
/// Return true if the query has finished and the result is available
70
bool
isResultAvailable(
RV_Render
*
r
);
71
/// Return true if any samples were drawn
72
bool
getAnySamplesDrawn(
RV_Render
* r);
73
/// Return the exact number of samples drawn
74
int64
getNumSamples(
RV_Render
* r);
75
};
76
77
// RV_OcclusionQueryGPU
78
// Intenally uses RV_VKQuery
79
//
80
/// Query to get occlusion results on the CPU results are written
81
/// to a buffer owned by the class instead of CPU memory.
82
class
RV_API
RV_OcclusionQueryGPU
:
public
RV_OcclusionQuery
83
{
84
public
:
85
RV_OcclusionQueryGPU
(
RV_OcclusionResult
t
=
RV_OCCLUSION_NUM_SAMPLES
);
86
~
RV_OcclusionQueryGPU
()
override
;
87
88
/// Read the query results into a buffer.
89
bool
getResults(
90
RV_Render
*
r
,
91
RV_VKBuffer
*
buffer
,
92
bool
wait
=
true
);
93
94
};
95
#if 0
96
/// A query that returns the elapsed time between begin and end in nanoseconds
97
class
RV_API
RV_TimerQuery
98
{
99
public
:
100
RV_TimerQuery();
101
102
/// Create the query
103
void
init(
RV_Render
*
r
);
104
/// Create the query
105
void
init(
RV_Render
* inst);
106
/// Begin the timer query
107
bool
begin
(
RV_VKCommandBuffer
*cb);
108
/// Begin end timer query
109
void
end
(
RV_VKCommandBuffer
* cb);
110
111
/// REturn the elapsed time in nanoseconds (10^-9 seconds)
112
int64
getTimeNS();
113
114
void
writeResult(
RV_VKCommandBuffer
* cb,
RV_VKBuffer
*
buf
);
115
private
:
116
UT_UniquePtr<RV_VKQuery>
myQuery;
117
};
118
119
#endif
120
121
#endif
RV_API.h
buf
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition:
glcorearb.h:2540
RV_OCCLUSION_NUM_SAMPLES
Definition:
RV_Query.h:27
RV_Render
Definition:
RV_Render.h:70
exint
int64 exint
Definition:
SYS_Types.h:125
RV_OcclusionQuery::myCurIdx
int myCurIdx
Definition:
RV_Query.h:45
UT_UniquePtr
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition:
UT_UniquePtr.h:39
RV_OcclusionQuery::myQuery
UT_UniquePtr< RV_VKQuery > myQuery
Definition:
RV_Query.h:44
RV_OcclusionQueryCPU
Definition:
RV_Query.h:62
SYS_Types.h
buffer
Definition:
core.h:760
RV_OcclusionQuery
Occlusion query object.
Definition:
RV_Query.h:31
end
GLuint GLuint end
Definition:
glcorearb.h:475
RV_API
#define RV_API
Definition:
RV_API.h:10
int64
long long int64
Definition:
SYS_Types.h:116
t
GLdouble t
Definition:
glad.h:2397
RV_OCCLUSION_BOOLEAN
Definition:
RV_Query.h:26
wait
*tasks wait()
RV_OcclusionQuery::myCurResult
int myCurResult
Definition:
RV_Query.h:46
UT_UniquePtr.h
RV_OcclusionQueryGPU
Definition:
RV_Query.h:82
RV_OcclusionQuery::myIsGPUOnly
bool myIsGPUOnly
Definition:
RV_Query.h:49
RV_VKCommandBuffer
Definition:
RV_VKCommandBuffer.h:32
r
GLboolean r
Definition:
glcorearb.h:1222
RV_VKBuffer
A vulkan buffer object.
Definition:
RV_VKBuffer.h:81
RV_OcclusionQuery::myIsBoolean
bool myIsBoolean
Definition:
RV_Query.h:48
RV_OcclusionResult
RV_OcclusionResult
Definition:
RV_Query.h:24
begin
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
Definition:
node.h:558
RV
RV_Query.h
Generated on Sat Dec 21 2024 02:48:44 for HDK by
1.8.6