Smart compaction goes brrrrr

This commit is contained in:
2026-09-17 23:01:29 +02:00
parent f34550e692
commit 306b01b44c
5 changed files with 180 additions and 401 deletions
+14 -11
View File
@@ -282,7 +282,7 @@ where
// Sorted requests
wgpu::BindGroupEntry {
binding: 3,
resource: request_buffer.sort_buffer().as_entire_binding(),
resource: request_buffer.index_buffer().as_entire_binding(),
},
// LRU list
wgpu::BindGroupEntry {
@@ -372,13 +372,13 @@ where
@group(0) @binding(0) var<storage, read_write> structure_pool: array<StructurePoolElement>;
@group(0) @binding(1) var<storage, read_write> color_pool: array<ColorPoolElement>;
@group(0) @binding(2) var<storage, read_write> location_pool: array<LocationPoolElement>;
@group(0) @binding(3) var<storage, read> sorted_requests: array<SortedRequestsElement>;
@group(0) @binding(3) var<storage, read> sorted_requests: array<u32>;
@group(0) @binding(4) var<storage, read> lru_list: array<u32>;
@group(0) @binding(5) var<storage, read_write> usage_buffer: array<u32>;
@group(0) @binding(6) var<storage, read> pools_request_count: u32;
@group(1) @binding(0) var<storage, read_write> structure_table_pointers: array<u32>;
@group(1) @binding(1) var<storage, read_write> structure_table_sorted_requests: array<SortedRequestsElement>;
@group(1) @binding(1) var<storage, read_write> structure_table_sorted_requests: array<u32>;
@group(1) @binding(2) var<storage, read_write> structure_table_request_count: u32;
");
@@ -445,7 +445,7 @@ where
{{
var request: CacheInterfaceRequest;
// Index in structure table IS structure id
request.structure_id = structure_table_sorted_requests[index].node;
request.structure_id = structure_table_sorted_requests[index];
request.locator = 0; // Root request -> locator 0
request.child_index = 0xFFFFFFFF; // child index u32::MAX ->
@@ -460,16 +460,19 @@ where
}}
let pool_index = index - structure_table_request_count;
let sorted_requests_node = sorted_requests[pool_index] / 64;
let sorted_requests_child = sorted_requests[pool_index] % 64;
// Request location comes from location pool
var request: CacheInterfaceRequest;
request.structure_id = location_pool[sorted_requests[pool_index].node].structure_id;
request.locator = location_pool[sorted_requests[pool_index].node].structure_locator;
request.child_index = sorted_requests[pool_index].child;
request.structure_id = location_pool[sorted_requests_node].structure_id;
request.locator = location_pool[sorted_requests_node].structure_locator;
request.child_index = sorted_requests_child;
var request_wb: CacheInterfaceRequestWb;
request_wb.node_index = sorted_requests[pool_index].node;
request_wb.child_index = sorted_requests[pool_index].child;
request_wb.node_index = sorted_requests_node;
request_wb.child_index = sorted_requests_child;
// Write request
requests[index] = request;
@@ -809,7 +812,7 @@ where
wgpu::BindGroupEntry
{
binding: 1,
resource: self.structure_table.request_buffer.sort_buffer().as_entire_binding(),
resource: self.structure_table.request_buffer.index_buffer().as_entire_binding(),
},
wgpu::BindGroupEntry
{