当前位置: 首页>>代码示例>>C++>>正文


C++ GraphicsContext::EndQuery方法代码示例

本文整理汇总了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];
		}
	}
开发者ID:Hiroky,项目名称:SimpleEngine,代码行数:60,代码来源:GPUProfiler.cpp

示例2: EndProfilePoint

	void GPUProfiler::EndProfilePoint(GraphicsContext& context)
	{
		context.EndQuery(hwQueries_[currentQuery_]);
		int32_t beginQuery = queriesStack_.top();
		queriesStack_.pop();
		correspondingQueryEnds_[beginQuery] = currentQuery_;
		IncrementCurrentQuery();
	}
开发者ID:Hiroky,项目名称:SimpleEngine,代码行数:8,代码来源:GPUProfiler.cpp

示例3: BeginProfilePoint

	void GPUProfiler::BeginProfilePoint(GraphicsContext& context, const char* profilePointName)
	{
		context.EndQuery(hwQueries_[currentQuery_]);
		hwQueriesDescs_[currentQuery_] = profilePointName;
		queriesStack_.push(currentQuery_);

		IncrementCurrentQuery();
	}
开发者ID:Hiroky,项目名称:SimpleEngine,代码行数:8,代码来源:GPUProfiler.cpp


注:本文中的GraphicsContext::EndQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。