mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-04 01:28:45 -04:00
fix(libsointu): Return error as soon as possible, exiting the rendering loop immediately on error.
This commit is contained in:
parent
7bb60de74e
commit
cd95c5ae37
14
render.asm
14
render.asm
@ -159,6 +159,12 @@ EXPORT MANGLE_FUNC(su_render,16)
|
|||||||
push _BX ; the nominal rowlength should be time_in
|
push _BX ; the nominal rowlength should be time_in
|
||||||
xor eax, eax ; rowtick starts at 0
|
xor eax, eax ; rowtick starts at 0
|
||||||
su_render_samples_loop:
|
su_render_samples_loop:
|
||||||
|
push _DI
|
||||||
|
fnstsw [_SP] ; store the FPU status flag to stack top
|
||||||
|
pop _DI ; _DI = FPU status flag
|
||||||
|
and _DI, 0011100001000101b ; mask TOP pointer, stack error, zero divide and invalid operation
|
||||||
|
test _DI,_DI ; all the aforementioned bits should be 0!
|
||||||
|
jne su_render_samples_time_finish ; otherwise, we exit due to error
|
||||||
cmp eax, [_SP] ; if rowtick >= maxtime
|
cmp eax, [_SP] ; if rowtick >= maxtime
|
||||||
jge su_render_samples_time_finish ; goto finish
|
jge su_render_samples_time_finish ; goto finish
|
||||||
mov ecx, [_SP + PTRSIZE*7] ; ecx = buffer length in samples
|
mov ecx, [_SP + PTRSIZE*7] ; ecx = buffer length in samples
|
||||||
@ -207,11 +213,9 @@ su_render_samples_time_finish:
|
|||||||
pop _DX
|
pop _DX
|
||||||
pop _BX ; pop the pointer to time
|
pop _BX ; pop the pointer to time
|
||||||
pop _SI ; pop the pointer to samples
|
pop _SI ; pop the pointer to samples
|
||||||
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
|
mov _AX,_DI ; _DI was the masked FPU status flag, _AX is return value
|
||||||
fnstsw ax ; store the FPU status flag in ax.
|
|
||||||
and ax, 0011100001000101b ; mask TOP pointer, stack error, zero divide and invalid operation
|
|
||||||
frstor [_SP] ; restore fpu state
|
frstor [_SP] ; restore fpu state
|
||||||
add _SP,108 ; rewind the stack allocate for FPU state
|
add _SP,108 ; rewind the stack allocate for FPU state
|
||||||
%if BITS == 32 ; stdcall
|
%if BITS == 32 ; stdcall
|
||||||
|
Loading…
x
Reference in New Issue
Block a user