mirror of https://github.com/red-prig/fpPS4.git
This commit is contained in:
parent
8dd93f0106
commit
d12c37229e
|
@ -1622,6 +1622,22 @@ var
|
|||
|
||||
LastRenderCmd:TvRenderTargets;
|
||||
|
||||
function FindImageInFrameBuffer(f:TvFramebuffer;ri:TvImage2):Boolean;
|
||||
var
|
||||
i:ptruint;
|
||||
iv:TvImageView2;
|
||||
begin
|
||||
Result:=False;
|
||||
if (f=nil) or (ri=nil) then Exit;
|
||||
|
||||
if (f.FImagesCount<>0) then
|
||||
For i:=0 to f.FImagesCount-1 do
|
||||
begin
|
||||
iv:=TvImageView2(f.FImages[i]);
|
||||
if (iv.Parent=ri) then Exit(True);
|
||||
end;
|
||||
end;
|
||||
|
||||
function UpdateGpuRegsInfo:Boolean;
|
||||
var
|
||||
FAttrBuilder:TvAttrBuilder;
|
||||
|
@ -1847,7 +1863,7 @@ begin
|
|||
|
||||
ri.PushBarrier(GFXRing.CmdBuffer,
|
||||
GetColorAccessMask(RT_INFO.IMAGE_USAGE),
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
{VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}VK_IMAGE_LAYOUT_GENERAL,
|
||||
ord(VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT) or
|
||||
ord(VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT) );
|
||||
|
||||
|
@ -2031,6 +2047,12 @@ begin
|
|||
|
||||
//if not GFXRing.CmdBuffer.IsRenderPass then
|
||||
begin
|
||||
|
||||
//if FindImageInFrameBuffer(FRenderCmd.FFramebuffer,ri) then
|
||||
//begin
|
||||
// writeln('wtf');
|
||||
//end;
|
||||
|
||||
ri.PushBarrier(GFXRing.CmdBuffer,
|
||||
ord(VK_ACCESS_SHADER_READ_BIT),
|
||||
VK_IMAGE_LAYOUT_GENERAL,
|
||||
|
@ -2064,7 +2086,7 @@ begin
|
|||
begin
|
||||
if not GFXRing.CmdBuffer.BeginRenderPass(FRenderCmd) then
|
||||
begin
|
||||
Writeln('!BeginRenderPass');
|
||||
Writeln(StdErr,'!BeginRenderPass');
|
||||
Assert(false);
|
||||
end;
|
||||
end;
|
||||
|
|
11
fpPS4.lpr
11
fpPS4.lpr
|
@ -9,6 +9,7 @@ uses
|
|||
Classes,
|
||||
sysutils,
|
||||
stub_manager,
|
||||
sys_crt,
|
||||
sys_types,
|
||||
sys_pthread,
|
||||
ps4libdoc,
|
||||
|
@ -96,14 +97,14 @@ begin
|
|||
|
||||
if not FileExists(ps4_app.app_file) then
|
||||
begin
|
||||
Writeln('File not found:',ps4_app.app_file);
|
||||
Writeln(StdErr,'File not found:',ps4_app.app_file);
|
||||
Writeln;
|
||||
Goto promo;
|
||||
end;
|
||||
|
||||
if not DirectoryExists(ps4_app.app_path) then
|
||||
begin
|
||||
Writeln('Path not found:',ps4_app.app_path);
|
||||
Writeln(StdErr,'Path not found:',ps4_app.app_path);
|
||||
Writeln;
|
||||
Goto promo;
|
||||
end;
|
||||
|
@ -145,7 +146,7 @@ end;
|
|||
|
||||
procedure print_stub(nid:QWORD;lib:PLIBRARY); MS_ABI_Default;
|
||||
begin
|
||||
Writeln('nop nid:',lib^.strName,':',HexStr(nid,16),':',ps4libdoc.GetFunctName(nid));
|
||||
Writeln(StdErr,'nop nid:',lib^.strName,':',HexStr(nid,16),':',ps4libdoc.GetFunctName(nid));
|
||||
//DebugBreak;
|
||||
Sleep(INFINITE);
|
||||
//readln;
|
||||
|
@ -388,6 +389,7 @@ begin
|
|||
DefaultFileSystemCodePage:=CP_UTF8;
|
||||
DefaultRTLFileSystemCodePage:=CP_UTF8;
|
||||
UTF8CompareLocale:=CP_UTF8;
|
||||
sys_crt_init;
|
||||
|
||||
ps4_app.save_path:=IncludeTrailingPathDelimiter(GetCurrentDir)+'savedata';
|
||||
if not ParseCmd then Exit;
|
||||
|
@ -510,6 +512,9 @@ begin
|
|||
//ps4_app.app_path:='G:\Games\Shovel Knight\CUSA01867\';
|
||||
//ps4_app.app_file:='G:\Games\Shovel Knight\CUSA01867\eboot.bin';
|
||||
|
||||
//ps4_app.app_path:='C:\Users\User\Desktop\Games\Stardew_Valley\CUSA06829\';
|
||||
//ps4_app.app_file:='C:\Users\User\Desktop\Games\Stardew_Valley\CUSA06829\eboot.bin';
|
||||
|
||||
//elf:=Telf_file(LoadPs4ElfFromFile('libSceLibcInternal.sprx'));
|
||||
//elf.Prepare;
|
||||
//elf.SavePs4ElfToFile('libSceLibcInternal.prx');
|
||||
|
|
54
ps4_elf.pas
54
ps4_elf.pas
|
@ -385,14 +385,14 @@ Var
|
|||
Result:=False;
|
||||
if PDWORD(@elf_hdr^.e_ident)^<>ELFMAG then
|
||||
begin
|
||||
Writeln(name,' ELF identifier mismatch');
|
||||
Writeln(StdErr,name,' ELF identifier mismatch');
|
||||
Exit;
|
||||
end;
|
||||
if ((elf_hdr^.e_type <> ET_SCE_DYNEXEC) and
|
||||
(elf_hdr^.e_type <> ET_SCE_DYNAMIC)) or
|
||||
(elf_hdr^.e_machine <> EM_X86_64) then
|
||||
begin
|
||||
Writeln(name,'unspported TYPE/ARCH.');
|
||||
Writeln(StdErr,name,'unspported TYPE/ARCH.');
|
||||
Exit;
|
||||
end;
|
||||
Writeln('hdr.[EI_CLASS] :',elf_hdr^.e_ident[EI_CLASS]);
|
||||
|
@ -428,7 +428,7 @@ begin
|
|||
SELF_SIZE:=FileSeek(F,0,fsFromEnd);
|
||||
if (SELF_SIZE<=0) then
|
||||
begin
|
||||
Writeln('Error read file:',name);
|
||||
Writeln(StdErr,'Error read file:',name);
|
||||
FileClose(F);
|
||||
Exit;
|
||||
end;
|
||||
|
@ -439,14 +439,14 @@ begin
|
|||
|
||||
if (s<>SELF_SIZE) then
|
||||
begin
|
||||
Writeln('Error read file:',name);
|
||||
Writeln(StdErr,'Error read file:',name);
|
||||
FreeMem(SELF_MEM);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if not _test_elf(SELF_MEM) then
|
||||
begin
|
||||
Writeln('Error test file:',name);
|
||||
Writeln(StdErr,'Error test file:',name);
|
||||
FreeMem(SELF_MEM);
|
||||
Exit;
|
||||
end;
|
||||
|
@ -462,7 +462,7 @@ begin
|
|||
SELF_SIZE:=FileSeek(F,0,fsFromEnd);
|
||||
if (SELF_SIZE<=0) then
|
||||
begin
|
||||
Writeln('Error read file:',name);
|
||||
Writeln(StdErr,'Error read file:',name);
|
||||
FileClose(F);
|
||||
Exit;
|
||||
end;
|
||||
|
@ -473,7 +473,7 @@ begin
|
|||
|
||||
if (s<>SELF_SIZE) then
|
||||
begin
|
||||
Writeln('Error read file:',name);
|
||||
Writeln(StdErr,'Error read file:',name);
|
||||
FreeMem(SELF_MEM);
|
||||
Exit;
|
||||
end;
|
||||
|
@ -490,13 +490,13 @@ begin
|
|||
begin
|
||||
if (Segments[i].flags and (SF_ENCR or SF_DFLG))<>0 then
|
||||
begin
|
||||
Writeln('[',i,']');
|
||||
Writeln(' Seg.flags =',test_SF_flags(Segments[i].flags));
|
||||
Writeln(' Seg.id =',Segments[i].flags shr 20);
|
||||
Writeln(' Seg.offset=',HexStr(Segments[i].offset,16));
|
||||
Writeln(' Seg.c_size=',HexStr(Segments[i].encrypted_compressed_size,16));
|
||||
Writeln(' Seg.d_size=',HexStr(Segments[i].decrypted_decompressed_size,16));
|
||||
Writeln('encrypted or deflated SELF not support!');
|
||||
Writeln(StdErr,'[',i,']');
|
||||
Writeln(StdErr,' Seg.flags =',test_SF_flags(Segments[i].flags));
|
||||
Writeln(StdErr,' Seg.id =',Segments[i].flags shr 20);
|
||||
Writeln(StdErr,' Seg.offset=',HexStr(Segments[i].offset,16));
|
||||
Writeln(StdErr,' Seg.c_size=',HexStr(Segments[i].encrypted_compressed_size,16));
|
||||
Writeln(StdErr,' Seg.d_size=',HexStr(Segments[i].decrypted_decompressed_size,16));
|
||||
Writeln(StdErr,'encrypted or deflated SELF not support!');
|
||||
FreeMem(SELF_MEM);
|
||||
Exit;
|
||||
end;
|
||||
|
@ -505,7 +505,7 @@ begin
|
|||
|
||||
if not _test_elf(elf_hdr) then
|
||||
begin
|
||||
Writeln('Error test file:',name);
|
||||
Writeln(StdErr,'Error test file:',name);
|
||||
FreeMem(SELF_MEM);
|
||||
Exit;
|
||||
end;
|
||||
|
@ -525,7 +525,7 @@ begin
|
|||
end;
|
||||
if (LowSeg=High(Int64)) then
|
||||
begin
|
||||
Writeln('Error LowSeg');
|
||||
Writeln(StdErr,'Error LowSeg');
|
||||
FreeMem(SELF_MEM);
|
||||
elf.Free;
|
||||
Exit;
|
||||
|
@ -548,7 +548,7 @@ begin
|
|||
else
|
||||
begin
|
||||
FileClose(F);
|
||||
Writeln(name,' is unknow file type!');
|
||||
Writeln(StdErr,name,' is unknow file type!');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -1573,23 +1573,23 @@ Procedure OnLoadRelaExport(elf:Telf_file;Info:PRelaInfo;data:Pointer);
|
|||
|
||||
if (IInfo._md=nil) then
|
||||
begin
|
||||
Writeln('Unknow module from ',Info^.pName);
|
||||
Writeln(StdErr,'Unknow module from ',Info^.pName);
|
||||
end;
|
||||
|
||||
if (IInfo._md^.Import<>Import) then
|
||||
begin
|
||||
Writeln('Wrong module ref:',IInfo._md^.strName,':',IInfo._md^.Import,'<>',Import);
|
||||
Writeln(StdErr,'Wrong module ref:',IInfo._md^.strName,':',IInfo._md^.Import,'<>',Import);
|
||||
end;
|
||||
|
||||
if (IInfo.lib=nil) then
|
||||
begin
|
||||
Writeln('Unknow library from ',Info^.pName);
|
||||
Writeln(StdErr,'Unknow library from ',Info^.pName);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if (IInfo.lib^.Import<>Import) then
|
||||
begin
|
||||
Writeln('Wrong library ref:',IInfo.lib^.strName,':',IInfo.lib^.Import,'<>',Import);
|
||||
Writeln(StdErr,'Wrong library ref:',IInfo.lib^.strName,':',IInfo.lib^.Import,'<>',Import);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
@ -1646,12 +1646,12 @@ begin
|
|||
_do_load(elf.mMap.pAddr+Info^.value);
|
||||
end;
|
||||
else
|
||||
Writeln('invalid sym bingding ',Info^.sBind);
|
||||
Writeln(StdErr,'invalid sym bingding ',Info^.sBind);
|
||||
end;
|
||||
end;
|
||||
|
||||
else
|
||||
Writeln('rela type not handled ', HexStr(Info^.rType,8));
|
||||
Writeln(StdErr,'rela type not handled ', HexStr(Info^.rType,8));
|
||||
|
||||
end;
|
||||
|
||||
|
@ -1708,23 +1708,23 @@ Procedure OnLoadRelaImport(elf:Telf_file;Info:PRelaInfo;data:Pointer);
|
|||
|
||||
if (IInfo._md=nil) then
|
||||
begin
|
||||
Writeln('Unknow module from ',Info^.pName);
|
||||
Writeln(StdErr,'Unknow module from ',Info^.pName);
|
||||
end;
|
||||
|
||||
if (IInfo._md^.Import<>Import) then
|
||||
begin
|
||||
Writeln('Wrong module ref:',IInfo._md^.strName,':',IInfo._md^.Import,'<>',Import);
|
||||
Writeln(StdErr,'Wrong module ref:',IInfo._md^.strName,':',IInfo._md^.Import,'<>',Import);
|
||||
end;
|
||||
|
||||
if (IInfo.lib=nil) then
|
||||
begin
|
||||
Writeln('Unknow library from ',Info^.pName);
|
||||
Writeln(StdErr,'Unknow library from ',Info^.pName);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if (IInfo.lib^.Import<>Import) then
|
||||
begin
|
||||
Writeln('Wrong library ref:',IInfo.lib^.strName,':',IInfo.lib^.Import,'<>',Import);
|
||||
Writeln(StdErr,'Wrong library ref:',IInfo.lib^.strName,':',IInfo.lib^.Import,'<>',Import);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ Const
|
|||
|
||||
procedure ps4_stack_chk_fail; SysV_ABI_CDecl;
|
||||
begin
|
||||
Writeln('Stack overflow detected! Aborting program.');
|
||||
Writeln(StdErr,'Stack overflow detected! Aborting program.');
|
||||
DebugBreak;
|
||||
end;
|
||||
|
||||
|
@ -67,8 +67,8 @@ var
|
|||
t:pthread;
|
||||
begin
|
||||
t:=_get_curthread;
|
||||
if (t<>nil) then
|
||||
Writeln('RaiseThread=',t^.name);
|
||||
//if (t<>nil) then
|
||||
// Writeln('RaiseThread=',t^.name);
|
||||
Writeln(StdErr,'RaiseException:',HexStr(dwStopReason,8),':',HexStr(dwStopId,8),':',GetStopReasonInfo(dwStopReason));
|
||||
DebugBreak;
|
||||
end;
|
||||
|
@ -78,8 +78,8 @@ var
|
|||
t:pthread;
|
||||
begin
|
||||
t:=_get_curthread;
|
||||
if (t<>nil) then
|
||||
Writeln('RaiseThread=',t^.name);
|
||||
//if (t<>nil) then
|
||||
// Writeln('RaiseThread=',t^.name);
|
||||
Writeln(StdErr,'RaiseException:',HexStr(dwStopReason,8),':',HexStr(dwStopId,8),':',GetStopReasonInfo(dwStopReason));
|
||||
DebugBreak;
|
||||
end;
|
||||
|
@ -1029,6 +1029,7 @@ begin
|
|||
lib^.set_proc($21620105D4C78ADE,@ps4_sceKernelMapFlexibleMemory);
|
||||
lib^.set_proc($71091EF54B8140E9,@ps4_sceKernelMunmap);
|
||||
lib^.set_proc($58571F2F697389DA,@ps4_sceKernelQueryMemoryProtection);
|
||||
lib^.set_proc($BD23009B77316136,@ps4_sceKernelMprotect);
|
||||
|
||||
//mmap
|
||||
|
||||
|
|
|
@ -102,12 +102,13 @@ function ps4_sceKernelMapNamedFlexibleMemory(
|
|||
|
||||
function ps4_sceKernelMapFlexibleMemory(
|
||||
virtualAddrDest:PPointer;
|
||||
length:Int64;
|
||||
length:QWORD;
|
||||
protections:Integer;
|
||||
flags:Integer):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_sceKernelMunmap(addr:Pointer;len:size_t):Integer; SysV_ABI_CDecl;
|
||||
function ps4_sceKernelQueryMemoryProtection(addr:Pointer;pStart,pEnd:PPointer;pProt:PInteger):Integer; SysV_ABI_CDecl;
|
||||
function ps4_sceKernelMprotect(addr:Pointer;len:QWORD;prot:Integer):Integer; SysV_ABI_CDecl;
|
||||
function ps4_mmap(addr:Pointer;len:size_t;prot,flags:Integer;fd:Integer;offset:size_t):Pointer; SysV_ABI_CDecl;
|
||||
function ps4_munmap(addr:Pointer;len:size_t):Integer; SysV_ABI_CDecl;
|
||||
function ps4_msync(addr:Pointer;len:size_t;flags:Integer):Integer; SysV_ABI_CDecl;
|
||||
|
@ -494,6 +495,7 @@ type
|
|||
function unmap(addr:Pointer;len:size_t):Boolean;
|
||||
|
||||
function QueryProt(addr:Pointer;pStart,pEnd:PPointer;pProt:PInteger):Boolean;
|
||||
function ChangeProt(addr:Pointer;len:QWORD;prot:Integer):Boolean;
|
||||
end;
|
||||
|
||||
Procedure TPageMM.Init;
|
||||
|
@ -1134,6 +1136,70 @@ begin
|
|||
rwlock_unlock(FLock);
|
||||
end;
|
||||
|
||||
function __mprotect(addr:Pointer;len:size_t;prot:Integer):Integer;
|
||||
Var
|
||||
newprotect,oldprotect:DWORD;
|
||||
begin
|
||||
newprotect:=__map_mmap_prot_page(prot);
|
||||
oldprotect:=0;
|
||||
|
||||
if not VirtualProtect(addr,len,newprotect,oldprotect) then
|
||||
begin
|
||||
Exit(-1);
|
||||
end;
|
||||
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function TPageMM.ChangeProt(addr:Pointer;len:QWORD;prot:Integer):Boolean;
|
||||
var
|
||||
_pblock:PBlock;
|
||||
begin
|
||||
Result:=False;
|
||||
rwlock_rdlock(FLock);
|
||||
|
||||
repeat
|
||||
|
||||
if _TryGetMapBlockByAddr(addr,_pblock) then
|
||||
begin
|
||||
|
||||
if (_pblock^.nSize>len) then
|
||||
begin
|
||||
Result:=(__mprotect(addr,len,prot)=0);
|
||||
Break;
|
||||
end else
|
||||
begin
|
||||
Result:=(__mprotect(addr,_pblock^.nSize,prot)=0);
|
||||
end;
|
||||
|
||||
if (len>=_pblock^.nSize) then
|
||||
begin
|
||||
len:=len-_pblock^.nSize;
|
||||
addr:=addr+_pblock^.nSize;
|
||||
end else
|
||||
begin
|
||||
Break;
|
||||
end;
|
||||
|
||||
end else
|
||||
begin
|
||||
|
||||
if (len>=PHYSICAL_PAGE_SIZE) then
|
||||
begin
|
||||
len:=len-PHYSICAL_PAGE_SIZE;
|
||||
addr:=addr+PHYSICAL_PAGE_SIZE;
|
||||
end else
|
||||
begin
|
||||
Break;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
until (len=0);
|
||||
|
||||
rwlock_unlock(FLock);
|
||||
end;
|
||||
|
||||
///////
|
||||
|
||||
Var
|
||||
|
@ -1213,12 +1279,12 @@ begin
|
|||
|
||||
if (searchEnd>SCE_KERNEL_MAIN_DMEM_SIZE) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
|
||||
if (alignment=0) then alignment:=LOGICAL_PAGE_SIZE;
|
||||
|
||||
if not IsAlign(length ,LOGICAL_PAGE_SIZE) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
if not IsAlign(alignment,LOGICAL_PAGE_SIZE) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
if not IsPowerOfTwo(alignment) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
|
||||
if (alignment=0) then alignment:=LOGICAL_PAGE_SIZE;
|
||||
|
||||
Adr.pAddr:=AlignUp(Pointer(searchStart),alignment);
|
||||
Adr.nSize:=length;
|
||||
Adr.bType:=memoryType;
|
||||
|
@ -1314,13 +1380,13 @@ begin
|
|||
|
||||
if (searchEnd>SCE_KERNEL_MAIN_DMEM_SIZE) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
|
||||
if (alignment=0) then alignment:=LOGICAL_PAGE_SIZE;
|
||||
|
||||
if not IsAlign(searchStart,LOGICAL_PAGE_SIZE) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
if not IsAlign(searchEnd ,LOGICAL_PAGE_SIZE) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
if not IsAlign(alignment ,LOGICAL_PAGE_SIZE) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
if not IsPowerOfTwo(alignment) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
|
||||
if (alignment=0) then alignment:=LOGICAL_PAGE_SIZE;
|
||||
|
||||
physAddrOut^:=0;
|
||||
sizeOut^ :=0;
|
||||
|
||||
|
@ -1455,6 +1521,8 @@ begin
|
|||
'physicalAddr:',HexStr(physicalAddr,16),' ',
|
||||
'alignment:',HexStr(alignment,16));
|
||||
|
||||
if (alignment=0) then alignment:=LOGICAL_PAGE_SIZE;
|
||||
|
||||
if not IsAlign(virtualAddrDest^,LOGICAL_PAGE_SIZE) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
if not IsAlign(length ,LOGICAL_PAGE_SIZE) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
if not IsAlign(alignment,LOGICAL_PAGE_SIZE) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
|
@ -1547,7 +1615,7 @@ end;
|
|||
|
||||
function ps4_sceKernelMapFlexibleMemory(
|
||||
virtualAddrDest:PPointer;
|
||||
length:Int64;
|
||||
length:QWORD;
|
||||
protections:Integer;
|
||||
flags:Integer):Integer; SysV_ABI_CDecl;
|
||||
var
|
||||
|
@ -1632,6 +1700,16 @@ begin
|
|||
_sig_unlock;
|
||||
end;
|
||||
|
||||
function ps4_sceKernelMprotect(addr:Pointer;len:QWORD;prot:Integer):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=SCE_KERNEL_ERROR_EINVAL;
|
||||
|
||||
_sig_lock;
|
||||
if PageMM.ChangeProt(addr,len,prot) then Result:=0;
|
||||
_sig_unlock;
|
||||
|
||||
end;
|
||||
|
||||
function ps4_mmap(addr:Pointer;len:size_t;prot,flags:Integer;fd:Integer;offset:size_t):Pointer; SysV_ABI_CDecl;
|
||||
Var
|
||||
map:Pointer;
|
||||
|
@ -1729,24 +1807,10 @@ begin
|
|||
end;
|
||||
|
||||
function ps4_mprotect(addr:Pointer;len:size_t;prot:Integer):Integer; SysV_ABI_CDecl;
|
||||
Var
|
||||
newprotect,oldprotect:DWORD;
|
||||
begin
|
||||
|
||||
newprotect:=__map_mmap_prot_page(prot);
|
||||
oldprotect:=0;
|
||||
|
||||
_sig_lock;
|
||||
if not VirtualProtect(addr,len,newprotect,oldprotect) then
|
||||
begin
|
||||
_sig_unlock;
|
||||
Writeln('GetLastError:',GetLastError);
|
||||
Exit;
|
||||
end;
|
||||
Result:=__mprotect(addr,len,prot);
|
||||
_sig_unlock;
|
||||
|
||||
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
|
|
@ -7,6 +7,7 @@ interface
|
|||
uses
|
||||
LFQueue,
|
||||
windows,
|
||||
sys_crt,
|
||||
sys_pthread,
|
||||
sys_signal;
|
||||
|
||||
|
@ -329,6 +330,7 @@ begin
|
|||
ps4_app.InitThread(1);
|
||||
ps4_app.InitCode;
|
||||
Telf_file(ps4_app.prog).mapCodeEntry;
|
||||
writeln('--[END]--');
|
||||
end;
|
||||
|
||||
const
|
||||
|
@ -354,6 +356,8 @@ type
|
|||
begin
|
||||
Result:=0;
|
||||
|
||||
sys_crt_init;
|
||||
|
||||
StackLength:=data^.Attr.stacksize_attr;
|
||||
StackBottom:=Sptr-StackLength;
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ type
|
|||
end;
|
||||
|
||||
|
||||
function ps4_sem_init(sem:PSceKernelSema;value:Integer):Integer; SysV_ABI_CDecl;
|
||||
function ps4_sem_init(sem:PSceKernelSema;pshared,value:Integer):Integer; SysV_ABI_CDecl;
|
||||
function ps4_sem_destroy(sem:PSceKernelSema):Integer; SysV_ABI_CDecl;
|
||||
function ps4_sem_getvalue(sem:PSceKernelSema;sval:PInteger):Integer; SysV_ABI_CDecl;
|
||||
function ps4_sem_post(sem:PSceKernelSema):Integer; SysV_ABI_CDecl;
|
||||
|
@ -566,7 +566,7 @@ end;
|
|||
|
||||
//
|
||||
|
||||
function ps4_sem_init(sem:PSceKernelSema;value:Integer):Integer; SysV_ABI_CDecl;
|
||||
function ps4_sem_init(sem:PSceKernelSema;pshared,value:Integer):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=_set_errno(_sem_init(sem,value));
|
||||
end;
|
||||
|
|
|
@ -311,7 +311,7 @@ begin
|
|||
|
||||
if (err<>0) then
|
||||
begin
|
||||
Writeln('Pa_GetErrorText:',PaErrorCode(err),':',Pa_GetErrorText(err));
|
||||
Writeln(StdErr,'Pa_GetErrorText:',PaErrorCode(err),':',Pa_GetErrorText(err));
|
||||
//Exit(SCE_AUDIO_OUT_ERROR_NOT_INIT);
|
||||
pstream:=nil;
|
||||
end;
|
||||
|
@ -663,7 +663,7 @@ begin
|
|||
0:;
|
||||
Integer(paOutputUnderflowed):;
|
||||
else
|
||||
Writeln('Pa_GetErrorText:',PaErrorCode(err),':',Pa_GetErrorText(err));
|
||||
Writeln(StdErr,'Pa_GetErrorText:',PaErrorCode(err),':',Pa_GetErrorText(err));
|
||||
end;
|
||||
|
||||
//Writeln('sceAudioOutOutput:',handle,':',HexStr(ptr));
|
||||
|
|
154
ps4_program.pas
154
ps4_program.pas
|
@ -429,6 +429,70 @@ function _parse_filename(filename:PChar):RawByteString;
|
|||
var
|
||||
Path:RawByteString;
|
||||
pp,fp:PChar;
|
||||
|
||||
function _cast(var str:RawByteString):Byte;
|
||||
begin
|
||||
Result:=0;
|
||||
Case (fp-pp) of
|
||||
0:pp:=fp+1; //next
|
||||
4:Case PDWORD(pp)^ of
|
||||
$30707061: //app0
|
||||
begin
|
||||
if (fp^<>#0) then Inc(fp);
|
||||
str:=PathConcat(ps4_app.app_path,fp);
|
||||
Result:=1;
|
||||
end;
|
||||
else
|
||||
Result:=2;
|
||||
end;
|
||||
9:Case PQWORD(pp)^ of
|
||||
$6174616465766173: //savedata
|
||||
begin
|
||||
Case (pp+8)^ of
|
||||
'0'..'9':
|
||||
begin
|
||||
if (fp^<>#0) then Inc(fp);
|
||||
str:=MountConcat(ord((pp+8)^)-ord('0'),fp);;
|
||||
Result:=1;
|
||||
end;
|
||||
else
|
||||
Result:=2;
|
||||
end;
|
||||
end;
|
||||
else
|
||||
Result:=2;
|
||||
end;
|
||||
10:Case PQWORD(pp)^ of
|
||||
$6174616465766173: //savedata
|
||||
begin
|
||||
Case PWORD(pp+8)^ of
|
||||
$3031, //10
|
||||
$3131, //11
|
||||
$3231, //12
|
||||
$3331, //13
|
||||
$3431, //14
|
||||
$3531: //15
|
||||
begin
|
||||
if (fp^<>#0) then Inc(fp);
|
||||
str:=MountConcat(ord((pp+9)^)-ord('0')+10,fp);
|
||||
//Result:=PathConcat(GetCurrentDir,fp);
|
||||
Result:=1;
|
||||
end;
|
||||
else
|
||||
Result:=2;
|
||||
end;
|
||||
end;
|
||||
else
|
||||
Result:=2;
|
||||
end;
|
||||
else
|
||||
begin
|
||||
//Writeln((fp-pp),'*',fp,'*',pp);
|
||||
Result:=2;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
Result:='';
|
||||
//Writeln(filename);
|
||||
|
@ -440,71 +504,25 @@ begin
|
|||
While (fp^<>#0) do
|
||||
begin
|
||||
Case fp^ of
|
||||
'/':Case (fp-pp) of
|
||||
0:pp:=fp+1; //next
|
||||
4:Case PDWORD(pp)^ of
|
||||
$30707061: //app0
|
||||
begin
|
||||
Inc(fp);
|
||||
Result:=PathConcat(ps4_app.app_path,fp);
|
||||
Exit;
|
||||
end;
|
||||
else
|
||||
Break;
|
||||
end;
|
||||
9:Case PQWORD(pp)^ of
|
||||
$6174616465766173: //savedata
|
||||
begin
|
||||
Case (pp+8)^ of
|
||||
'0'..'9':
|
||||
begin
|
||||
Inc(fp);
|
||||
Result:=MountConcat(ord((pp+8)^)-ord('0'),fp);
|
||||
//Result:=PathConcat(GetCurrentDir,fp);
|
||||
Exit;
|
||||
end;
|
||||
else
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
else
|
||||
Break;
|
||||
end;
|
||||
10:Case PQWORD(pp)^ of
|
||||
$6174616465766173: //savedata
|
||||
begin
|
||||
Case PWORD(pp+8)^ of
|
||||
$3031, //10
|
||||
$3131, //11
|
||||
$3231, //12
|
||||
$3331, //13
|
||||
$3431, //14
|
||||
$3531: //15
|
||||
begin
|
||||
Inc(fp);
|
||||
Result:=MountConcat(ord((pp+9)^)-ord('0')+10,fp);
|
||||
//Result:=PathConcat(GetCurrentDir,fp);
|
||||
Exit;
|
||||
end;
|
||||
else
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
else
|
||||
Break;
|
||||
end;
|
||||
else
|
||||
begin
|
||||
//Writeln((fp-pp),'*',fp,'*',pp);
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
'/':
|
||||
begin
|
||||
Case _cast(Result) of
|
||||
1:Exit; //mapped
|
||||
2:Exit(''); //not mapped
|
||||
else;
|
||||
//next char
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Inc(fp);
|
||||
end;
|
||||
fp:=PChar(Path);
|
||||
if (fp^='/') then Inc(fp);
|
||||
Result:=PathConcat(GetCurrentDir,fp);
|
||||
|
||||
Case _cast(Result) of
|
||||
1:Exit; //mapped
|
||||
else;
|
||||
Exit(''); //not mapped
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
//--
|
||||
|
@ -973,7 +991,7 @@ begin
|
|||
nid:=ps4_nid_hash(node.pFileName);
|
||||
PP:=HAMT_insert64(@files.hamt,nid,Pointer(node));
|
||||
Assert(PP<>nil);
|
||||
if (PP^<>Pointer(node)) then Writeln('Warn, ',node.pFileName,' file is registred');
|
||||
if (PP^<>Pointer(node)) then Writeln(StdErr,'Warn, ',node.pFileName,' file is registred');
|
||||
|
||||
files.Unlock;
|
||||
end;
|
||||
|
@ -1028,7 +1046,7 @@ begin
|
|||
nid:=ps4_nid_hash(strName);
|
||||
PP:=HAMT_insert64(@mods.hamt,nid,Pointer(node));
|
||||
Assert(PP<>nil);
|
||||
if (PP^<>Pointer(node)) then Writeln('Warn, ',strName,' module is registred');
|
||||
if (PP^<>Pointer(node)) then Writeln(StdErr,'Warn, ',strName,' module is registred');
|
||||
end;
|
||||
|
||||
Procedure Tps4_program.SetLib(lib:PLIBRARY);
|
||||
|
@ -1042,7 +1060,7 @@ begin
|
|||
nid:=ps4_nid_hash(lib^.strName);
|
||||
PP:=HAMT_insert64(@libs.hamt,nid,Pointer(lib));
|
||||
Assert(PP<>nil);
|
||||
if (PP^<>Pointer(lib)) then Writeln('Warn, ',lib^.strName,' lib is registred');
|
||||
if (PP^<>Pointer(lib)) then Writeln(StdErr,'Warn, ',lib^.strName,' lib is registred');
|
||||
end;
|
||||
|
||||
function Tps4_program.GetLib(const strName:RawByteString):PLIBRARY;
|
||||
|
@ -1129,7 +1147,7 @@ begin
|
|||
pre_load.LockWr;
|
||||
if not pre_load._set_proc(nid,Pointer(cb)) then
|
||||
begin
|
||||
Writeln('Warn, ',strName,' is registred')
|
||||
Writeln(StdErr,'Warn, ',strName,' is registred')
|
||||
end;
|
||||
pre_load.Unlock;
|
||||
end;
|
||||
|
@ -1143,7 +1161,7 @@ begin
|
|||
fin_load.LockWr;
|
||||
if not fin_load._set_proc(nid,Pointer(cb)) then
|
||||
begin
|
||||
Writeln('Warn, ',strName,' is registred')
|
||||
Writeln(StdErr,'Warn, ',strName,' is registred')
|
||||
end;
|
||||
fin_load.Unlock;
|
||||
end;
|
||||
|
@ -1299,7 +1317,7 @@ begin
|
|||
node:=Loader(S);
|
||||
if (node=nil) then
|
||||
begin
|
||||
Writeln('Warn, file ',S,' not loaded!');
|
||||
Writeln(StdErr,'Warn, file ',S,' not loaded!');
|
||||
end else
|
||||
begin
|
||||
PopupFile(node);
|
||||
|
|
|
@ -424,7 +424,7 @@ begin
|
|||
else;
|
||||
end;
|
||||
|
||||
Writeln(HexStr(PDWORD(rec.ExceptionAddress)[0],8)); //C1780FF2
|
||||
Writeln(StdErr,HexStr(PDWORD(rec.ExceptionAddress)[0],8)); //C1780FF2
|
||||
Exit(EXCEPTION_EXECUTE_HANDLER); //Unknow
|
||||
end;
|
||||
else
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
unit sys_crt;
|
||||
|
||||
{$mode ObjFPC}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
windows,
|
||||
spinlock;
|
||||
|
||||
Procedure sys_crt_init;
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
StdOutLock:Pointer=nil;
|
||||
|
||||
function GetConsoleTextAttribute(hConsoleOutput:HANDLE;var wAttributes:WORD):WINBOOL;
|
||||
var
|
||||
info:CONSOLE_SCREEN_BUFFER_INFO;
|
||||
begin
|
||||
Result:=GetConsoleScreenBufferInfo(hConsoleOutput,@info);
|
||||
if Result then
|
||||
begin
|
||||
wAttributes:=info.wAttributes
|
||||
end;
|
||||
end;
|
||||
|
||||
Procedure CrtOutWrite(var t:TextRec);
|
||||
var
|
||||
n:DWORD;
|
||||
Begin
|
||||
if (t.BufPos=0) then exit;
|
||||
n:=0;
|
||||
|
||||
spin_lock(StdOutLock);
|
||||
|
||||
WriteConsole(t.Handle,t.Bufptr,t.BufPos,@n,nil);
|
||||
|
||||
if (n<>t.BufPos) then InOutRes:=101;
|
||||
t.BufPos:=0;
|
||||
|
||||
spin_unlock(StdOutLock);
|
||||
end;
|
||||
|
||||
Procedure CrtErrWrite(var t:TextRec);
|
||||
const
|
||||
new=FOREGROUND_RED;
|
||||
var
|
||||
n:DWORD;
|
||||
old:WORD;
|
||||
Begin
|
||||
if (t.BufPos=0) then exit;
|
||||
n:=0;
|
||||
|
||||
spin_lock(StdOutLock);
|
||||
|
||||
old:=7;
|
||||
GetConsoleTextAttribute(t.Handle,old);
|
||||
SetConsoleTextAttribute(t.Handle,new);
|
||||
|
||||
WriteConsole(t.Handle,t.Bufptr,t.BufPos,@n,nil);
|
||||
|
||||
SetConsoleTextAttribute(t.Handle,old);
|
||||
|
||||
if (n<>t.BufPos) then InOutRes:=101;
|
||||
t.BufPos:=0;
|
||||
|
||||
spin_unlock(StdOutLock);
|
||||
end;
|
||||
|
||||
Procedure CrtClose(Var F:TextRec);
|
||||
Begin
|
||||
F.Mode:=fmClosed;
|
||||
end;
|
||||
|
||||
Procedure CrtOpenOut(Var F:TextRec);
|
||||
Begin
|
||||
TextRec(F).Handle:=GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
TextRec(F).InOutFunc:=@CrtOutWrite;
|
||||
TextRec(F).FlushFunc:=@CrtOutWrite;
|
||||
TextRec(F).CloseFunc:=@CrtClose;
|
||||
end;
|
||||
|
||||
Procedure CrtOpenErr(Var F:TextRec);
|
||||
Begin
|
||||
TextRec(F).Handle:=GetStdHandle(STD_ERROR_HANDLE);
|
||||
TextRec(F).InOutFunc:=@CrtErrWrite;
|
||||
TextRec(F).FlushFunc:=@CrtErrWrite;
|
||||
TextRec(F).CloseFunc:=@CrtClose;
|
||||
end;
|
||||
|
||||
procedure AssignCrt(var F:Text;cb:codepointer);
|
||||
begin
|
||||
Assign(F,'');
|
||||
TextRec(F).OpenFunc:=cb;
|
||||
end;
|
||||
|
||||
Procedure sys_crt_init;
|
||||
begin
|
||||
AssignCrt(Output,@CrtOpenOut);
|
||||
Rewrite(Output);
|
||||
|
||||
AssignCrt(StdOut,@CrtOpenOut);
|
||||
Rewrite(StdOut);
|
||||
|
||||
AssignCrt(ErrOutput,@CrtOpenErr);
|
||||
Rewrite(ErrOutput);
|
||||
|
||||
AssignCrt(StdErr,@CrtOpenErr);
|
||||
Rewrite(StdErr);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
@ -166,6 +166,8 @@ function SysBeginThread(sa:Pointer;
|
|||
implementation
|
||||
|
||||
uses
|
||||
atomic,
|
||||
spinlock,
|
||||
Windows;
|
||||
|
||||
function _get_curthread:pthread; inline;
|
||||
|
@ -174,34 +176,23 @@ begin
|
|||
end;
|
||||
|
||||
var
|
||||
TLSKey:PDword; external name '_FPC_TlsKey';
|
||||
_lazy_init:Integer=0;
|
||||
_lazy_wait:Integer=0;
|
||||
|
||||
procedure SysAllocateThreadVars; external name '_FPC_SysAllocateThreadVars';
|
||||
|
||||
function SysRelocateThreadVar(offset : dword) : pointer;
|
||||
var
|
||||
dataindex : pointer;
|
||||
errorsave : dword;
|
||||
function _thread_null(parameter:pointer):ptrint;
|
||||
begin
|
||||
errorsave:=GetLastError;
|
||||
dataindex:=TlsGetValue(tlskey^);
|
||||
if (dataindex=nil) then
|
||||
begin
|
||||
SysAllocateThreadVars;
|
||||
dataindex:=TlsGetValue(tlskey^);
|
||||
InitThread($1000000);
|
||||
end;
|
||||
SetLastError(errorsave);
|
||||
Result:=DataIndex+Offset;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
procedure SysInitTLS;
|
||||
procedure init_threads;
|
||||
begin
|
||||
if (TLSKey^=$ffffffff) then
|
||||
if XCHG(_lazy_init,1)=0 then
|
||||
begin
|
||||
{ We're still running in single thread mode, setup the TLS }
|
||||
TLSKey^:=TlsAlloc;
|
||||
InitThreadVars(@SysRelocateThreadVar);
|
||||
BeginThread(@_thread_null);
|
||||
fetch_add(_lazy_wait,1);
|
||||
end else
|
||||
begin
|
||||
wait_until_equal(_lazy_wait,0);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -224,18 +215,11 @@ function SysBeginThread(sa:Pointer;
|
|||
creationFlags:dword;
|
||||
var ThreadId:TThreadID):TThreadID;
|
||||
var
|
||||
_threadid : dword;
|
||||
_threadid:dword;
|
||||
begin
|
||||
_sig_lock;
|
||||
|
||||
{ Initialize multithreading if not done }
|
||||
SysInitTLS;
|
||||
if not IsMultiThread then
|
||||
begin
|
||||
{ lazy initialize thread support }
|
||||
LazyInitThreading;
|
||||
IsMultiThread:=true;
|
||||
end;
|
||||
init_threads;
|
||||
|
||||
_threadid:=0;
|
||||
Result:=CreateThread(sa,stacksize,ThreadMain,p,creationflags,_threadid);
|
||||
|
|
|
@ -39,7 +39,7 @@ begin
|
|||
r:=vkCreateBuffer(Device.FHandle,@cinfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateBuffer:',r);
|
||||
Writeln(StdErr,'vkCreateBuffer:',r);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
|
|
@ -260,7 +260,7 @@ begin
|
|||
r:=vkBeginCommandBuffer(cmdbuf,@Info);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkBeginCommandBuffer:',r);
|
||||
Writeln(StdErr,'vkBeginCommandBuffer:',r);
|
||||
Exit;
|
||||
end;
|
||||
FCBState:=True;
|
||||
|
@ -285,7 +285,7 @@ begin
|
|||
r:=vkEndCommandBuffer(cmdbuf);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkEndCommandBuffer:',r);
|
||||
Writeln(StdErr,'vkEndCommandBuffer:',r);
|
||||
end;
|
||||
FCBState:=False;
|
||||
end;
|
||||
|
@ -452,7 +452,7 @@ begin
|
|||
ret:=Integer(r);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkQueueSubmit:',r);
|
||||
Writeln(StdErr,'vkQueueSubmit:',r);
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
|
|
@ -536,7 +536,7 @@ begin
|
|||
r:=FCreateDebugReportCallback(VulkanApp.FInstance,@cinfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('CreateDebugReportCallback:',r);
|
||||
Writeln(StdErr,'CreateDebugReportCallback:',r);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
@ -716,14 +716,14 @@ begin
|
|||
r:=vkCreateInstance(@vkCInfo,nil,@FInstance);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateInstance:',r);
|
||||
Writeln(StdErr,'vkCreateInstance:',r);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
FPhysicalDevice:=vkGetPhysicalDevice(FInstance);
|
||||
if (FPhysicalDevice=VK_NULL_HANDLE) then
|
||||
begin
|
||||
Writeln('failed to choice vulkan GPU');
|
||||
Writeln(StdErr,'failed to choice vulkan GPU');
|
||||
halt;
|
||||
end;
|
||||
|
||||
|
@ -889,7 +889,7 @@ begin
|
|||
r:=vkCreateWin32SurfaceKHR(VulkanApp.FInstance,@ci,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateWin32SurfaceKHR:',r);
|
||||
Writeln(StdErr,'vkCreateWin32SurfaceKHR:',r);
|
||||
Exit;
|
||||
end;
|
||||
LoadFamily;
|
||||
|
@ -907,7 +907,7 @@ begin
|
|||
FPFamily:=0;
|
||||
if not vkGetQueuePresentFamily(VulkanApp.FPhysicalDevice,FHandle,FPFamily) then
|
||||
begin
|
||||
Writeln('failed to chouse QueuePresentFamily');
|
||||
Writeln(StdErr,'failed to chouse QueuePresentFamily');
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
@ -1110,7 +1110,7 @@ begin
|
|||
r:=vkCreateDevice(VulkanApp.FPhysicalDevice,@DeviceInfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateDevice:',r);
|
||||
Writeln(StdErr,'vkCreateDevice:',r);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
@ -1185,7 +1185,7 @@ begin
|
|||
r:=vkCreateCommandPool(Device.FHandle,@cinfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('failed to create command pool!');
|
||||
Writeln(StdErr,'vkCreateCommandPool:',r);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
@ -1209,7 +1209,7 @@ begin
|
|||
r:=vkAllocateCommandBuffers(Device.FHandle,@ainfo,@Result);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('failed to allocate command buffers!');
|
||||
Writeln(StdErr,'vkAllocateCommandBuffers:',r);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
@ -1232,7 +1232,7 @@ begin
|
|||
r:=vkCreateFence(Device.FHandle,@cinfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateFence:',r);
|
||||
Writeln(StdErr,'vkCreateFence:',r);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
|
|
@ -431,11 +431,11 @@ begin
|
|||
if FNeoMode then
|
||||
begin
|
||||
buf^.PITCH:=(width+127) div 128;
|
||||
buf^.SIZE :=buf^.PITCH*128*((height+127) div 128)*128*4;
|
||||
buf^.SIZE :=buf^.PITCH*128*((height+127) and (not 127))*4;
|
||||
end else
|
||||
begin
|
||||
buf^.PITCH:=(width+127) div 128;
|
||||
buf^.SIZE :=buf^.PITCH*128*((height+63) div 64)*64*4;
|
||||
buf^.SIZE :=buf^.PITCH*128*((height+63) and (not 63))*4;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -594,7 +594,7 @@ begin
|
|||
VK_NOT_READY:Exit(False);
|
||||
else
|
||||
begin
|
||||
Writeln('vkGetEventStatus:',r);
|
||||
Writeln(StdErr,'vkGetEventStatus:',r);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
@ -679,7 +679,7 @@ begin
|
|||
VK_SUBOPTIMAL_KHR:recreateSwapChain;
|
||||
else
|
||||
begin
|
||||
Writeln('vkAcquireNextImageKHR:',R);
|
||||
Writeln(StdErr,'vkAcquireNextImageKHR:',R);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
@ -1024,7 +1024,7 @@ begin
|
|||
VK_SUBOPTIMAL_KHR:recreateSwapChain;
|
||||
else
|
||||
begin
|
||||
Writeln('vkQueuePresentKHR:',R);
|
||||
Writeln(StdErr,'vkQueuePresentKHR:',R);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
|
|
@ -311,7 +311,7 @@ begin
|
|||
r:=vkCreateFramebuffer(Device.FHandle,@info,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateFramebuffer');
|
||||
Writeln(StdErr,'vkCreateFramebuffer');
|
||||
end;
|
||||
|
||||
Result:=(r=VK_SUCCESS);
|
||||
|
@ -379,7 +379,7 @@ begin
|
|||
r:=vkCreateSwapchainKHR(Device.FHandle,@cinfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateSwapchainKHR:',r);
|
||||
Writeln(StdErr,'vkCreateSwapchainKHR:',r);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
@ -395,7 +395,7 @@ begin
|
|||
r:=vkGetSwapchainImagesKHR(Device.FHandle,FHandle,@count,@FImage[0]);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkGetSwapchainImagesKHR:',r);
|
||||
Writeln(StdErr,'vkGetSwapchainImagesKHR:',r);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
@ -420,7 +420,7 @@ begin
|
|||
r:=vkCreateImageView(Device.FHandle,@cimg,nil,@FView);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateImageView:',r);
|
||||
Writeln(StdErr,'vkCreateImageView:',r);
|
||||
Exit;
|
||||
end;
|
||||
FImages[i]:=TvSwapChainImage.Create;
|
||||
|
@ -499,7 +499,7 @@ begin
|
|||
r:=vkCreateImage(Device.FHandle,@cinfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateImage:',r);
|
||||
Writeln(StdErr,'vkCreateImage:',r);
|
||||
Exit;
|
||||
end;
|
||||
Result:=True;
|
||||
|
@ -543,7 +543,7 @@ begin
|
|||
r:=vkCreateImageView(Device.FHandle,@cinfo,nil,@FImg);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateImageView:',r);
|
||||
Writeln(StdErr,'vkCreateImageView:',r);
|
||||
Exit;
|
||||
end;
|
||||
Result:=TvImageView.Create;
|
||||
|
|
|
@ -8,7 +8,7 @@ uses
|
|||
SysUtils,
|
||||
RWLock,
|
||||
g23tree,
|
||||
sys_types,
|
||||
//sys_types,
|
||||
Vulkan,
|
||||
vDevice,
|
||||
vMemory,
|
||||
|
@ -41,6 +41,7 @@ type
|
|||
|
||||
TvImageView2Set=specialize T23treeSet<PvImageViewKey,TvImageView2Compare>;
|
||||
|
||||
{
|
||||
TvHostImage2=class(TvCustomImage)
|
||||
Parent:TvImage2;
|
||||
FUsage:TVkFlags;
|
||||
|
@ -54,6 +55,7 @@ type
|
|||
newImageLayout:TVkImageLayout;
|
||||
dstStageMask:TVkPipelineStageFlags);
|
||||
end;
|
||||
}
|
||||
|
||||
TvImage2=class(TvCustomImage)
|
||||
key:TvImageKey;
|
||||
|
@ -64,7 +66,7 @@ type
|
|||
//
|
||||
Barrier:TvImageBarrier;
|
||||
//
|
||||
FHostImage:TvHostImage2;
|
||||
//FHostImage:TvHostImage2;
|
||||
//
|
||||
Fdevc:TvPointer;
|
||||
//
|
||||
|
@ -79,7 +81,7 @@ type
|
|||
Function GetSubresLayer:TVkImageSubresourceLayers;
|
||||
function FetchView(cmd:TvCustomCmdBuffer;var F:TvImageViewKey):TvImageView2;
|
||||
function FetchView(cmd:TvCustomCmdBuffer):TvImageView2;
|
||||
function FetchHostImage(cmd:TvCustomCmdBuffer;usage:TVkFlags):TvHostImage2;
|
||||
//function FetchHostImage(cmd:TvCustomCmdBuffer;usage:TVkFlags):TvHostImage2;
|
||||
procedure PushBarrier(cmd:TvCustomCmdBuffer;
|
||||
dstAccessMask:TVkAccessFlags;
|
||||
newImageLayout:TVkImageLayout;
|
||||
|
@ -245,6 +247,7 @@ begin
|
|||
Result.initialLayout:=VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
end;
|
||||
|
||||
{
|
||||
Constructor TvHostImage2.Create;
|
||||
begin
|
||||
inherited;
|
||||
|
@ -258,6 +261,7 @@ begin
|
|||
Result:=Parent.GetImageInfo;
|
||||
Result.tiling:=VK_IMAGE_TILING_LINEAR;
|
||||
Result.usage :=FUsage;
|
||||
Result.flags :=ord(VK_IMAGE_CREATE_ALIAS_BIT);
|
||||
if (Parent.key.params.tiling_idx=8) then
|
||||
begin
|
||||
size:=Result.extent.width;
|
||||
|
@ -276,6 +280,7 @@ begin
|
|||
Result.extent.width:=size;
|
||||
end;
|
||||
end;
|
||||
}
|
||||
|
||||
Function TvImage2.GetSubresRange:TVkImageSubresourceRange;
|
||||
begin
|
||||
|
@ -336,7 +341,7 @@ begin
|
|||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
rwlock_unlock(lock);
|
||||
Writeln('vkCreateImageView:',r);
|
||||
Writeln(StdErr,'vkCreateImageView:',r);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
@ -395,6 +400,7 @@ begin
|
|||
Result:=FetchView(cmd,F);
|
||||
end;
|
||||
|
||||
{
|
||||
function TvImage2.FetchHostImage(cmd:TvCustomCmdBuffer;usage:TVkFlags):TvHostImage2;
|
||||
var
|
||||
t:TvHostImage2;
|
||||
|
@ -447,6 +453,7 @@ begin
|
|||
end;
|
||||
|
||||
end;
|
||||
}
|
||||
|
||||
procedure TvImage2.PushBarrier(cmd:TvCustomCmdBuffer;
|
||||
dstAccessMask:TVkAccessFlags;
|
||||
|
@ -471,6 +478,7 @@ begin
|
|||
rwlock_unlock(lock);
|
||||
end;
|
||||
|
||||
{
|
||||
procedure TvHostImage2.PushBarrier(cmd:TvCustomCmdBuffer;
|
||||
dstAccessMask:TVkAccessFlags;
|
||||
newImageLayout:TVkImageLayout;
|
||||
|
@ -489,6 +497,7 @@ begin
|
|||
Inc(cmd.cmd_count);
|
||||
end;
|
||||
end;
|
||||
}
|
||||
|
||||
Procedure TvImage2.Acquire(Sender:TObject);
|
||||
begin
|
||||
|
|
|
@ -24,17 +24,60 @@ implementation
|
|||
uses
|
||||
vImageManager;
|
||||
|
||||
{
|
||||
Function GetAlignWidth(format:TVkFormat;width:DWORD):DWORD;
|
||||
var
|
||||
bpp,size:Ptruint;
|
||||
begin
|
||||
size:=width;
|
||||
bpp:=getFormatSize(format);
|
||||
if IsTexelFormat(format) then
|
||||
begin
|
||||
size:=(size+3) div 4;
|
||||
end;
|
||||
size:=size*bpp;
|
||||
size:=(size+127) and (not 127);
|
||||
size:=size div bpp;
|
||||
if IsTexelFormat(format) then
|
||||
begin
|
||||
size:=size*4;
|
||||
end;
|
||||
Result:=size;
|
||||
end;
|
||||
|
||||
Function GetLinearSize(image:TvImage2;align:Boolean):Ptruint;
|
||||
var
|
||||
extend:TvExtent3D;
|
||||
begin
|
||||
extend:=image.key.params.extend;
|
||||
|
||||
if align then
|
||||
begin
|
||||
extend.width:=GetAlignWidth(image.key.cformat,extend.width);
|
||||
end;
|
||||
|
||||
if IsTexelFormat(image.key.cformat) then
|
||||
begin
|
||||
extend.width :=(extend.width +3) div 4;
|
||||
extend.height :=(extend.height +3) div 4;
|
||||
extend.depth :=(extend.depth +3) div 4;
|
||||
end;
|
||||
|
||||
Result:=extend.width*
|
||||
extend.height*
|
||||
extend.depth*
|
||||
getFormatSize(image.key.cformat);
|
||||
end;
|
||||
|
||||
Procedure _Load_Linear(cmd:TvCustomCmdBuffer;image:TvImage2);
|
||||
var
|
||||
buf:TvHostBuffer;
|
||||
BufferImageCopy:TVkBufferImageCopy;
|
||||
size:Ptruint;
|
||||
begin
|
||||
size:=image.key.params.extend.width*
|
||||
image.key.params.extend.height*
|
||||
image.key.params.extend.depth*
|
||||
getFormatSize(image.key.cformat);
|
||||
|
||||
if (image.key.params.samples>ord(VK_SAMPLE_COUNT_1_BIT)) then Exit;
|
||||
|
||||
size:=GetLinearSize(image,(image.key.params.tiling_idx=8));
|
||||
|
||||
image.PushBarrier(cmd,
|
||||
ord(VK_ACCESS_TRANSFER_WRITE_BIT),
|
||||
|
@ -65,13 +108,18 @@ begin
|
|||
image.key.params.extend.height,
|
||||
image.key.params.extend.depth);
|
||||
|
||||
Case image.key.cformat of
|
||||
VK_FORMAT_D16_UNORM_S8_UINT,
|
||||
VK_FORMAT_D24_UNORM_S8_UINT,
|
||||
VK_FORMAT_D32_SFLOAT_S8_UINT:
|
||||
BufferImageCopy.imageSubresource.aspectMask:=ord(VK_IMAGE_ASPECT_DEPTH_BIT);
|
||||
else;
|
||||
end;
|
||||
if (image.key.params.tiling_idx=8) then
|
||||
begin
|
||||
BufferImageCopy.bufferRowLength:=GetAlignWidth(image.key.cformat,image.key.params.extend.width);
|
||||
end;
|
||||
|
||||
Case image.key.cformat of
|
||||
VK_FORMAT_D16_UNORM_S8_UINT,
|
||||
VK_FORMAT_D24_UNORM_S8_UINT,
|
||||
VK_FORMAT_D32_SFLOAT_S8_UINT:
|
||||
BufferImageCopy.imageSubresource.aspectMask:=ord(VK_IMAGE_ASPECT_DEPTH_BIT);
|
||||
else;
|
||||
end;
|
||||
|
||||
//image.data_usage:=image.data_usage and (not TM_READ);
|
||||
|
||||
|
@ -82,8 +130,8 @@ begin
|
|||
1,
|
||||
@BufferImageCopy);
|
||||
end;
|
||||
}
|
||||
|
||||
{
|
||||
Procedure _Load_Linear(cmd:TvCustomCmdBuffer;image:TvImage2);
|
||||
var
|
||||
buf:TvHostImage2;
|
||||
|
@ -134,6 +182,7 @@ begin
|
|||
1,@ImageCopy);
|
||||
|
||||
end;
|
||||
}
|
||||
|
||||
type
|
||||
TvTempBuffer=class(TvBuffer)
|
||||
|
@ -150,25 +199,12 @@ end;
|
|||
Procedure _Copy_Linear(cmd:TvCustomCmdBuffer;buf:TvTempBuffer;image:TvImage2);
|
||||
var
|
||||
BufferImageCopy:TVkBufferImageCopy;
|
||||
extend:TvExtent3D;
|
||||
size:Ptruint;
|
||||
begin
|
||||
|
||||
cmd.AddDependence(@buf.Release);
|
||||
|
||||
extend:=image.key.params.extend;
|
||||
|
||||
if IsTexelFormat(image.key.cformat) then
|
||||
begin
|
||||
extend.width :=(extend.width +3) div 4;
|
||||
extend.height :=(extend.height +3) div 4;
|
||||
extend.depth :=(extend.depth +3) div 4;
|
||||
end;
|
||||
|
||||
size:=extend.width*
|
||||
extend.height*
|
||||
extend.depth*
|
||||
getFormatSize(image.key.cformat);
|
||||
size:=GetLinearSize(image,false);
|
||||
|
||||
image.PushBarrier(cmd,
|
||||
ord(VK_ACCESS_TRANSFER_WRITE_BIT),
|
||||
|
@ -323,13 +359,13 @@ begin
|
|||
end else
|
||||
Case m_bitsPerElement of
|
||||
32:begin
|
||||
tiler.m_paddedWidth :=((tiler.m_linearWidth +7) div 8)*8;
|
||||
tiler.m_paddedHeight:=((tiler.m_linearHeight+7) div 8)*8;
|
||||
tiler.m_paddedWidth :=(tiler.m_linearWidth +7) and (not 7);
|
||||
tiler.m_paddedHeight:=(tiler.m_linearHeight+7) and (not 7);
|
||||
tiler.m_paddedDepth :=tiler.m_linearDepth;
|
||||
end;
|
||||
8:begin
|
||||
tiler.m_paddedWidth :=((tiler.m_linearWidth +31) div 32)*32;
|
||||
tiler.m_paddedHeight:=((tiler.m_linearHeight+ 7) div 8)*8;
|
||||
tiler.m_paddedWidth :=(tiler.m_linearWidth +31) and (not 31);
|
||||
tiler.m_paddedHeight:=(tiler.m_linearHeight+ 7) and (not 7);
|
||||
tiler.m_paddedDepth :=tiler.m_linearDepth;
|
||||
end;
|
||||
else
|
||||
|
|
|
@ -585,7 +585,7 @@ begin
|
|||
r:=vkAllocateMemory(device,@ainfo,nil,@Result);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkAllocateMemory:',r);
|
||||
Writeln(StdErr,'vkAllocateMemory:',r);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -608,7 +608,7 @@ begin
|
|||
r:=vkAllocateMemory(device,@ainfo,nil,@Result);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkAllocateMemory:',r);
|
||||
Writeln(StdErr,'vkAllocateMemory:',r);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -630,7 +630,7 @@ begin
|
|||
r:=vkAllocateMemory(device,@ainfo,nil,@Result);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkAllocateMemory:',r);
|
||||
Writeln(StdErr,'vkAllocateMemory:',r);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -652,7 +652,7 @@ begin
|
|||
r:=vkAllocateMemory(device,@ainfo,nil,@Result);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkAllocateMemory:',r);
|
||||
Writeln(StdErr,'vkAllocateMemory:',r);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -661,7 +661,7 @@ begin
|
|||
InitVulkan;
|
||||
|
||||
//Some games request too much video memory, relevant for built-in iGPU
|
||||
//if (len>1024*1024*1024) then len:=1024*1024*1024;
|
||||
if (len>1024*1024*1024) then len:=1024*1024*1024;
|
||||
|
||||
Result:=vkAllocHostPointer(Device.FHandle,len,MemManager.FHostVisibMt{FHostCacheMt},addr);
|
||||
Assert(Result<>VK_NULL_HANDLE);
|
||||
|
|
|
@ -237,7 +237,7 @@ begin
|
|||
r:=vkCreateDescriptorSetLayout(Device.FHandle,@cinfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateDescriptorSetLayout:',r);
|
||||
Writeln(StdErr,'vkCreateDescriptorSetLayout:',r);
|
||||
Exit;
|
||||
end;
|
||||
FCompile:=FEdit;
|
||||
|
@ -373,7 +373,7 @@ begin
|
|||
r:=vkCreatePipelineLayout(Device.FHandle,@cinfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreatePipelineLayout:',r);
|
||||
Writeln(StdErr,'vkCreatePipelineLayout:',r);
|
||||
Exit;
|
||||
end;
|
||||
FCompile:=FEdit;
|
||||
|
@ -454,7 +454,7 @@ begin
|
|||
r:=vkCreateComputePipelines(Device.FHandle,VK_NULL_HANDLE,1,@cinfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateComputePipelines:',r);
|
||||
Writeln(StdErr,'vkCreateComputePipelines:',r);
|
||||
Exit;
|
||||
end;
|
||||
FCompile:=FEdit;
|
||||
|
@ -604,7 +604,7 @@ begin
|
|||
r:=vkCreateDescriptorPool(Device.FHandle,@cinfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateDescriptorPool:',r);
|
||||
Writeln(StdErr,'vkCreateDescriptorPool:',r);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
@ -703,7 +703,7 @@ begin
|
|||
r:=vkAllocateDescriptorSets(Device.FHandle,@ainfo,@FResult);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkAllocateDescriptorSets:',r);
|
||||
Writeln(StdErr,'vkAllocateDescriptorSets:',r);
|
||||
Exit;
|
||||
end;
|
||||
Result:=TvDescriptorSet.Create;
|
||||
|
@ -730,7 +730,7 @@ begin
|
|||
r:=vkAllocateDescriptorSets(Device.FHandle,@ainfo,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkAllocateDescriptorSets:',r);
|
||||
Writeln(StdErr,'vkAllocateDescriptorSets:',r);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
@ -747,7 +747,7 @@ begin
|
|||
r:=vkFreeDescriptorSets(Device.FHandle,FParent.FHandle,1,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkFreeDescriptorSets:',r);
|
||||
Writeln(StdErr,'vkFreeDescriptorSets:',r);
|
||||
end;
|
||||
end;
|
||||
FHandle:=VK_NULL_HANDLE;
|
||||
|
@ -959,7 +959,7 @@ begin
|
|||
r:=vkCreateDescriptorPool(Device.FHandle,@cinfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateDescriptorPool:',r);
|
||||
Writeln(StdErr,'vkCreateDescriptorPool:',r);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
@ -987,7 +987,7 @@ begin
|
|||
r:=vkAllocateDescriptorSets(Device.FHandle,@ainfo,@FResult);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkAllocateDescriptorSets:',r);
|
||||
Writeln(StdErr,'vkAllocateDescriptorSets:',r);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ var
|
|||
begin
|
||||
if (subpass.colorAttachmentCount>7) then Exit;
|
||||
ColorRef[subpass.colorAttachmentCount].attachment:=id;
|
||||
ColorRef[subpass.colorAttachmentCount].layout :=VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL{VK_IMAGE_LAYOUT_GENERAL};
|
||||
ColorRef[subpass.colorAttachmentCount].layout :={VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}VK_IMAGE_LAYOUT_GENERAL;
|
||||
Inc(subpass.colorAttachmentCount);
|
||||
|
||||
dependency.srcStageMask :=dependency.srcStageMask or ord(VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT);
|
||||
|
@ -239,14 +239,14 @@ begin
|
|||
With ColorAt[AtCount] do
|
||||
if (IMAGE_USAGE and TM_READ<>0) then
|
||||
begin
|
||||
initialLayout :=VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
initialLayout :={VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}VK_IMAGE_LAYOUT_GENERAL;
|
||||
end else
|
||||
begin
|
||||
initialLayout :=VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
end;
|
||||
|
||||
With ColorAt[AtCount] do
|
||||
finalLayout:=VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
finalLayout:={VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}VK_IMAGE_LAYOUT_GENERAL;
|
||||
|
||||
Inc(AtCount);
|
||||
end;
|
||||
|
@ -363,7 +363,7 @@ begin
|
|||
r:=vkCreateRenderPass(Device.FHandle,@info,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateRenderPass');
|
||||
Writeln(StdErr,'vkCreateRenderPass:',r);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
@ -560,7 +560,7 @@ begin
|
|||
r:=vkCreateGraphicsPipelines(Device.FHandle,VK_NULL_HANDLE,1,@info,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('failed to create graphics pipeline!');
|
||||
Writeln(StdErr,'vkCreateGraphicsPipelines:',r);
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ begin
|
|||
r:=vkCreateRenderPass(Device.FHandle,@info,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateRenderPass');
|
||||
Writeln(StdErr,'vkCreateRenderPass:',r);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ begin
|
|||
r:=vkCreateSampler(Device.FHandle,pInfo,nil,@FHandle);
|
||||
if (r<>VK_SUCCESS) then
|
||||
begin
|
||||
Writeln('vkCreateImage:',r);
|
||||
Writeln(StdErr,'vkCreateImage:',r);
|
||||
Exit;
|
||||
end;
|
||||
Result:=True;
|
||||
|
|
Loading…
Reference in New Issue