Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. align 4
  3. proc glopViewport uses eax ebx ecx edx, context:dword, p:dword
  4. locals
  5.         xsize dd ? ;int
  6.         ysize dd ? ;int
  7.         xmin dd ? ;int
  8.         ymin dd ? ;int
  9.         xsize_req dd ? ;int
  10.         ysize_req dd ? ;int
  11. endl
  12.         mov edx,[context]
  13.         mov ebx,[p]
  14.  
  15.         mov ecx,[ebx+4]
  16.         mov [xmin],ecx
  17.         mov ecx,[ebx+8]
  18.         mov [ymin],ecx
  19.         mov ecx,[ebx+12]
  20.         mov [xsize],ecx
  21.         mov ecx,[ebx+16]
  22.         mov [ysize],ecx
  23.  
  24.         ; we may need to resize the zbuffer
  25.  
  26.         cmp dword[edx+offs_cont_viewport+offs_vpor_ysize],ecx
  27.         jne @f
  28.         mov ecx,[xmin]
  29.         cmp dword[edx+offs_cont_viewport+offs_vpor_xmin],ecx
  30.         jne @f
  31.         mov ecx,[ymin]
  32.         cmp dword[edx+offs_cont_viewport+offs_vpor_ymin],ecx
  33.         jne @f
  34.         mov ecx,[xsize]
  35.         cmp dword[edx+offs_cont_viewport+offs_vpor_xsize],ecx
  36.         jne @f
  37.                 jmp .end_f
  38.         @@:
  39.  
  40.         mov ecx,[xmin]
  41.         add ecx,[xsize]
  42.         mov [xsize_req],ecx ;xsize_req = xmin + xsize
  43.         mov ecx,[ymin]
  44.         add ecx,[ysize]
  45.         mov [ysize_req],ecx ;ysize_req = ymin + ysize
  46.  
  47.         cmp dword[edx+offs_cont_gl_resize_viewport],0
  48.         je @f
  49.                 mov eax,ebp
  50.                 sub eax,4
  51.                 push eax
  52.                 sub eax,4
  53.                 push eax
  54.                 stdcall dword[edx+offs_cont_gl_resize_viewport], edx ;gl_resize_viewport(context,&xsize_req,&ysize_req)
  55.                 cmp eax,0
  56.                 je @f
  57.                         stdcall dbg_print,sz_glViewport,err_4
  58.         @@:
  59.  
  60.         mov ecx,[xsize_req]
  61.         sub ecx,[xmin]
  62.         mov [xsize],ecx
  63.         mov ecx,[ysize_req]
  64.         sub ecx,[ymin]
  65.         mov [ysize],ecx
  66.         cmp ecx,0
  67.         jg @f
  68.         cmp dword[xsize],0
  69.         jg @f
  70.                 stdcall dbg_print,sz_glViewport,err_5
  71.         @@:
  72.         mov ecx,[xmin]
  73.         mov dword[edx+offs_cont_viewport+offs_vpor_xmin],ecx
  74.         mov ecx,[ymin]
  75.         mov dword[edx+offs_cont_viewport+offs_vpor_ymin],ecx
  76.         mov ecx,[xsize]
  77.         mov dword[edx+offs_cont_viewport+offs_vpor_xsize],ecx
  78.         mov ecx,[ysize]
  79.         mov dword[edx+offs_cont_viewport+offs_vpor_ysize],ecx
  80.  
  81.         mov dword[edx+offs_cont_viewport+offs_vpor_updated],1
  82.         .end_f:
  83.         ret
  84. endp
  85.  
  86. align 4
  87. proc glopEnableDisable uses eax ebx ecx, context:dword, p:dword
  88.         mov eax,[context]
  89.         mov ebx,[p]
  90.         mov ecx,[ebx+8]
  91.         mov ebx,[ebx+4]
  92.  
  93.         cmp ebx,GL_CULL_FACE
  94.         jne @f
  95.                 mov [eax+offs_cont_cull_face_enabled],ecx
  96.                 jmp .end_f
  97.         @@:
  98.         cmp ebx,GL_LIGHTING
  99.         jne @f
  100.                 mov [eax+offs_cont_lighting_enabled],ecx
  101.                 jmp .end_f
  102.         @@:
  103.         cmp ebx,GL_COLOR_MATERIAL
  104.         jne @f
  105.                 mov [eax+offs_cont_color_material_enabled],ecx
  106.                 jmp .end_f
  107.         @@:
  108.         cmp ebx,GL_TEXTURE_2D
  109.         jne @f
  110.                 mov [eax+offs_cont_texture_2d_enabled],ecx
  111.                 jmp .end_f
  112.         @@:
  113.         cmp ebx,GL_NORMALIZE
  114.         jne @f
  115.                 mov [eax+offs_cont_normalize_enabled],ecx
  116.                 jmp .end_f
  117.         @@:
  118.         cmp ebx,GL_DEPTH_TEST
  119.         jne @f
  120.                 mov [eax+offs_cont_depth_test],ecx
  121.                 jmp .end_f
  122.         @@:
  123.         cmp ebx,GL_POLYGON_OFFSET_FILL
  124.         jne .polygon_offset_fill
  125.                 cmp ecx,0
  126.                 je @f
  127.                         or dword[eax+offs_cont_offset_states],TGL_OFFSET_FILL
  128.                         jmp .end_f
  129.                 @@:
  130.                         and dword[eax+offs_cont_offset_states],not TGL_OFFSET_FILL
  131.                 jmp .end_f
  132.         .polygon_offset_fill:
  133.         cmp ebx,GL_POLYGON_OFFSET_POINT
  134.         jne .polygon_offset_point
  135.                 cmp ecx,0
  136.                 je @f
  137.                         or dword[eax+offs_cont_offset_states],TGL_OFFSET_POINT
  138.                         jmp .end_f
  139.                 @@:
  140.                         and dword[eax+offs_cont_offset_states],not TGL_OFFSET_POINT
  141.                 jmp .end_f
  142.         .polygon_offset_point:
  143.         cmp ebx,GL_POLYGON_OFFSET_LINE
  144.         jne .polygon_offset_line
  145.                 cmp ecx,0
  146.                 je @f
  147.                         or dword[eax+offs_cont_offset_states],TGL_OFFSET_LINE
  148.                         jmp .end_f
  149.                 @@:
  150.                         and dword[eax+offs_cont_offset_states],not TGL_OFFSET_LINE
  151.                 jmp .end_f
  152.         .polygon_offset_line: ;default:
  153.         cmp ebx,GL_LIGHT0
  154.         jl .els_0
  155.         cmp ebx,GL_LIGHT0+MAX_LIGHTS
  156.         jge .els_0 ;if (GL_LIGHT0 <= ebx < GL_LIGHT0+MAX_LIGHTS)
  157.                 sub ebx,GL_LIGHT0
  158.                 stdcall gl_enable_disable_light, eax,ebx,ecx
  159.                 jmp .end_f
  160.         .els_0:
  161. ;//fprintf(stderr,"glEnableDisable: 0x%X not supported.\n",code);
  162.         .end_f:
  163.         ret
  164. endp
  165.  
  166. align 4
  167. proc glopShadeModel uses eax ebx, context:dword,p:dword
  168.         mov eax,[context]
  169.         mov ebx,[p]
  170.         mov ebx,[ebx+4]
  171.         mov [eax+offs_cont_current_shade_model],ebx
  172.         ret
  173. endp
  174.  
  175. align 4
  176. proc glopCullFace uses eax ebx, context:dword,p:dword
  177.         mov eax,[context]
  178.         mov ebx,[p]
  179.         mov ebx,[ebx+4]
  180.         mov [eax+offs_cont_current_cull_face],ebx
  181.         ret
  182. endp
  183.  
  184. align 4
  185. proc glopFrontFace uses eax ebx, context:dword,p:dword
  186.         mov eax,[context]
  187.         mov ebx,[p]
  188.         mov ebx,[ebx+4]
  189.         mov [eax+offs_cont_current_front_face],ebx
  190.         ret
  191. endp
  192.  
  193. align 4
  194. proc glopPolygonMode uses eax ebx, context:dword,p:dword
  195.         mov eax,[context]
  196.         mov ebx,[p]
  197.  
  198.         cmp dword[ebx+4],GL_BACK
  199.         jne @f
  200.                 mov ebx,[ebx+8]
  201.                 mov [eax+offs_cont_polygon_mode_back],ebx
  202.                 jmp .end_f
  203.         @@:
  204.         cmp dword[ebx+4],GL_FRONT
  205.         jne @f
  206.                 mov ebx,[ebx+8]
  207.                 mov [eax+offs_cont_polygon_mode_front],ebx
  208.                 jmp .end_f
  209.         @@:
  210.         cmp dword[ebx+4],GL_FRONT_AND_BACK
  211.         jne @f
  212.                 mov ebx,[ebx+8]
  213.                 mov [eax+offs_cont_polygon_mode_front],ebx
  214.                 mov [eax+offs_cont_polygon_mode_back],ebx
  215.                 jmp .end_f
  216.         @@:
  217. ;    assert(0);
  218.         .end_f:
  219.         ret
  220. endp
  221.  
  222. align 4
  223. proc glopHint, context:dword,p:dword
  224. if 0
  225. ;  int target=p[1].i;
  226. ;  int mode=p[2].i;
  227.  
  228.         ; do nothing
  229. end if
  230.         ret
  231. endp
  232.  
  233. align 4
  234. proc glopPolygonOffset uses eax ebx ecx, context:dword,p:dword
  235.         mov eax,[context]
  236.         mov ebx,[p]
  237.         mov ecx,[ebx+4]
  238.         mov [eax+offs_cont_offset_factor],ecx
  239.         mov ecx,[ebx+8]
  240.         mov [eax+offs_cont_offset_units],ecx
  241.         ret
  242. endp