@@ -12,11 +12,11 @@ open System.Threading
1212type CopyCommand =
1313 internal
1414 | BufferToBufferCmd of src : VkBuffer * dst : VkBuffer * info : VkBufferCopy
15- | BufferToImageCmd of src : VkBuffer * dst : VkImage * dstLayout : VkImageLayout * info : VkBufferImageCopy * size : int64
16- | ImageToBufferCmd of src : VkImage * srcLayout : VkImageLayout * dst : VkBuffer * info : VkBufferImageCopy * size : int64
17- | ImageToImageCmd of src : VkImage * srcLayout : VkImageLayout * dst : VkImage * dstLayout : VkImageLayout * info : VkImageCopy * size : int64
15+ | BufferToImageCmd of src : VkBuffer * dst : VkImage * dstLayout : VkImageLayout * info : VkBufferImageCopy * size : uint64
16+ | ImageToBufferCmd of src : VkImage * srcLayout : VkImageLayout * dst : VkBuffer * info : VkBufferImageCopy * size : uint64
17+ | ImageToImageCmd of src : VkImage * srcLayout : VkImageLayout * dst : VkImage * dstLayout : VkImageLayout * info : VkImageCopy * size : uint64
1818 | CallbackCmd of ( unit -> unit )
19- | ReleaseBufferCmd of buffer : VkBuffer * offset : int64 * size : int64 * dstQueueFamily : uint32
19+ | ReleaseBufferCmd of buffer : VkBuffer * offset : uint64 * size : uint64 * dstQueueFamily : uint32
2020 | ReleaseImageCmd of image : VkImage * range : VkImageSubresourceRange * srcLayout : VkImageLayout * dstLayout : VkImageLayout * dstQueueFamily : uint32
2121 | TransformLayoutCmd of image : VkImage * range : VkImageSubresourceRange * srcLayout : VkImageLayout * dstLayout : VkImageLayout
2222
@@ -26,19 +26,19 @@ type CopyCommand =
2626 static member SyncImage ( image : VkImage , range : VkImageSubresourceRange , layout : VkImageLayout ) =
2727 CopyCommand.TransformLayoutCmd( image, range, layout, layout)
2828
29- static member Copy ( src : VkBuffer , srcOffset : int64 , dst : VkBuffer , dstOffset : int64 , size : int64 ) =
29+ static member Copy ( src : VkBuffer , srcOffset : uint64 , dst : VkBuffer , dstOffset : uint64 , size : uint64 ) =
3030 CopyCommand.BufferToBufferCmd(
3131 src,
3232 dst,
33- VkBufferCopy( uint64 srcOffset, uint64 dstOffset, uint64 size)
33+ VkBufferCopy( srcOffset, dstOffset, size)
3434 )
3535
3636 static member Copy ( src : VkBuffer , dst : VkImage , dstLayout : VkImageLayout , format : VkFormat , info : VkBufferImageCopy ) =
3737 let sizeInBytes =
38- int64 info.imageExtent.width *
39- int64 info.imageExtent.height *
40- int64 info.imageExtent.depth *
41- int64 ( VkFormat.sizeInBytes format)
38+ uint64 info.imageExtent.width *
39+ uint64 info.imageExtent.height *
40+ uint64 info.imageExtent.depth *
41+ uint64 ( VkFormat.sizeInBytes format)
4242
4343 CopyCommand.BufferToImageCmd(
4444 src,
@@ -48,10 +48,10 @@ type CopyCommand =
4848
4949 static member Copy ( src : VkImage , srcLayout : VkImageLayout , dst : VkBuffer , format : VkFormat , info : VkBufferImageCopy ) =
5050 let sizeInBytes =
51- int64 info.imageExtent.width *
52- int64 info.imageExtent.height *
53- int64 info.imageExtent.depth *
54- int64 ( VkFormat.sizeInBytes format)
51+ uint64 info.imageExtent.width *
52+ uint64 info.imageExtent.height *
53+ uint64 info.imageExtent.depth *
54+ uint64 ( VkFormat.sizeInBytes format)
5555
5656 CopyCommand.ImageToBufferCmd(
5757 src, srcLayout,
@@ -62,18 +62,18 @@ type CopyCommand =
6262 static member Callback ( cb : unit -> unit ) =
6363 CopyCommand.CallbackCmd cb
6464
65- static member Release ( buffer : VkBuffer , offset : int64 , size : int64 , dstQueueFamily : int ) =
65+ static member Release ( buffer : VkBuffer , offset : uint64 , size : uint64 , dstQueueFamily : int ) =
6666 CopyCommand.ReleaseBufferCmd( buffer, offset, size, uint32 dstQueueFamily)
6767
6868 static member Release ( image : VkImage , range : VkImageSubresourceRange , srcLayout : VkImageLayout , dstLayout : VkImageLayout , dstQueueFamily : int ) =
6969 CopyCommand.ReleaseImageCmd( image, range, srcLayout, dstLayout, uint32 dstQueueFamily)
7070
7171 member x.SizeInBytes =
7272 match x with
73- | BufferToBufferCmd(_,_, i) -> int64 i.size
73+ | BufferToBufferCmd(_,_, i) -> i.size
7474 | BufferToImageCmd(_,_,_,_, s) -> s
7575 | ImageToBufferCmd(_,_,_,_, s) -> s
76- | _ -> 0 L
76+ | _ -> 0 UL
7777
7878and CopyEngine ( family : DeviceQueueFamily ) =
7979 let familyIndex = family.Index
@@ -83,7 +83,7 @@ and CopyEngine(family: DeviceQueueFamily) =
8383 // queue
8484 let lockObj = obj()
8585 let mutable pending = List< CopyCommand>()
86- let mutable totalSize = 0 L
86+ let mutable totalSize = 0 UL
8787 let mutable running = true
8888
8989
@@ -95,8 +95,8 @@ and CopyEngine(family: DeviceQueueFamily) =
9595 let mutable minBatchSize = Mem( 1 UL <<< 60 )
9696 let mutable maxBatchSize = Mem( 0 UL)
9797 let enqueueMon = obj()
98- let mutable vEnqueue = 0 L
99- let mutable vDone = - 1 L
98+ let mutable vEnqueue = 0 UL
99+ let mutable vDone = 0 UL
100100 let run ( _threadName : string ) ( queue : DeviceQueue ) () =
101101 let device = queue.DeviceInterface
102102 let fence = new Fence( device)
@@ -114,19 +114,19 @@ and CopyEngine(family: DeviceQueueFamily) =
114114 lock lockObj ( fun () ->
115115
116116 if not running then
117- empty, 0 L , 0 L
117+ empty, 0 UL , 0 UL
118118 else
119119 while pending.Count = 0 && running do Monitor.Wait lockObj |> ignore
120120 if not running then
121- empty, 0 L , 0 L
122- elif totalSize >= 0 L then
121+ empty, 0 UL , 0 UL
122+ elif totalSize >= 0 UL then
123123 let mine = pending
124124 let s = totalSize
125125 pending <- List()
126- totalSize <- 0 L
126+ totalSize <- 0 UL
127127 mine, vEnqueue, s
128128 else
129- empty, 0 L , 0 L
129+ empty, 0 UL , 0 UL
130130 )
131131
132132 if copies.Count > 0 then
@@ -234,7 +234,7 @@ and CopyEngine(family: DeviceQueueFamily) =
234234 fence.Wait()
235235 sw.Stop()
236236
237- if totalSize > 0 L then
237+ if totalSize > 0 UL then
238238 lock statLock ( fun () ->
239239 let totalSize = Mem totalSize
240240 maxBatchSize <- max maxBatchSize totalSize
@@ -304,23 +304,23 @@ and CopyEngine(family: DeviceQueueFamily) =
304304 lock lockObj ( fun () ->
305305 pending.AddRange commands
306306
307- let s = commands |> Seq.fold ( fun s c -> s + c.SizeInBytes) 0 L
307+ let s = commands |> Seq.fold ( fun s c -> s + c.SizeInBytes) 0 UL
308308 totalSize <- totalSize + s
309309
310310 Monitor.PulseAll lockObj
311311 s
312312 )
313313
314- if size > 0 L then () // trigger.Signal()
314+ if size > 0 UL then () // trigger.Signal()
315315
316316 /// Enqueues the commands and waits for them to be submitted.
317317 member x.EnqueueSafe ( commands : seq < CopyCommand >) =
318318 let enq , size =
319319 lock lockObj ( fun () ->
320- vEnqueue <- vEnqueue + 1 L
320+ vEnqueue <- vEnqueue + 1 UL
321321 pending.AddRange commands
322322
323- let s = commands |> Seq.fold ( fun s c -> s + c.SizeInBytes) 0 L
323+ let s = commands |> Seq.fold ( fun s c -> s + c.SizeInBytes) 0 UL
324324 totalSize <- totalSize + s
325325
326326 Monitor.PulseAll lockObj
@@ -332,7 +332,7 @@ and CopyEngine(family: DeviceQueueFamily) =
332332 while vDone < enq do
333333 Monitor.Wait enqueueMon |> ignore
334334 )
335- if size > 0 L then () // trigger.Signal()
335+ if size > 0 UL then () // trigger.Signal()
336336
337337 member x.Wait () =
338338 let l = obj()
0 commit comments