diff --git a/kernel/ps4_map_mm.pas b/kernel/ps4_map_mm.pas index 78dc7da6..6f553f21 100644 --- a/kernel/ps4_map_mm.pas +++ b/kernel/ps4_map_mm.pas @@ -80,8 +80,8 @@ type isPooledMemory :0..1; isCommitted :0..1; end; - align:array[0..6] of Byte; name:array[0..SCE_KERNEL_VIRTUAL_RANGE_NAME_SIZE-1] of AnsiChar; + align:array[0..6] of Byte; end; function ps4_sceKernelGetDirectMemorySize:Int64; SysV_ABI_CDecl; diff --git a/vulkan/vDevice.pas b/vulkan/vDevice.pas index 0e7930c6..422fc0d6 100644 --- a/vulkan/vDevice.pas +++ b/vulkan/vDevice.pas @@ -225,6 +225,7 @@ function uniformBuffer8Bit:Boolean; function storageBuffer16Bit:Boolean; function uniformBuffer16Bit:Boolean; function storageInputOutput16:Boolean; +function sparseBinding:Boolean; var limits:record @@ -334,6 +335,11 @@ begin Result:=Boolean(VulkanApp.FSF16.storageInputOutput16); end; +function sparseBinding:Boolean; +begin + Result:=Boolean(VulkanApp.FDeviceFeature.sparseBinding); +end; + procedure FillDeviceProperties(physicalDevice:TVkPhysicalDevice); var prop:TVkPhysicalDeviceProperties2; diff --git a/vulkan/vHostBufferManager.pas b/vulkan/vHostBufferManager.pas index 025c3196..44580e42 100644 --- a/vulkan/vHostBufferManager.pas +++ b/vulkan/vHostBufferManager.pas @@ -10,6 +10,7 @@ uses sys_types, g23tree, Vulkan, + vDevice, vMemory, vBuffer, vCmdBuffer; @@ -123,6 +124,8 @@ var t:TvHostBuffer; host:TvPointer; + _size:qword; + label _exit; @@ -149,10 +152,11 @@ begin begin //Writeln('NewBuf:',HexStr(Addr)); host:=Default(TvPointer); - if not TryGetHostPointerByAddr(addr,host) then + if not TryGetHostPointerByAddr(addr,host,@_size) then begin Goto _exit; end; + Assert(_size>=Size,'Sparse buffers TODO:'+BooltoStr(vDevice.sparseBinding,True)); t:=_New(host,Size,usage); t.FAddr:=addr; FHostBufferSet.Insert(@t.FAddr); diff --git a/vulkan/vMemory.pas b/vulkan/vMemory.pas index 190a84a5..7fbeef58 100644 --- a/vulkan/vMemory.pas +++ b/vulkan/vMemory.pas @@ -84,7 +84,7 @@ function vkAllocHostPointer(device:TVkDevice;Size:TVkDeviceSize;mtindex:TVkUInt3 function vkAllocDedicatedImage(device:TVkDevice;Size:TVkDeviceSize;mtindex:TVkUInt32;FHandle:TVkImage):TVkDeviceMemory; function vkAllocDedicatedBuffer(device:TVkDevice;Size:TVkDeviceSize;mtindex:TVkUInt32;FHandle:TVkBuffer):TVkDeviceMemory; -Function TryGetHostPointerByAddr(addr:Pointer;var P:TvPointer):Boolean; +Function TryGetHostPointerByAddr(addr:Pointer;var P:TvPointer;SizeOut:PQWORD=nil):Boolean; implementation @@ -637,7 +637,7 @@ begin vkFreeMemory(Device.FHandle,h,nil); end; -Function TryGetHostPointerByAddr(addr:Pointer;var P:TvPointer):Boolean; +Function TryGetHostPointerByAddr(addr:Pointer;var P:TvPointer;SizeOut:PQWORD=nil):Boolean; var block:TGpuMemBlock; begin @@ -646,6 +646,12 @@ begin begin P.FHandle:=TVkDeviceMemory(block.Handle); P.FOffset:=addr-block.pAddr; + + if (SizeOut<>nil) then + begin + SizeOut^:=block.nSize-P.FOffset; + end; + Result:=True; end; end;