mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-04 01:28:45 -04:00
fix(sointulib): Reset the FPU on each call to render, seems to take away the undeterministic behaviour.
This commit is contained in:
parent
e7ae775842
commit
83937bb2ee
@ -137,6 +137,8 @@ EXPORT MANGLE_FUNC(su_render,16)
|
|||||||
mov rcx, rdi ; rcx = &Synthstate
|
mov rcx, rdi ; rcx = &Synthstate
|
||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
|
sub _SP,108 ; allocate space on stack for the FPU state
|
||||||
|
fsave [_SP] ; save the FPU state to stack & reset the FPU
|
||||||
push _SI ; push the pointer to samples
|
push _SI ; push the pointer to samples
|
||||||
push _BX ; push the pointer to time
|
push _BX ; push the pointer to time
|
||||||
xor eax, eax ; samplenumber starts at 0
|
xor eax, eax ; samplenumber starts at 0
|
||||||
@ -208,6 +210,8 @@ su_render_samples_time_finish:
|
|||||||
mov dword [_SI], edx ; *samples = samples rendered
|
mov dword [_SI], edx ; *samples = samples rendered
|
||||||
mov dword [_BX], eax ; *time = time ticks rendered
|
mov dword [_BX], eax ; *time = time ticks rendered
|
||||||
xor eax, eax ; TODO: set eax to possible error code, now just 0
|
xor eax, eax ; TODO: set eax to possible error code, now just 0
|
||||||
|
frstor [_SP] ; restore fpu state
|
||||||
|
add _SP,108 ; rewind the stack allocate for FPU state
|
||||||
%if BITS == 32 ; stdcall
|
%if BITS == 32 ; stdcall
|
||||||
mov [_SP + 28],eax ; we want to return eax, but popad pops everything, so put eax to stack for popad to pop
|
mov [_SP + 28],eax ; we want to return eax, but popad pops everything, so put eax to stack for popad to pop
|
||||||
popad
|
popad
|
||||||
|
Loading…
x
Reference in New Issue
Block a user