本文整理汇总了C++中GraphicsContext::EndQuery方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsContext::EndQuery方法的具体用法?C++ GraphicsContext::EndQuery怎么用?C++ GraphicsContext::EndQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsContext
的用法示例。
在下文中一共展示了GraphicsContext::EndQuery方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EndFrameProfiling
void GPUProfiler::EndFrameProfiling(GraphicsContext& context)
{
PendingFrameQueries pendingFrame;
pendingFrame.disjointQueryId_ = currentDisjointQuery_;
pendingFrame.beginQuery_ = currentFrameFirstQuery_;
pendingFrame.endQuery_ = currentQuery_;
EndProfilePoint(context);
if (queriesStack_.size() != 0) {
throw "Wrong profile point count! Did you forget about EndProfilePoint?";
}
context.EndQuery(disjointQueries_[currentDisjointQuery_]);
pendingFrames_.push(pendingFrame);
IncrementCurrentDisjointQuery();
if (currentFrameProfilerTree_) {
delete currentFrameProfilerTree_;
}
// Time to fetch prev frames!
if (pendingFrames_.size() > 4) {
pendingFrame = pendingFrames_.front();
pendingFrames_.pop();
D3D11_QUERY_DATA_TIMESTAMP_DISJOINT disjointData;
context.GetQueryData(disjointQueries_[pendingFrame.disjointQueryId_], &disjointData, sizeof(disjointData));
ProfilerTreeMember* parent = new ProfilerTreeMember();
ProfilerTreeMember* frameParent = parent;
for (int queryIterator = pendingFrame.beginQuery_; queryIterator != (pendingFrame.endQuery_ + 1) % MAX_HW_QUERIES; queryIterator = (queryIterator + 1) % MAX_HW_QUERIES) {
if (correspondingQueryEnds_[queryIterator] != INT_MAX) {
auto* profilerObject = new ProfilerTreeMember();
int correspondingEnd = correspondingQueryEnds_[queryIterator];
uint64_t beginProfilePointData, endProfilePointData;
context.GetQueryData(hwQueries_[queryIterator], &beginProfilePointData, sizeof(beginProfilePointData));
context.GetQueryData(hwQueries_[correspondingEnd], &endProfilePointData, sizeof(endProfilePointData));
profilerObject->time_ = (double)(endProfilePointData - beginProfilePointData) / (double)disjointData.Frequency * 1000.0;
profilerObject->name_ = hwQueriesDescs_[queryIterator];
profilerObject->parent_ = parent;
parent->childMembers_.push_back(profilerObject);
parent = profilerObject;
} else {
parent = parent->parent_;
if (parent == nullptr) {
throw "Error while constructing profiler tree";
}
}
}
if (frameParent->childMembers_.size() < 1) {
throw "Error while constructing profiler tree";
}
currentFrameProfilerTree_ = frameParent->childMembers_[0];
}
}
示例2: EndProfilePoint
void GPUProfiler::EndProfilePoint(GraphicsContext& context)
{
context.EndQuery(hwQueries_[currentQuery_]);
int32_t beginQuery = queriesStack_.top();
queriesStack_.pop();
correspondingQueryEnds_[beginQuery] = currentQuery_;
IncrementCurrentQuery();
}
示例3: BeginProfilePoint
void GPUProfiler::BeginProfilePoint(GraphicsContext& context, const char* profilePointName)
{
context.EndQuery(hwQueries_[currentQuery_]);
hwQueriesDescs_[currentQuery_] = profilePointName;
queriesStack_.push(currentQuery_);
IncrementCurrentQuery();
}