This commit is contained in:
Pavel 2022-05-31 15:31:50 +03:00
parent 4cc4225b53
commit ac8b3a5da8
5 changed files with 66 additions and 11 deletions

View File

@ -788,10 +788,10 @@ begin
NUMBER_UNORM:Result.FImageInfo.cformat:=VK_FORMAT_R8G8B8A8_UNORM;
NUMBER_SRGB :Result.FImageInfo.cformat:=VK_FORMAT_R8G8B8A8_SRGB;
else
Assert(false);
Assert(false,'TODO');
end;
else
Assert(false);
Assert(false,'TODO');
end;
//Result.TILE_MODE_INDEX:=RENDER_TARGET[i].ATTRIB.TILE_MODE_INDEX;
@ -809,7 +809,14 @@ begin
Result.FImageView.cformat :=Result.FImageInfo.cformat;
Result.FImageView.vtype :=ord(VK_IMAGE_VIEW_TYPE_2D);
Result.FImageView.dstSel.r:=ord(VK_COMPONENT_SWIZZLE_R);
Result.FImageView.dstSel.g:=ord(VK_COMPONENT_SWIZZLE_G);
Result.FImageView.dstSel.b:=ord(VK_COMPONENT_SWIZZLE_B);
Result.FImageView.dstSel.a:=ord(VK_COMPONENT_SWIZZLE_A);
//Result.FImageView.dstSel:TvDstSel; TODO
//Result.FImageView.base_level:Byte; //first mip level (0..15)
//Result.FImageView.last_level:Byte; //last mip level (0..15)
//Result.FImageView.base_array:Word; //first array index (0..16383)

View File

@ -1079,7 +1079,7 @@ begin
if (flipMode=SCE_VIDEO_OUT_FLIP_MODE_VSYNC) then
if (FlipRate<>0) then
begin
time:=(1000000 div (FlipRate+5)); //+5 selected empirically
time:=(1000000 div (FlipRate+1)); //+5 selected empirically
//time:=time-1300;
//time:=time-1300;

View File

@ -421,7 +421,7 @@ begin
r:=FQueue.QueueSubmit(1,@info,FFence);
if (r<>VK_SUCCESS) then
begin
Writeln('vkQueueSubmit');
Writeln('vkQueueSubmit:',r);
exit;
end;
end;

View File

@ -852,6 +852,7 @@ begin
end;
until true;
FreeMem(formats);
Writeln('VSurfaceFormat:',Fformat.format);
end;
end;
@ -1334,8 +1335,6 @@ begin
VulkanApp:=TVulkanApp.Create(true,true,true);
DebugReport:=TVDebugReport.Create;
MemManager:=TvMemManager.Create;
FillDeviceExtension(VulkanApp.FPhysicalDevice);
FillDeviceProperties(VulkanApp.FPhysicalDevice);
@ -1435,6 +1434,8 @@ begin
Device:=TvDevice.Create(DeviceQueues);
DeviceQueues.Free;
MemManager:=TvMemManager.Create;
XCHG(_lazy_wait,1);
//ImgProp:=Default(TVkFormatProperties);

View File

@ -152,12 +152,59 @@ begin
Result:=1;}
end;
Constructor TvMemManager.Create;
const
buf_ext:TVkExternalMemoryBufferCreateInfo=(
sType:VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO;
pNext:nil;
handleTypes:ord(VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT);
);
function GetHostMappedRequirements:TVkMemoryRequirements;
var
cinfo:TVkBufferCreateInfo;
r:TVkResult;
FHandle:TVkBuffer;
begin
Result:=Default(TVkMemoryRequirements);
cinfo:=Default(TVkBufferCreateInfo);
cinfo.sType :=VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
cinfo.size :=4*1024;
cinfo.usage :=ord(VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) or ord(VK_BUFFER_USAGE_TRANSFER_SRC_BIT);
cinfo.sharingMode:=VK_SHARING_MODE_EXCLUSIVE;
cinfo.pNext :=@buf_ext;
r:=vkCreateBuffer(Device.FHandle,@cinfo,nil,@FHandle);
if (r=VK_SUCCESS) then
begin
vkGetBufferMemoryRequirements(Device.FHandle,FHandle,@Result);
vkDestroyBuffer(Device.FHandle,FHandle,nil);
end;
end;
Constructor TvMemManager.Create;
var
mr:TVkMemoryRequirements;
i:Byte;
begin
mr:=GetHostMappedRequirements;
Writeln('[HostMappedRequirements]');
Writeln(' alignment=',mr.alignment);
Write(' memoryType=');
For i:=0 to 31 do
if ((1 shl i) and (mr.memoryTypeBits))<>0 then
begin
Write(i,',');
end;
Writeln;
FProperties:=Default(TVkPhysicalDeviceMemoryProperties);
vkGetPhysicalDeviceMemoryProperties(VulkanApp.FPhysicalDevice,@FProperties);
FHostVisibMt:=findMemoryType($FFFFFFFF,
FHostVisibMt:=findMemoryType(mr.memoryTypeBits,
ord(VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) or
ord(VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) or
ord(VK_MEMORY_PROPERTY_HOST_CACHED_BIT)
@ -165,7 +212,7 @@ begin
if (FHostVisibMt=DWORD(-1)) then
begin
FHostVisibMt:=findMemoryType($FFFFFFFF,
FHostVisibMt:=findMemoryType(mr.memoryTypeBits,
ord(VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) or
ord(VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)
);
@ -174,12 +221,12 @@ begin
if (FHostVisibMt=DWORD(-1)) then
begin
FHostVisibMt:=findMemoryType($FFFFFFFF,
FHostVisibMt:=findMemoryType(mr.memoryTypeBits,
ord(VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
);
end;
//FHostCacheMt:=findMemoryType($FFFFFFFF,
//FHostCacheMt:=findMemoryType(mr.memoryTypeBits,
// ord(VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) or
// ord(VK_MEMORY_PROPERTY_HOST_CACHED_BIT));