'mapped' -> 'buffer_cpu_address'

This commit is contained in:
jacob 2026-03-19 18:48:47 -05:00
parent 039e354a9d
commit a76cfc5dfd
5 changed files with 45 additions and 45 deletions

View File

@ -1535,7 +1535,7 @@ G_BaseDescriptorIndex G_PushMemory(G_CommandListHandle cl_handle, G_ArenaHandle
}
}
if (should_map && !resource->mapped)
if (should_map && !resource->buffer_cpu_address)
{
D3D12_RANGE zero_read_range = Zi;
D3D12_RANGE *read_range_arg = &zero_read_range;
@ -1544,7 +1544,7 @@ G_BaseDescriptorIndex G_PushMemory(G_CommandListHandle cl_handle, G_ArenaHandle
// Specify NULL read range to signal to D3D12 that any part of address range may be read by CPU
read_range_arg = 0;
}
HRESULT hr = ID3D12Resource_Map(resource->d3d_resource, 0, read_range_arg, &resource->mapped);
HRESULT hr = ID3D12Resource_Map(resource->d3d_resource, 0, read_range_arg, &resource->buffer_cpu_address);
if (!SUCCEEDED(hr))
{
// TODO: Don't panic
@ -1907,7 +1907,7 @@ i32 G_CountMips(G_TextureRef texture)
void *G_CpuPointerFromBuffer(G_BufferRef buffer)
{
G_D12_Resource *resource = G_D12_ResourceFromBufferRef(buffer);
void *result = resource->mapped;
void *result = resource->buffer_cpu_address;
return result;
}

View File

@ -78,12 +78,12 @@ Struct(G_D12_Resource)
// D3D12 resource
D3D12_RESOURCE_DESC1 d3d_desc;
ID3D12Resource *d3d_resource;
void *mapped;
struct G_D12_Descriptor *gpu_descriptor;
// Buffer info
D3D12_GPU_VIRTUAL_ADDRESS buffer_gpu_address;
void *buffer_cpu_address;
u64 buffer_element_offset;
u64 buffer_element_stride;
u64 buffer_element_count;

View File

@ -164,12 +164,14 @@ M_EmbedObj M_Embed(String store_name, String dir_path)
BB_WriteUBits(&bbw, entries_count, 64);
// Reserve entries space
u64 entry_size = 0
u64 entry_size = (
0
+ 8 // Store hash
+ 8 // Name start
+ 8 // Name end
+ 8 // Data start
+ 8; // Data end
+ 8 // Data end
);
u8 *entries_start = BB_GetWrittenRaw(&bbw) + BB_GetNumBytesWritten(&bbw);
u64 entries_size = entry_size * entries_count;
String entries_str = STRING(entries_size, entries_start);

View File

@ -121,7 +121,7 @@ Struct(P_Ent)
//- Client data
i64 local_observation_ns;
i64 observation_time_ns;
b32 has_observed;
//- Build data

View File

@ -1895,7 +1895,6 @@ void V_TickForever(WaveLaneCtx *lane)
//////////////////////////////
//- Observe entities
{
for (P_Ent *ent = P_FirstEnt(local_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent))
{
P_EntKey key = ent->key;
@ -1915,7 +1914,7 @@ void V_TickForever(WaveLaneCtx *lane)
{
if (obs->time_ns + expiration_ns > frame->time_ns)
{
// Re-observe expired observation
// Re-observe matching expired observation
DllQueueRemove(V.first_observation, V.last_observation, obs);
DllQueuePush(V.first_observation, V.last_observation, obs);
obs->time_ns = frame->time_ns;
@ -1942,9 +1941,8 @@ void V_TickForever(WaveLaneCtx *lane)
}
observation_time_ns = obs->time_ns;
}
ent->local_observation_ns = observation_time_ns;
ent->has_observed = observation_time_ns == frame->time_ns;
}
ent->observation_time_ns = observation_time_ns;
ent->has_observed = observation_time_ns < frame->time_ns;
}