This commit is contained in:
red-prig 2022-10-17 02:18:56 +03:00
parent 2a80a49d93
commit 144fedd550
4 changed files with 72 additions and 10 deletions

View File

@ -69,6 +69,8 @@ const
procedure vSubmitDone;
function vSubmitsAllowed:Boolean;
var
DEPTH_DISABLE_HACK:Boolean=false;
COMPUTE_DISABLE_HACK:Boolean=false;
@ -164,6 +166,9 @@ var
FIdleEvent:PRTLEvent=nil;
FSubmitEvent:PRTLEvent=nil;
FSubmitAllowed:DWORD=0;
GPU_REGS:TGPU_REGS;
FCmdPool:TvCmdPool;
@ -420,10 +425,10 @@ begin
begin
if me_node_test(GFXMicroEngine.Current) then
begin
if (GFXMicroEngine.Current^.mode=metCmdBuffer) then
begin
RTLEventSetEvent(FIdleEvent);
end;
//if (GFXMicroEngine.Current^.mode=metCmdBuffer) then
//begin
// RTLEventSetEvent(FIdleEvent);
//end;
end else
begin
time:=-100000;
@ -462,6 +467,9 @@ begin
FIdleEvent:=RTLEventCreate;
RTLEventSetEvent(FIdleEvent);
FSubmitEvent:=RTLEventCreate;
RTLEventSetEvent(FSubmitEvent);
t:=BeginThread(@GFX_thread);
_gfx_handle:=t;
@ -607,14 +615,25 @@ end;
procedure vSubmitDone;
begin
if (FIdleEvent<>nil) then
if (FIdleEvent<>nil) and (FSubmitEvent<>nil) then
begin
RTLEventWaitFor(FIdleEvent);
While not CAS(FSubmitAllowed,0,1) do
begin
RTLEventWaitFor(FSubmitEvent); //wait another vSubmitDone
end;
RTLEventResetEvent(FSubmitEvent);
RTLEventWaitFor(FIdleEvent,2000); //wait idle GPU
RTLEventSetEvent(FSubmitEvent);
store_release(FSubmitAllowed,0);
end;
//Sleep(100);
//Device.WaitIdle;
end;
function vSubmitsAllowed:Boolean;
begin
Result:=FSubmitAllowed=0;
end;
procedure onPrepareFlip();
begin

View File

@ -302,6 +302,7 @@
<Unit66>
<Filename Value="src\ps4_libscediscmap.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ps4_libSceDiscMap"/>
</Unit66>
<Unit67>
<Filename Value="src\ps4_libscegnmdriver.pas"/>
@ -316,6 +317,7 @@
<Unit69>
<Filename Value="src\ps4_libsceime.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ps4_libSceIme"/>
</Unit69>
<Unit70>
<Filename Value="src\ps4_libscemouse.pas"/>

View File

@ -1300,6 +1300,9 @@ end;
//
var
SceSubmitDoneGame:TRTLCriticalSection;
function ps4_sceGnmSubmitCommandBuffersForWorkload(
workload:QWORD;
count:DWORD;
@ -1322,7 +1325,11 @@ begin
Submit.ccbSizesInBytes:=ccbSizesInBytes;
_sig_lock;
EnterCriticalSection(SceSubmitDoneGame);
Result:=vSubmitCommandBuffers(@Submit,nil);
LeaveCriticalSection(SceSubmitDoneGame);
_sig_unlock;
Result:=0;
@ -1380,7 +1387,11 @@ begin
Flip.flipArg :=flipArg;
_sig_lock;
EnterCriticalSection(SceSubmitDoneGame);
Result:=vSubmitCommandBuffers(@Submit,@Flip);
LeaveCriticalSection(SceSubmitDoneGame);
_sig_unlock;
Result:=0;
@ -1449,8 +1460,12 @@ begin
Flip.flipArg :=flipArg;
_sig_lock;
EnterCriticalSection(SceSubmitDoneGame);
Result:=vSubmitCommandBuffers(@Submit,@Flip);
vSubmitDone;
LeaveCriticalSection(SceSubmitDoneGame);
_sig_unlock;
Result:=0;
@ -1482,7 +1497,11 @@ begin
//exit(0);
_sig_lock;
EnterCriticalSection(SceSubmitDoneGame);
vSubmitDone;
LeaveCriticalSection(SceSubmitDoneGame);
_sig_unlock;
Result:=0;
@ -1512,7 +1531,7 @@ end;
//A value of true is returned if submit/dingdong is allowed; otherwise false is returned.
function ps4_sceGnmAreSubmitsAllowed:Boolean; SysV_ABI_CDecl;
begin
Result:=true;
Result:=vSubmitsAllowed;
end;
const
@ -1742,6 +1761,8 @@ end;
initialization
GnmInitEmbedded;
InitCriticalSection(SceSubmitDoneGame);
EopEvents.Init;
ComputeEvents[0].Init;
ComputeEvents[1].Init;

View File

@ -11,11 +11,30 @@ uses
implementation
type
pSceImeEvent=^SceImeEvent;
SceImeEvent=packed record
id:Integer; //SceImeEventId
//param:SceImeEventParam;
end;
SceImeEventHandler=procedure(arg:Pointer;e:pSceImeEvent);
pSceImeKeyboardParam=^SceImeKeyboardParam;
SceImeKeyboardParam=packed record
option:DWORD;
reserved1:DWORD;
arg:Pointer;
handler:SceImeEventHandler;
reserved2:QWORD;
end;
function ps4_sceImeKeyboardOpen(
userId:Integer;
param:Pointer //SceImeKeyboardParam
param:pSceImeKeyboardParam
):Integer; SysV_ABI_CDecl;
begin
Writeln('sceImeKeyboardOpen:',userId,' ',HexStr(param));
Result:=Integer($80BC0004);
end;
@ -23,6 +42,7 @@ function ps4_sceImeUpdate(
handler:Pointer //SceImeEventHandler
):Integer; SysV_ABI_CDecl;
begin
Writeln('sceImeUpdate:',HexStr(handler));
Result:=Integer($80BC0004);
end;