diff --git a/programs/develop/libraries/TinyGL/asm_fork/api.asm b/programs/develop/libraries/TinyGL/asm_fork/api.asm index 25254a09b8..f40e7494aa 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/api.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/api.asm @@ -1021,6 +1021,6 @@ align 4 proc glDebug uses eax, mode:dword stdcall gl_get_context ;после вызова функции в eax указатель на GLContext push dword[mode] - pop dword[eax+offs_cont_print_flag] + pop dword[eax+GLContext.print_flag] ret endp diff --git a/programs/develop/libraries/TinyGL/asm_fork/arrays.asm b/programs/develop/libraries/TinyGL/asm_fork/arrays.asm index c07e8fb635..9c62a9f448 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/arrays.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/arrays.asm @@ -16,13 +16,13 @@ endl mov ebx,[param] mov ebx,[ebx+4] ;ebx = p[1] - bt dword[eax+offs_cont_client_states],1 ;2^1=COLOR_ARRAY + bt dword[eax+GLContext.client_states],1 ;2^1=COLOR_ARRAY jnc @f - mov ecx,[eax+offs_cont_color_array_size] - add ecx,[eax+offs_cont_color_array_stride] + mov ecx,[eax+GLContext.color_array_size] + add ecx,[eax+GLContext.color_array_stride] imul ecx,ebx shl ecx,2 - add ecx,[eax+offs_cont_color_array] ;ecx = &context.color_array[i] + add ecx,[eax+GLContext.color_array] ;ecx = &context.color_array[i] mov ebx,ebp sub ebx,20 ;=sizeof(dd)*5 mov edx,[ecx] @@ -31,7 +31,7 @@ endl mov [ebx+8],edx mov edx,[ecx+8] mov [ebx+12],edx - cmp dword[eax+offs_cont_color_array_size],3 + cmp dword[eax+GLContext.color_array_size],3 jg .l0 mov edx,1.0 jmp .l1 @@ -41,41 +41,41 @@ endl mov [ebx+16],edx stdcall glopColor, eax,ebx @@: - bt dword[eax+offs_cont_client_states],2 ;2^2=NORMAL_ARRAY + bt dword[eax+GLContext.client_states],2 ;2^2=NORMAL_ARRAY jnc @f - mov esi,dword[eax+offs_cont_normal_array_stride] + mov esi,dword[eax+GLContext.normal_array_stride] add esi,3 imul esi,ebx shl esi,2 - add esi,[eax+offs_cont_normal_array] ;esi = &normal_array[ebx * (3 + c->normal_array_stride)] + add esi,[eax+GLContext.normal_array] ;esi = &normal_array[ebx * (3 + c->normal_array_stride)] mov edi,eax - add edi,offs_cont_current_normal + add edi,GLContext.current_normal mov ecx,3 rep movsd mov dword[edi],0.0 @@: - bt dword[eax+offs_cont_client_states],3 ;2^3=TEXCOORD_ARRAY + bt dword[eax+GLContext.client_states],3 ;2^3=TEXCOORD_ARRAY jnc @f - mov ecx,[eax+offs_cont_texcoord_array_size] - add ecx,[eax+offs_cont_texcoord_array_stride] + mov ecx,[eax+GLContext.texcoord_array_size] + add ecx,[eax+GLContext.texcoord_array_stride] imul ecx,ebx shl ecx,2 - add ecx,[eax+offs_cont_texcoord_array] ;ecx = &context.texcoord_array[i] + add ecx,[eax+GLContext.texcoord_array] ;ecx = &context.texcoord_array[i] mov edx,[ecx] - mov [eax+offs_cont_current_tex_coord],edx + mov [eax+GLContext.current_tex_coord],edx mov edx,[ecx+4] - mov [eax+offs_cont_current_tex_coord+4],edx + mov [eax+GLContext.current_tex_coord+4],edx - cmp dword[eax+offs_cont_texcoord_array_size],2 + cmp dword[eax+GLContext.texcoord_array_size],2 jg .l2 mov edx,0.0 jmp .l3 .l2: mov edx,[ecx+8] .l3: - mov [eax+offs_cont_current_tex_coord+8],edx + mov [eax+GLContext.current_tex_coord+8],edx - cmp dword[eax+offs_cont_texcoord_array_size],3 + cmp dword[eax+GLContext.texcoord_array_size],3 jg .l4 mov edx,1.0 jmp .l5 @@ -83,15 +83,15 @@ endl mov edx,[ecx+12] .l5: - mov [eax+offs_cont_current_tex_coord+12],edx + mov [eax+GLContext.current_tex_coord+12],edx @@: - bt dword[eax+offs_cont_client_states],0 ;2^0=VERTEX_ARRAY + bt dword[eax+GLContext.client_states],0 ;2^0=VERTEX_ARRAY jnc @f - mov ecx,[eax+offs_cont_vertex_array_size] - add ecx,[eax+offs_cont_vertex_array_stride] + mov ecx,[eax+GLContext.vertex_array_size] + add ecx,[eax+GLContext.vertex_array_stride] imul ecx,ebx shl ecx,2 - add ecx,[eax+offs_cont_vertex_array] ;ecx = &context.vertex_array[i] + add ecx,[eax+GLContext.vertex_array] ;ecx = &context.vertex_array[i] mov ebx,ebp sub ebx,20 ;=sizeof(dd)*5 mov edx,[ecx] @@ -99,7 +99,7 @@ endl mov edx,[ecx+4] mov [ebx+8],edx - cmp dword[eax+offs_cont_vertex_array_size],2 + cmp dword[eax+GLContext.vertex_array_size],2 jg .l6 mov edx,0.0 jmp .l7 @@ -107,7 +107,7 @@ endl mov edx,[ecx+8] .l7: mov [ebx+12],edx - cmp dword[eax+offs_cont_vertex_array_size],3 + cmp dword[eax+GLContext.vertex_array_size],3 jg .l8 mov edx,1.0 jmp .l9 @@ -149,7 +149,7 @@ pushad mov edx,[context] mov ebx,[param] mov ecx,[ebx+12] ;count = param[3].i - mov eax,[edx+offs_cont_client_states] + mov eax,[edx+GLContext.client_states] mov [states],eax mov eax,[ebx+8] mov [idx],eax ;param[2].i @@ -166,12 +166,12 @@ align 4 jge .cycle_0_end bt dword[states],1 ;2^1=COLOR_ARRAY jnc @f - mov esi,[edx+offs_cont_color_array_size] + mov esi,[edx+GLContext.color_array_size] mov [size],esi - add esi,[edx+offs_cont_color_array_stride] + add esi,[edx+GLContext.color_array_stride] imul esi,[idx] ;esi = i shl esi,2 - add esi,[edx+offs_cont_color_array] ;esi = &context.color_array[i] + add esi,[edx+GLContext.color_array] ;esi = &context.color_array[i] mov edi,ebp sub edi,28 ;edi = &p[1] mov ebx,[esi+8] @@ -203,13 +203,13 @@ align 4 @@: bt dword[states],2 ;2^2=NORMAL_ARRAY jnc @f - mov esi,[edx+offs_cont_normal_array_stride] + mov esi,[edx+GLContext.normal_array_stride] add esi,3 imul esi,[idx] shl esi,2 - add esi,[edx+offs_cont_normal_array] ;esi = &context.normal_array[ idx * (3 + context.normal_array_stride) ] + add esi,[edx+GLContext.normal_array] ;esi = &context.normal_array[ idx * (3 + context.normal_array_stride) ] mov edi,edx - add edi,offs_cont_current_normal + add edi,GLContext.current_normal movsd ;context.current_normal.X = context.normal_array[i] movsd movsd @@ -217,14 +217,14 @@ align 4 @@: bt dword[states],3 ;2^3=TEXCOORD_ARRAY jnc @f - mov esi,[edx+offs_cont_texcoord_array_size] + mov esi,[edx+GLContext.texcoord_array_size] mov [size],esi - add esi,[edx+offs_cont_texcoord_array_stride] + add esi,[edx+GLContext.texcoord_array_stride] imul esi,[idx] ;esi = i shl esi,2 - add esi,[edx+offs_cont_texcoord_array] ;esi = &context.texcoord_array[i] + add esi,[edx+GLContext.texcoord_array] ;esi = &context.texcoord_array[i] mov edi,edx - add edi,offs_cont_current_tex_coord + add edi,GLContext.current_tex_coord movsd ;context.current_tex_coord.X = ccontext.texcoord_array[i] movsd cmp dword[size],2 @@ -244,12 +244,12 @@ align 4 @@: bt dword[states],0 ;2^0=VERTEX_ARRAY jnc @f - mov esi,[edx+offs_cont_vertex_array_size] + mov esi,[edx+GLContext.vertex_array_size] mov [size],esi - add esi,[edx+offs_cont_vertex_array_stride] + add esi,[edx+GLContext.vertex_array_stride] imul esi,[idx] ;esi = i shl esi,2 - add esi,[edx+offs_cont_vertex_array] ;esi = &context.vertex_array[i] + add esi,[edx+GLContext.vertex_array] ;esi = &context.vertex_array[i] mov edi,ebp sub edi,28 ;edi = &p[1] movsd ;p[1].f = context.vertex_array[i] @@ -319,7 +319,7 @@ endl pushad mov edx,[context] mov ebx,[param] - mov eax,[edx+offs_cont_client_states] + mov eax,[edx+GLContext.client_states] mov [states],eax mov eax,[ebx+4] mov [p+4],eax ;p[1].i = param[1].i @@ -353,12 +353,12 @@ align 4 bt dword[states],1 ;2^1=COLOR_ARRAY jnc @f - mov esi,[edx+offs_cont_color_array_size] + mov esi,[edx+GLContext.color_array_size] mov [size],esi - add esi,[edx+offs_cont_color_array_stride] + add esi,[edx+GLContext.color_array_stride] imul esi,[idx] ;esi = i shl esi,2 - add esi,[edx+offs_cont_color_array] ;esi = &context.color_array[i] + add esi,[edx+GLContext.color_array] ;esi = &context.color_array[i] mov edi,ebp sub edi,28 ;edi = &p[1] mov ebx,[esi+8] @@ -390,13 +390,13 @@ align 4 @@: bt dword[states],2 ;2^2=NORMAL_ARRAY jnc @f - mov esi,[edx+offs_cont_normal_array_stride] + mov esi,[edx+GLContext.normal_array_stride] add esi,3 imul esi,[idx] ;esi = idx * (3 + context.normal_array_stride) shl esi,2 - add esi,[edx+offs_cont_normal_array] + add esi,[edx+GLContext.normal_array] mov edi,edx - add edi,offs_cont_current_normal + add edi,GLContext.current_normal movsd ;context.current_normal.X = context.normal_array[i] movsd movsd @@ -404,14 +404,14 @@ align 4 @@: bt dword[states],3 ;2^3=TEXCOORD_ARRAY jnc @f - mov esi,[edx+offs_cont_texcoord_array_size] + mov esi,[edx+GLContext.texcoord_array_size] mov [size],esi - add esi,[edx+offs_cont_texcoord_array_stride] + add esi,[edx+GLContext.texcoord_array_stride] imul esi,[idx] ;esi = i shl esi,2 - add esi,[edx+offs_cont_texcoord_array] ;esi = &context.texcoord_array[i] + add esi,[edx+GLContext.texcoord_array] ;esi = &context.texcoord_array[i] mov edi,edx - add edi,offs_cont_current_tex_coord + add edi,GLContext.current_tex_coord movsd ;context.current_tex_coord.X = ccontext.texcoord_array[i] movsd cmp dword[size],2 @@ -431,12 +431,12 @@ align 4 @@: bt dword[states],0 ;2^0=VERTEX_ARRAY jnc @f - mov esi,[edx+offs_cont_vertex_array_size] + mov esi,[edx+GLContext.vertex_array_size] mov [size],esi - add esi,[edx+offs_cont_vertex_array_stride] + add esi,[edx+GLContext.vertex_array_stride] imul esi,[idx] ;esi = i shl esi,2 - add esi,[edx+offs_cont_vertex_array] ;esi = &context.vertex_array[i] + add esi,[edx+GLContext.vertex_array] ;esi = &context.vertex_array[i] mov edi,ebp sub edi,28 ;edi = &p[1] movsd ;p[1].f = context.vertex_array[i] @@ -499,7 +499,7 @@ proc glopEnableClientState uses eax ebx, context:dword, p:dword mov eax,[context] mov ebx,[p] mov ebx,[ebx+4] ;ebx = p[1] - or dword[eax+offs_cont_client_states],ebx + or dword[eax+GLContext.client_states],ebx ret endp @@ -544,7 +544,7 @@ proc glopDisableClientState uses eax ebx, context:dword, p:dword mov eax,[context] mov ebx,[p] mov ebx,[ebx+4] ;ebx = p[1] - and dword[eax+offs_cont_client_states],ebx + and dword[eax+GLContext.client_states],ebx ret endp @@ -589,11 +589,11 @@ proc glopVertexPointer uses eax ebx ecx, context:dword, p:dword mov eax,[context] mov ebx,[p] mov ecx,[ebx+4] ;ecx = p[1] - mov dword[eax+offs_cont_vertex_array_size],ecx + mov dword[eax+GLContext.vertex_array_size],ecx mov ecx,[ebx+8] ;ecx = p[2] - mov dword[eax+offs_cont_vertex_array_stride],ecx + mov dword[eax+GLContext.vertex_array_stride],ecx mov ecx,[ebx+12] ;ecx = p[3] - mov dword[eax+offs_cont_vertex_array],ecx + mov dword[eax+GLContext.vertex_array],ecx ret endp @@ -623,11 +623,11 @@ proc glopColorPointer uses eax ebx ecx, context:dword, p:dword mov eax,[context] mov ebx,[p] mov ecx,[ebx+4] ;ecx = p[1] - mov dword[eax+offs_cont_color_array_size],ecx + mov dword[eax+GLContext.color_array_size],ecx mov ecx,[ebx+8] ;ecx = p[2] - mov dword[eax+offs_cont_color_array_stride],ecx + mov dword[eax+GLContext.color_array_stride],ecx mov ecx,[ebx+12] ;ecx = p[3] - mov dword[eax+offs_cont_color_array],ecx + mov dword[eax+GLContext.color_array],ecx ret endp @@ -657,9 +657,9 @@ proc glopNormalPointer uses eax ebx ecx, context:dword, p:dword mov eax,[context] mov ebx,[p] mov ecx,[ebx+4] ;ecx = p[1] - mov dword[eax+offs_cont_normal_array_stride],ecx + mov dword[eax+GLContext.normal_array_stride],ecx mov ecx,[ebx+8] ;ecx = p[2] - mov dword[eax+offs_cont_normal_array],ecx + mov dword[eax+GLContext.normal_array],ecx ret endp @@ -687,11 +687,11 @@ proc glopTexCoordPointer uses eax ebx ecx, context:dword, p:dword mov eax,[context] mov ebx,[p] mov ecx,[ebx+4] ;ecx = p[1] - mov dword[eax+offs_cont_texcoord_array_size],ecx + mov dword[eax+GLContext.texcoord_array_size],ecx mov ecx,[ebx+8] ;ecx = p[2] - mov dword[eax+offs_cont_texcoord_array_stride],ecx + mov dword[eax+GLContext.texcoord_array_stride],ecx mov ecx,[ebx+12] ;ecx = p[3] - mov dword[eax+offs_cont_texcoord_array],ecx + mov dword[eax+GLContext.texcoord_array],ecx ret endp diff --git a/programs/develop/libraries/TinyGL/asm_fork/clear.asm b/programs/develop/libraries/TinyGL/asm_fork/clear.asm index 2aabccdcfc..d4f2a07265 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/clear.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/clear.asm @@ -4,7 +4,7 @@ proc glopClearColor uses ecx esi edi, context:dword, p:dword mov esi,[p] add esi,4 mov edi,[context] - add edi,offs_cont_clear_color + add edi,GLContext.clear_color mov ecx,4 rep movsd ret @@ -15,7 +15,7 @@ proc glopClearDepth uses eax ebx, context:dword, p:dword mov eax,[context] mov ebx,[p] mov ebx,[ebx+4] ;ebx = p[1] - mov dword[eax+offs_cont_clear_depth],ebx + mov dword[eax+GLContext.clear_depth],ebx ret endp @@ -25,13 +25,13 @@ fl_65535 dd 65535.0 align 4 proc glopClear uses eax ebx, context:dword, p:dword mov eax,[context] - fld dword[eax+offs_cont_clear_color+8] ;context.clear_color.v[2] + fld dword[eax+GLContext.clear_color+8] ;context.clear_color.v[2] fmul dword[fl_65535] fistp dword[esp-4] - fld dword[eax+offs_cont_clear_color+4] ;context.clear_color.v[1] + fld dword[eax+GLContext.clear_color+4] ;context.clear_color.v[1] fmul dword[fl_65535] fistp dword[esp-8] - fld dword[eax+offs_cont_clear_color] ;context.clear_color.v[0] + fld dword[eax+GLContext.clear_color] ;context.clear_color.v[0] fmul dword[fl_65535] fistp dword[esp-12] sub esp,12 @@ -45,7 +45,7 @@ proc glopClear uses eax ebx, context:dword, p:dword and ebx,GL_DEPTH_BUFFER_BIT ; TODO : correct value of Z - stdcall ZB_clear,[eax+offs_cont_zb],ebx,0 ;,...,r,g,b + stdcall ZB_clear,[eax+GLContext.zb],ebx,0 ;,...,r,g,b ret endp diff --git a/programs/develop/libraries/TinyGL/asm_fork/clip.asm b/programs/develop/libraries/TinyGL/asm_fork/clip.asm index 9107fbc748..09947f3280 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/clip.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/clip.asm @@ -19,24 +19,24 @@ proc gl_transform_to_viewport uses eax ebx ecx, context:dword,v:dword fld dword[ebx+offs_vert_pc+offs_X] ;st0 = v.pc.X fmul st0,st1 - fmul dword[eax+offs_cont_viewport+offs_vpor_scale+offs_X] - fadd dword[eax+offs_cont_viewport+offs_vpor_trans+offs_X] + fmul dword[eax+GLContext.viewport+offs_vpor_scale+offs_X] + fadd dword[eax+GLContext.viewport+offs_vpor_trans+offs_X] fistp dword[ebx+offs_vert_zp] ;v.zp.x = st0, st0 = st1 fld dword[ebx+offs_vert_pc+offs_Y] ;st0 = v.pc.Y fmul st0,st1 - fmul dword[eax+offs_cont_viewport+offs_vpor_scale+offs_Y] - fadd dword[eax+offs_cont_viewport+offs_vpor_trans+offs_Y] + fmul dword[eax+GLContext.viewport+offs_vpor_scale+offs_Y] + fadd dword[eax+GLContext.viewport+offs_vpor_trans+offs_Y] fistp dword[ebx+offs_vert_zp+offs_zbup_y] ;v.zp.y = st0, st0 = st1 fld dword[ebx+offs_vert_pc+offs_Z] ;st0 = v.pc.Z fmulp - fmul dword[eax+offs_cont_viewport+offs_vpor_scale+offs_Z] - fadd dword[eax+offs_cont_viewport+offs_vpor_trans+offs_Z] + fmul dword[eax+GLContext.viewport+offs_vpor_scale+offs_Z] + fadd dword[eax+GLContext.viewport+offs_vpor_trans+offs_Z] fistp dword[ebx+offs_vert_zp+offs_zbup_z] ;v.zp.z = st0, st0 = st1 ; color - cmp dword[eax+offs_cont_lighting_enabled],0 ;if (context.lighting_enabled) + cmp dword[eax+GLContext.lighting_enabled],0 ;if (context.lighting_enabled) je @f mov ecx,ebx add ecx,offs_vert_zp+offs_zbup_b @@ -50,18 +50,18 @@ proc gl_transform_to_viewport uses eax ebx ecx, context:dword,v:dword align 4 @@: ; no need to convert to integer if no lighting : take current color - mov ecx,[eax+offs_cont_longcurrent_color] + mov ecx,[eax+GLContext.longcurrent_color] mov dword[ebx+offs_vert_zp+offs_zbup_r],ecx - mov ecx,[eax+offs_cont_longcurrent_color+4] + mov ecx,[eax+GLContext.longcurrent_color+4] mov dword[ebx+offs_vert_zp+offs_zbup_g],ecx - mov ecx,[eax+offs_cont_longcurrent_color+8] + mov ecx,[eax+GLContext.longcurrent_color+8] mov dword[ebx+offs_vert_zp+offs_zbup_b],ecx .end_if: ; texture - cmp dword[eax+offs_cont_texture_2d_enabled],0 + cmp dword[eax+GLContext.texture_2d_enabled],0 je @f - mov eax,[eax+offs_cont_current_texture] ;eax = &context.current_texture + mov eax,[eax+GLContext.current_texture] ;eax = &context.current_texture mov eax,[eax] ;eax = context.current_texture ;[eax+offs_text_images] = im = &context.current_texture.images[0] @@ -116,14 +116,14 @@ proc gl_draw_point uses eax ebx, context:dword, p0:dword cmp dword[ebx+offs_vert_clip_code],0 ;if (p0.clip_code == 0) jne @f mov eax,[context] - cmp dword[eax+offs_cont_render_mode],GL_SELECT + cmp dword[eax+GLContext.render_mode],GL_SELECT jne .els stdcall gl_add_select, eax,dword[ebx+offs_vert_zp+offs_zbup_z],dword[ebx+offs_vert_zp+offs_zbup_z] ;p0.zp.z,p0.zp.z jmp @f align 4 .els: add ebx,offs_vert_zp - stdcall ZB_plot, dword[eax+offs_cont_zb],ebx + stdcall ZB_plot, dword[eax+GLContext.zb],ebx @@: ret endp @@ -285,7 +285,7 @@ pushad cmp dword[esi+offs_vert_clip_code],0 jne .els_i ;if ( (p1.clip_code | p2.clip_code) == 0) - cmp dword[edx+offs_cont_render_mode],GL_SELECT ;if (context.render_mode == GL_SELECT) + cmp dword[edx+GLContext.render_mode],GL_SELECT ;if (context.render_mode == GL_SELECT) jne .els_1 stdcall gl_add_select1, edx,dword[edi+offs_vert_zp+offs_zbup_z],\ dword[esi+offs_vert_zp+offs_zbup_z],dword[esi+offs_vert_zp+offs_zbup_z] @@ -296,15 +296,15 @@ align 4 add esi,offs_vert_zp push esi push edi - push dword[edx+offs_cont_zb] - cmp dword[edx+offs_cont_depth_test],0 + push dword[edx+GLContext.zb] + cmp dword[edx+GLContext.depth_test],0 je .els_2 ;if (context.depth_test) - call ZB_line_z ;, dword[edx+offs_cont_zb],edi,esi + call ZB_line_z ;, dword[edx+GLContext.zb],edi,esi jmp .end_f align 4 .els_2: - call ZB_line ;, dword[edx+offs_cont_zb],edi,esi + call ZB_line ;, dword[edx+GLContext.zb],edi,esi jmp .end_f align 4 .els_i: @@ -451,8 +451,8 @@ align 4 push eax sub eax,sizeof.GLVertex ;eax = &q1.zp push eax - push dword[edx+offs_cont_zb] - cmp dword[edx+offs_cont_depth_test],0 + push dword[edx+GLContext.zb] + cmp dword[edx+GLContext.depth_test],0 je .els_3 call ZB_line_z ;(context.zb,&q1.zp,&q2.zp) jmp .end_f @@ -592,7 +592,7 @@ align 16 proc updateTmp uses eax ecx edx, context:dword, p0:dword, p1:dword, t:dword mov edx,[context] mov eax,[p0] - cmp dword[edx+offs_cont_current_shade_model],GL_SMOOTH ;if (context.current_shade_model == GL_SMOOTH) + cmp dword[edx+GLContext.current_shade_model],GL_SMOOTH ;if (context.current_shade_model == GL_SMOOTH) jne .els_0 mov ecx,[p1] fld dword[ecx+offs_vert_color] @@ -621,7 +621,7 @@ align 4 mov [edi+offs_vert_color+8],ecx ;q.color.v[2]=p0.color.v[2] @@: - cmp dword[edx+offs_cont_texture_2d_enabled],0 ;if (context.texture_2d_enabled) + cmp dword[edx+GLContext.texture_2d_enabled],0 ;if (context.texture_2d_enabled) je @f mov ecx,[p1] fld dword[ecx+offs_vert_tex_coord+offs_X] @@ -709,37 +709,37 @@ pushad inc dword[front] ;front = norm < 0.0 @@: mov edi,[context] - mov eax,dword[edi+offs_cont_current_front_face] + mov eax,dword[edi+GLContext.current_front_face] xor dword[front],eax ;front ^= context.current_front_face ; back face culling - cmp dword[edi+offs_cont_cull_face_enabled],0 + cmp dword[edi+GLContext.cull_face_enabled],0 je .els_1 ; most used case first - cmp dword[edi+offs_cont_current_cull_face],GL_BACK + cmp dword[edi+GLContext.current_cull_face],GL_BACK jne @f cmp dword[front],0 je .end_f - stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx + stdcall dword[edi+GLContext.draw_triangle_front], edi,ebx,ecx,edx jmp .end_f align 4 @@: - cmp dword[edi+offs_cont_current_cull_face],GL_FRONT + cmp dword[edi+GLContext.current_cull_face],GL_FRONT jne .end_f cmp dword[front],0 jne .end_f - stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx + stdcall dword[edi+GLContext.draw_triangle_back], edi,ebx,ecx,edx jmp .end_f align 4 .els_1: ; no culling cmp dword[front],0 je @f - stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx + stdcall dword[edi+GLContext.draw_triangle_front], edi,ebx,ecx,edx jmp .end_f align 4 @@: - stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx + stdcall dword[edi+GLContext.draw_triangle_back], edi,ebx,ecx,edx jmp .end_f align 4 .els_0: @@ -1035,24 +1035,24 @@ end if mov ecx,[p2] add ecx,offs_vert_zp mov edx,[context] - cmp dword[edx+offs_cont_texture_2d_enabled],0 + cmp dword[edx+GLContext.texture_2d_enabled],0 je .els_i ;if (context.texture_2d_enabled) if PROFILE eq 1 inc dword[count_triangles_textured] end if - mov eax,[edx+offs_cont_current_texture] + mov eax,[edx+GLContext.current_texture] mov eax,[eax] ;переход по указателю ;так как offs_text_images+offs_imag_pixmap = 0 то context.current_texture.images[0].pixmap = [eax] - stdcall ZB_setTexture, [edx+offs_cont_zb], [eax],\ + stdcall ZB_setTexture, [edx+GLContext.zb], [eax],\ [eax+offs_imag_s_bound],[eax+offs_imag_t_bound],[eax+offs_imag_xsize_log2] mov eax,[p0] add eax,offs_vert_zp push ecx push ebx push eax - push dword[edx+offs_cont_zb] - cmp dword[edx+offs_cont_matrix_model_projection_no_w_transform],0 + push dword[edx+GLContext.zb] + cmp dword[edx+GLContext.matrix_model_projection_no_w_transform],0 je @f call ZB_fillTriangleMappingPerspective jmp .end_f @@ -1064,14 +1064,14 @@ align 4 .els_i: mov eax,[p0] add eax,offs_vert_zp - cmp dword[edx+offs_cont_current_shade_model],GL_SMOOTH + cmp dword[edx+GLContext.current_shade_model],GL_SMOOTH jne .els ;else if (context.current_shade_model == GL_SMOOTH) - stdcall ZB_fillTriangleSmooth, dword[edx+offs_cont_zb],eax,ebx,ecx + stdcall ZB_fillTriangleSmooth, dword[edx+GLContext.zb],eax,ebx,ecx jmp .end_f align 4 .els: - stdcall ZB_fillTriangleFlat, dword[edx+offs_cont_zb],eax,ebx,ecx + stdcall ZB_fillTriangleFlat, dword[edx+GLContext.zb],eax,ebx,ecx .end_f: popad ret @@ -1082,7 +1082,7 @@ endp align 16 proc gl_draw_triangle_line uses eax ebx ecx edx, context:dword, p0:dword,p1:dword,p2:dword mov edx,[context] - cmp dword[edx+offs_cont_depth_test],0 + cmp dword[edx+GLContext.depth_test],0 je .els lea ecx,[ZB_line_z] jmp @f @@ -1099,7 +1099,7 @@ align 4 add ebx,offs_vert_zp mov eax,[p1] add eax,offs_vert_zp - stdcall ecx,dword[edx+offs_cont_zb],ebx,eax + stdcall ecx,dword[edx+GLContext.zb],ebx,eax @@: ;if (p1.edge_flag) ZB_line_z(context.zb,&p1.zp,&p2.zp) mov eax,[p1] @@ -1109,7 +1109,7 @@ align 4 add ebx,offs_vert_zp mov eax,[p2] add eax,offs_vert_zp - stdcall ecx,dword[edx+offs_cont_zb],ebx,eax + stdcall ecx,dword[edx+GLContext.zb],ebx,eax @@: ;if (p2.edge_flag) ZB_line_z(context.zb,&p2.zp,&p0.zp); mov eax,[p2] @@ -1119,7 +1119,7 @@ align 4 add ebx,offs_vert_zp mov eax,[p0] add eax,offs_vert_zp - stdcall ecx,dword[edx+offs_cont_zb],ebx,eax + stdcall ecx,dword[edx+GLContext.zb],ebx,eax @@: ret @@ -1134,21 +1134,21 @@ proc gl_draw_triangle_point uses eax ebx edx, context:dword, p0:dword,p1:dword,p je @f mov ebx,eax add ebx,offs_vert_zp - stdcall ZB_plot,dword[edx+offs_cont_zb],ebx + stdcall ZB_plot,dword[edx+GLContext.zb],ebx @@: mov eax,[p1] cmp dword[eax+offs_vert_edge_flag],0 je @f mov ebx,eax add ebx,offs_vert_zp - stdcall ZB_plot,dword[edx+offs_cont_zb],ebx + stdcall ZB_plot,dword[edx+GLContext.zb],ebx @@: mov eax,[p2] cmp dword[eax+offs_vert_edge_flag],0 je @f mov ebx,eax add ebx,offs_vert_zp - stdcall ZB_plot,dword[edx+offs_cont_zb],ebx + stdcall ZB_plot,dword[edx+GLContext.zb],ebx @@: ret endp diff --git a/programs/develop/libraries/TinyGL/asm_fork/init.asm b/programs/develop/libraries/TinyGL/asm_fork/init.asm index 6c62259de3..a16046934e 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/init.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/init.asm @@ -4,9 +4,9 @@ proc initSharedState uses eax ebx, context:dword mov ebx,[context] stdcall gl_zalloc, 4*MAX_DISPLAY_LISTS - mov [ebx+offs_cont_shared_state],eax ;...lists=gl_zalloc(...) + mov [ebx+GLContext.shared_state],eax ;...lists=gl_zalloc(...) stdcall gl_zalloc, 4*TEXTURE_HASH_TABLE_SIZE - mov [ebx+offs_cont_shared_state+4],eax ;...texture_hash_table=gl_zalloc(...) + mov [ebx+GLContext.shared_state+4],eax ;...texture_hash_table=gl_zalloc(...) stdcall alloc_texture, [context],0 ret @@ -19,8 +19,8 @@ proc endSharedState uses eax ebx, context:dword ; for(i=0;imatrix_stack_ptr[ebx] - c->matrix_stack[ebx] + 1 ) ; < c->matrix_stack_depth_max[ebx] ); shl ebx,2 add ebx,eax - add ebx,offs_cont_matrix_stack_ptr + add ebx,GLContext.matrix_stack_ptr add dword[ebx],sizeof.M4 mov ebx,[ebx] ;ebx = ++context.matrix_stack_ptr[context.matrix_mode] @@ -167,13 +167,13 @@ endp align 4 proc glopPopMatrix uses eax ebx, context:dword, p:dword mov eax,[context] - mov ebx,[eax+offs_cont_matrix_mode] + mov ebx,[eax+GLContext.matrix_mode] ; assert( c->matrix_stack_ptr[n] > c->matrix_stack[n] ); shl ebx,2 add ebx,eax - sub dword[ebx+offs_cont_matrix_stack_ptr],sizeof.M4 + sub dword[ebx+GLContext.matrix_stack_ptr],sizeof.M4 gl_matrix_update eax,ebx ret @@ -424,10 +424,10 @@ endl .end_sw: mov eax,[context] - mov ebx,[eax+offs_cont_matrix_mode] + mov ebx,[eax+GLContext.matrix_mode] shl ebx,2 add ebx,eax - stdcall gl_M4_MulLeft,dword[ebx+offs_cont_matrix_stack_ptr],ecx + stdcall gl_M4_MulLeft,dword[ebx+GLContext.matrix_stack_ptr],ecx gl_matrix_update eax,ebx jmp .end_f .f2: @@ -444,10 +444,10 @@ proc glopScale uses eax ebx ecx, context:dword, p:dword mov ecx,[p] mov eax,[context] - mov ebx,[eax+offs_cont_matrix_mode] + mov ebx,[eax+GLContext.matrix_mode] shl ebx,2 add ebx,eax - mov ebx,[ebx+offs_cont_matrix_stack_ptr] ;ebx = &m[0] + mov ebx,[ebx+GLContext.matrix_stack_ptr] ;ebx = &m[0] fld dword[ecx+ 4] ;x fld dword[ecx+ 8] ;y @@ -481,10 +481,10 @@ proc glopTranslate uses eax ebx ecx, context:dword, p:dword mov ecx,[p] mov eax,[context] - mov ebx,[eax+offs_cont_matrix_mode] + mov ebx,[eax+GLContext.matrix_mode] shl ebx,2 add ebx,eax - mov ebx,[ebx+offs_cont_matrix_stack_ptr] ;ebx = &m[0] + mov ebx,[ebx+GLContext.matrix_stack_ptr] ;ebx = &m[0] fld dword[ecx+ 4] ;x fld dword[ecx+ 8] ;y @@ -594,14 +594,14 @@ endl mov dword[ecx+56],-1.0 mov dword[ecx+60],0.0 - mov ebx,[eax+offs_cont_matrix_mode] + mov ebx,[eax+GLContext.matrix_mode] shl ebx,2 add ebx,eax - stdcall gl_M4_MulLeft,dword[ebx+offs_cont_matrix_stack_ptr],ecx + stdcall gl_M4_MulLeft,dword[ebx+GLContext.matrix_stack_ptr],ecx if DEBUG ;glopFrustum stdcall gl_print_matrix,ecx,4 - stdcall gl_print_matrix,dword[ebx+offs_cont_matrix_stack_ptr],4 + stdcall gl_print_matrix,dword[ebx+GLContext.matrix_stack_ptr],4 end if gl_matrix_update eax,ebx ret diff --git a/programs/develop/libraries/TinyGL/asm_fork/misc.asm b/programs/develop/libraries/TinyGL/asm_fork/misc.asm index bf0ae2239b..3d853c9c2d 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/misc.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/misc.asm @@ -23,16 +23,16 @@ endl ; we may need to resize the zbuffer - cmp dword[edx+offs_cont_viewport+offs_vpor_ysize],ecx + cmp dword[edx+GLContext.viewport+offs_vpor_ysize],ecx jne @f mov ecx,[xmin] - cmp dword[edx+offs_cont_viewport+offs_vpor_xmin],ecx + cmp dword[edx+GLContext.viewport+offs_vpor_xmin],ecx jne @f mov ecx,[ymin] - cmp dword[edx+offs_cont_viewport+offs_vpor_ymin],ecx + cmp dword[edx+GLContext.viewport+offs_vpor_ymin],ecx jne @f mov ecx,[xsize] - cmp dword[edx+offs_cont_viewport+offs_vpor_xsize],ecx + cmp dword[edx+GLContext.viewport+offs_vpor_xsize],ecx jne @f jmp .end_f @@: @@ -44,14 +44,14 @@ endl add ecx,[ysize] mov [ysize_req],ecx ;ysize_req = ymin + ysize - cmp dword[edx+offs_cont_gl_resize_viewport],0 + cmp dword[edx+GLContext.gl_resize_viewport],0 je @f mov eax,ebp sub eax,4 push eax sub eax,4 push eax - stdcall dword[edx+offs_cont_gl_resize_viewport], edx ;gl_resize_viewport(context,&xsize_req,&ysize_req) + stdcall dword[edx+GLContext.gl_resize_viewport], edx ;gl_resize_viewport(context,&xsize_req,&ysize_req) cmp eax,0 je @f stdcall dbg_print,sz_glViewport,err_4 @@ -70,15 +70,15 @@ endl stdcall dbg_print,sz_glViewport,err_5 @@: mov ecx,[xmin] - mov dword[edx+offs_cont_viewport+offs_vpor_xmin],ecx + mov dword[edx+GLContext.viewport+offs_vpor_xmin],ecx mov ecx,[ymin] - mov dword[edx+offs_cont_viewport+offs_vpor_ymin],ecx + mov dword[edx+GLContext.viewport+offs_vpor_ymin],ecx mov ecx,[xsize] - mov dword[edx+offs_cont_viewport+offs_vpor_xsize],ecx + mov dword[edx+GLContext.viewport+offs_vpor_xsize],ecx mov ecx,[ysize] - mov dword[edx+offs_cont_viewport+offs_vpor_ysize],ecx + mov dword[edx+GLContext.viewport+offs_vpor_ysize],ecx - mov dword[edx+offs_cont_viewport+offs_vpor_updated],1 + mov dword[edx+GLContext.viewport+offs_vpor_updated],1 .end_f: ret endp @@ -92,62 +92,62 @@ proc glopEnableDisable uses eax ebx ecx, context:dword, p:dword cmp ebx,GL_CULL_FACE jne @f - mov [eax+offs_cont_cull_face_enabled],ecx + mov [eax+GLContext.cull_face_enabled],ecx jmp .end_f @@: cmp ebx,GL_LIGHTING jne @f - mov [eax+offs_cont_lighting_enabled],ecx + mov [eax+GLContext.lighting_enabled],ecx jmp .end_f @@: cmp ebx,GL_COLOR_MATERIAL jne @f - mov [eax+offs_cont_color_material_enabled],ecx + mov [eax+GLContext.color_material_enabled],ecx jmp .end_f @@: cmp ebx,GL_TEXTURE_2D jne @f - mov [eax+offs_cont_texture_2d_enabled],ecx + mov [eax+GLContext.texture_2d_enabled],ecx jmp .end_f @@: cmp ebx,GL_NORMALIZE jne @f - mov [eax+offs_cont_normalize_enabled],ecx + mov [eax+GLContext.normalize_enabled],ecx jmp .end_f @@: cmp ebx,GL_DEPTH_TEST jne @f - mov [eax+offs_cont_depth_test],ecx + mov [eax+GLContext.depth_test],ecx jmp .end_f @@: cmp ebx,GL_POLYGON_OFFSET_FILL jne .polygon_offset_fill cmp ecx,0 je @f - or dword[eax+offs_cont_offset_states],TGL_OFFSET_FILL + or dword[eax+GLContext.offset_states],TGL_OFFSET_FILL jmp .end_f @@: - and dword[eax+offs_cont_offset_states],not TGL_OFFSET_FILL + and dword[eax+GLContext.offset_states],not TGL_OFFSET_FILL jmp .end_f .polygon_offset_fill: cmp ebx,GL_POLYGON_OFFSET_POINT jne .polygon_offset_point cmp ecx,0 je @f - or dword[eax+offs_cont_offset_states],TGL_OFFSET_POINT + or dword[eax+GLContext.offset_states],TGL_OFFSET_POINT jmp .end_f @@: - and dword[eax+offs_cont_offset_states],not TGL_OFFSET_POINT + and dword[eax+GLContext.offset_states],not TGL_OFFSET_POINT jmp .end_f .polygon_offset_point: cmp ebx,GL_POLYGON_OFFSET_LINE jne .polygon_offset_line cmp ecx,0 je @f - or dword[eax+offs_cont_offset_states],TGL_OFFSET_LINE + or dword[eax+GLContext.offset_states],TGL_OFFSET_LINE jmp .end_f @@: - and dword[eax+offs_cont_offset_states],not TGL_OFFSET_LINE + and dword[eax+GLContext.offset_states],not TGL_OFFSET_LINE jmp .end_f .polygon_offset_line: ;default: cmp ebx,GL_LIGHT0 @@ -158,7 +158,7 @@ proc glopEnableDisable uses eax ebx ecx, context:dword, p:dword stdcall gl_enable_disable_light, eax,ebx,ecx jmp .end_f .els_0: -;//fprintf(stderr,"glEnableDisable: 0x%X not supported.\n",code); +;fprintf(stderr,"glEnableDisable: 0x%X not supported.\n",code); .end_f: ret endp @@ -168,7 +168,7 @@ proc glopShadeModel uses eax ebx, context:dword,p:dword mov eax,[context] mov ebx,[p] mov ebx,[ebx+4] - mov [eax+offs_cont_current_shade_model],ebx + mov [eax+GLContext.current_shade_model],ebx ret endp @@ -177,7 +177,7 @@ proc glopCullFace uses eax ebx, context:dword,p:dword mov eax,[context] mov ebx,[p] mov ebx,[ebx+4] - mov [eax+offs_cont_current_cull_face],ebx + mov [eax+GLContext.current_cull_face],ebx ret endp @@ -186,7 +186,7 @@ proc glopFrontFace uses eax ebx, context:dword,p:dword mov eax,[context] mov ebx,[p] mov ebx,[ebx+4] - mov [eax+offs_cont_current_front_face],ebx + mov [eax+GLContext.current_front_face],ebx ret endp @@ -198,20 +198,20 @@ proc glopPolygonMode uses eax ebx, context:dword,p:dword cmp dword[ebx+4],GL_BACK jne @f mov ebx,[ebx+8] - mov [eax+offs_cont_polygon_mode_back],ebx + mov [eax+GLContext.polygon_mode_back],ebx jmp .end_f @@: cmp dword[ebx+4],GL_FRONT jne @f mov ebx,[ebx+8] - mov [eax+offs_cont_polygon_mode_front],ebx + mov [eax+GLContext.polygon_mode_front],ebx jmp .end_f @@: cmp dword[ebx+4],GL_FRONT_AND_BACK jne @f mov ebx,[ebx+8] - mov [eax+offs_cont_polygon_mode_front],ebx - mov [eax+offs_cont_polygon_mode_back],ebx + mov [eax+GLContext.polygon_mode_front],ebx + mov [eax+GLContext.polygon_mode_back],ebx jmp .end_f @@: ; assert(0); @@ -235,8 +235,8 @@ proc glopPolygonOffset uses eax ebx ecx, context:dword,p:dword mov eax,[context] mov ebx,[p] mov ecx,[ebx+4] - mov [eax+offs_cont_offset_factor],ecx + mov [eax+GLContext.offset_factor],ecx mov ecx,[ebx+8] - mov [eax+offs_cont_offset_units],ecx + mov [eax+GLContext.offset_units],ecx ret endp \ No newline at end of file diff --git a/programs/develop/libraries/TinyGL/asm_fork/select.asm b/programs/develop/libraries/TinyGL/asm_fork/select.asm index 7af1617279..9dd855fad4 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/select.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/select.asm @@ -4,39 +4,39 @@ proc glRenderMode uses ebx ecx, mode:dword call gl_get_context xor ebx,ebx - cmp dword[eax+offs_cont_render_mode],GL_RENDER + cmp dword[eax+GLContext.render_mode],GL_RENDER je .e_sw_1 - cmp dword[eax+offs_cont_render_mode],GL_SELECT + cmp dword[eax+GLContext.render_mode],GL_SELECT jne .def_1 - cmp dword[eax+offs_cont_select_overflow],0 + cmp dword[eax+GLContext.select_overflow],0 je @f - sub ebx,[eax+offs_cont_select_hits] + sub ebx,[eax+GLContext.select_hits] jmp .else_e @@: - mov ebx,[eax+offs_cont_select_hits] + mov ebx,[eax+GLContext.select_hits] .else_e: - mov dword[eax+offs_cont_select_overflow],0 - mov ecx,[eax+offs_cont_select_buffer] - mov dword[eax+offs_cont_select_ptr],ecx - mov dword[eax+offs_cont_name_stack_size],0 + mov dword[eax+GLContext.select_overflow],0 + mov ecx,[eax+GLContext.select_buffer] + mov dword[eax+GLContext.select_ptr],ecx + mov dword[eax+GLContext.name_stack_size],0 jmp .e_sw_1 .def_1: ; assert(0); .e_sw_1: cmp dword[mode],GL_RENDER jne @f - mov dword[eax+offs_cont_render_mode],GL_RENDER + mov dword[eax+GLContext.render_mode],GL_RENDER jmp .e_sw_2 @@: cmp dword[mode],GL_SELECT jne .def_2 - mov dword[eax+offs_cont_render_mode],GL_SELECT + mov dword[eax+GLContext.render_mode],GL_SELECT ; assert( c->select_buffer != NULL); - mov ecx,[eax+offs_cont_select_buffer] - mov dword[eax+offs_cont_select_ptr],ecx - mov dword[eax+offs_cont_select_hits],0 - mov dword[eax+offs_cont_select_overflow],0 - mov dword[eax+offs_cont_select_hit],0 ;NULL + mov ecx,[eax+GLContext.select_buffer] + mov dword[eax+GLContext.select_ptr],ecx + mov dword[eax+GLContext.select_hits],0 + mov dword[eax+GLContext.select_overflow],0 + mov dword[eax+GLContext.select_hit],0 ;NULL jmp .e_sw_2 .def_2: ; assert(0); @@ -52,19 +52,19 @@ proc glSelectBuffer uses eax ebx, size:dword, buf:dword ; assert(c->render_mode != GL_SELECT); mov ebx,[buf] - mov dword[eax+offs_cont_select_buffer],ebx + mov dword[eax+GLContext.select_buffer],ebx mov ebx,[size] - mov dword[eax+offs_cont_select_size],ebx + mov dword[eax+GLContext.select_size],ebx ret endp align 4 proc glopInitNames uses eax, context:dword, p:dword mov eax,[context] - cmp dword[eax+offs_cont_render_mode],GL_SELECT + cmp dword[eax+GLContext.render_mode],GL_SELECT jne @f - mov dword[eax+offs_cont_name_stack_size],0 - mov dword[eax+offs_cont_select_hit],0 ;=NULL + mov dword[eax+GLContext.name_stack_size],0 + mov dword[eax+GLContext.select_hit],0 ;=NULL @@: ret endp @@ -72,17 +72,17 @@ endp align 4 proc glopPushName uses eax ebx, context:dword, p:dword mov eax,[context] - cmp dword[eax+offs_cont_render_mode],GL_SELECT + cmp dword[eax+GLContext.render_mode],GL_SELECT jne @f ; assert(c->name_stack_sizename_stack_size>0); - dec dword[eax+offs_cont_name_stack_size] - mov dword[eax+offs_cont_select_hit],0 ;=NULL + dec dword[eax+GLContext.name_stack_size] + mov dword[eax+GLContext.select_hit],0 ;=NULL @@: ret endp @@ -102,17 +102,17 @@ endp align 4 proc glopLoadName uses eax ebx, context:dword, p:dword mov eax,[context] - cmp dword[eax+offs_cont_render_mode],GL_SELECT + cmp dword[eax+GLContext.render_mode],GL_SELECT jne @f ; assert(c->name_stack_size>0); - mov dword[eax+offs_cont_select_hit],0 ;=NULL - mov ebx,dword[eax+offs_cont_name_stack_size] + mov dword[eax+GLContext.select_hit],0 ;=NULL + mov ebx,dword[eax+GLContext.name_stack_size] dec ebx shl ebx,2 add ebx,eax mov eax,[p] mov eax,[eax+4] - mov dword[ebx+offs_cont_name_stack],eax ;context.name_stack[context.name_stack_size-1]=p[1] + mov dword[ebx+GLContext.name_stack],eax ;context.name_stack[context.name_stack_size-1]=p[1] @@: ret endp @@ -123,23 +123,23 @@ proc gl_add_select uses eax ebx ecx edx, context:dword, zmin:dword, zmax:dword ; int i; mov eax,[context] - cmp dword[eax+offs_cont_select_overflow],0 + cmp dword[eax+GLContext.select_overflow],0 jne .end_f ;if (!context.select_overflow) - cmp dword[eax+offs_cont_select_hit],0 ;if (context.select_hit==NULL) + cmp dword[eax+GLContext.select_hit],0 ;if (context.select_hit==NULL) jne .els_0 - mov ecx,[eax+offs_cont_name_stack_size] - mov ebx,[eax+offs_cont_select_ptr] - sub ebx,[eax+offs_cont_select_buffer] + mov ecx,[eax+GLContext.name_stack_size] + mov ebx,[eax+GLContext.select_ptr] + sub ebx,[eax+GLContext.select_buffer] sub ebx,3 sub ebx,ecx - cmp ebx,[eax+offs_cont_select_size] + cmp ebx,[eax+GLContext.select_size] jle .els_1 - mov dword[eax+offs_cont_select_overflow],1 + mov dword[eax+GLContext.select_overflow],1 jmp .end_f .els_1: - mov ebx,[eax+offs_cont_select_ptr] - mov [eax+offs_cont_select_hit],ebx - mov edx,[eax+offs_cont_name_stack_size] + mov ebx,[eax+GLContext.select_ptr] + mov [eax+GLContext.select_hit],ebx + mov edx,[eax+GLContext.name_stack_size] mov [ebx],edx add ebx,4 mov edx,[zmin] @@ -149,19 +149,19 @@ proc gl_add_select uses eax ebx ecx edx, context:dword, zmin:dword, zmax:dword mov [ebx],edx add ebx,4 ; for(i=0;iname_stack[i]; - mov [eax+offs_cont_select_ptr],ebx - inc dword[eax+offs_cont_select_hits] + mov [eax+GLContext.select_ptr],ebx + inc dword[eax+GLContext.select_hits] jmp .end_f .els_0: mov ebx,[zmin] - cmp dword[eax+offs_cont_select_hit+4],ebx + cmp dword[eax+GLContext.select_hit+4],ebx jle @f - mov dword[eax+offs_cont_select_hit+4],ebx + mov dword[eax+GLContext.select_hit+4],ebx @@: mov ebx,[zmax] - cmp dword[eax+offs_cont_select_hit+8],ebx + cmp dword[eax+GLContext.select_hit+8],ebx jge .end_f - mov dword[eax+offs_cont_select_hit+8],ebx + mov dword[eax+GLContext.select_hit+8],ebx .end_f: ret endp diff --git a/programs/develop/libraries/TinyGL/asm_fork/specbuf.asm b/programs/develop/libraries/TinyGL/asm_fork/specbuf.asm index a190f262e4..1b472dea08 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/specbuf.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/specbuf.asm @@ -63,7 +63,7 @@ locals oldest dd ? ;GLSpecBuf * endl mov edx,[context] - mov eax,[edx+offs_cont_specbuf_first] + mov eax,[edx+GLContext.specbuf_first] mov [found],eax mov [oldest],eax mov ebx,[shininess_i] @@ -84,14 +84,14 @@ endl cmp dword[found],0 ;if (found) /* hey, found one! */ je @f mov eax,[found] - mov ecx,[edx+offs_cont_specbuf_used_counter] + mov ecx,[edx+GLContext.specbuf_used_counter] mov [eax+offs_spec_last_used],ecx ;found.last_used = context.specbuf_used_counter - inc dword[edx+offs_cont_specbuf_used_counter] + inc dword[edx+GLContext.specbuf_used_counter] jmp .end_f ;return found @@: cmp dword[oldest],0 ;if (oldest == NULL || context.specbuf_num_buffers < MAX_SPECULAR_BUFFERS) je @f - cmp dword[edx+offs_cont_specbuf_num_buffers],MAX_SPECULAR_BUFFERS + cmp dword[edx+GLContext.specbuf_num_buffers],MAX_SPECULAR_BUFFERS jge .end_1 @@: ; create new buffer @@ -100,13 +100,13 @@ endl jnz @f ;gl_fatal_error("could not allocate specular buffer") @@: - inc dword[edx+offs_cont_specbuf_num_buffers] - mov ecx,[edx+offs_cont_specbuf_first] + inc dword[edx+GLContext.specbuf_num_buffers] + mov ecx,[edx+GLContext.specbuf_first] mov [eax+offs_spec_next],ecx - mov [edx+offs_cont_specbuf_first],eax - mov ecx,[edx+offs_cont_specbuf_used_counter] + mov [edx+GLContext.specbuf_first],eax + mov ecx,[edx+GLContext.specbuf_used_counter] mov [eax+offs_spec_last_used],ecx - inc dword[edx+offs_cont_specbuf_used_counter] + inc dword[edx+GLContext.specbuf_used_counter] mov [eax+offs_spec_shininess_i],ebx stdcall calc_buf, eax,dword[shininess] jmp .end_f @@ -115,9 +115,9 @@ endl ;tgl_trace("overwriting spec buffer :(\n"); mov eax,[oldest] mov [eax+offs_spec_shininess_i],ebx - mov ecx,[edx+offs_cont_specbuf_used_counter] + mov ecx,[edx+GLContext.specbuf_used_counter] mov [eax+offs_spec_last_used],ecx - inc dword[edx+offs_cont_specbuf_used_counter] + inc dword[edx+GLContext.specbuf_used_counter] stdcall calc_buf, eax,dword[shininess] .end_f: ret diff --git a/programs/develop/libraries/TinyGL/asm_fork/texture.asm b/programs/develop/libraries/TinyGL/asm_fork/texture.asm index d06484370e..cd78122c0a 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/texture.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/texture.asm @@ -5,7 +5,7 @@ align 4 proc find_texture uses ebx ecx, context:dword, h:dword mov ebx,[context] - mov ebx,[ebx+offs_cont_shared_state+4] ;ebx = &texture_hash_table + mov ebx,[ebx+GLContext.shared_state+4] ;ebx = &texture_hash_table mov eax,[h] and eax,0xff shl eax,2 @@ -34,7 +34,7 @@ proc free_texture uses eax ebx ecx edx, context:dword, h:dword stdcall find_texture,edx,[h] ;t=find_texture(context,h) cmp dword[eax+offs_text_prev],0 ;if (t.prev==NULL) jne .else - mov edx,[edx+offs_cont_shared_state+4] ;edx = &context.shared_state.texture_hash_table[0] + mov edx,[edx+GLContext.shared_state+4] ;edx = &context.shared_state.texture_hash_table[0] mov ebx,[eax+offs_text_handle] and ebx,0xff shl ebx,2 @@ -80,7 +80,7 @@ proc alloc_texture uses ebx ecx, context:dword, h:dword stdcall gl_zalloc,sizeof.GLTexture mov ebx,[context] - mov ebx,[ebx+offs_cont_shared_state+4] ;ebx = &texture_hash_table + mov ebx,[ebx+GLContext.shared_state+4] ;ebx = &texture_hash_table mov ecx,[h] and ecx,0xff shl ecx,2 @@ -105,9 +105,9 @@ align 4 proc glInitTextures uses eax edx, context:dword ; textures mov edx,[context] - mov dword[edx+offs_cont_texture_2d_enabled],0 + mov dword[edx+GLContext.texture_2d_enabled],0 stdcall find_texture,edx,0 - mov dword[edx+offs_cont_current_texture],eax + mov dword[edx+GLContext.current_texture],eax ret endp @@ -115,7 +115,7 @@ align 4 proc glGenTextures uses eax ebx ecx edx esi, n:dword, textures:dword ;edx - GLTexture *t call gl_get_context - add eax,offs_cont_shared_state+4 ;offset texture_hash_table = 4 + add eax,GLContext.shared_state+4 ;offset texture_hash_table = 4 xor ebx,ebx ;max=0 xor ecx,ecx ;i=0 @@ -167,7 +167,7 @@ proc glDeleteTextures uses eax ebx ecx edx, n:dword, textures:dword stdcall find_texture,edx,[ecx] ;t=find_texture(context,textures[i]) or eax,eax ;if (t!=0) jz @f - cmp eax,[edx+offs_cont_current_texture] ;if (t==context.current_texture) + cmp eax,[edx+GLContext.current_texture] ;if (t==context.current_texture) jne .end_1 stdcall glBindTexture,GL_TEXTURE_2D,0 .end_1: @@ -200,7 +200,7 @@ proc glopBindTexture uses eax ebx edx, context:dword, p:dword jnz @f stdcall alloc_texture, edx,ebx @@: - mov [edx+offs_cont_current_texture],eax + mov [edx+GLContext.current_texture],eax ret endp @@ -265,7 +265,7 @@ align 4 @@: mov ecx,[context] - mov ecx,[ecx+offs_cont_current_texture] + mov ecx,[ecx+GLContext.current_texture] add ecx,offs_text_images imul ebx,sizeof.GLTexture add ecx,ebx ;ecx = &context.current_texture.images[level] diff --git a/programs/develop/libraries/TinyGL/asm_fork/vertex.asm b/programs/develop/libraries/TinyGL/asm_fork/vertex.asm index c21de68adc..5cbbb9b7de 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/vertex.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/vertex.asm @@ -7,7 +7,7 @@ proc glopNormal uses ecx esi edi, context:dword, p:dword mov esi,[p] add esi,4 mov edi,[context] - add edi,offs_cont_current_normal + add edi,GLContext.current_normal mov ecx,3 rep movsd mov dword[edi],0.0 ;context.current_normal.W = 0.0 @@ -19,7 +19,7 @@ proc glopTexCoord uses ecx esi edi, context:dword, p:dword mov esi,[p] add esi,4 mov edi,[context] - add edi,offs_cont_current_tex_coord + add edi,GLContext.current_tex_coord mov ecx,4 rep movsd ret @@ -30,7 +30,7 @@ proc glopEdgeFlag uses eax ebx, context:dword, p:dword mov eax,[context] mov ebx,[p] mov ebx,[ebx+4] ;ebx = p[1] - mov dword[eax+offs_cont_current_edge_flag],ebx + mov dword[eax+GLContext.current_edge_flag],ebx ret endp @@ -44,17 +44,17 @@ endl mov esi,[p] add esi,4 mov edi,[context] - add edi,offs_cont_current_color + add edi,GLContext.current_color mov ecx,7 rep movsd mov eax,[context] - cmp dword[eax+offs_cont_color_material_enabled],0 + cmp dword[eax+GLContext.color_material_enabled],0 je @f mov dword[q],OP_Material - mov ecx,[eax+offs_cont_current_color_material_mode] + mov ecx,[eax+GLContext.current_color_material_mode] mov dword[q+4],ecx - mov ecx,[eax+offs_cont_current_color_material_type] + mov ecx,[eax+GLContext.current_color_material_type] mov dword[q+8],ecx mov esi,[p] add esi,4 @@ -75,7 +75,7 @@ locals zsize dd ? ;float endl mov eax,[context] - add eax,offs_cont_viewport ;eax = (GLViewport*) v + add eax,GLContext.viewport ;eax = (GLViewport*) v mov dword[zsize],(1 shl (ZB_Z_BITS + ZB_POINT_Z_FRAC_BITS)) fild dword[zsize] @@ -125,35 +125,35 @@ endl mov edx,[context] mov ebx,[p] mov ebx,[ebx+4] ;ebx = p[1] - mov [edx+offs_cont_begin_type],ebx - mov dword[edx+offs_cont_in_begin],1 - mov dword[edx+offs_cont_vertex_n],0 - mov dword[edx+offs_cont_vertex_cnt],0 + mov [edx+GLContext.begin_type],ebx + mov dword[edx+GLContext.in_begin],1 + mov dword[edx+GLContext.vertex_n],0 + mov dword[edx+GLContext.vertex_cnt],0 - bt dword[edx+offs_cont_matrix_model_projection_updated],0 + bt dword[edx+GLContext.matrix_model_projection_updated],0 jnc .end_mmpu - cmp dword[edx+offs_cont_lighting_enabled],0 ;if(context.lighting_enabled) + cmp dword[edx+GLContext.lighting_enabled],0 ;if(context.lighting_enabled) jne .if_0 - cmp dword[eax+offs_cont_texture_2d_enabled],0 + cmp dword[eax+GLContext.texture_2d_enabled],0 jne .if_0 jmp @f align 4 .if_0: if DEBUG ;context.matrix_stack_ptr[0] - stdcall gl_print_matrix,dword[edx+offs_cont_matrix_stack_ptr],4 + stdcall gl_print_matrix,dword[edx+GLContext.matrix_stack_ptr],4 end if ; precompute inverse modelview mov ebx,ebp sub ebx,sizeof.M4 - stdcall gl_M4_Inv, ebx,dword[edx+offs_cont_matrix_stack_ptr] + stdcall gl_M4_Inv, ebx,dword[edx+GLContext.matrix_stack_ptr] if DEBUG ;tmp stdcall dbg_print,txt_sp,txt_nl stdcall gl_print_matrix,ebx,4 end if push ebx mov ebx,edx - add ebx,offs_cont_matrix_model_view_inv + add ebx,GLContext.matrix_model_view_inv stdcall gl_M4_Transpose, ebx if DEBUG ;context.matrix_model_view_inv stdcall dbg_print,txt_sp,txt_nl @@ -163,12 +163,12 @@ end if align 4 @@: mov ecx,edx - add ecx,offs_cont_matrix_model_projection + add ecx,GLContext.matrix_model_projection ; precompute projection matrix - stdcall gl_M4_Mul, ecx,dword[edx+offs_cont_matrix_stack_ptr+4],dword[edx+offs_cont_matrix_stack_ptr] + stdcall gl_M4_Mul, ecx,dword[edx+GLContext.matrix_stack_ptr+4],dword[edx+GLContext.matrix_stack_ptr] ; test to accelerate computation - mov dword[edx+offs_cont_matrix_model_projection_no_w_transform],0 + mov dword[edx+GLContext.matrix_model_projection_no_w_transform],0 fldz fld dword[ecx+12*4] fcomp st1 @@ -185,7 +185,7 @@ align 4 fstsw ax sahf jne @f - mov dword[edx+offs_cont_matrix_model_projection_no_w_transform],1 + mov dword[edx+GLContext.matrix_model_projection_no_w_transform],1 @@: ffree st0 ;0.0 fincstp @@ -193,57 +193,57 @@ align 4 ; test if the texture matrix is not Identity mov eax,edx - add eax,offs_cont_matrix_stack_ptr+8 + add eax,GLContext.matrix_stack_ptr+8 stdcall gl_M4_IsId,eax xor eax,1 - mov dword[edx+offs_cont_apply_texture_matrix],eax + mov dword[edx+GLContext.apply_texture_matrix],eax - mov dword[edx+offs_cont_matrix_model_projection_updated],0 + mov dword[edx+GLContext.matrix_model_projection_updated],0 .end_mmpu: ; viewport - cmp dword[edx+offs_cont_viewport+offs_vpor_updated],0 ;if (context.viewport.updated) + cmp dword[edx+GLContext.viewport+offs_vpor_updated],0 ;if (context.viewport.updated) je @f stdcall gl_eval_viewport,edx - mov dword[edx+offs_cont_viewport+offs_vpor_updated],0 + mov dword[edx+GLContext.viewport+offs_vpor_updated],0 @@: ; triangle drawing functions - cmp dword[edx+offs_cont_render_mode],GL_SELECT + cmp dword[edx+GLContext.render_mode],GL_SELECT jne @f - mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_select - mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_select + mov dword[edx+GLContext.draw_triangle_front],gl_draw_triangle_select + mov dword[edx+GLContext.draw_triangle_back],gl_draw_triangle_select jmp .end_if_2 align 4 @@: - cmp dword[edx+offs_cont_polygon_mode_front],GL_POINT + cmp dword[edx+GLContext.polygon_mode_front],GL_POINT jne @f - mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_point + mov dword[edx+GLContext.draw_triangle_front],gl_draw_triangle_point jmp .end_if_1 align 4 @@: - cmp dword[edx+offs_cont_polygon_mode_front],GL_LINE + cmp dword[edx+GLContext.polygon_mode_front],GL_LINE jne @f - mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_line + mov dword[edx+GLContext.draw_triangle_front],gl_draw_triangle_line jmp .end_if_1 align 4 @@: ;default: - mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_fill + mov dword[edx+GLContext.draw_triangle_front],gl_draw_triangle_fill .end_if_1: - cmp dword[edx+offs_cont_polygon_mode_back],GL_POINT + cmp dword[edx+GLContext.polygon_mode_back],GL_POINT jne @f - mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_point + mov dword[edx+GLContext.draw_triangle_back],gl_draw_triangle_point jmp .end_if_2 align 4 @@: - cmp dword[edx+offs_cont_polygon_mode_back],GL_LINE + cmp dword[edx+GLContext.polygon_mode_back],GL_LINE jne @f - mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_line + mov dword[edx+GLContext.draw_triangle_back],gl_draw_triangle_line jmp .end_if_2 align 4 @@: ;default: - mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_fill + mov dword[edx+GLContext.draw_triangle_back],gl_draw_triangle_fill .end_if_2: ret endp @@ -255,15 +255,15 @@ proc gl_vertex_transform, context:dword, v:dword pushad mov eax,[context] mov edx,[v] - cmp dword[eax+offs_cont_lighting_enabled],0 ;if (context.lighting_enabled) + cmp dword[eax+GLContext.lighting_enabled],0 ;if (context.lighting_enabled) jne @f - cmp dword[eax+offs_cont_texture_2d_enabled],0 + cmp dword[eax+GLContext.texture_2d_enabled],0 jne @f jmp .els_0 align 4 @@: ; eye coordinates needed for lighting - mov ebx,dword[eax+offs_cont_matrix_stack_ptr] + mov ebx,dword[eax+GLContext.matrix_stack_ptr] finit fld dword[edx+offs_vert_coord+offs_X] fld dword[edx+offs_vert_coord+offs_Y] @@ -292,7 +292,7 @@ align 4 fincstp ; projection coordinates - mov ebx,dword[eax+offs_cont_matrix_stack_ptr+4] + mov ebx,dword[eax+GLContext.matrix_stack_ptr+4] mov edx,[v] fld dword[edx+offs_vert_ec+offs_X] @@ -327,9 +327,9 @@ align 4 fincstp mov ebx,eax - add ebx,offs_cont_matrix_model_view_inv + add ebx,GLContext.matrix_model_view_inv mov edi,eax - add edi,offs_cont_current_normal + add edi,GLContext.current_normal mov edx,[v] fld dword[edi] ;edi = &n @@ -368,7 +368,7 @@ align 4 faddp ;st0 = v.normal.X fstp dword[edx+8];v.normal.X = n.X * m[8] + n.Y * m[9] + n.Z * m[10] - cmp dword[eax+offs_cont_normalize_enabled],0 + cmp dword[eax+GLContext.normalize_enabled],0 je .end_els stdcall gl_V3_Norm,edx jmp .end_els @@ -377,7 +377,7 @@ align 4 ; no eye coordinates needed, no normal ; NOTE: W = 1 is assumed mov ebx,eax - add ebx,offs_cont_matrix_model_projection + add ebx,GLContext.matrix_model_projection finit fld dword[edx+offs_vert_coord+offs_X] @@ -420,7 +420,7 @@ align 4 faddp ;st0 = v.pc.Z fstp dword[esi+8] ;v.pc.Z = v.coord.X * m[8] + v.coord.Y * m[9] + v.coord.Z * m[10] + m[11] - cmp dword[eax+offs_cont_matrix_model_projection_no_w_transform],0 + cmp dword[eax+GLContext.matrix_model_projection_no_w_transform],0 je .els_1 ;if (context.matrix_model_projection_no_w_transform) mov ebx,dword[ebx+60] ;ebx = m[15] @@ -471,15 +471,15 @@ pushad ; assert(c->in_begin != 0); - mov ecx,[edx+offs_cont_vertex_n] + mov ecx,[edx+GLContext.vertex_n] mov [n],ecx - inc dword[edx+offs_cont_vertex_cnt] + inc dword[edx+GLContext.vertex_cnt] ; quick fix to avoid crashes on large polygons - mov ecx,[edx+offs_cont_vertex_max] + mov ecx,[edx+GLContext.vertex_max] cmp dword[n],ecx jl @f - shl dword[edx+offs_cont_vertex_max],1 ; just double size + shl dword[edx+GLContext.vertex_max],1 ; just double size imul ecx,2*sizeof.GLVertex stdcall gl_malloc,ecx cmp eax,0 @@ -488,17 +488,17 @@ pushad .no_err: mov edi,eax mov ebx,eax - mov esi,[edx+offs_cont_vertex] + mov esi,[edx+GLContext.vertex] mov ecx,[n] imul ecx,(sizeof.GLVertex)/4 ;((...)/4) что-бы использовать movsd вместо movsb rep movsd - stdcall gl_free,dword[edx+offs_cont_vertex] - mov dword[edx+offs_cont_vertex],ebx + stdcall gl_free,dword[edx+GLContext.vertex] + mov dword[edx+GLContext.vertex],ebx @@: ; new vertex entry mov ebx,[n] imul ebx,sizeof.GLVertex - add ebx,[edx+offs_cont_vertex] + add ebx,[edx+GLContext.vertex] inc dword[n] mov esi,[p] @@ -511,14 +511,14 @@ pushad stdcall gl_vertex_transform, edx, ebx ; color - cmp dword[edx+offs_cont_lighting_enabled],0 + cmp dword[edx+GLContext.lighting_enabled],0 je .els_0 stdcall gl_shade_vertex, edx,ebx jmp @f align 4 .els_0: mov esi,edx - add esi,offs_cont_current_color + add esi,GLContext.current_color mov edi,ebx add edi,offs_vert_color ;edi = &v.color mov ecx,4 @@ -526,21 +526,21 @@ align 4 @@: ; tex coords - cmp dword[edx+offs_cont_texture_2d_enabled],0 + cmp dword[edx+GLContext.texture_2d_enabled],0 je @f - cmp dword[edx+offs_cont_apply_texture_matrix],0 + cmp dword[edx+GLContext.apply_texture_matrix],0 je .els_1 mov eax,edx - add eax,offs_cont_current_tex_coord + add eax,GLContext.current_tex_coord push eax ;&context.current_tex_coord mov eax,ebx add eax,offs_vert_tex_coord - stdcall gl_M4_MulV4, eax, dword[edx+offs_cont_matrix_stack_ptr+8] + stdcall gl_M4_MulV4, eax, dword[edx+GLContext.matrix_stack_ptr+8] jmp @f align 4 .els_1: mov esi,edx - add esi,offs_cont_current_tex_coord + add esi,GLContext.current_tex_coord mov edi,ebx add edi,offs_vert_tex_coord mov ecx,4 @@ -554,21 +554,21 @@ align 4 @@: ; edge flag - mov eax,[edx+offs_cont_current_edge_flag] + mov eax,[edx+GLContext.current_edge_flag] mov dword[ebx+offs_vert_edge_flag],eax ;v.edge_flag = context.current_edge_flag - cmp dword[edx+offs_cont_begin_type],GL_POINTS + cmp dword[edx+GLContext.begin_type],GL_POINTS jne @f - stdcall gl_draw_point, edx, dword[edx+offs_cont_vertex] ;dword[edx+...] = &context.vertex[0] + stdcall gl_draw_point, edx, dword[edx+GLContext.vertex] ;dword[edx+...] = &context.vertex[0] mov dword[n],0 jmp .end_f align 4 @@: - cmp dword[edx+offs_cont_begin_type],GL_LINES + cmp dword[edx+GLContext.begin_type],GL_LINES jne @f cmp dword[n],2 jne .end_f - mov eax,[edx+offs_cont_vertex] + mov eax,[edx+GLContext.vertex] push eax add eax,sizeof.GLVertex stdcall gl_draw_line, edx, eax @@ -577,14 +577,14 @@ align 4 jmp .end_f align 4 @@: - cmp dword[edx+offs_cont_begin_type],GL_LINE_STRIP + cmp dword[edx+GLContext.begin_type],GL_LINE_STRIP je .li_loop - cmp dword[edx+offs_cont_begin_type],GL_LINE_LOOP + cmp dword[edx+GLContext.begin_type],GL_LINE_LOOP jne @f .li_loop: cmp dword[n],1 jne .els_2 - mov esi,[edx+offs_cont_vertex] + mov esi,[edx+GLContext.vertex] mov edi,esi add edi,2*sizeof.GLVertex mov ecx,(sizeof.GLVertex)/4 ;((...)/4) что-бы использовать movsd вместо movsb @@ -594,7 +594,7 @@ align 4 .els_2: cmp dword[n],2 jne .end_f ;else if (n == 2) - mov eax,[edx+offs_cont_vertex] + mov eax,[edx+GLContext.vertex] push eax mov edi,eax add eax,sizeof.GLVertex @@ -606,11 +606,11 @@ align 4 jmp .end_f align 4 @@: - cmp dword[edx+offs_cont_begin_type],GL_TRIANGLES + cmp dword[edx+GLContext.begin_type],GL_TRIANGLES jne @f cmp dword[n],3 jne .end_f - mov eax,[edx+offs_cont_vertex] + mov eax,[edx+GLContext.vertex] mov [esp-12],eax add eax,sizeof.GLVertex mov [esp-8],eax @@ -623,9 +623,9 @@ align 4 jmp .end_f align 4 @@: - cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_STRIP + cmp dword[edx+GLContext.begin_type],GL_TRIANGLE_STRIP jne @f - cmp dword[edx+offs_cont_vertex_cnt],3 ;if (context.vertex_cnt >= 3) + cmp dword[edx+GLContext.vertex_cnt],3 ;if (context.vertex_cnt >= 3) jl .end_f cmp dword[n],3 jne .ts3 @@ -633,8 +633,8 @@ align 4 mov dword[n],eax .ts3: ; needed to respect triangle orientation - mov eax,[edx+offs_cont_vertex] - bt dword[edx+offs_cont_vertex_cnt],0 + mov eax,[edx+GLContext.vertex] + bt dword[edx+GLContext.vertex_cnt],0 jc .case_1 mov [esp-4],eax add eax,sizeof.GLVertex @@ -656,11 +656,11 @@ align 4 jmp .end_f align 4 @@: - cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_FAN + cmp dword[edx+GLContext.begin_type],GL_TRIANGLE_FAN jne @f cmp dword[n],3 jne .end_f - mov eax,[edx+offs_cont_vertex] + mov eax,[edx+GLContext.vertex] mov [esp-12],eax add eax,sizeof.GLVertex mov [esp-8],eax @@ -676,11 +676,11 @@ align 4 jmp .end_f align 4 @@: - cmp dword[edx+offs_cont_begin_type],GL_QUADS + cmp dword[edx+GLContext.begin_type],GL_QUADS jne @f cmp dword[n],4 jne .end_f - mov eax,[edx+offs_cont_vertex] + mov eax,[edx+GLContext.vertex] add eax,2*sizeof.GLVertex mov dword[eax+offs_vert_edge_flag],0 ;context.vertex[2].edge_flag = 0 push eax @@ -702,11 +702,11 @@ align 4 jmp .end_f align 4 @@: - cmp dword[edx+offs_cont_begin_type],GL_QUAD_STRIP + cmp dword[edx+GLContext.begin_type],GL_QUAD_STRIP jne @f cmp dword[n],4 jne .end_f - mov eax,[edx+offs_cont_vertex] + mov eax,[edx+GLContext.vertex] mov [esp-12],eax mov edi,eax add eax,sizeof.GLVertex @@ -729,7 +729,7 @@ align 4 jmp .end_f align 4 @@: - cmp dword[edx+offs_cont_begin_type],GL_POLYGON + cmp dword[edx+GLContext.begin_type],GL_POLYGON je .end_f ; default: ; gl_fatal_error("glBegin: type %x not handled\n", c->begin_type); @@ -737,7 +737,7 @@ align 4 .end_f: mov ecx,[n] - mov [edx+offs_cont_vertex_n],ecx + mov [edx+GLContext.vertex_n],ecx popad ret endp @@ -747,11 +747,11 @@ proc glopEnd uses eax ebx ecx, context:dword, p:dword mov eax,[context] ; assert(c->in_begin == 1); - cmp dword[eax+offs_cont_begin_type],GL_LINE_LOOP + cmp dword[eax+GLContext.begin_type],GL_LINE_LOOP jne .else_i - cmp dword[eax+offs_cont_vertex_cnt],3 + cmp dword[eax+GLContext.vertex_cnt],3 jl .end_i - mov ebx,[eax+offs_cont_vertex] + mov ebx,[eax+GLContext.vertex] push ebx add ebx,2*sizeof.GLVertex push ebx @@ -759,23 +759,23 @@ proc glopEnd uses eax ebx ecx, context:dword, p:dword jmp .end_i align 4 .else_i: - cmp dword[eax+offs_cont_begin_type],GL_POLYGON + cmp dword[eax+GLContext.begin_type],GL_POLYGON jne .end_i - mov ebx,dword[eax+offs_cont_vertex_cnt] + mov ebx,dword[eax+GLContext.vertex_cnt] @@: ;while (ebx >= 3) cmp ebx,3 jl .end_i dec ebx mov ecx,ebx imul ecx,sizeof.GLVertex - add ecx,[eax+offs_cont_vertex] + add ecx,[eax+GLContext.vertex] push ecx ;ecx = &context.vertex[i] sub ecx,sizeof.GLVertex push ecx ;ecx = &context.vertex[i-1] - stdcall gl_draw_triangle, eax,[eax+offs_cont_vertex] + stdcall gl_draw_triangle, eax,[eax+GLContext.vertex] jmp @b align 4 .end_i: - mov dword[eax+offs_cont_in_begin],0 + mov dword[eax+GLContext.in_begin],0 ret endp diff --git a/programs/develop/libraries/TinyGL/asm_fork/zgl.inc b/programs/develop/libraries/TinyGL/asm_fork/zgl.inc index fd84da677c..e2a77df6de 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/zgl.inc +++ b/programs/develop/libraries/TinyGL/asm_fork/zgl.inc @@ -333,93 +333,6 @@ struct GLContext depth_test dd ? ;int ends -offs_cont_s0 equ (4 + sizeof.GLLight * MAX_LIGHTS) -offs_cont_s1 equ (32 + offs_cont_s0 + sizeof.GLMaterial * 2) -offs_cont_s2 equ (228 + offs_cont_s1 + sizeof.GLViewport) -offs_cont_s3 equ (64 + offs_cont_s2 + MAX_NAME_STACK_DEPTH * 4) - -offs_cont_zb equ 0 ;ZBuffer* -offs_cont_lights equ 4 ;GLLight[MAX_LIGHTS] -offs_cont_first_light equ offs_cont_s0 ;GLLight* -offs_cont_ambient_light_model equ 4+offs_cont_s0 ;V4 -offs_cont_local_light_model equ 20+offs_cont_s0 ;int -offs_cont_lighting_enabled equ 24+offs_cont_s0 ;int -offs_cont_light_model_two_side equ 28+offs_cont_s0 ;int -offs_cont_materials equ 32+offs_cont_s0 ;GLMaterial[2] -offs_cont_color_material_enabled equ offs_cont_s1 ;int -offs_cont_current_color_material_mode equ 4+offs_cont_s1 ;int -offs_cont_current_color_material_type equ 8+offs_cont_s1 ;int -offs_cont_current_texture equ 12+offs_cont_s1 ;GLTexture* -offs_cont_texture_2d_enabled equ 16+offs_cont_s1 ;int -offs_cont_shared_state equ 20+offs_cont_s1 ;GLSharedState -offs_cont_current_op_buffer equ 28+offs_cont_s1 ;GLParamBuffer* -offs_cont_current_op_buffer_index equ 32+offs_cont_s1 ;int -offs_cont_exec_flag equ 36+offs_cont_s1 ;int -offs_cont_compile_flag equ 40+offs_cont_s1 ;int -offs_cont_print_flag equ 44+offs_cont_s1 ;int -offs_cont_matrix_mode equ 48+offs_cont_s1 ;int -offs_cont_matrix_stack equ 52+offs_cont_s1 ;*M4[3] -offs_cont_matrix_stack_ptr equ 64+offs_cont_s1 ;*M4[3] -offs_cont_matrix_stack_depth_max equ 76+offs_cont_s1 ;int[3] -offs_cont_matrix_model_view_inv equ 88+offs_cont_s1 ;M4 -offs_cont_matrix_model_projection equ 152+offs_cont_s1 ;M4 -offs_cont_matrix_model_projection_updated equ 216+offs_cont_s1 ;int -offs_cont_matrix_model_projection_no_w_transform equ 220+offs_cont_s1 ;int -offs_cont_apply_texture_matrix equ 224+offs_cont_s1 ;int -offs_cont_viewport equ 228+offs_cont_s1 ;GLViewport -offs_cont_polygon_mode_back equ offs_cont_s2 ;int -offs_cont_polygon_mode_front equ 4+offs_cont_s2 ;int -offs_cont_current_front_face equ 8+offs_cont_s2 ;int -offs_cont_current_shade_model equ 12+offs_cont_s2 ;int -offs_cont_current_cull_face equ 16+offs_cont_s2 ;int -offs_cont_cull_face_enabled equ 20+offs_cont_s2 ;int -offs_cont_normalize_enabled equ 24+offs_cont_s2 ;int -offs_cont_draw_triangle_front equ 28+offs_cont_s2 ;gl_draw_triangle_func -offs_cont_draw_triangle_back equ 32+offs_cont_s2 ;gl_draw_triangle_func -offs_cont_render_mode equ 36+offs_cont_s2 ;int -offs_cont_select_buffer equ 40+offs_cont_s2 ;unsigned int* -offs_cont_select_size equ 44+offs_cont_s2 ;int -offs_cont_select_ptr equ 48+offs_cont_s2 ;unsigned int* -offs_cont_select_hit equ 52+offs_cont_s2 ;unsigned int* -offs_cont_select_overflow equ 56+offs_cont_s2 ;int -offs_cont_select_hits equ 60+offs_cont_s2 ;int -offs_cont_name_stack equ 64+offs_cont_s2 ;unsigned int[MAX_NAME_STACK_DEPTH] -offs_cont_name_stack_size equ offs_cont_s3 ;int -offs_cont_clear_depth equ 4+offs_cont_s3 ;float -offs_cont_clear_color equ 8+offs_cont_s3 ;V4 -offs_cont_current_color equ 24+offs_cont_s3 ;V4 -offs_cont_longcurrent_color equ 40+offs_cont_s3 ;unsigned int[3] -offs_cont_current_normal equ 52+offs_cont_s3 ;V4 -offs_cont_current_tex_coord equ 68+offs_cont_s3 ;V4 -offs_cont_current_edge_flag equ 84+offs_cont_s3 ;int -offs_cont_in_begin equ 88+offs_cont_s3 ;int -offs_cont_begin_type equ 92+offs_cont_s3 ;int -offs_cont_vertex_n equ 96+offs_cont_s3 ;int -offs_cont_vertex_cnt equ 100+offs_cont_s3 ;int -offs_cont_vertex_max equ 104+offs_cont_s3 ;int -offs_cont_vertex equ 108+offs_cont_s3 ;GLVertex* -offs_cont_vertex_array equ 112+offs_cont_s3 ;float* -offs_cont_vertex_array_size equ 116+offs_cont_s3 ;int -offs_cont_vertex_array_stride equ 120+offs_cont_s3 ;int -offs_cont_normal_array equ 124+offs_cont_s3 ;float* -offs_cont_normal_array_stride equ 128+offs_cont_s3 ;int -offs_cont_color_array equ 132+offs_cont_s3 ;float* -offs_cont_color_array_size equ 136+offs_cont_s3 ;int -offs_cont_color_array_stride equ 140+offs_cont_s3 ;int -offs_cont_texcoord_array equ 144+offs_cont_s3 ;float* -offs_cont_texcoord_array_size equ 148+offs_cont_s3 ;int -offs_cont_texcoord_array_stride equ 152+offs_cont_s3 ;int -offs_cont_client_states equ 156+offs_cont_s3 ;int -offs_cont_offset_factor equ 160+offs_cont_s3 ;float -offs_cont_offset_units equ 164+offs_cont_s3 ;float -offs_cont_offset_states equ 168+offs_cont_s3 ;int -offs_cont_specbuf_first equ 172+offs_cont_s3 ;GLSpecBuf* -offs_cont_specbuf_used_counter equ 176+offs_cont_s3 ;int -offs_cont_specbuf_num_buffers equ 180+offs_cont_s3 ;int -offs_cont_opaque equ 184+offs_cont_s3 ;void* -offs_cont_gl_resize_viewport equ 188+offs_cont_s3 ;(struct GLContext *c,int *xsize,int *ysize) -offs_cont_depth_test equ 192+offs_cont_s3 ;int - align 16 gl_ctx dd ? ;extern GLContext*