@@ -16,38 +16,35 @@ void initializeDescriptorPool() {
1616 // 集計
1717 uint32_t maxSets = 0 ;
1818 std::unordered_map<vk::DescriptorType, uint32_t > sizesMap;
19- for (const auto &[_, n]: config::config ().pipelines ) {
20- for (const auto &m: n.descSets ) {
21- maxSets += m.count ;
19+ const auto fontCount = config::config ().fonts .size ();
2220
23- std::unordered_map<config::DescriptorType, uint32_t > map;
24- for (const auto &b: m.bindings ) {
25- const auto t = config::convertDescriptorType (b.type );
26- sizesMap[t] += b.count * m.count ;
27- }
28- }
29- }
30-
31- // テキストレンダリングパイプライン用のディスクリプタセットを追加
32- // TODO: こっちに統合した方が実際に使うパイプラインだけ列挙できるから良さそう?
33- // FIXME: というか、現状だと同じパイプラインを複数サブパスで使うことが想定されていない。
34- uint32_t textRenderingPipelineCount = 0 ;
21+ // グラフィックスパイプライン用のディスクリプタセットを追加
3522 for (const auto &[_, n]: config::config ().renderPasses ) {
3623 for (const auto &m: n.subpasses ) {
3724 for (const auto &o: m.pipelines ) {
25+ // テキストレンダリングパイプライン
3826 if (o == " @text@" ) {
39- textRenderingPipelineCount += 1 ;
27+ maxSets += 2 ;
28+ sizesMap[vk::DescriptorType::eStorageBuffer] += 1 ;
29+ sizesMap[vk::DescriptorType::eSampledImage] += static_cast <uint32_t >(fontCount);
30+ sizesMap[vk::DescriptorType::eSampler] += 1 ;
31+ continue ;
32+ }
33+
34+ // 一般パイプライン
35+ const auto &plconfig = config::config ().pipelines .at (o);
36+ for (const auto &d: plconfig.descSets ) {
37+ maxSets += d.count ;
38+
39+ std::unordered_map<config::DescriptorType, uint32_t > map;
40+ for (const auto &b: d.bindings ) {
41+ const auto t = config::convertDescriptorType (b.type );
42+ sizesMap[t] += b.count * d.count ;
43+ }
4044 }
4145 }
4246 }
4347 }
44- if (textRenderingPipelineCount > 0 ) {
45- const auto fontCount = config::config ().fonts .size ();
46- maxSets += textRenderingPipelineCount * 2 ;
47- sizesMap[vk::DescriptorType::eStorageBuffer] += textRenderingPipelineCount;
48- sizesMap[vk::DescriptorType::eSampledImage] += textRenderingPipelineCount * static_cast <uint32_t >(fontCount);
49- sizesMap[vk::DescriptorType::eSampler] += textRenderingPipelineCount;
50- }
5148
5249 // コンピュートパイプライン用のディスクリプタセットを追加
5350 for (const auto &[_, n]: config::config ().computePipelines ) {
0 commit comments