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
UT_UniquePtr<RV_VKQuery>
myQuery
;
43
bool
myIsBoolean
;
44
bool
myIsGPUOnly
;
45
46
RV_OcclusionQuery
(
RV_OcclusionResult
t
,
bool
gpu_exclusive);
47
virtual
~
RV_OcclusionQuery
();
48
};
49
50
// RV_OcclusionQueryCPU
51
// Intenally uses RV_VKQuery
52
//
53
54
/// Query to get occlusion results on the CPU -- useful for Debugging
55
/// more performant code should use the GPU version (RV_OcclusionQueryGPU)
56
/// and use conditional rendering in the command buffer
57
class
RV_API
RV_OcclusionQueryCPU
:
public
RV_OcclusionQuery
58
{
59
public
:
60
61
RV_OcclusionQueryCPU
(
RV_OcclusionResult
t
=
RV_OCCLUSION_NUM_SAMPLES
);
62
~
RV_OcclusionQueryCPU
()
override
;
63
64
/// Return true if the query has finished and the result is available
65
bool
isResultAvailable(
RV_Render
*
r
);
66
/// Return true if any samples were drawn
67
bool
getAnySamplesDrawn(
RV_Render
* r);
68
/// Return the exact number of samples drawn
69
int64
getNumSamples(
RV_Render
* r);
70
};
71
72
// RV_OcclusionQueryGPU
73
// Intenally uses RV_VKQuery
74
//
75
/// Query to get occlusion results on the CPU results are written
76
/// to a buffer owned by the class instead of CPU memory.
77
class
RV_API
RV_OcclusionQueryGPU
:
public
RV_OcclusionQuery
78
{
79
public
:
80
RV_OcclusionQueryGPU
(
RV_OcclusionResult
t
=
RV_OCCLUSION_NUM_SAMPLES
);
81
~
RV_OcclusionQueryGPU
()
override
;
82
83
/// Read the query results into a buffer.
84
bool
getResults(
85
RV_Render
*
r
,
86
RV_VKBuffer
*
buffer
,
87
bool
wait
=
true
);
88
89
};
90
#if 0
91
/// A query that returns the elapsed time between begin and end in nanoseconds
92
class
RV_API
RV_TimerQuery
93
{
94
public
:
95
RV_TimerQuery();
96
97
/// Create the query
98
void
init(
RV_Render
*
r
);
99
/// Create the query
100
void
init(
RV_Render
* inst);
101
/// Begin the timer query
102
bool
begin
(
RV_VKCommandBuffer
*cb);
103
/// Begin end timer query
104
void
end
(
RV_VKCommandBuffer
* cb);
105
106
/// REturn the elapsed time in nanoseconds (10^-9 seconds)
107
int64
getTimeNS();
108
109
void
writeResult(
RV_VKCommandBuffer
* cb,
RV_VKBuffer
*
buf
);
110
private
:
111
UT_UniquePtr<RV_VKQuery>
myQuery;
112
};
113
114
#endif
115
116
#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:63
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:42
RV_OcclusionQueryCPU
Definition:
RV_Query.h:57
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()
UT_UniquePtr.h
RV_OcclusionQueryGPU
Definition:
RV_Query.h:77
RV_OcclusionQuery::myIsGPUOnly
bool myIsGPUOnly
Definition:
RV_Query.h:44
RV_VKCommandBuffer
Definition:
RV_VKCommandBuffer.h:32
r
GLboolean r
Definition:
glcorearb.h:1222
RV_VKBuffer
A vulkan buffer object.
Definition:
RV_VKBuffer.h:80
RV_OcclusionQuery::myIsBoolean
bool myIsBoolean
Definition:
RV_Query.h:43
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:483
RV
RV_Query.h
Generated on Thu May 9 2024 03:16:38 for HDK by
1.8.6