前言
上章深入分析了帧循环中记录与提交的处理流程。本章将继续分析帧循环过程中最后一部分的内容:呈现,上章通过代码的分析,在记录与提交阶段,队列提交完成后生成通知信号量,本章将通过代码剖析呈现阶段的具体工作,说明上一阶段(记录与提交阶段)完成后的通知信号量与呈现阶段的关系。
目录
- 1 RecordAndSubmitTask
- 2 呈现
1 RecordAndSubmitTask
vsg_viewer->assignRecordAndSubmitTaskAndPresentation({ commandGraph });
vsg::Viewer调用接口assignRecordAndSubmitTaskAndPresentation,传入commandGraph,创建RecordAndSubmitTask对象。
1.1 DeviceQueueFamily
RecordAndSubmitTask的创建粒度为DeviceQueueFamily,其中DeviceQueueFamily定义代码如下:
struct DeviceQueueFamily
{
Device* device = nullptr;
int queueFamily = -1;
int presentFamily = -1;
bool operator<(const DeviceQueueFamily& rhs) const
{
if (device < rhs.device) return true;
if (device > rhs.device) return false;
if (queueFamily < rhs.queueFamily) return true;
if (queueFamily > rhs.queueFamily) return false;
return presentFamily < rhs.presentFamily;
}
};
其中Device表示逻辑设备,queueFamily表示队列族,presentFamily表示呈现族。
1.2 收集所有DeviceQueueFamily
通过遍历接口assignRecordAndSubmitTaskAndPresentation传入的CommandGraph数组,可获取由queueFamily对象作为key值与对应的CommandGraph数组映射的map数组。
std::map<DeviceQueueFamily, CommandGraphs> deviceCommandGraphsMap;
for (auto& commandGraph : in_commandGraphs)
{
commandGraph->accept(findWindows);
deviceCommandGraphsMap[DeviceQueueFamily{commandGraph->device.get(), commandGraph->queueFamily, commandGraph->presentFamily}].emplace_back(commandGraph);
}

最低0.47元/天 解锁文章
1061

被折叠的 条评论
为什么被折叠?



