upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/bindless_sizing_test.cpp
diff options
context:
space:
mode:
authorRain156 <77776581+Rain156@users.noreply.github.com>2026-11-24 21:19:30 +0800
committerRain156 <77776581+Rain156@users.noreply.github.com>2026-11-24 21:19:30 +0800
commitdb19bbd3455a757c3fe986c6e6db36998f275150 (patch)
treefc55054b03582969e5897c73a667cc4c8b44ad5a /runtime/test/bindless_sizing_test.cpp
parente0d4fd2b81e6636b1c6bb2f76be79e910e84d84b (diff)
runtime: connect native pipelines and title resources to the offline first-run UI
Build on the public frame-loop integration in #321. Carry the texture-view and depth work from #213 and #261, the layout provider from #461, the responsive window from #526, and the rectangle generator from #682. Integrate the Xbox constant-buffer row addressing measured in #513 and the draw-time rectangle selection in #722. Keep all fixtures synthetic. The Windows GPU path resolves title-owned shader objects, retires geometry uploads per submission, materializes texture views on use, maps linear surfaces, and delivers completed GPU label writes. A first-run UI launch selects the tested settings for these paths.
Diffstat (limited to 'runtime/test/bindless_sizing_test.cpp')
-rw-r--r--runtime/test/bindless_sizing_test.cpp52
1 files changed, 46 insertions, 6 deletions
diff --git a/runtime/test/bindless_sizing_test.cpp b/runtime/test/bindless_sizing_test.cpp
index 4553f25b6..3a4ddb7ba 100644
--- a/runtime/test/bindless_sizing_test.cpp
+++ b/runtime/test/bindless_sizing_test.cpp
@@ -84,6 +84,13 @@ bool storage_consistent(const BindlessFeatures& f) {
84 f.counts[bindless::r32ui_binding(dimension)] != held) 84 f.counts[bindless::r32ui_binding(dimension)] != held)
85 return false; 85 return false;
86 } 86 }
87 // 1D arrays have no sampled capacity, but all three storage classes are always present.
88 const auto array = ImageDimension::dim_1d_array;
89 const auto held = storage(f, array);
90 for (std::uint32_t c = 0; c < 3; ++c) {
91 const auto binding = bindless::storage_binding(array, c);
92 if (!held || !bindless::binding_enabled(binding, f) || f.counts[binding] != held) return false;
93 }
87 return true; 94 return true;
88} 95}
89 96
@@ -93,6 +100,33 @@ int main() {
93 using D = ImageDimension; 100 using D = ImageDimension;
94 constexpr auto defaults = bindless::default_counts(); 101 constexpr auto defaults = bindless::default_counts();
95 static_assert(defaults[0] == 4096 && defaults[bindless::sampler_binding] == 1024 && defaults[8] == 256); 102 static_assert(defaults[0] == 4096 && defaults[bindless::sampler_binding] == 1024 && defaults[8] == 256);
103 static_assert(bindless::sampled_binding(D::dim_1d_array) == bindless::no_binding);
104 static_assert(bindless::storage_binding(D::dim_1d_array, 0) == 26 &&
105 bindless::storage_binding(D::dim_1d_array, 1) == 27 &&
106 bindless::storage_binding(D::dim_1d_array, 2) == 28);
107 static_assert(bindless::sampled_binding(D::dim_2d_ms, 0) == 20 &&
108 bindless::sampled_binding(D::dim_2d_ms_array, 0) == 21 &&
109 bindless::sampled_binding(D::dim_2d_ms, 1) == 22 &&
110 bindless::sampled_binding(D::dim_2d_ms_array, 1) == 23 &&
111 bindless::sampled_binding(D::dim_2d_ms, 2) == 24 &&
112 bindless::sampled_binding(D::dim_2d_ms_array, 2) == 25);
113
114 // SetLayout compacts disabled MS pairs without renumbering either the enabled pair or the storage-only tail.
115 {
116 BindlessFeatures f{};
117 f.update_after_bind = f.partially_bound = true;
118 f.ms_samples[1] = VK_SAMPLE_COUNT_4_BIT;
119 const bindless::SetLayout layout(f);
120 EXPECT(layout.info.bindingCount == 25 && layout.flags_info.bindingCount == 25);
121 EXPECT(layout.entries[20].binding == 22 && layout.entries[21].binding == 23);
122 for (std::uint32_t c = 0; c < 3; ++c) {
123 const auto& entry = layout.entries[22 + c];
124 EXPECT(entry.binding == 26 + c && entry.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE &&
125 entry.descriptorCount == 256);
126 EXPECT(layout.flags[22 + c] ==
127 (VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT | VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT));
128 }
129 }
96 130
97 // An RTX 5070 (driver 621.24): 1048576 of each descriptor type, update-after-bind or not, 4000 samplers. 131 // An RTX 5070 (driver 621.24): 1048576 of each descriptor type, update-after-bind or not, 4000 samplers.
98 for (const bool update_after_bind : {true, false}) { 132 for (const bool update_after_bind : {true, false}) {
@@ -103,8 +137,9 @@ int main() {
103 EXPECT(f.counts[bindless::sampler_binding] == 4000 - bindless::reserved_samplers); 137 EXPECT(f.counts[bindless::sampler_binding] == 4000 - bindless::reserved_samplers);
104 EXPECT(f.counts[bindless::sampler_binding] > 2048); // a full sampler heap and the fallback 138 EXPECT(f.counts[bindless::sampler_binding] > 2048); // a full sampler heap and the fallback
105 EXPECT(storage(f, D::dim_2d) == bindless::max_storage_indices); 139 EXPECT(storage(f, D::dim_2d) == bindless::max_storage_indices);
106 EXPECT(storage(f, D::dim_2d_array) == 1024 && storage(f, D::dim_3d) == 256 && storage(f, D::dim_1d) == 256); 140 EXPECT(storage(f, D::dim_2d_array) == bindless::max_storage_indices && storage(f, D::dim_3d) == 256 && storage(f, D::dim_1d) == 256);
107 EXPECT(count(f, D::dim_2d_array) == 1024 && count(f, D::dim_3d) == 256 && count(f, D::dim_1d) == 256); 141 EXPECT(storage(f, D::dim_1d_array) == 256 && totals(f).all == 119137);
142 EXPECT(count(f, D::dim_2d_array) == bindless::max_2d_array_images && count(f, D::dim_3d) == 256 && count(f, D::dim_1d) == 256);
108 EXPECT(f.ms_samples[0] == VK_SAMPLE_COUNT_4_BIT && f.ms_samples[2] == VK_SAMPLE_COUNT_4_BIT); 143 EXPECT(f.ms_samples[0] == VK_SAMPLE_COUNT_4_BIT && f.ms_samples[2] == VK_SAMPLE_COUNT_4_BIT);
109 EXPECT(storage_consistent(f)); 144 EXPECT(storage_consistent(f));
110 if (update_after_bind) 145 if (update_after_bind)
@@ -112,12 +147,12 @@ int main() {
112 count(f, D::dim_2d), f.counts[bindless::sampler_binding], storage(f, D::dim_2d), totals(f).all); 147 count(f, D::dim_2d), f.counts[bindless::sampler_binding], storage(f, D::dim_2d), totals(f).all);
113 } 148 }
114 149
115 // At today's sizes exactly (5632 sampled images, 1024 samplers, 3584 storage images): today's set, no MS pairs. 150 // At today's sizes exactly (5632 sampled images, 1024 samplers, 4352 storage images): no MS pairs.
116 { 151 {
117 Device d = uniform(1048576, 1048576); 152 Device d = uniform(1048576, 1048576);
118 d.v12.maxPerStageDescriptorUpdateAfterBindSampledImages = 5632; 153 d.v12.maxPerStageDescriptorUpdateAfterBindSampledImages = 5632;
119 d.v12.maxPerStageDescriptorUpdateAfterBindSamplers = 1024; 154 d.v12.maxPerStageDescriptorUpdateAfterBindSamplers = 1024;
120 d.v12.maxPerStageDescriptorUpdateAfterBindStorageImages = 3584; 155 d.v12.maxPerStageDescriptorUpdateAfterBindStorageImages = 4352;
121 BindlessFeatures f = with_ms(true); 156 BindlessFeatures f = with_ms(true);
122 EXPECT(bindless::size_bindings(f, d.limits, d.v11, d.v12)); 157 EXPECT(bindless::size_bindings(f, d.limits, d.v11, d.v12));
123 EXPECT(count(f, D::dim_2d) == 4096 && f.counts[bindless::sampler_binding] == 1024 && 158 EXPECT(count(f, D::dim_2d) == 4096 && f.counts[bindless::sampler_binding] == 1024 &&
@@ -125,6 +160,7 @@ int main() {
125 for (std::uint32_t b = 0; b < bindless::first_ms_binding; ++b) 160 for (std::uint32_t b = 0; b < bindless::first_ms_binding; ++b)
126 if (bindless::bindings[b].type != VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) EXPECT(f.counts[b] == defaults[b]); 161 if (bindless::bindings[b].type != VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) EXPECT(f.counts[b] == defaults[b]);
127 EXPECT(f.ms_samples == (std::array{VK_SAMPLE_COUNT_1_BIT, VK_SAMPLE_COUNT_1_BIT, VK_SAMPLE_COUNT_1_BIT})); 162 EXPECT(f.ms_samples == (std::array{VK_SAMPLE_COUNT_1_BIT, VK_SAMPLE_COUNT_1_BIT, VK_SAMPLE_COUNT_1_BIT}));
163 EXPECT(totals(f).storage == 4352 && storage(f, D::dim_1d_array) == 256);
128 EXPECT(storage_consistent(f)); 164 EXPECT(storage_consistent(f));
129 } 165 }
130 166
@@ -178,15 +214,19 @@ int main() {
178 Device d = uniform(1048576, 1048576); 214 Device d = uniform(1048576, 1048576);
179 d.v11.maxPerSetDescriptors = 6159; 215 d.v11.maxPerSetDescriptors = 6159;
180 d.limits.maxSamplerAllocationCount = 4000; 216 d.limits.maxSamplerAllocationCount = 4000;
181 unsigned asked = 0, asked_within = 0; 217 unsigned asked = 0, asked_within = 0, missing_storage = 0;
182 const auto all_supported = [&](const BindlessFeatures& candidate) { 218 const auto all_supported = [&](const BindlessFeatures& candidate) {
183 ++asked; 219 ++asked;
184 asked_within += totals(candidate).all <= 6159; 220 asked_within += totals(candidate).all <= 6159;
221 const bindless::SetLayout layout(candidate);
222 const auto& last = layout.entries[layout.info.bindingCount - 1];
223 missing_storage += last.binding != 28 || last.descriptorType != VK_DESCRIPTOR_TYPE_STORAGE_IMAGE ||
224 last.descriptorCount != storage(candidate, D::dim_1d_array);
185 return true; 225 return true;
186 }; 226 };
187 BindlessFeatures f = with_ms(true); 227 BindlessFeatures f = with_ms(true);
188 EXPECT(bindless::size_bindings(f, d.limits, d.v11, d.v12, all_supported)); 228 EXPECT(bindless::size_bindings(f, d.limits, d.v11, d.v12, all_supported));
189 EXPECT(asked > 0 && asked_within == 0); 229 EXPECT(asked > 0 && asked_within == 0 && missing_storage == 0);
190 EXPECT(count(f, D::dim_2d) == bindless::max_2d_images && 230 EXPECT(count(f, D::dim_2d) == bindless::max_2d_images &&
191 f.counts[bindless::sampler_binding] == 4000 - bindless::reserved_samplers); 231 f.counts[bindless::sampler_binding] == 4000 - bindless::reserved_samplers);
192 EXPECT(storage(f, D::dim_2d) == bindless::max_storage_indices && storage_consistent(f)); 232 EXPECT(storage(f, D::dim_2d) == bindless::max_storage_indices && storage_consistent(f));