forked from KolibriOS/kolibrios
add list operations
git-svn-id: svn://kolibrios.org@5171 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c59d1565ab
commit
3a4ecad384
183
programs/develop/libraries/TinyGL/asm_fork/examples/test2.asm
Normal file
183
programs/develop/libraries/TinyGL/asm_fork/examples/test2.asm
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
use32
|
||||||
|
org 0x0
|
||||||
|
db 'MENUET01'
|
||||||
|
dd 0x1
|
||||||
|
dd start
|
||||||
|
dd i_end
|
||||||
|
dd mem,stacktop
|
||||||
|
dd 0,cur_dir_path
|
||||||
|
|
||||||
|
include '../../../../../../programs/proc32.inc'
|
||||||
|
include '../../../../../../programs/macros.inc'
|
||||||
|
include '../../../../../../programs/develop/libraries/box_lib/load_lib.mac'
|
||||||
|
include '../../../../../../programs/dll.inc'
|
||||||
|
include '../opengl_const.inc'
|
||||||
|
|
||||||
|
@use_library
|
||||||
|
|
||||||
|
align 4
|
||||||
|
start:
|
||||||
|
load_library name_tgl, cur_dir_path, library_path, system_path, \
|
||||||
|
err_message_found_lib, head_f_l, import_lib_tinygl, err_message_import, head_f_i
|
||||||
|
cmp eax,-1
|
||||||
|
jz button.exit
|
||||||
|
|
||||||
|
mcall 40,0x27
|
||||||
|
|
||||||
|
stdcall [kosglMakeCurrent], 10,10,300,225,ctx1
|
||||||
|
stdcall [glEnable], GL_DEPTH_TEST
|
||||||
|
|
||||||
|
stdcall [glGenLists],1
|
||||||
|
mov [obj1],eax
|
||||||
|
stdcall [glNewList],eax,GL_COMPILE
|
||||||
|
;---
|
||||||
|
stdcall [glColor3f],1.0, 0.0, 0.0
|
||||||
|
stdcall [glBegin],GL_LINE_LOOP
|
||||||
|
stdcall [glVertex3f], 0, 0.9, 0.1
|
||||||
|
stdcall [glVertex3f], 0.636, 0.636, 0.1
|
||||||
|
stdcall [glVertex3f], 0.9, 0.0, 0.1
|
||||||
|
stdcall [glVertex3f], 0.636, -0.636, 0.1
|
||||||
|
stdcall [glVertex3f], 0.0, -0.9, 0.1
|
||||||
|
stdcall [glVertex3f], -0.636,-0.636, 0.1
|
||||||
|
stdcall [glVertex3f], -0.9, 0.0, 0.1
|
||||||
|
stdcall [glVertex3f], -0.636, 0.636, 0.1
|
||||||
|
call [glEnd]
|
||||||
|
|
||||||
|
stdcall [glColor3f],0.0, 0.0, 1.0
|
||||||
|
stdcall [glBegin],GL_LINE_LOOP
|
||||||
|
stdcall [glVertex3f], 0.0, 1.1, 0.1
|
||||||
|
stdcall [glVertex3f], 0.778, 0.778, 0.1
|
||||||
|
stdcall [glVertex3f], 2.1, 0.0, 0.1
|
||||||
|
stdcall [glVertex3f], 0.778, -0.778, 0.1
|
||||||
|
stdcall [glVertex3f], 0.0, -1.1, 0.1
|
||||||
|
stdcall [glVertex3f], -0.778, -0.778, 0.1
|
||||||
|
stdcall [glVertex3f], -2.1, 0.0, 0.1
|
||||||
|
stdcall [glVertex3f], -0.778, 0.778, 0.1
|
||||||
|
call [glEnd]
|
||||||
|
;---
|
||||||
|
call [glEndList]
|
||||||
|
|
||||||
|
call draw_3d
|
||||||
|
|
||||||
|
align 4
|
||||||
|
red_win:
|
||||||
|
call draw_window
|
||||||
|
|
||||||
|
align 4
|
||||||
|
still:
|
||||||
|
mcall 10
|
||||||
|
cmp al,1
|
||||||
|
jz red_win
|
||||||
|
cmp al,2
|
||||||
|
jz key
|
||||||
|
cmp al,3
|
||||||
|
jz button
|
||||||
|
jmp still
|
||||||
|
|
||||||
|
align 4
|
||||||
|
draw_window:
|
||||||
|
pushad
|
||||||
|
mcall 12,1
|
||||||
|
|
||||||
|
mov edx,0x33ffffff ;0x73ffffff
|
||||||
|
mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption
|
||||||
|
stdcall [kosglSwapBuffers]
|
||||||
|
|
||||||
|
mcall 12,2
|
||||||
|
popad
|
||||||
|
ret
|
||||||
|
|
||||||
|
align 4
|
||||||
|
key:
|
||||||
|
mcall 2
|
||||||
|
|
||||||
|
cmp ah,27 ;Esc
|
||||||
|
je button.exit
|
||||||
|
|
||||||
|
;178 ;Up
|
||||||
|
;177 ;Down
|
||||||
|
cmp ah,176 ;Left
|
||||||
|
jne @f
|
||||||
|
fld dword[angle_z]
|
||||||
|
fadd dword[delt_size]
|
||||||
|
fstp dword[angle_z]
|
||||||
|
call draw_3d
|
||||||
|
stdcall [kosglSwapBuffers]
|
||||||
|
@@:
|
||||||
|
cmp ah,179 ;Right
|
||||||
|
jne @f
|
||||||
|
fld dword[angle_z]
|
||||||
|
fsub dword[delt_size]
|
||||||
|
fstp dword[angle_z]
|
||||||
|
call draw_3d
|
||||||
|
stdcall [kosglSwapBuffers]
|
||||||
|
@@:
|
||||||
|
|
||||||
|
jmp still
|
||||||
|
|
||||||
|
align 4
|
||||||
|
button:
|
||||||
|
mcall 17
|
||||||
|
cmp ah,1
|
||||||
|
jne still
|
||||||
|
.exit:
|
||||||
|
mcall -1
|
||||||
|
|
||||||
|
|
||||||
|
align 4
|
||||||
|
caption db 'Test tinygl library, [Esc] - exit, [<-] and [->] - rotate',0
|
||||||
|
align 4
|
||||||
|
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
|
||||||
|
;sizeof.TinyGLContext = 28
|
||||||
|
|
||||||
|
align 4
|
||||||
|
draw_3d:
|
||||||
|
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
|
||||||
|
|
||||||
|
stdcall [glPushMatrix]
|
||||||
|
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
|
||||||
|
stdcall [glScalef], 0.3,0.3,0.3
|
||||||
|
|
||||||
|
stdcall [glCallList],[obj1]
|
||||||
|
|
||||||
|
stdcall [glPopMatrix]
|
||||||
|
ret
|
||||||
|
|
||||||
|
align 4
|
||||||
|
angle_z dd 0.0
|
||||||
|
delt_size dd 3.0
|
||||||
|
obj1 dd ?
|
||||||
|
|
||||||
|
;--------------------------------------------------
|
||||||
|
align 4
|
||||||
|
import_lib_tinygl:
|
||||||
|
|
||||||
|
macro E_LIB n
|
||||||
|
{
|
||||||
|
n dd sz_#n
|
||||||
|
}
|
||||||
|
include '../export.inc'
|
||||||
|
dd 0,0
|
||||||
|
macro E_LIB n
|
||||||
|
{
|
||||||
|
sz_#n db `n,0
|
||||||
|
}
|
||||||
|
include '../export.inc'
|
||||||
|
|
||||||
|
;--------------------------------------------------
|
||||||
|
system_path db '/sys/lib/'
|
||||||
|
name_tgl db 'tinygl.obj',0
|
||||||
|
err_message_found_lib db 'Sorry I cannot load library tinygl.obj',0
|
||||||
|
head_f_i:
|
||||||
|
head_f_l db 'System error',0
|
||||||
|
err_message_import db 'Error on load import library tinygl.obj',0
|
||||||
|
;--------------------------------------------------
|
||||||
|
|
||||||
|
i_end:
|
||||||
|
rb 1024
|
||||||
|
stacktop:
|
||||||
|
cur_dir_path:
|
||||||
|
rb 4096
|
||||||
|
library_path:
|
||||||
|
rb 4096
|
||||||
|
mem:
|
@ -15,21 +15,17 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
proc endSharedState uses eax ebx, context:dword
|
proc endSharedState uses eax ebx, context:dword
|
||||||
mov ebx,[context]
|
mov ebx,[context]
|
||||||
mov ebx,[ebx+offs_cont_shared_state]
|
|
||||||
|
|
||||||
; int i;
|
|
||||||
; for(i=0;i<MAX_DISPLAY_LISTS;i++) {
|
; for(i=0;i<MAX_DISPLAY_LISTS;i++) {
|
||||||
; /* TODO */
|
; /* TODO */
|
||||||
; }
|
; }
|
||||||
stdcall gl_free, dword[ebx] ;lists
|
stdcall gl_free, dword[ebx+offs_cont_shared_state] ;lists
|
||||||
stdcall gl_free, dword[ebx+4] ;texture_hash_table
|
stdcall gl_free, dword[ebx+offs_cont_shared_state+4] ;texture_hash_table
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc glInit uses eax ebx ecx edx, zbuffer1:dword
|
proc glInit uses eax ebx ecx edx, zbuffer1:dword
|
||||||
; int i;
|
|
||||||
|
|
||||||
stdcall gl_zalloc,sizeof.GLContext
|
stdcall gl_zalloc,sizeof.GLContext
|
||||||
mov dword[gl_ctx],eax
|
mov dword[gl_ctx],eax
|
||||||
mov edx,eax
|
mov edx,eax
|
||||||
|
@ -33,45 +33,75 @@ proc find_list uses ebx, context:dword, list:dword
|
|||||||
shl ebx,2
|
shl ebx,2
|
||||||
add eax,ebx
|
add eax,ebx
|
||||||
mov eax,[eax]
|
mov eax,[eax]
|
||||||
|
if DEBUG ;find_list
|
||||||
|
push edi
|
||||||
|
mov ecx,80
|
||||||
|
lea edi,[buf_param]
|
||||||
|
stdcall convert_int_to_str,ecx
|
||||||
|
|
||||||
|
stdcall str_n_cat,edi,txt_nl,2
|
||||||
|
stdcall dbg_print,f_find_l,buf_param
|
||||||
|
pop edi
|
||||||
|
end if
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;static void delete_list(GLContext *c,int list)
|
align 4
|
||||||
;{
|
proc delete_list uses eax ebx ecx edx, context:dword, list:dword
|
||||||
; GLParamBuffer *pb,*pb1;
|
mov ebx,[context]
|
||||||
; GLList *l;
|
stdcall find_list,ebx,[list]
|
||||||
|
mov edx,eax
|
||||||
; l=find_list(c,list);
|
|
||||||
; assert(l != NULL);
|
; assert(l != NULL);
|
||||||
|
|
||||||
; /* free param buffer */
|
; free param buffer
|
||||||
; pb=l->first_op_buffer;
|
mov eax,[edx] ;eax = GLList.first_op_buffer
|
||||||
; while (pb!=NULL) {
|
@@:
|
||||||
; pb1=pb->next;
|
cmp eax,0
|
||||||
; gl_free(pb);
|
je .end_w
|
||||||
; pb=pb1;
|
mov ecx,[eax+offs_gpbu_next]
|
||||||
; }
|
stdcall gl_free,eax
|
||||||
|
mov eax,ecx
|
||||||
|
jmp @b
|
||||||
|
.end_w:
|
||||||
|
|
||||||
; gl_free(l);
|
stdcall gl_free,edx
|
||||||
; c->shared_state.lists[list]=NULL;
|
mov ecx,[list]
|
||||||
;}
|
shl ecx,2
|
||||||
|
mov ebx,[ebx+offs_cont_shared_state] ;ebx = &context.shared_state.lists
|
||||||
|
add ebx,ecx
|
||||||
|
mov dword[ebx],0 ;=NULL
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
;static GLList *alloc_list(GLContext *c,int list)
|
align 4
|
||||||
;{
|
proc alloc_list uses ebx ecx, context:dword, list:dword
|
||||||
; GLList *l;
|
stdcall gl_zalloc,sizeof.GLParamBuffer
|
||||||
; GLParamBuffer *ob;
|
mov ecx,eax
|
||||||
|
stdcall gl_zalloc,sizeof.GLList
|
||||||
|
|
||||||
; l=gl_zalloc(sizeof(GLList));
|
mov dword[ecx+offs_gpbu_next],0 ;ob.next=NULL
|
||||||
; ob=gl_zalloc(sizeof(GLParamBuffer));
|
mov dword[eax],ecx ;l.first_op_buffer=ob
|
||||||
|
|
||||||
; ob->next=NULL;
|
mov dword[ecx+offs_gpbu_ops],OP_EndList ;ob.ops[0].op=OP_EndList
|
||||||
; l->first_op_buffer=ob;
|
|
||||||
|
|
||||||
; ob->ops[0].op=OP_EndList;
|
mov ebx,[context]
|
||||||
|
mov ebx,[ebx+offs_cont_shared_state]
|
||||||
|
mov ecx,[list]
|
||||||
|
shl ecx,2
|
||||||
|
add ebx,ecx
|
||||||
|
mov [ebx],eax ;context.shared_state.lists[list]=l
|
||||||
|
if DEBUG ;alloc_list
|
||||||
|
push edi
|
||||||
|
mov ecx,80
|
||||||
|
lea edi,[buf_param]
|
||||||
|
stdcall convert_int_to_str,ecx
|
||||||
|
|
||||||
; c->shared_state.lists[list]=l;
|
stdcall str_n_cat,edi,txt_nl,2
|
||||||
; return l;
|
stdcall dbg_print,f_alloc_l,buf_param
|
||||||
;}
|
pop edi
|
||||||
|
end if
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
;void gl_print_op(FILE *f,GLParam *p)
|
;void gl_print_op(FILE *f,GLParam *p)
|
||||||
;{
|
;{
|
||||||
@ -102,43 +132,55 @@ endp
|
|||||||
;}
|
;}
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc gl_compile_op uses eax ebx, context:dword, p:dword
|
proc gl_compile_op, context:dword, p:dword
|
||||||
mov eax,[context]
|
pushad
|
||||||
; int op,op_size;
|
mov edx,[context]
|
||||||
; GLParamBuffer *ob,*ob1;
|
|
||||||
; int index,i;
|
|
||||||
|
|
||||||
; op=p[0].op;
|
lea ebx,[op_table_size]
|
||||||
; op_size=op_table_size[op];
|
mov ecx,[p]
|
||||||
; index=c->current_op_buffer_index;
|
mov ecx,[ecx]
|
||||||
; ob=c->current_op_buffer;
|
shl ecx,2
|
||||||
|
add ecx,ebx
|
||||||
|
mov ecx,[ecx] ;ecx = кол-во параметров в компилируемой функции
|
||||||
|
mov ebx,[edx+offs_cont_current_op_buffer_index]
|
||||||
|
mov eax,[edx+offs_cont_current_op_buffer]
|
||||||
|
|
||||||
; /* we should be able to add a NextBuffer opcode */
|
; we should be able to add a NextBuffer opcode
|
||||||
; if ((index + op_size) > (OP_BUFFER_MAX_SIZE-2)) {
|
mov esi,ebx
|
||||||
|
add esi,ecx
|
||||||
|
cmp esi,(OP_BUFFER_MAX_SIZE-2)
|
||||||
|
jle @f
|
||||||
|
mov edi,eax
|
||||||
|
stdcall gl_zalloc,sizeof.GLParamBuffer
|
||||||
|
mov dword[eax+offs_gpbu_next],0 ;=NULL
|
||||||
|
|
||||||
; ob1=gl_zalloc(sizeof(GLParamBuffer));
|
mov dword[edi+offs_gpbu_next],eax
|
||||||
; ob1->next=NULL;
|
mov esi,ebx
|
||||||
|
shl esi,2
|
||||||
|
add esi,edi
|
||||||
|
mov dword[esi+offs_gpbu_ops],OP_NextBuffer
|
||||||
|
mov dword[esi+offs_gpbu_ops+4],eax
|
||||||
|
|
||||||
; ob->next=ob1;
|
mov dword[edx+offs_cont_current_op_buffer],eax
|
||||||
; ob->ops[index].op=OP_NextBuffer;
|
xor ebx,ebx
|
||||||
; ob->ops[index+1].p=(void *)ob1;
|
@@:
|
||||||
|
|
||||||
; c->current_op_buffer=ob1;
|
mov esi,[p]
|
||||||
; ob=ob1;
|
@@:
|
||||||
; index=0;
|
mov edi,ebx
|
||||||
; }
|
shl edi,2
|
||||||
|
add edi,eax
|
||||||
; for(i=0;i<op_size;i++) {
|
movsd
|
||||||
; ob->ops[index]=p[i];
|
inc ebx
|
||||||
; index++;
|
loop @b
|
||||||
; }
|
mov dword[edx+offs_cont_current_op_buffer_index],ebx
|
||||||
; c->current_op_buffer_index=index;
|
popad
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc gl_add_op uses eax ebx ecx, p:dword ;GLParam*
|
proc gl_add_op uses eax ebx ecx, p:dword ;GLParam*
|
||||||
if DEBUG
|
if DEBUG ;gl_add_op
|
||||||
push edi esi
|
push edi esi
|
||||||
mov ebx,[p]
|
mov ebx,[p]
|
||||||
mov ebx,[ebx]
|
mov ebx,[ebx]
|
||||||
@ -209,6 +251,7 @@ end if
|
|||||||
add ecx,ebx
|
add ecx,ebx
|
||||||
call dword[ecx] ;op_table_func[op](c,p)
|
call dword[ecx] ;op_table_func[op](c,p)
|
||||||
@@:
|
@@:
|
||||||
|
call gl_get_context
|
||||||
cmp dword[eax+offs_cont_compile_flag],0
|
cmp dword[eax+offs_cont_compile_flag],0
|
||||||
je @f
|
je @f
|
||||||
stdcall gl_compile_op,eax,[p]
|
stdcall gl_compile_op,eax,[p]
|
||||||
@ -234,61 +277,107 @@ proc glopNextBuffer, context:dword, p:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;void glopCallList(GLContext *c,GLParam *p)
|
align 4
|
||||||
;{
|
proc glopCallList uses eax ebx ecx edx edi, context:dword, p:dword
|
||||||
; GLList *l;
|
mov edx,[context]
|
||||||
; int list,op;
|
mov ebx,[p]
|
||||||
|
|
||||||
; list=p[1].ui;
|
stdcall find_list,edx,[ebx+4]
|
||||||
; l=find_list(c,list);
|
cmp eax,0
|
||||||
; if (l == NULL) gl_fatal_error("list %d not defined",list);
|
jne @f
|
||||||
; p=l->first_op_buffer->ops;
|
;if (eax == NULL) gl_fatal_error("list %d not defined",[ebx+4])
|
||||||
|
@@:
|
||||||
|
mov edi,[eax] ;edi = &GLList.first_op_buffer.ops
|
||||||
|
|
||||||
; while (1) {
|
align 4
|
||||||
; op=p[0].op;
|
.cycle_0: ;while (1)
|
||||||
; if (op == OP_EndList) break;
|
if DEBUG ;glopCallList
|
||||||
; if (op == OP_NextBuffer) {
|
push ecx edi
|
||||||
; p=(GLParam *)p[1].p;
|
mov eax,[edi]
|
||||||
; } else {
|
mov ecx,80
|
||||||
; op_table_func[op](c,p);
|
lea edi,[buf_param]
|
||||||
; p+=op_table_size[op];
|
stdcall convert_int_to_str,ecx
|
||||||
; }
|
|
||||||
; }
|
stdcall str_n_cat,edi,txt_nl,2
|
||||||
;}
|
stdcall dbg_print,txt_op,buf_param
|
||||||
|
pop edi ecx
|
||||||
|
end if
|
||||||
|
cmp dword[edi],OP_EndList
|
||||||
|
je .end_f ;if (op == OP_EndList) break
|
||||||
|
cmp dword[edi],OP_NextBuffer
|
||||||
|
jne .els_0 ;if (op == OP_NextBuffer)
|
||||||
|
mov edi,[edi+4] ;p=p[1].p
|
||||||
|
jmp .cycle_0
|
||||||
|
.els_0:
|
||||||
|
mov ecx,dword[edi] ;ecx = OP_...
|
||||||
|
shl ecx,2
|
||||||
|
lea ebx,[op_table_func]
|
||||||
|
add ecx,ebx
|
||||||
|
stdcall dword[ecx],edx,edi ;op_table_func[op](context,p)
|
||||||
|
|
||||||
|
mov ecx,dword[edi] ;ecx = OP_...
|
||||||
|
shl ecx,2
|
||||||
|
lea ebx,[op_table_size]
|
||||||
|
add ecx,ebx
|
||||||
|
mov ecx,[ecx]
|
||||||
|
shl ecx,2
|
||||||
|
add edi,ecx ;edi += op_table_size[op]
|
||||||
|
jmp .cycle_0
|
||||||
|
.end_f:
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
align 4
|
||||||
|
proc glNewList uses eax ebx, list:dword, mode:dword
|
||||||
|
call gl_get_context
|
||||||
|
mov ebx,eax
|
||||||
|
|
||||||
;void glNewList(unsigned int list,int mode)
|
|
||||||
;{
|
|
||||||
; GLList *l;
|
|
||||||
; GLContext *c=gl_get_context();
|
|
||||||
;
|
|
||||||
; assert(mode == GL_COMPILE || mode == GL_COMPILE_AND_EXECUTE);
|
; assert(mode == GL_COMPILE || mode == GL_COMPILE_AND_EXECUTE);
|
||||||
; assert(c->compile_flag == 0);
|
; assert(ebx->compile_flag == 0);
|
||||||
;
|
|
||||||
; l=find_list(c,list);
|
|
||||||
; if (l!=NULL) delete_list(c,list);
|
|
||||||
; l=alloc_list(c,list);
|
|
||||||
;
|
|
||||||
; c->current_op_buffer=l->first_op_buffer;
|
|
||||||
; c->current_op_buffer_index=0;
|
|
||||||
;
|
|
||||||
; c->compile_flag=1;
|
|
||||||
; c->exec_flag=(mode == GL_COMPILE_AND_EXECUTE);
|
|
||||||
;}
|
|
||||||
|
|
||||||
;void glEndList(void)
|
stdcall find_list,ebx,[list]
|
||||||
;{
|
cmp eax,0
|
||||||
; GLContext *c=gl_get_context();
|
je @f
|
||||||
; GLParam p[1];
|
stdcall delete_list,ebx,[list]
|
||||||
|
@@:
|
||||||
|
stdcall alloc_list,ebx,[list]
|
||||||
|
|
||||||
|
mov eax,[eax] ;eax = GLList.first_op_buffer
|
||||||
|
mov [ebx+offs_cont_current_op_buffer],eax
|
||||||
|
mov dword[ebx+offs_cont_current_op_buffer_index],0
|
||||||
|
|
||||||
|
mov dword[ebx+offs_cont_compile_flag],1
|
||||||
|
xor eax,eax
|
||||||
|
cmp dword[mode],GL_COMPILE_AND_EXECUTE
|
||||||
|
jne @f
|
||||||
|
inc eax ;eax = (mode == GL_COMPILE_AND_EXECUTE)
|
||||||
|
@@:
|
||||||
|
mov [ebx+offs_cont_exec_flag],eax
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
align 4
|
||||||
|
proc glEndList uses eax ebx
|
||||||
|
locals
|
||||||
|
p dd ?
|
||||||
|
endl
|
||||||
|
call gl_get_context
|
||||||
|
|
||||||
; assert(c->compile_flag == 1);
|
; assert(c->compile_flag == 1);
|
||||||
|
|
||||||
; /* end of list */
|
; end of list
|
||||||
; p[0].op=OP_EndList;
|
mov dword[p],OP_EndList
|
||||||
; gl_compile_op(c,p);
|
mov ebx,ebp
|
||||||
|
sub ebx,4 ;=sizeof(dd)
|
||||||
|
stdcall gl_compile_op,eax,ebx
|
||||||
|
|
||||||
; c->compile_flag=0;
|
mov dword[eax+offs_cont_compile_flag],0
|
||||||
; c->exec_flag=1;
|
mov dword[eax+offs_cont_exec_flag],1
|
||||||
;}
|
if DEBUG ;glEndList
|
||||||
|
stdcall dbg_print,f_end_l,txt_nl
|
||||||
|
end if
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
;output:
|
;output:
|
||||||
; eax = (find_list(gl_get_context,list) != NULL)
|
; eax = (find_list(gl_get_context,list) != NULL)
|
||||||
@ -300,30 +389,60 @@ proc glIsList, list:dword
|
|||||||
je @f
|
je @f
|
||||||
mov eax,1
|
mov eax,1
|
||||||
@@:
|
@@:
|
||||||
|
if DEBUG ;glIsList
|
||||||
|
push edi
|
||||||
|
mov ecx,80
|
||||||
|
lea edi,[buf_param]
|
||||||
|
stdcall convert_int_to_str,ecx
|
||||||
|
|
||||||
|
stdcall str_n_cat,edi,txt_nl,2
|
||||||
|
stdcall dbg_print,f_is_l,buf_param
|
||||||
|
pop edi
|
||||||
|
end if
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;unsigned int glGenLists(int range)
|
align 4
|
||||||
;{
|
proc glGenLists uses ebx ecx edx edi esi, range:dword
|
||||||
; GLContext *c=gl_get_context();
|
call gl_get_context
|
||||||
; int count,i,list;
|
mov edi,eax
|
||||||
; GLList **lists;
|
|
||||||
|
|
||||||
; lists=c->shared_state.lists;
|
mov ebx,[eax+offs_cont_shared_state] ;ebx=context.shared_state.lists
|
||||||
; count=0;
|
xor edx,edx ;count=0
|
||||||
; for(i=0;i<MAX_DISPLAY_LISTS;i++) {
|
mov ecx,MAX_DISPLAY_LISTS
|
||||||
; if (lists[i]==NULL) {
|
xor esi,esi
|
||||||
; count++;
|
.cycle_0: ;for(esi=0;esi<MAX_DISPLAY_LISTS;esi++)
|
||||||
; if (count == range) {
|
cmp dword[ebx],0 ;if (ebx[i]==NULL)
|
||||||
; list=i-range+1;
|
je .els_0
|
||||||
; for(i=0;i<range;i++) {
|
inc edx
|
||||||
; alloc_list(c,list+i);
|
cmp edx,[range] ;if (count == range)
|
||||||
; }
|
jne .els_1
|
||||||
; return list;
|
mov ecx,[range]
|
||||||
; }
|
inc esi
|
||||||
; } else {
|
sub esi,ecx ;esi = (esi-range+1)
|
||||||
; count=0;
|
.cycle_1: ;for(i=0;i<range;i++)
|
||||||
; }
|
stdcall alloc_list,edi,esi
|
||||||
; }
|
inc esi
|
||||||
; return 0;
|
loop .cycle_1
|
||||||
;}
|
mov eax,esi
|
||||||
|
jmp .end_f
|
||||||
|
.els_0:
|
||||||
|
xor edx,edx ;count=0
|
||||||
|
.els_1:
|
||||||
|
add ebx,4
|
||||||
|
inc esi
|
||||||
|
loop .cycle_0
|
||||||
|
xor eax,eax
|
||||||
|
.end_f:
|
||||||
|
if DEBUG ;glGenLists
|
||||||
|
push edi
|
||||||
|
mov ecx,80
|
||||||
|
lea edi,[buf_param]
|
||||||
|
stdcall convert_int_to_str,ecx
|
||||||
|
|
||||||
|
stdcall str_n_cat,edi,txt_nl,2
|
||||||
|
stdcall dbg_print,f_gen_l,buf_param
|
||||||
|
pop edi
|
||||||
|
end if
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
@ -64,9 +64,6 @@ glTexCoord3dv: ;(double *)
|
|||||||
glTexCoord4d: ;(double ,double ,double, double )
|
glTexCoord4d: ;(double ,double ,double, double )
|
||||||
glTexCoord4fv: ;(float *)
|
glTexCoord4fv: ;(float *)
|
||||||
glTexCoord4dv: ;(double *)
|
glTexCoord4dv: ;(double *)
|
||||||
glGenLists: ;(int range)
|
|
||||||
glNewList: ;(unsigned int list,int mode)
|
|
||||||
glEndList: ;(void)
|
|
||||||
glGenTextures: ;(int n, unsigned int *textures)
|
glGenTextures: ;(int n, unsigned int *textures)
|
||||||
glDeleteTextures: ;(int n, const unsigned int *textures)
|
glDeleteTextures: ;(int n, const unsigned int *textures)
|
||||||
glGetIntegerv: ;(int pname,int *params)
|
glGetIntegerv: ;(int pname,int *params)
|
||||||
@ -74,12 +71,12 @@ glGetFloatv: ;(int pname, float *v)
|
|||||||
|
|
||||||
; ***
|
; ***
|
||||||
glopLight:
|
glopLight:
|
||||||
glopCallList:
|
|
||||||
|
|
||||||
if DEBUG
|
if DEBUG
|
||||||
align 4
|
align 4
|
||||||
txt_nl db 13,10,0
|
txt_nl db 13,10,0
|
||||||
txt_sp db ' ',0
|
txt_sp db ' ',0
|
||||||
|
txt_op db 'Op_code',0
|
||||||
txt_zp_sp db ', ',0
|
txt_zp_sp db ', ',0
|
||||||
m_1 db '(1)',13,10,0
|
m_1 db '(1)',13,10,0
|
||||||
m_2 db '(2)',13,10,0
|
m_2 db '(2)',13,10,0
|
||||||
@ -159,6 +156,11 @@ f_zb db ' ZB_line',0
|
|||||||
f_cl1 db ' ClipLine1',0
|
f_cl1 db ' ClipLine1',0
|
||||||
f_m4m db 'gl_M4_Mul',0
|
f_m4m db 'gl_M4_Mul',0
|
||||||
f_m4ml db 'gl_M4_MulLeft',0
|
f_m4ml db 'gl_M4_MulLeft',0
|
||||||
|
f_find_l db 'find_list',0
|
||||||
|
f_alloc_l db 'alloc_list',0
|
||||||
|
f_is_l db 'glIsList',0
|
||||||
|
f_gen_l db 'glGenLists',0
|
||||||
|
f_end_l db 'glEndList',0
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc dbg_print, fun:dword, mes:dword
|
proc dbg_print, fun:dword, mes:dword
|
||||||
|
@ -130,9 +130,12 @@ struct GLParamBuffer
|
|||||||
next dd ? ;struct GLParamBuffer*
|
next dd ? ;struct GLParamBuffer*
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
offs_gpbu_ops equ 0
|
||||||
|
offs_gpbu_next equ 4*OP_BUFFER_MAX_SIZE
|
||||||
|
|
||||||
struct GLList
|
struct GLList
|
||||||
first_op_buffer dd ? ;GLParamBuffer*
|
first_op_buffer dd ? ;GLParamBuffer*
|
||||||
; /* TODO: extensions for an hash table or a better allocating scheme */
|
; TODO: extensions for an hash table or a better allocating scheme
|
||||||
ends
|
ends
|
||||||
|
|
||||||
struct GLVertex
|
struct GLVertex
|
||||||
|
Loading…
Reference in New Issue
Block a user