Skip to content

Commit c57ce07

Browse files
Bump numem to 1.4
1 parent d62c657 commit c57ce07

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

dub.sdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ subPackage "modules/nir"
1010
subPackage "tools/dlslc"
1111

1212
dependency ":nir" version="*"
13-
dependency "numem" version="~>1.3"
13+
dependency "numem" version="~>1.4"
1414
dependency "nulib" version="~>0.3"
1515

1616
targetName "niobium"

modules/vulkan/source/niobium/vk/heap/allocator.d

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ private:
297297
auto offset = pools[type].blocks[index.blockIdx].layout[index.spanIdx].offset;
298298

299299
// Find the next aligned subarea, allocate enough space for it.
300-
VkDeviceSize reqSizeAligned = size.alignTo(alignment);
301-
VkDeviceSize reqOffsetAligned = offset.alignTo(alignment);
300+
VkDeviceSize reqSizeAligned = nu_alignup(size, alignment);
301+
VkDeviceSize reqOffsetAligned = nu_alignup(offset, alignment);
302302
pools[type].blocks[index.blockIdx].layout[index.spanIdx].offset += reqSizeAligned;
303303
pools[type].blocks[index.blockIdx].layout[index.spanIdx].length -= reqSizeAligned;
304304

@@ -359,8 +359,8 @@ public:
359359

360360
// Page size must be a multiple of the bufferImageGranularity.
361361
auto granularity = deviceProperties.limits.bufferImageGranularity;
362-
this.pageSize = max(desc.pageSize, granularity).alignTo(granularity);
363-
this.blockMinSize = desc.size.alignTo(pageSize);
362+
this.pageSize = nu_alignup(max(desc.pageSize, granularity), granularity);
363+
this.blockMinSize = nu_alignup(desc.size, pageSize);
364364
this.mutex_ = nogc_new!Mutex();
365365
}
366366

@@ -461,7 +461,7 @@ public:
461461
scope(exit) mutex_.unlock();
462462

463463
auto pool = pools[obj.memory.type];
464-
VkDeviceSize reqSize = (size + (size % pageSize)).alignTo(obj.alignment);
464+
VkDeviceSize reqSize = nu_alignup((size + (size % pageSize)), obj.alignment);
465465

466466
Span span = Span(obj.offset, reqSize);
467467

source/niobium/heap.d

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,6 @@ struct NioHeapDescriptor {
4545
uint pageSize = 16_384;
4646
}
4747

48-
/**
49-
Aligns the given size to the given alignment.
50-
51-
Params:
52-
size = The size to align, in bytes.
53-
alignment = The byte alignment, in bytes.
54-
55-
Returns:
56-
The size aligned to the given alignment.
57-
*/
58-
pragma(inline, true)
59-
T alignTo(T)(T size, T alignment) @nogc if (__traits(isIntegral, T)) {
60-
return alignment > 0 ? size + (alignment - (size % alignment)) : size;
61-
}
62-
6348
/**
6449
A heap which can suballocate resources from itself.
6550
*/

0 commit comments

Comments
 (0)