Subversion Repositories Kolibri OS

Rev

Rev 5153 | Rev 6108 | 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,f_vp,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,f_vp,err_5
  71.         @@:
  72. if DEBUG ;glopViewport
  73. push edi
  74.         mov ecx,80
  75.         mov eax,[xmin]
  76.         lea edi,[buf_param]
  77.         stdcall convert_int_to_str,ecx
  78.         stdcall str_n_cat,edi,txt_zp_sp,2
  79.         stdcall str_len,edi
  80.         add edi,eax
  81.         sub ecx,eax
  82.  
  83.         mov eax,[ymin]
  84.         stdcall convert_int_to_str,ecx
  85.         stdcall str_n_cat,edi,txt_zp_sp,2
  86.         stdcall str_len,edi
  87.         add edi,eax
  88.         sub ecx,eax
  89.  
  90.         mov eax,[xsize]
  91.         stdcall convert_int_to_str,ecx
  92.         stdcall str_n_cat,edi,txt_zp_sp,2
  93.         stdcall str_len,edi
  94.         add edi,eax
  95.         sub ecx,eax
  96.  
  97.         mov eax,[ysize]
  98.         stdcall convert_int_to_str,ecx
  99.  
  100.         stdcall str_n_cat,edi,txt_nl,2
  101.         stdcall dbg_print,f_vp,buf_param
  102. pop edi
  103. end if
  104.         mov ecx,[xmin]
  105.         mov dword[edx+offs_cont_viewport+offs_vpor_xmin],ecx
  106.         mov ecx,[ymin]
  107.         mov dword[edx+offs_cont_viewport+offs_vpor_ymin],ecx
  108.         mov ecx,[xsize]
  109.         mov dword[edx+offs_cont_viewport+offs_vpor_xsize],ecx
  110.         mov ecx,[ysize]
  111.         mov dword[edx+offs_cont_viewport+offs_vpor_ysize],ecx
  112.  
  113.         mov dword[edx+offs_cont_viewport+offs_vpor_updated],1
  114.         .end_f:
  115.         ret
  116. endp
  117.  
  118. align 4
  119. proc glopEnableDisable uses eax ebx ecx, context:dword, p:dword
  120.         mov eax,[context]
  121.         mov ebx,[p]
  122.         mov ecx,[ebx+8]
  123.         mov ebx,[ebx+4]
  124.  
  125.         cmp ebx,GL_CULL_FACE
  126.         jne @f
  127.                 mov [eax+offs_cont_cull_face_enabled],ecx
  128.                 jmp .end_f
  129.         @@:
  130.         cmp ebx,GL_LIGHTING
  131.         jne @f
  132.                 mov [eax+offs_cont_lighting_enabled],ecx
  133.                 jmp .end_f
  134.         @@:
  135.         cmp ebx,GL_COLOR_MATERIAL
  136.         jne @f
  137.                 mov [eax+offs_cont_color_material_enabled],ecx
  138.                 jmp .end_f
  139.         @@:
  140.         cmp ebx,GL_TEXTURE_2D
  141.         jne @f
  142.                 mov [eax+offs_cont_texture_2d_enabled],ecx
  143.                 jmp .end_f
  144.         @@:
  145.         cmp ebx,GL_NORMALIZE
  146.         jne @f
  147.                 mov [eax+offs_cont_normalize_enabled],ecx
  148.                 jmp .end_f
  149.         @@:
  150.         cmp ebx,GL_DEPTH_TEST
  151.         jne @f
  152.                 mov [eax+offs_cont_depth_test],ecx
  153.                 jmp .end_f
  154.         @@:
  155.         cmp ebx,GL_POLYGON_OFFSET_FILL
  156.         jne .polygon_offset_fill
  157.                 cmp ecx,0
  158.                 je @f
  159.                         or dword[eax+offs_cont_offset_states],TGL_OFFSET_FILL
  160.                         jmp .end_f
  161.                 @@:
  162.                         and dword[eax+offs_cont_offset_states],not TGL_OFFSET_FILL
  163.                 jmp .end_f
  164.         .polygon_offset_fill:
  165.         cmp ebx,GL_POLYGON_OFFSET_POINT
  166.         jne .polygon_offset_point
  167.                 cmp ecx,0
  168.                 je @f
  169.                         or dword[eax+offs_cont_offset_states],TGL_OFFSET_POINT
  170.                         jmp .end_f
  171.                 @@:
  172.                         and dword[eax+offs_cont_offset_states],not TGL_OFFSET_POINT
  173.                 jmp .end_f
  174.         .polygon_offset_point:
  175.         cmp ebx,GL_POLYGON_OFFSET_LINE
  176.         jne .polygon_offset_line
  177.                 cmp ecx,0
  178.                 je @f
  179.                         or dword[eax+offs_cont_offset_states],TGL_OFFSET_LINE
  180.                         jmp .end_f
  181.                 @@:
  182.                         and dword[eax+offs_cont_offset_states],not TGL_OFFSET_LINE
  183.                 jmp .end_f
  184.         .polygon_offset_line: ;default:
  185.         cmp ebx,GL_LIGHT0
  186.         jl .els_0
  187.         cmp ebx,GL_LIGHT0+MAX_LIGHTS
  188.         jge .els_0 ;if (GL_LIGHT0 <= ebx < GL_LIGHT0+MAX_LIGHTS)
  189.                 sub ebx,GL_LIGHT0
  190.                 stdcall gl_enable_disable_light, eax,ebx,ecx
  191.                 jmp .end_f
  192.         .els_0:
  193. ;//fprintf(stderr,"glEnableDisable: 0x%X not supported.\n",code);
  194.         .end_f:
  195.         ret
  196. endp
  197.  
  198. align 4
  199. proc glopShadeModel uses eax ebx, context:dword,p:dword
  200.         mov eax,[context]
  201.         mov ebx,[p]
  202.         mov ebx,[ebx+4]
  203.         mov [eax+offs_cont_current_shade_model],ebx
  204.         ret
  205. endp
  206.  
  207. align 4
  208. proc glopCullFace uses eax ebx, context:dword,p:dword
  209.         mov eax,[context]
  210.         mov ebx,[p]
  211.         mov ebx,[ebx+4]
  212.         mov [eax+offs_cont_current_cull_face],ebx
  213.         ret
  214. endp
  215.  
  216. align 4
  217. proc glopFrontFace uses eax ebx, context:dword,p:dword
  218.         mov eax,[context]
  219.         mov ebx,[p]
  220.         mov ebx,[ebx+4]
  221.         mov [eax+offs_cont_current_front_face],ebx
  222.         ret
  223. endp
  224.  
  225. align 4
  226. proc glopPolygonMode uses eax ebx, context:dword,p:dword
  227.         mov eax,[context]
  228.         mov ebx,[p]
  229.  
  230.         cmp dword[ebx+4],GL_BACK
  231.         jne @f
  232.                 mov ebx,[ebx+8]
  233.                 mov [eax+offs_cont_polygon_mode_back],ebx
  234.                 jmp .end_f
  235.         @@:
  236.         cmp dword[ebx+4],GL_FRONT
  237.         jne @f
  238.                 mov ebx,[ebx+8]
  239.                 mov [eax+offs_cont_polygon_mode_front],ebx
  240.                 jmp .end_f
  241.         @@:
  242.         cmp dword[ebx+4],GL_FRONT_AND_BACK
  243.         jne @f
  244.                 mov ebx,[ebx+8]
  245.                 mov [eax+offs_cont_polygon_mode_front],ebx
  246.                 mov [eax+offs_cont_polygon_mode_back],ebx
  247.                 jmp .end_f
  248.         @@:
  249. ;    assert(0);
  250.         .end_f:
  251.         ret
  252. endp
  253.  
  254. align 4
  255. proc glopHint, context:dword,p:dword
  256. if 0
  257. ;  int target=p[1].i;
  258. ;  int mode=p[2].i;
  259.  
  260.         ; do nothing
  261. end if
  262.         ret
  263. endp
  264.  
  265. align 4
  266. proc glopPolygonOffset uses eax ebx ecx, context:dword,p:dword
  267.         mov eax,[context]
  268.         mov ebx,[p]
  269.         mov ecx,[ebx+4]
  270.         mov [eax+offs_cont_offset_factor],ecx
  271.         mov ecx,[ebx+8]
  272.         mov [eax+offs_cont_offset_units],ecx
  273.         ret
  274. endp