Skip to content

Commit

Permalink
switch to fixed default device heap
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNumbat committed Sep 30, 2024
1 parent 393ad1b commit e8dc377
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion rvk/instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static VkBool32 debug_callback(VkDebugUtilsMessageSeverityFlagBitsEXT sev,
if(is_error) RPP_DEBUG_BREAK;
#endif

return is_error;
return false;
}

Slice<const char*> Instance::baseline_extensions() {
Expand Down
8 changes: 4 additions & 4 deletions rvk/rvk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ Vk::Vk(Config config) {
if(heap_size < Math::MB(128)) {
die("[rvk] Device heap is too small: %mb / 128mb.", heap_size / Math::MB(1));
}
if(config.device_heap_margin > heap_size) {
warn("[rvk] Requested device heap margin is larger than the heap, using 64mb margin.");
config.device_heap_margin = Math::MB(64);
if(config.device_heap > heap_size) {
warn("[rvk] Requested device margin is larger than available, using entire heap.");
config.device_heap = heap_size;
}

u64 allocated = 0;
u64 target = device->heap_size(Heap::device) - config.device_heap_margin;
u64 target = config.device_heap;
while(allocated < target) {
u64 size = Math::min(target - allocated, physical_device->max_allocation());
device_memories.push(
Expand Down
10 changes: 5 additions & 5 deletions rvk/rvk.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct Config {
Function<VkSurfaceKHR(VkInstance)> create_surface;

u64 host_heap = Math::GB(1);
u64 device_heap_margin = Math::GB(1);
u64 device_heap = Math::MB(4094);
};

bool startup(Config config);
Expand Down Expand Up @@ -118,13 +118,13 @@ void submit(Commands& cmds, u32 index, Slice<const Sem_Ref> wait, Slice<const Se

template<typename F>
requires Invocable<F, Commands&>
auto sync(F&& f, Queue_Family family = Queue_Family::graphics, u32 index = 0)
-> Invoke_Result<F, Commands&>;
auto sync(F&& f, Queue_Family family = Queue_Family::graphics,
u32 index = 0) -> Invoke_Result<F, Commands&>;

template<typename F>
requires Invocable<F, Commands&>
auto async(Async::Pool<>& pool, F&& f, Queue_Family family = Queue_Family::graphics, u32 index = 0)
-> Async::Task<Invoke_Result<F, Commands&>>;
auto async(Async::Pool<>& pool, F&& f, Queue_Family family = Queue_Family::graphics,
u32 index = 0) -> Async::Task<Invoke_Result<F, Commands&>>;

} // namespace rvk

Expand Down

0 comments on commit e8dc377

Please sign in to comment.