15 #ifndef OGLPLUS_EXT_AMD_PERFORMANCE_MONITOR_1203031902_HPP
16 #define OGLPLUS_EXT_AMD_PERFORMANCE_MONITOR_1203031902_HPP
27 #if OGLPLUS_DOCUMENTATION_ONLY || GL_AMD_performance_monitor
37 #include <oglplus/enums/ext/amd_perf_monitor_type.ipp>
40 #if !OGLPLUS_NO_ENUM_VALUE_NAMES
41 #include <oglplus/enums/ext/amd_perf_monitor_type_names.ipp>
44 #if !OGLPLUS_ENUM_VALUE_RANGES
45 #include <oglplus/enums/ext/amd_perf_monitor_type_range.ipp>
79 OGLPLUS_GLFUNC(GetPerfMonitorCounterStringAMD)(
87 GetPerfMonitorCounterStringAMD,
92 std::vector<GLchar> buffer(length);
93 OGLPLUS_GLFUNC(GetPerfMonitorCounterStringAMD)(
96 GLsizei(buffer.size()),
101 GetPerfMonitorCounterStringAMD,
105 return String(buffer.data(), buffer.size());
117 OGLPLUS_GLFUNC(GetPerfMonitorCounterInfoAMD)(
124 GetPerfMonitorCounterInfoAMD,
157 OGLPLUS_GLFUNC(GetPerfMonitorGroupStringAMD)(
164 GetPerfMonitorGroupStringAMD,
169 std::vector<GLchar> buffer(length);
170 OGLPLUS_GLFUNC(GetPerfMonitorGroupStringAMD)(
172 GLsizei(buffer.size()),
177 GetPerfMonitorGroupStringAMD,
181 return String(buffer.data(), buffer.size());
190 GLint& max_active_counters,
191 std::vector<PerfMonitorAMDCounter>& counters
195 OGLPLUS_GLFUNC(GetPerfMonitorCountersAMD)(
198 &max_active_counters,
203 GetPerfMonitorCountersAMD,
208 std::vector<GLuint> buffer(count);
209 OGLPLUS_GLFUNC(GetPerfMonitorCountersAMD)(
212 &max_active_counters,
217 GetPerfMonitorCountersAMD,
223 counters.reserve(count);
224 for(
auto i=buffer.begin(), e=buffer.end(); i!=e; ++i)
233 std::vector<PerfMonitorAMDCounter>
236 std::vector<PerfMonitorAMDCounter> result;
311 static void Gen(tag::Generate, GLsizei count, GLuint* names)
313 assert(names !=
nullptr);
314 OGLPLUS_GLFUNC(GenPerfMonitorsAMD)(count, names);
315 OGLPLUS_CHECK_SIMPLE(GenSamplers);
318 static void Delete(GLsizei count, GLuint* names)
320 assert(names !=
nullptr);
321 OGLPLUS_GLFUNC(DeletePerfMonitorsAMD)(count, names);
322 OGLPLUS_VERIFY_SIMPLE(DeleteSamplers);
325 static GLboolean IsA(GLuint name)
337 :
public ObjZeroOps<tag::DirectState, tag::PerfMonitorAMD>
351 const std::vector<PerfMonitorAMDCounter>& counters
354 if(counters.empty())
return;
356 std::vector<GLuint> list(counters.size());
357 GLuint group = counters[0]._group;
359 for(
size_t i=0, n=counters.size(); i!=n; ++i)
361 assert(group == counters[i]._group);
362 list[i] = counters[i]._counter;
365 OGLPLUS_GLFUNC(SelectPerfMonitorCountersAMD)(
367 enable? GL_TRUE: GL_FALSE,
373 SelectPerfMonitorCountersAMD,
386 OGLPLUS_GLFUNC(BeginPerfMonitorAMD)(this->_name);
401 OGLPLUS_GLFUNC(EndPerfMonitorAMD)(this->_name);
418 OGLPLUS_GLFUNC(GetPerfMonitorCounterDataAMD)(
420 GL_PERFMON_RESULT_AVAILABLE_AMD,
426 GetPerfMonitorCounterDataAMD,
440 void Result(std::vector<PerfMonitorAMDResult>& results)
const
443 OGLPLUS_GLFUNC(GetPerfMonitorCounterDataAMD)(
445 GL_PERFMON_RESULT_SIZE_AMD,
451 GetPerfMonitorCounterDataAMD,
456 std::vector<GLuint> data(size /
sizeof(GLuint));
457 OGLPLUS_GLFUNC(GetPerfMonitorCounterDataAMD)(
459 GL_PERFMON_RESULT_AMD,
460 data.size() *
sizeof(GLuint),
465 GetPerfMonitorCounterDataAMD,
471 results.reserve(data.size() / 3);
473 auto i = data.begin(), e = data.end();
482 auto type = counter.
Type();
483 GLuint lo = *i++, hi = 0;
493 typedef ObjectOps<tag::DirectState, tag::PerfMonitorAMD>
515 OGLPLUS_EXTENSION_CLASS(AMD, performance_monitor)
525 OGLPLUS_GLFUNC(GetPerfMonitorGroupsAMD)(
530 OGLPLUS_CHECK_SIMPLE(GetPerfMonitorGroupsAMD);
532 std::vector<GLuint> buffer(count);
533 OGLPLUS_GLFUNC(GetPerfMonitorGroupsAMD)(
538 OGLPLUS_CHECK_SIMPLE(GetPerfMonitorGroupsAMD);
541 groups.reserve(count);
542 for(
auto i=buffer.begin(), e=buffer.end(); i!=e; ++i)
553 std::vector<PerfMonitorAMDGroup> result;
562 #endif // include guard
String GetString(void) const
Returns a string describing the monitor counter.
Definition: AMD_performance_monitor.hpp:76
Object< PerfMonitorAMDOps > PerfMonitorAMD
An oglplus_object encapsulating the performance monitor functionality.
Definition: AMD_performance_monitor.hpp:503
Funcions and classes for handling and wrapping OpenGL extensions.
GLuint High(void) const
Returns the high dword of the result.
Definition: AMD_performance_monitor.hpp:287
Generic OpenGL object wrapper.
Enumeration-related declarations.
GLuint Low(void) const
Returns the low dword of the result.
Definition: AMD_performance_monitor.hpp:281
PerfMonitorAMDType
Performance counter type.
Definition: AMD_performance_monitor.hpp:36
Implements operations applicable to named (non-zero) objects.
Definition: wrap_tpl.hpp:45
String GetString(void) const
Returns a string describing the monitor group.
Definition: AMD_performance_monitor.hpp:154
PerfMonitorAMDCounter Counter(void) const
Returns the counter that this is a result of.
Definition: AMD_performance_monitor.hpp:275
GLfloat Float(void) const
Returns the floating-point value of the result.
Definition: AMD_performance_monitor.hpp:293
void GetCounters(GLint &max_active_counters, std::vector< PerfMonitorAMDCounter > &counters) const
Queries the performance counters in this group.
Definition: AMD_performance_monitor.hpp:189
ObjectOps< tag::DirectState, tag::PerfMonitorAMD > PerfMonitorAMDOps
PerfMonitorAMD operations with direct state access.
Definition: AMD_performance_monitor.hpp:494
Implements operations applicable to any object including object 0 (zero)
Definition: fwd.hpp:157
Wrapper for performance counter result.
Definition: AMD_performance_monitor.hpp:249
std::vector< PerfMonitorAMDCounter > GetCounters(GLint &max_active_counters) const
Returns the performance counters in this group.
Definition: AMD_performance_monitor.hpp:234
void Result(std::vector< PerfMonitorAMDResult > &results) const
Returns the results.
Definition: AMD_performance_monitor.hpp:440
::std::basic_string< GLchar > String
String class.
Definition: def.hpp:36
Exception class for general OpenGL errors.
Definition: basic.hpp:43
Exception class for GL object-related errors.
Definition: object.hpp:24
bool ResultAvailable(void) const
Returns true if results are available.
Definition: AMD_performance_monitor.hpp:415
void End(void) const
Ends a monitoring session on this monitor.
Definition: AMD_performance_monitor.hpp:399
Wrapper for performance monitor group functionality.
Definition: AMD_performance_monitor.hpp:138
void Begin(void) const
Begins a monitoring session on this monitor.
Definition: AMD_performance_monitor.hpp:384
PerfMonitorAMDType Type(void) const
Returns the type of the counter.
Definition: AMD_performance_monitor.hpp:114
Wrapper for performance monitor counter functionality.
Definition: AMD_performance_monitor.hpp:57
void SelectCounters(bool enable, const std::vector< PerfMonitorAMDCounter > &counters) const
Enables or disables the specified counters for this monitor.
Definition: AMD_performance_monitor.hpp:349