Subversion Repositories Kolibri OS

Rev

Rev 5337 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5153 IgorA 1
VERTEX_ARRAY   equ 0x0001
2
COLOR_ARRAY    equ 0x0002
3
NORMAL_ARRAY   equ 0x0004
4
TEXCOORD_ARRAY equ 0x0008
5
 
6
align 4
7
proc glopArrayElement uses eax ebx ecx edx, context:dword, param:dword
8
locals
9
	p rd 5
10
endl
11
	mov eax,[context]
12
	mov ebx,[param]
13
	mov ebx,[ebx+4] ;ebx = p[1]
14
 
15
	bt dword[eax+offs_cont_client_states],1 ;2^1=COLOR_ARRAY
16
	jnc @f
17
		mov ecx,[eax+offs_cont_color_array_size]
18
		add ecx,[eax+offs_cont_color_array_stride]
19
		imul ecx,ebx
20
		shl ecx,2
21
		add ecx,eax
22
		add ecx,offs_cont_color_array ;ecx = &context.color_array[i]
23
		mov ebx,ebp
24
		sub ebx,20 ;=sizeof(dd)*5
25
		mov edx,[ecx]
26
		mov [ebx+4],edx
27
		mov edx,[ecx+4]
28
		mov [ebx+8],edx
29
		mov edx,[ecx+8]
30
		mov [ebx+12],edx
31
		cmp dword[eax+offs_cont_color_array_size],3
32
		jg .l0
33
			mov edx,1.0
34
			jmp .l1
35
		.l0:
36
			mov edx,[ecx+12]
37
		.l1:
38
		mov [ebx+16],edx
39
		stdcall glopColor, eax, ebx
40
	@@:
41
	bt dword[eax+offs_cont_client_states],2 ;2^2=NORMAL_ARRAY
42
	jnc @f
43
		mov esi,dword[eax+offs_cont_normal_array_stride]
44
		add esi,3
45
		imul esi,ebx
46
		shl esi,2
47
		add esi,eax
48
		add esi,offs_cont_normal_array ;esi = &normal_array[ebx * (3 + c->normal_array_stride)]
49
		mov edi,eax
50
		add edi,offs_cont_current_normal
51
		mov ecx,3
52
		rep movsd
53
		mov dword[edi],0.0
54
	@@:
55
	bt dword[eax+offs_cont_client_states],3 ;2^3=TEXCOORD_ARRAY
56
	jnc @f
57
		mov ecx,[eax+offs_cont_texcoord_array_size]
58
		add ecx,[eax+offs_cont_texcoord_array_stride]
59
		imul ecx,ebx
60
		shl ecx,2
61
		add ecx,eax
62
		add ecx,offs_cont_texcoord_array ;ecx = &context.texcoord_array[i]
63
		mov edx,[ecx]
64
		mov [eax+offs_cont_current_tex_coord],edx
65
		mov edx,[ecx+4]
66
		mov [eax+offs_cont_current_tex_coord+4],edx
67
 
68
		cmp dword[eax+offs_cont_texcoord_array_size],2
69
		jg .l2
70
			mov edx,0.0
71
			jmp .l3
72
		.l2:
73
			mov edx,[ecx+8]
74
		.l3:
75
		mov [eax+offs_cont_current_tex_coord+8],edx
76
 
77
		cmp dword[eax+offs_cont_texcoord_array_size],3
78
		jg .l4
79
			mov edx,1.0
80
			jmp .l5
81
		.l4:
82
			mov edx,[ecx+12]
83
		.l5:
84
 
85
		mov [eax+offs_cont_current_tex_coord+12],edx
86
	@@:
87
	bt dword[eax+offs_cont_client_states],0 ;2^0=VERTEX_ARRAY
88
	jnc @f
89
		mov ecx,[eax+offs_cont_vertex_array_size]
90
		add ecx,[eax+offs_cont_vertex_array_stride]
91
		imul ecx,ebx
92
		shl ecx,2
93
		add ecx,eax
94
		add ecx,offs_cont_vertex_array ;ecx = &context.vertex_array[i]
95
		mov ebx,ebp
96
		sub ebx,20 ;=sizeof(dd)*5
97
		mov edx,[ecx]
98
		mov [ebx+4],edx
99
		mov edx,[ecx+4]
100
		mov [ebx+8],edx
101
 
102
		cmp dword[eax+offs_cont_vertex_array_size],2
103
		jg .l6
104
			mov edx,0.0
105
			jmp .l7
106
		.l6:
107
			mov edx,[ecx+8]
108
		.l7:
109
		mov [ebx+12],edx
110
 
111
		cmp dword[eax+offs_cont_vertex_array_size],3
112
		jg .l8
113
			mov edx,1.0
114
			jmp .l9
115
		.l8:
116
			mov edx,[ecx+12]
117
		.l9:
118
 
119
		mov [ebx+16],edx
120
		stdcall glopVertex, eax, ebx
121
	@@:
122
	ret
123
endp
124
 
125
align 4
126
proc glArrayElement uses eax, i:dword
127
locals
128
	p rd 2
129
endl
130
	mov dword[p],OP_ArrayElement
131
	mov eax,[i]
132
	mov dword[p+4],eax
133
 
134
	mov eax,ebp
135
	sub eax,8 ;=sizeof(dd)*2
136
	stdcall gl_add_op,eax
137
	ret
138
endp
139
 
140
align 4
141
proc glopEnableClientState uses eax ebx, context:dword, p:dword
142
	mov eax,[context]
143
	mov ebx,[p]
144
	mov ebx,[ebx+4] ;ebx = p[1]
145
	or dword[eax+offs_cont_client_states],ebx
146
	ret
147
endp
148
 
149
align 4
150
proc glEnableClientState uses eax, array:dword
151
locals
152
	p rd 2
153
endl
154
	mov dword[p],OP_EnableClientState
155
 
156
	cmp dword[array],GL_VERTEX_ARRAY
157
	jne @f
158
		mov dword[p+4],VERTEX_ARRAY
159
		jmp .end_f
160
	@@:
161
	cmp dword[array],GL_NORMAL_ARRAY
162
	jne @f
163
		mov dword[p+4],NORMAL_ARRAY
164
		jmp .end_f
165
	@@:
166
	cmp dword[array],GL_COLOR_ARRAY
167
	jne @f
168
		mov dword[p+4],COLOR_ARRAY
169
		jmp .end_f
170
	@@:
171
	cmp dword[array],GL_TEXTURE_COORD_ARRAY
172
	jne @f
173
		mov dword[p+4],TEXCOORD_ARRAY
174
		jmp .end_f
175
	@@:
176
		;assert(0);
177
	.end_f:
178
 
179
	mov eax,ebp
180
	sub eax,8 ;=sizeof(dd)*2
181
	stdcall gl_add_op,eax
182
	ret
183
endp
184
 
185
align 4
186
proc glopDisableClientState uses eax ebx, context:dword, p:dword
187
	mov eax,[context]
188
	mov ebx,[p]
189
	mov ebx,[ebx+4] ;ebx = p[1]
190
	and dword[eax+offs_cont_client_states],ebx
191
	ret
192
endp
193
 
194
align 4
195
proc glDisableClientState uses eax, array:dword
196
locals
197
	p rd 2
198
endl
199
	mov dword[p],OP_DisableClientState
200
 
201
	cmp dword[array],GL_VERTEX_ARRAY
202
	jne @f
203
		mov dword[p+4], not VERTEX_ARRAY
204
		jmp .end_f
205
	@@:
206
	cmp dword[array],GL_NORMAL_ARRAY
207
	jne @f
208
		mov dword[p+4], not NORMAL_ARRAY
209
		jmp .end_f
210
	@@:
211
	cmp dword[array],GL_COLOR_ARRAY
212
	jne @f
213
		mov dword[p+4], not COLOR_ARRAY
214
		jmp .end_f
215
	@@:
216
	cmp dword[array],GL_TEXTURE_COORD_ARRAY
217
	jne @f
218
		mov dword[p+4], not TEXCOORD_ARRAY
219
		jmp .end_f
220
	@@:
221
		;assert(0);
222
	.end_f:
223
 
224
	mov eax,ebp
225
	sub eax,8 ;=sizeof(dd)*2
226
	stdcall gl_add_op,eax
227
	ret
228
endp
229
 
230
align 4
231
proc glopVertexPointer uses eax ebx ecx, context:dword, p:dword
232
	mov eax,[context]
233
	mov ebx,[p]
234
	mov ecx,[ebx+4] ;ecx = p[1]
235
	mov dword[eax+offs_cont_vertex_array_size],ecx
236
	mov ecx,[ebx+8] ;ecx = p[2]
237
	mov dword[eax+offs_cont_vertex_array_stride],ecx
238
	mov ecx,[ebx+12] ;ecx = p[3]
239
	mov dword[eax+offs_cont_vertex_array],ecx
240
	ret
241
endp
242
 
243
align 4
244
proc glVertexPointer uses eax, size:dword, type:dword, stride:dword, pointer:dword
245
locals
246
	p rd 4
247
endl
248
;  assert(type == GL_FLOAT);
249
 
250
	mov dword[p],OP_TexCoordPointer
251
	mov eax,[size]
252
	mov dword[p+4],eax
253
	mov eax,[stride]
254
	mov dword[p+8],eax
255
	mov eax,[pointer]
256
	mov dword[p+12],eax
257
 
258
	mov eax,ebp
259
	sub eax,16 ;=sizeof(dd)*4
260
	stdcall gl_add_op,eax
261
	ret
262
endp
263
 
264
align 4
265
proc glopColorPointer uses eax ebx ecx, context:dword, p:dword
266
	mov eax,[context]
267
	mov ebx,[p]
268
	mov ecx,[ebx+4] ;ecx = p[1]
269
	mov dword[eax+offs_cont_color_array_size],ecx
270
	mov ecx,[ebx+8] ;ecx = p[2]
271
	mov dword[eax+offs_cont_color_array_stride],ecx
272
	mov ecx,[ebx+12] ;ecx = p[3]
273
	mov dword[eax+offs_cont_color_array],ecx
274
	ret
275
endp
276
 
277
align 4
278
proc glColorPointer uses eax, size:dword, type:dword, stride:dword, pointer:dword
279
locals
280
	p rd 4
281
endl
282
;  assert(type == GL_FLOAT);
283
 
284
	mov dword[p],OP_ColorPointer
285
	mov eax,[size]
286
	mov dword[p+4],eax
287
	mov eax,[stride]
288
	mov dword[p+8],eax
289
	mov eax,[pointer]
290
	mov dword[p+12],eax
291
 
292
	mov eax,ebp
293
	sub eax,16 ;=sizeof(dd)*4
294
	stdcall gl_add_op,eax
295
	ret
296
endp
297
 
298
align 4
299
proc glopNormalPointer uses eax ebx ecx, context:dword, p:dword
300
	mov eax,[context]
301
	mov ebx,[p]
302
	mov ecx,[ebx+4] ;ecx = p[1]
303
	mov dword[eax+offs_cont_normal_array_stride],ecx
304
	mov ecx,[ebx+8] ;ecx = p[2]
305
	mov dword[eax+offs_cont_normal_array],ecx
306
	ret
307
endp
308
 
309
align 4
310
proc glNormalPointer uses eax, type:dword, stride:dword, pointer:dword
311
locals
312
	p rd 3
313
endl
314
;  assert(type == GL_FLOAT);
315
 
316
	mov dword[p],OP_NormalPointer
317
	mov eax,[stride]
318
	mov dword[p+4],eax
319
	mov eax,[pointer]
320
	mov dword[p+8],eax
321
 
322
	mov eax,ebp
323
	sub eax,12 ;=sizeof(dd)*3
324
	stdcall gl_add_op,eax
325
	ret
326
endp
327
 
328
align 4
329
proc glopTexCoordPointer uses eax ebx ecx, context:dword, p:dword
330
	mov eax,[context]
331
	mov ebx,[p]
332
	mov ecx,[ebx+4] ;ecx = p[1]
333
	mov dword[eax+offs_cont_texcoord_array_size],ecx
334
	mov ecx,[ebx+8] ;ecx = p[2]
335
	mov dword[eax+offs_cont_texcoord_array_stride],ecx
336
	mov ecx,[ebx+12] ;ecx = p[3]
337
	mov dword[eax+offs_cont_texcoord_array],ecx
338
	ret
339
endp
340
 
341
align 4
342
proc glTexCoordPointer uses eax, size:dword, type:dword, stride:dword, pointer:dword
343
locals
344
	p rd 4
345
endl
346
;  assert(type == GL_FLOAT);
347
 
348
	mov dword[p],OP_TexCoordPointer
349
	mov eax,[size]
350
	mov dword[p+4],eax
351
	mov eax,[stride]
352
	mov dword[p+8],eax
353
	mov eax,[pointer]
354
	mov dword[p+12],eax
355
 
356
	mov eax,ebp
357
	sub eax,16 ;=sizeof(dd)*4
358
	stdcall gl_add_op,eax
359
	ret
360
endp