investigating memory issues
This commit is contained in:
@@ -2,6 +2,7 @@ const std = @import("std");
|
|||||||
const vk = @import("vulkan");
|
const vk = @import("vulkan");
|
||||||
const SoftDevice = @import("SoftDevice.zig");
|
const SoftDevice = @import("SoftDevice.zig");
|
||||||
const base = @import("base");
|
const base = @import("base");
|
||||||
|
const lib = @import("lib.zig");
|
||||||
|
|
||||||
const VkError = base.VkError;
|
const VkError = base.VkError;
|
||||||
|
|
||||||
@@ -12,6 +13,9 @@ interface: Interface,
|
|||||||
data: []u8,
|
data: []u8,
|
||||||
|
|
||||||
pub fn create(device: *SoftDevice, allocator: std.mem.Allocator, size: vk.DeviceSize, memory_type_index: u32) VkError!*Self {
|
pub fn create(device: *SoftDevice, allocator: std.mem.Allocator, size: vk.DeviceSize, memory_type_index: u32) VkError!*Self {
|
||||||
|
if (size > lib.MAX_MEMORY_ALLOCATION_SIZE)
|
||||||
|
return VkError.OutOfDeviceMemory;
|
||||||
|
|
||||||
const self = allocator.create(Self) catch return VkError.OutOfHostMemory;
|
const self = allocator.create(Self) catch return VkError.OutOfHostMemory;
|
||||||
errdefer allocator.destroy(self);
|
errdefer allocator.destroy(self);
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ pub const MAX_IMAGE_LEVELS_CUBE = 15;
|
|||||||
pub const MAX_IMAGE_ARRAY_LAYERS = 2048;
|
pub const MAX_IMAGE_ARRAY_LAYERS = 2048;
|
||||||
|
|
||||||
pub const PHYSICAL_DEVICE_HEAP_SIZE = 0x80000000; // 2 GiB
|
pub const PHYSICAL_DEVICE_HEAP_SIZE = 0x80000000; // 2 GiB
|
||||||
|
pub const MAX_MEMORY_ALLOCATION_SIZE = 0x80000000; // 2 GiB
|
||||||
pub const MAX_ALLOCATION_COUNT = 4096;
|
pub const MAX_ALLOCATION_COUNT = 4096;
|
||||||
|
|
||||||
pub const std_options = base.std_options;
|
pub const std_options = base.std_options;
|
||||||
|
|||||||
Reference in New Issue
Block a user