perf(engine): eliminate frame jitter using timeBeginPeriod(1) and timeGetTime
This commit is contained in:
parent
5997849f75
commit
4c89864afb
4 changed files with 8 additions and 3 deletions
Binary file not shown.
11
casino3d.inc
11
casino3d.inc
|
|
@ -38,6 +38,9 @@ CreateThread PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
|
|||
CreateEventA PROTO :DWORD,:DWORD,:DWORD,:DWORD
|
||||
SetEvent PROTO :DWORD
|
||||
WaitForSingleObject PROTO :DWORD,:DWORD
|
||||
timeBeginPeriod PROTO :DWORD
|
||||
timeEndPeriod PROTO :DWORD
|
||||
timeGetTime PROTO
|
||||
|
||||
C3D_POINT STRUCT
|
||||
x dd ?
|
||||
|
|
@ -4691,6 +4694,7 @@ Init3DEngine PROC
|
|||
push esi
|
||||
push edi
|
||||
|
||||
invoke timeBeginPeriod, 1
|
||||
call LoadDisplaySettings3D
|
||||
call Create3DWindow
|
||||
test eax, eax
|
||||
|
|
@ -5008,7 +5012,7 @@ StartCasino3D PROC uses ebx esi edi
|
|||
call Init3DEngine
|
||||
test eax, eax
|
||||
jz engine_shutdown
|
||||
invoke GetTickCount
|
||||
invoke timeGetTime
|
||||
mov rngSeed3D, eax
|
||||
mov previousTick3D, eax
|
||||
engine_loop:
|
||||
|
|
@ -5022,7 +5026,7 @@ engine_loop:
|
|||
jmp engine_loop
|
||||
|
||||
dispatch_frame:
|
||||
invoke GetTickCount
|
||||
invoke timeGetTime
|
||||
mov frameStart3D, eax
|
||||
sub eax, previousTick3D
|
||||
cmp eax, 50
|
||||
|
|
@ -5321,7 +5325,7 @@ present_frame:
|
|||
xor eax, eax
|
||||
mov ecx, 64
|
||||
rep stosd
|
||||
invoke GetTickCount
|
||||
invoke timeGetTime
|
||||
sub eax, frameStart3D
|
||||
mov ecx, 16
|
||||
cmp settingsLowSpec, 1
|
||||
|
|
@ -5373,6 +5377,7 @@ engine_shutdown:
|
|||
invoke DestroyWindow, h3DWnd
|
||||
mov h3DWnd, 0
|
||||
@@:
|
||||
invoke timeEndPeriod, 1
|
||||
ret
|
||||
StartCasino3D ENDP
|
||||
|
||||
|
|
|
|||
BIN
poker.exe
BIN
poker.exe
Binary file not shown.
BIN
poker.obj
BIN
poker.obj
Binary file not shown.
Loading…
Add table
Reference in a new issue