Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. align 4
  3. proc glRenderMode uses ebx ecx, mode:dword
  4.         call gl_get_context
  5.         xor ebx,ebx
  6.  
  7.         cmp dword[eax+offs_cont_render_mode],GL_RENDER
  8.         je .e_sw_1
  9.         cmp dword[eax+offs_cont_render_mode],GL_SELECT
  10.         jne .def_1
  11.                 cmp dword[eax+offs_cont_select_overflow],0
  12.                 je @f
  13.                         sub ebx,[eax+offs_cont_select_hits]
  14.                         jmp .else_e
  15.                 @@:
  16.                         mov ebx,[eax+offs_cont_select_hits]
  17.                 .else_e:
  18.                         mov dword[eax+offs_cont_select_overflow],0
  19.                         mov ecx,[eax+offs_cont_select_buffer]
  20.                         mov dword[eax+offs_cont_select_ptr],ecx
  21.                         mov dword[eax+offs_cont_name_stack_size],0
  22.                 jmp .e_sw_1
  23.         .def_1:
  24. ;    assert(0);
  25.         .e_sw_1:
  26.         cmp dword[mode],GL_RENDER
  27.         jne @f
  28.                 mov dword[eax+offs_cont_render_mode],GL_RENDER
  29.                 jmp .e_sw_2
  30.         @@:
  31.         cmp dword[mode],GL_SELECT
  32.         jne .def_2
  33.                 mov dword[eax+offs_cont_render_mode],GL_SELECT
  34. ;    assert( c->select_buffer != NULL);
  35.                 mov ecx,[eax+offs_cont_select_buffer]
  36.                 mov dword[eax+offs_cont_select_ptr],ecx
  37.                 mov dword[eax+offs_cont_select_hits],0
  38.                 mov dword[eax+offs_cont_select_overflow],0
  39.                 mov dword[eax+offs_cont_select_hit],0 ;NULL
  40.                 jmp .e_sw_2
  41.         .def_2:
  42. ;    assert(0);
  43.         .e_sw_2:
  44.         mov eax,ebx
  45.         ret
  46. endp
  47.  
  48. align 4
  49. proc glSelectBuffer uses eax ebx, size:dword, buf:dword
  50.         call gl_get_context
  51.  
  52. ;  assert(c->render_mode != GL_SELECT);
  53.  
  54.         mov ebx,[buf]
  55.         mov dword[eax+offs_cont_select_buffer],ebx
  56.         mov ebx,[size]
  57.         mov dword[eax+offs_cont_select_size],ebx
  58.         ret
  59. endp
  60.  
  61. align 4
  62. proc glopInitNames uses eax, context:dword, p:dword
  63.         mov eax,[context]
  64.         cmp dword[eax+offs_cont_render_mode],GL_SELECT
  65.         jne @f
  66.                 mov dword[eax+offs_cont_name_stack_size],0
  67.                 mov dword[eax+offs_cont_select_hit],0 ;=NULL
  68.         @@:
  69.         ret
  70. endp
  71.  
  72. align 4
  73. proc glopPushName uses eax ebx, context:dword, p:dword
  74.         mov eax,[context]
  75.         cmp dword[eax+offs_cont_render_mode],GL_SELECT
  76.         jne @f
  77. ;    assert(c->name_stack_size<MAX_NAME_STACK_DEPTH);
  78.                 mov dword[eax+offs_cont_select_hit],0 ;=NULL
  79.                 inc dword[eax+offs_cont_name_stack_size]
  80.                 mov ebx,dword[eax+offs_cont_name_stack_size]
  81.                 shl ebx,2
  82.                 add ebx,eax
  83.                 mov eax,[p]
  84.                 mov eax,[eax+4]
  85.                 mov dword[ebx+offs_cont_name_stack],eax ;context.name_stack[context.name_stack_size++]=p[1]
  86.         @@:
  87.         ret
  88. endp
  89.  
  90. align 4
  91. proc glopPopName uses eax, context:dword, p:dword
  92.         mov eax,[context]
  93.         cmp dword[eax+offs_cont_render_mode],GL_SELECT
  94.         jne @f
  95. ;    assert(c->name_stack_size>0);
  96.                 dec dword[eax+offs_cont_name_stack_size]
  97.                 mov dword[eax+offs_cont_select_hit],0 ;=NULL
  98.         @@:
  99.         ret
  100. endp
  101.  
  102. align 4
  103. proc glopLoadName uses eax ebx, context:dword, p:dword
  104.         mov eax,[context]
  105.         cmp dword[eax+offs_cont_render_mode],GL_SELECT
  106.         jne @f
  107. ;   assert(c->name_stack_size>0);
  108.                 mov dword[eax+offs_cont_select_hit],0 ;=NULL
  109.                 mov ebx,dword[eax+offs_cont_name_stack_size]
  110.                 dec ebx
  111.                 shl ebx,2
  112.                 add ebx,eax
  113.                 mov eax,[p]
  114.                 mov eax,[eax+4]
  115.                 mov dword[ebx+offs_cont_name_stack],eax ;context.name_stack[context.name_stack_size-1]=p[1]
  116.         @@:
  117.         ret
  118. endp
  119.  
  120. align 4
  121. proc gl_add_select uses eax ebx ecx edx, context:dword, zmin:dword, zmax:dword
  122. ;  unsigned int *ptr;
  123. ;  int i;
  124.         mov eax,[context]
  125.  
  126.         cmp dword[eax+offs_cont_select_overflow],0
  127.         jne .end_f ;if (!context.select_overflow)
  128.         cmp dword[eax+offs_cont_select_hit],0 ;if (context.select_hit==NULL)
  129.         jne .els_0
  130.                 mov ecx,[eax+offs_cont_name_stack_size]
  131.                 mov ebx,[eax+offs_cont_select_ptr]
  132.                 sub ebx,[eax+offs_cont_select_buffer]
  133.                 sub ebx,3
  134.                 sub ebx,ecx
  135.                 cmp ebx,[eax+offs_cont_select_size]
  136.                 jle .els_1
  137.                         mov dword[eax+offs_cont_select_overflow],1
  138.                 jmp .end_f
  139.                 .els_1:
  140.                 mov ebx,[eax+offs_cont_select_ptr]
  141.                 mov [eax+offs_cont_select_hit],ebx
  142.                 mov edx,[eax+offs_cont_name_stack_size]
  143.                 mov [ebx],edx
  144.                 add ebx,4
  145.                 mov edx,[zmin]
  146.                 mov [ebx],edx
  147.                 add ebx,4
  148.                 mov edx,[zmax]
  149.                 mov [ebx],edx
  150.                 add ebx,4
  151. ;       for(i=0;i<ecx;i++) *ptr++=c->name_stack[i];
  152.                 mov [eax+offs_cont_select_ptr],ebx
  153.                 inc dword[eax+offs_cont_select_hits]
  154.                 jmp .end_f
  155.         .els_0:
  156.                 mov ebx,[zmin]
  157.                 cmp dword[eax+offs_cont_select_hit+4],ebx
  158.                 jle @f
  159.                         mov dword[eax+offs_cont_select_hit+4],ebx
  160.                 @@:
  161.                 mov ebx,[zmax]
  162.                 cmp dword[eax+offs_cont_select_hit+8],ebx
  163.                 jge .end_f
  164.                         mov dword[eax+offs_cont_select_hit+8],ebx
  165.         .end_f:
  166.         ret
  167. endp
  168.  
  169.