Subversion Repositories Kolibri OS

Rev

Rev 6243 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6243 Rev 6523
Line 3... Line 3...
3
;
3
;
Line 4... Line 4...
4
 
4
 
5
align 4
5
align 4
6
proc find_texture uses ebx ecx, context:dword, h:dword
6
proc find_texture uses ebx ecx, context:dword, h:dword
7
	mov ebx,[context]
7
	mov ebx,[context]
8
	mov ebx,[ebx+offs_cont_shared_state+4] ;ebx = &texture_hash_table
8
	mov ebx,[ebx+GLContext.shared_state+4] ;ebx = &texture_hash_table
9
	mov eax,[h]
9
	mov eax,[h]
10
	and eax,0xff
10
	and eax,0xff
11
	shl eax,2
11
	shl eax,2
Line 32... Line 32...
32
	mov edx,[context]
32
	mov edx,[context]
Line 33... Line 33...
33
 
33
 
34
	stdcall find_texture,edx,[h] ;t=find_texture(context,h)
34
	stdcall find_texture,edx,[h] ;t=find_texture(context,h)
35
	cmp dword[eax+offs_text_prev],0 ;if (t.prev==NULL)
35
	cmp dword[eax+offs_text_prev],0 ;if (t.prev==NULL)
36
	jne .else
36
	jne .else
37
		mov edx,[edx+offs_cont_shared_state+4] ;edx = &context.shared_state.texture_hash_table[0]
37
		mov edx,[edx+GLContext.shared_state+4] ;edx = &context.shared_state.texture_hash_table[0]
38
		mov ebx,[eax+offs_text_handle]
38
		mov ebx,[eax+offs_text_handle]
39
		and ebx,0xff
39
		and ebx,0xff
40
		shl ebx,2
40
		shl ebx,2
41
		add edx,ebx ;edx = &context.shared_state.texture_hash_table[t.handle % TEXTURE_HASH_TABLE_SIZE]
41
		add edx,ebx ;edx = &context.shared_state.texture_hash_table[t.handle % TEXTURE_HASH_TABLE_SIZE]
Line 78... Line 78...
78
proc alloc_texture uses ebx ecx, context:dword, h:dword
78
proc alloc_texture uses ebx ecx, context:dword, h:dword
Line 79... Line 79...
79
 
79
 
Line 80... Line 80...
80
	stdcall gl_zalloc,sizeof.GLTexture
80
	stdcall gl_zalloc,sizeof.GLTexture
81
 
81
 
82
	mov ebx,[context]
82
	mov ebx,[context]
83
	mov ebx,[ebx+offs_cont_shared_state+4] ;ebx = &texture_hash_table
83
	mov ebx,[ebx+GLContext.shared_state+4] ;ebx = &texture_hash_table
84
	mov ecx,[h]
84
	mov ecx,[h]
85
	and ecx,0xff
85
	and ecx,0xff
Line 103... Line 103...
103
 
103
 
104
align 4
104
align 4
105
proc glInitTextures uses eax edx, context:dword
105
proc glInitTextures uses eax edx, context:dword
106
	; textures
106
	; textures
107
	mov edx,[context]
107
	mov edx,[context]
108
	mov dword[edx+offs_cont_texture_2d_enabled],0
108
	mov dword[edx+GLContext.texture_2d_enabled],0
109
	stdcall find_texture,edx,0
109
	stdcall find_texture,edx,0
110
	mov dword[edx+offs_cont_current_texture],eax
110
	mov dword[edx+GLContext.current_texture],eax
111
	ret
111
	ret
Line 112... Line 112...
112
endp
112
endp
113
 
113
 
114
align 4
114
align 4
115
proc glGenTextures uses eax ebx ecx edx esi, n:dword, textures:dword
115
proc glGenTextures uses eax ebx ecx edx esi, n:dword, textures:dword
116
;edx - GLTexture *t
116
;edx - GLTexture *t
Line 117... Line 117...
117
	call gl_get_context
117
	call gl_get_context
118
	add eax,offs_cont_shared_state+4 ;offset texture_hash_table = 4
118
	add eax,GLContext.shared_state+4 ;offset texture_hash_table = 4
119
 
119
 
120
	xor ebx,ebx ;max=0
120
	xor ebx,ebx ;max=0
Line 165... Line 165...
165
	cmp ebx,[n]
165
	cmp ebx,[n]
166
	jge .cycle_0_end
166
	jge .cycle_0_end
167
		stdcall find_texture,edx,[ecx] ;t=find_texture(context,textures[i])
167
		stdcall find_texture,edx,[ecx] ;t=find_texture(context,textures[i])
168
		or eax,eax ;if (t!=0)
168
		or eax,eax ;if (t!=0)
169
		jz @f
169
		jz @f
170
			cmp eax,[edx+offs_cont_current_texture] ;if (t==context.current_texture)
170
			cmp eax,[edx+GLContext.current_texture] ;if (t==context.current_texture)
171
			jne .end_1
171
			jne .end_1
172
				stdcall glBindTexture,GL_TEXTURE_2D,0
172
				stdcall glBindTexture,GL_TEXTURE_2D,0
173
			.end_1:
173
			.end_1:
174
			stdcall free_texture, edx,[ecx]
174
			stdcall free_texture, edx,[ecx]
175
		@@:
175
		@@:
Line 198... Line 198...
198
	stdcall find_texture, edx,ebx
198
	stdcall find_texture, edx,ebx
199
	or eax,eax ;if(t==NULL)
199
	or eax,eax ;if(t==NULL)
200
	jnz @f
200
	jnz @f
201
		stdcall alloc_texture, edx,ebx
201
		stdcall alloc_texture, edx,ebx
202
	@@:
202
	@@:
203
	mov [edx+offs_cont_current_texture],eax
203
	mov [edx+GLContext.current_texture],eax
204
	ret
204
	ret
205
endp
205
endp
Line 206... Line 206...
206
 
206
 
207
align 4
207
align 4
Line 263... Line 263...
263
		mov edx,[aligned_width]
263
		mov edx,[aligned_width]
264
		mov esi,[aligned_height]
264
		mov esi,[aligned_height]
265
	@@:
265
	@@:
Line 266... Line 266...
266
 
266
 
267
	mov ecx,[context]
267
	mov ecx,[context]
268
	mov ecx,[ecx+offs_cont_current_texture]
268
	mov ecx,[ecx+GLContext.current_texture]
269
	add ecx,offs_text_images
269
	add ecx,offs_text_images
270
	imul ebx,sizeof.GLTexture
270
	imul ebx,sizeof.GLTexture
271
	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
272
	mov [ecx+offs_imag_xsize],edx ;im.xsize=width