#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pubenum MemoryLocation { /// The allocated resource is stored at an unknown memory location; let the driver decide what's the best location
Unknown, /// Store the allocation in GPU only accessible memory - typically this is the faster GPU resource and this should be /// where most of the allocations live.
GpuOnly, /// Memory useful for uploading data to the GPU and potentially for constant buffers
CpuToGpu, /// Memory useful for CPU readback of data
GpuToCpu,
}
#[derive(Copy, Clone, Debug)] pubstruct AllocatorDebugSettings { /// Logs out debugging information about the various heaps the current device has on startup pub log_memory_information: bool, /// Logs out all memory leaks on shutdown with log level Warn pub log_leaks_on_shutdown: bool, /// Stores a copy of the full backtrace for every allocation made, this makes it easier to debug leaks /// or other memory allocations, but storing stack traces has a RAM overhead so should be disabled /// in shipping applications. pub store_stack_traces: bool, /// Log out every allocation as it's being made with log level Debug, rather spammy so off by default pub log_allocations: bool, /// Log out every free that is being called with log level Debug, rather spammy so off by default pub log_frees: bool, /// Log out stack traces when either `log_allocations` or `log_frees` is enabled. pub log_stack_traces: bool,
}
/// The sizes of the memory blocks that the allocator will create. /// /// Useful for tuning the allocator to your application's needs. For example most games will be fine with the default /// values, but eg. an app might want to use smaller block sizes to reduce the amount of memory used. /// /// Clamped between 4MB and 256MB, and rounds up to the nearest multiple of 4MB for alignment reasons. #[derive(Clone, Copy, Debug)] pubstruct AllocationSizes { /// The size of the memory blocks that will be created for the GPU only memory type. /// /// Defaults to 256MB.
device_memblock_size: u64, /// The size of the memory blocks that will be created for the CPU visible memory types. /// /// Defaults to 64MB.
host_memblock_size: u64,
}
if device_memblock_size % FOUR_MB != 0 { let val = device_memblock_size / FOUR_MB + 1;
device_memblock_size = val * FOUR_MB;
log::warn!( "Device memory block size must be a multiple of 4MB, clamping to {}MB",
device_memblock_size / 1024 / 1024
)
}
if host_memblock_size % FOUR_MB != 0 { let val = host_memblock_size / FOUR_MB + 1;
host_memblock_size = val * FOUR_MB;
log::warn!( "Host memory block size must be a multiple of 4MB, clamping to {}MB",
host_memblock_size / 1024 / 1024
)
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.