This commit is contained in:
Pavel 2022-10-14 12:18:48 +03:00
parent abf83b729e
commit cad2d30172
5 changed files with 162 additions and 13 deletions

View File

@ -69,6 +69,10 @@ const
procedure vSubmitDone;
var
DEPTH_DISABLE_HACK:Boolean=false;
COMPUTE_DISABLE_HACK:Boolean=false;
implementation
Uses
@ -1893,8 +1897,8 @@ begin
end;
if not GPU_REGS.COMP_ENABLE then Exit(false);
if GPU_REGS.DB_ENABLE {false} then
if DEPTH_DISABLE_HACK and (not GPU_REGS.COMP_ENABLE) then Exit(false);
if (not DEPTH_DISABLE_HACK) and GPU_REGS.DB_ENABLE {false} then
begin
DB_INFO:=GPU_REGS.GET_DB_INFO;
@ -2200,7 +2204,7 @@ begin
//writeln;
end;
procedure UpdateGpuRegsInfoCompute;
function UpdateGpuRegsInfoCompute:Boolean;
var
FUniformBuilder:TvUniformBuilder;
@ -2221,13 +2225,16 @@ var
FComputePipeline:TvComputePipeline2;
begin
Result:=False;
if COMPUTE_DISABLE_HACK then Exit;
{$ifdef null_rt}Exit;{$endif}
if (LastSetShCount=GFXRing.SetShCount) and
(LastSetCxCount=GFXRing.SetCxCount) then
begin
Exit;
Exit(True);
end;
LastSetShCount:=GFXRing.SetShCount;
@ -2300,6 +2307,7 @@ begin
GFXRing.CmdBuffer.BindSets(VK_PIPELINE_BIND_POINT_COMPUTE,FDescriptorGroup);
//
Result:=True;
end;
procedure test_reset_index(INDEX_TYPE:TVkIndexType;RESET_EN:Byte;IB_RESET_INDX:DWORD);
@ -2409,9 +2417,10 @@ end;
procedure onDispatchDirect(pm4Hdr:PM4_TYPE_3_HEADER;Body:PPM4CMDDISPATCHDIRECT);
begin
UpdateGpuRegsInfoCompute;
GFXRing.CmdBuffer.DispatchDirect(Body^.dimX,Body^.dimY,Body^.dimZ);
if UpdateGpuRegsInfoCompute then
begin
GFXRing.CmdBuffer.DispatchDirect(Body^.dimX,Body^.dimY,Body^.dimZ);
end;
{$ifdef ww}Writeln('onDispatchDirect:',Body^.dimX,':',Body^.dimY,':',Body^.dimZ);{$endif}

View File

@ -335,7 +335,8 @@ begin
if (mode and SCE_SAVE_DATA_MOUNT_MODE_CREATE)<>0 then
begin
if not ForceDirectories(ps4_app.save_path) then Exit(SCE_SAVE_DATA_ERROR_INTERNAL);
if not CreateDir(sp) then Exit(SCE_SAVE_DATA_ERROR_EXISTS);
//if not CreateDir(sp) then Exit(SCE_SAVE_DATA_ERROR_EXISTS);
CreateDir(sp);
end else
begin
if not DirectoryExists(sp) then Exit(SCE_SAVE_DATA_ERROR_NOT_FOUND);

View File

@ -342,14 +342,133 @@ begin
end;
end;
const
SCE_SAVE_DATA_SORT_KEY_DIRNAME =0;
SCE_SAVE_DATA_SORT_KEY_USER_PARAM =1;
SCE_SAVE_DATA_SORT_KEY_BLOCKS =2;
SCE_SAVE_DATA_SORT_KEY_MTIME =3;
SCE_SAVE_DATA_SORT_KEY_FREE_BLOCKS=4;
SCE_SAVE_DATA_SORT_ORDER_ASCENT =0;
SCE_SAVE_DATA_SORT_ORDER_DESCENT=1;
function _convert_dir_name_search(P:PChar):RawByteString;
var
i:Integer;
begin
Result:=RawByteString(P); //copy
if (Length(Result)=0) then
begin
Result:='*';
end else
For i:=1 to Length(Result) do
begin
Case Result[i] of
'%':Result[i]:='*';
'_':Result[i]:='#';
else;
end;
end;
end;
function StringListAscCompare(List:TStringList;Index1,Index2:Integer):Integer;
begin
Result:=CompareStr(List[Index1],List[Index2]);
end;
function StringListDscCompare(List:TStringList;Index1,Index2:Integer):Integer;
begin
Result:=CompareStr(List[Index2],List[Index1]);
end;
function ps4_sceSaveDataDirNameSearch(cond:pSceSaveDataDirNameSearchCond;
sres:pSceSaveDataDirNameSearchResult):Integer; SysV_ABI_CDecl;
var
ROut:TRawByteSearchRec;
S,F:RawByteString;
List:TStringList;
i,n:Integer;
begin
Result:=0;
if (sres<>nil) then
begin
sres^:=Default(SceSaveDataDirNameSearchResult);
if (cond=nil) then Exit(SCE_SAVE_DATA_ERROR_PARAMETER);
if (sres=nil) then Exit(SCE_SAVE_DATA_ERROR_PARAMETER);
Case cond^.order of
SCE_SAVE_DATA_SORT_ORDER_ASCENT :;
SCE_SAVE_DATA_SORT_ORDER_DESCENT:;
else
Exit(SCE_SAVE_DATA_ERROR_PARAMETER);
end;
Assert(cond^.key =SCE_SAVE_DATA_SORT_KEY_DIRNAME);
s:=IncludeTrailingPathDelimiter(ps4_app.save_path)+_convert_dir_name_search(@cond^.dirName);
ROut:=Default(TRawByteSearchRec);
if (FindFirst(s,faDirectory,ROut)=0) then
begin
List:=TStringList.Create;
repeat
if (ROut.FindData.dwFileAttributes and faDirectory)=faDirectory then
begin
F:=UTF8Encode(WideString(ROut.FindData.cFileName));
Case F of
'.','..':;
else
List.Add(F);
end;
end;
until (FindNext(ROut)<>0);
FindClose(ROut);
sres^.hitNum:=List.Count;
if (List.Count<>0) and (sres^.dirNamesNum<>0) then
begin
Case cond^.order of
SCE_SAVE_DATA_SORT_ORDER_ASCENT :List.CustomSort(@StringListAscCompare);
SCE_SAVE_DATA_SORT_ORDER_DESCENT:List.CustomSort(@StringListDscCompare);
else;
end;
n:=List.Count;
if (n>sres^.dirNamesNum) then n:=sres^.dirNamesNum;
sres^.setNum:=n;
For i:=0 to n-1 do
begin
s:=List[i];
if (sres^.dirNames<>nil) then
begin
sres^.dirNames[i]:=Default(SceSaveDataDirName);
MoveChar0(PChar(s)^,sres^.dirNames[i],SCE_SAVE_DATA_DIRNAME_DATA_MAXSIZE);
end;
if (sres^.params<>nil) then
begin
sres^.params[i]:=Default(SceSaveDataParam);
end;
if (sres^.infos<>nil) then
begin
sres^.infos[i]:=Default(SceSaveDataSearchInfo);
sres^.infos[i].blocks :=100000;
sres^.infos[i].freeBlocks:=100000;
end;
end;
end else
begin
sres^.setNum:=0;
end;
FreeAndNil(List);
end;
end;
type

View File

@ -103,6 +103,10 @@ const
handleTypes:ord(VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT);
);
var
IMAGE_TEST_HACK:Boolean=False;
IMAGE_LOAD_HACK:Boolean=False;
implementation
type
@ -639,17 +643,27 @@ begin
if ((Result.data_usage and TM_READ)<>0) and (Result.submit_id<>cmd.submit_id) then
begin
//hash test
if IMAGE_TEST_HACK then
begin
Result.data_usage:=Result.data_usage and (not TM_READ);
end else
if CheckFromBuffer(Result) then
begin
Result.data_usage:=Result.data_usage and (not TM_READ);
end;
end;
if ((Result.data_usage and TM_READ)=0) and ((data_usage and TM_READ)<>0) then
begin
Result.submit_id:=cmd.submit_id;
Result.data_usage:=Result.data_usage or TM_READ;
LoadFromBuffer(cmd,Result);
if not IMAGE_LOAD_HACK then
begin
LoadFromBuffer(cmd,Result);
end;
end;
end;

View File

@ -93,6 +93,9 @@ Function TryGetHostPointerByAddr(addr:Pointer;var P:TvPointer;SizeOut:PQWORD=nil
function GetHostMappedRequirements:TVkMemoryRequirements;
function GetSparceMemoryTypes:TVkUInt32;
var
MEMORY_BOUND_HACK:Boolean=False;
implementation
uses
@ -673,7 +676,10 @@ 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 MEMORY_BOUND_HACK then
begin
if (len>1024*1024*1024) then len:=1024*1024*1024;
end;
Result:=vkAllocHostPointer(Device.FHandle,len,MemManager.FHostVisibMt{FHostCacheMt},addr);
Assert(Result<>VK_NULL_HANDLE);