Rev 6189 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6189 | Rev 6243 | ||
---|---|---|---|
Line 207... | Line 207... | ||
207 | align 4 |
207 | align 4 |
208 | proc glopTexImage2D, context:dword, p:dword |
208 | proc glopTexImage2D, context:dword, p:dword |
209 | locals |
209 | locals |
210 | pixels1 dd ? |
210 | pixels1 dd ? |
211 | do_free dd ? |
211 | do_free dd ? |
- | 212 | aligned_width dd ? |
|
- | 213 | aligned_height dd ? |
|
212 | endl |
214 | endl |
213 | pushad |
215 | pushad |
214 | mov edi,[p] |
216 | mov edi,[p] |
215 | mov eax,[edi+4] ;target=p[1].i |
217 | mov eax,[edi+4] ;target=p[1].i |
216 | mov ebx,[edi+8] ;level=p[2].i |
218 | mov ebx,[edi+8] ;level=p[2].i |
Line 234... | Line 236... | ||
234 | jmp @f |
236 | jmp @f |
235 | .error: |
237 | .error: |
236 | stdcall dbg_print,sz_glTexImage2D,err_8 ;"glTexImage2D: combinaison of parameters not handled" |
238 | stdcall dbg_print,sz_glTexImage2D,err_8 ;"glTexImage2D: combinaison of parameters not handled" |
237 | @@: |
239 | @@: |
Line -... | Line 240... | ||
- | 240 | ||
- | 241 | stdcall gl_getPervPowerOfTwo,edx |
|
- | 242 | mov [aligned_width],eax |
|
- | 243 | stdcall gl_getPervPowerOfTwo,esi |
|
- | 244 | mov [aligned_height],eax |
|
238 | 245 | ||
239 | mov dword[do_free],0 |
246 | mov dword[do_free],0 |
240 | cmp edx,256 |
247 | cmp edx,[aligned_width] |
241 | jne .else |
248 | jne .else |
242 | cmp esi,256 |
249 | cmp esi,[aligned_height] |
243 | jne .else |
250 | jne .else |
244 | mov eax,[edi+36] |
251 | mov eax,[edi+36] |
245 | mov [pixels1],eax ;pixels1=pixels |
252 | mov [pixels1],eax ;pixels1=pixels |
- | 253 | jmp @f |
|
246 | jmp @f |
254 | align 4 |
- | 255 | .else: ;if (width != aligned_width || height != aligned_height) |
|
- | 256 | imul eax,[aligned_width] |
|
247 | .else: ;if (width != 256 || height != 256) |
257 | imul eax,3 |
248 | stdcall gl_malloc, 256*256*3 |
258 | stdcall gl_malloc, eax |
249 | mov [pixels1],eax ;pixels1 = gl_malloc(256 * 256 * 3) |
259 | mov [pixels1],eax ;pixels1 = gl_malloc(aligned_width * aligned_height * 3) |
250 | ; no interpolation is done here to respect the original image aliasing ! |
260 | ; no interpolation is done here to respect the original image aliasing ! |
251 | stdcall gl_resizeImage, eax,256,256,[edi+36],edx,esi |
261 | stdcall gl_resizeImage, eax,[aligned_width],[aligned_height],[edi+36],edx,esi |
252 | mov dword[do_free],1 |
262 | mov dword[do_free],1 |
253 | mov edx,256 |
263 | mov edx,[aligned_width] |
254 | mov esi,256 |
264 | mov esi,[aligned_height] |
Line 255... | Line 265... | ||
255 | @@: |
265 | @@: |
256 | 266 | ||
257 | mov ecx,[context] |
267 | mov ecx,[context] |
258 | mov ecx,[ecx+offs_cont_current_texture] |
268 | mov ecx,[ecx+offs_cont_current_texture] |
259 | add ecx,offs_text_images |
269 | add ecx,offs_text_images |
260 | imul ebx,sizeof.GLTexture |
270 | imul ebx,sizeof.GLTexture |
261 | add ecx,ebx ;ecx = &context.current_texture.images[level] |
271 | add ecx,ebx ;ecx = &context.current_texture.images[level] |
- | 272 | mov [ecx+offs_imag_xsize],edx ;im.xsize=width |
|
- | 273 | mov [ecx+offs_imag_ysize],esi ;im.ysize=height |
|
- | 274 | mov ebx,edx |
|
- | 275 | dec ebx |
|
- | 276 | shl ebx,ZB_POINT_TEXEL_SIZE |
|
- | 277 | mov [ecx+offs_imag_s_bound],ebx ;im.s_bound = (unsigned int)(width-1) |
|
- | 278 | shr ebx,ZB_POINT_TEXEL_SIZE |
|
- | 279 | ||
- | 280 | mov dword[ecx+offs_imag_xsize_log2],ZB_POINT_TEXEL_SIZE |
|
- | 281 | or ebx,ebx |
|
- | 282 | jz .set_l2 |
|
- | 283 | @@: |
|
- | 284 | dec dword[ecx+offs_imag_xsize_log2] |
|
- | 285 | shr ebx,1 |
|
- | 286 | or ebx,ebx |
|
- | 287 | jnz @b |
|
- | 288 | .set_l2: |
|
- | 289 | ;im.xsize_log2 = ZB_POINT_TEXEL_SIZE-log_2(width) |
|
- | 290 | dec esi |
|
- | 291 | shl esi,ZB_POINT_TEXEL_SIZE |
|
- | 292 | mov [ecx+offs_imag_t_bound],esi ;im.t_bound = (unsigned int)(height-1) |
|
262 | mov dword[ecx+offs_imag_xsize],edx ;im.xsize=width |
293 | shr esi,ZB_POINT_TEXEL_SIZE |
263 | mov dword[ecx+offs_imag_ysize],esi ;im.ysize=height |
294 | inc esi |
264 | cmp dword[ecx+offs_imag_pixmap],0 ;if (im.pixmap!=NULL) |
295 | cmp dword[ecx+offs_imag_pixmap],0 ;if (im.pixmap!=NULL) |
265 | je @f |
296 | je @f |
266 | stdcall gl_free, [ecx+offs_imag_pixmap] |
297 | stdcall gl_free, [ecx+offs_imag_pixmap] |