diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/evas/src/modules/engines/gl_common/evas_gl_shader.c | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to 'libraries/evas/src/modules/engines/gl_common/evas_gl_shader.c')
-rw-r--r-- | libraries/evas/src/modules/engines/gl_common/evas_gl_shader.c | 1262 |
1 files changed, 0 insertions, 1262 deletions
diff --git a/libraries/evas/src/modules/engines/gl_common/evas_gl_shader.c b/libraries/evas/src/modules/engines/gl_common/evas_gl_shader.c deleted file mode 100644 index 6666ac5..0000000 --- a/libraries/evas/src/modules/engines/gl_common/evas_gl_shader.c +++ /dev/null | |||
@@ -1,1262 +0,0 @@ | |||
1 | #include "evas_gl_private.h" | ||
2 | |||
3 | ///////////////////////////////////////////// | ||
4 | #if defined (GLES_VARIETY_S3C6410) | ||
5 | const unsigned int rect_frag_bin[] = | ||
6 | { | ||
7 | # include "shader/rect_frag_bin_s3c6410.h" | ||
8 | }; | ||
9 | #endif | ||
10 | |||
11 | const char rect_frag_glsl[] = | ||
12 | #include "shader/rect_frag.h" | ||
13 | ; | ||
14 | Evas_GL_Program_Source shader_rect_frag_src = | ||
15 | { | ||
16 | rect_frag_glsl, | ||
17 | #if defined (GLES_VARIETY_S3C6410) | ||
18 | rect_frag_bin, sizeof(rect_frag_bin) | ||
19 | #else | ||
20 | NULL, 0 | ||
21 | #endif | ||
22 | }; | ||
23 | |||
24 | #if defined (GLES_VARIETY_S3C6410) | ||
25 | const unsigned int rect_vert_bin[] = | ||
26 | { | ||
27 | # include "shader/rect_vert_bin_s3c6410.h" | ||
28 | }; | ||
29 | #endif | ||
30 | const char rect_vert_glsl[] = | ||
31 | #include "shader/rect_vert.h" | ||
32 | ; | ||
33 | Evas_GL_Program_Source shader_rect_vert_src = | ||
34 | { | ||
35 | rect_vert_glsl, | ||
36 | #if defined (GLES_VARIETY_S3C6410) | ||
37 | rect_vert_bin, sizeof(rect_vert_bin) | ||
38 | #else | ||
39 | NULL, 0 | ||
40 | #endif | ||
41 | }; | ||
42 | |||
43 | ///////////////////////////////////////////// | ||
44 | #if defined (GLES_VARIETY_S3C6410) | ||
45 | const unsigned int font_frag_bin[] = | ||
46 | { | ||
47 | # include "shader/font_frag_bin_s3c6410.h" | ||
48 | }; | ||
49 | #endif | ||
50 | |||
51 | const char font_frag_glsl[] = | ||
52 | #include "shader/font_frag.h" | ||
53 | ; | ||
54 | Evas_GL_Program_Source shader_font_frag_src = | ||
55 | { | ||
56 | font_frag_glsl, | ||
57 | #if defined (GLES_VARIETY_S3C6410) | ||
58 | font_frag_bin, sizeof(font_frag_bin) | ||
59 | #else | ||
60 | NULL, 0 | ||
61 | #endif | ||
62 | }; | ||
63 | |||
64 | #if defined (GLES_VARIETY_S3C6410) | ||
65 | const unsigned int font_vert_bin[] = | ||
66 | { | ||
67 | # include "shader/font_vert_bin_s3c6410.h" | ||
68 | }; | ||
69 | #endif | ||
70 | const char font_vert_glsl[] = | ||
71 | #include "shader/font_vert.h" | ||
72 | ; | ||
73 | Evas_GL_Program_Source shader_font_vert_src = | ||
74 | { | ||
75 | font_vert_glsl, | ||
76 | #if defined (GLES_VARIETY_S3C6410) | ||
77 | font_vert_bin, sizeof(font_vert_bin) | ||
78 | #else | ||
79 | NULL, 0 | ||
80 | #endif | ||
81 | }; | ||
82 | |||
83 | ///////////////////////////////////////////// | ||
84 | #if defined (GLES_VARIETY_S3C6410) | ||
85 | const unsigned int yuv_frag_bin[] = | ||
86 | { | ||
87 | # include "shader/yuv_frag_bin_s3c6410.h" | ||
88 | }; | ||
89 | #endif | ||
90 | |||
91 | const char yuv_frag_glsl[] = | ||
92 | #include "shader/yuv_frag.h" | ||
93 | ; | ||
94 | Evas_GL_Program_Source shader_yuv_frag_src = | ||
95 | { | ||
96 | yuv_frag_glsl, | ||
97 | #if defined (GLES_VARIETY_S3C6410) | ||
98 | yuv_frag_bin, sizeof(yuv_frag_bin) | ||
99 | #else | ||
100 | NULL, 0 | ||
101 | #endif | ||
102 | }; | ||
103 | |||
104 | #if defined (GLES_VARIETY_S3C6410) | ||
105 | const unsigned int yuv_vert_bin[] = | ||
106 | { | ||
107 | # include "shader/yuv_vert_bin_s3c6410.h" | ||
108 | }; | ||
109 | #endif | ||
110 | const char yuv_vert_glsl[] = | ||
111 | #include "shader/yuv_vert.h" | ||
112 | ; | ||
113 | Evas_GL_Program_Source shader_yuv_vert_src = | ||
114 | { | ||
115 | yuv_vert_glsl, | ||
116 | #if defined (GLES_VARIETY_S3C6410) | ||
117 | yuv_vert_bin, sizeof(yuv_vert_bin) | ||
118 | #else | ||
119 | NULL, 0 | ||
120 | #endif | ||
121 | }; | ||
122 | |||
123 | ///////////////////////////////////////////// | ||
124 | #if defined (GLES_VARIETY_S3C6410) | ||
125 | const unsigned int yuy2_frag_bin[] = | ||
126 | { | ||
127 | # include "shader/yuy2_frag_bin_s3c6410.h" | ||
128 | }; | ||
129 | #endif | ||
130 | |||
131 | const char yuy2_frag_glsl[] = | ||
132 | #include "shader/yuy2_frag.h" | ||
133 | ; | ||
134 | Evas_GL_Program_Source shader_yuy2_frag_src = | ||
135 | { | ||
136 | yuy2_frag_glsl, | ||
137 | #if defined (GLES_VARIETY_S3C6410) | ||
138 | yuy2_frag_bin, sizeof(yuy2_frag_bin) | ||
139 | #else | ||
140 | NULL, 0 | ||
141 | #endif | ||
142 | }; | ||
143 | |||
144 | #if defined (GLES_VARIETY_S3C6410) | ||
145 | const unsigned int yuy2_vert_bin[] = | ||
146 | { | ||
147 | # include "shader/yuy2_vert_bin_s3c6410.h" | ||
148 | }; | ||
149 | #endif | ||
150 | const char yuy2_vert_glsl[] = | ||
151 | #include "shader/yuy2_vert.h" | ||
152 | ; | ||
153 | Evas_GL_Program_Source shader_yuy2_vert_src = | ||
154 | { | ||
155 | yuy2_vert_glsl, | ||
156 | #if defined (GLES_VARIETY_S3C6410) | ||
157 | yuy2_vert_bin, sizeof(yuy2_vert_bin) | ||
158 | #else | ||
159 | NULL, 0 | ||
160 | #endif | ||
161 | }; | ||
162 | |||
163 | ///////////////////////////////////////////// | ||
164 | #if defined (GLES_VARIETY_S3C6410) | ||
165 | const unsigned int yuy2_nomul_frag_bin[] = | ||
166 | { | ||
167 | # include "shader/yuy2_nomul_frag_bin_s3c6410.h" | ||
168 | }; | ||
169 | #endif | ||
170 | |||
171 | const char yuy2_nomul_frag_glsl[] = | ||
172 | #include "shader/yuy2_nomul_frag.h" | ||
173 | ; | ||
174 | Evas_GL_Program_Source shader_yuy2_nomul_frag_src = | ||
175 | { | ||
176 | yuy2_nomul_frag_glsl, | ||
177 | #if defined (GLES_VARIETY_S3C6410) | ||
178 | yuy2_nomul_frag_bin, sizeof(yuy2_nomul_frag_bin) | ||
179 | #else | ||
180 | NULL, 0 | ||
181 | #endif | ||
182 | }; | ||
183 | |||
184 | #if defined (GLES_VARIETY_S3C6410) | ||
185 | const unsigned int yuy2_nomul_vert_bin[] = | ||
186 | { | ||
187 | # include "shader/yuy2_nomul_vert_bin_s3c6410.h" | ||
188 | }; | ||
189 | #endif | ||
190 | const char yuy2_nomul_vert_glsl[] = | ||
191 | #include "shader/yuy2_nomul_vert.h" | ||
192 | ; | ||
193 | Evas_GL_Program_Source shader_yuy2_nomul_vert_src = | ||
194 | { | ||
195 | yuy2_nomul_vert_glsl, | ||
196 | #if defined (GLES_VARIETY_S3C6410) | ||
197 | yuy2_nomul_vert_bin, sizeof(yuy2_nomul_vert_bin) | ||
198 | #else | ||
199 | NULL, 0 | ||
200 | #endif | ||
201 | }; | ||
202 | |||
203 | ///////////////////////////////////////////// | ||
204 | #if defined (GLES_VARIETY_S3C6410) | ||
205 | const unsigned int nv12_nomul_vert_bin[] = | ||
206 | { | ||
207 | # include "shader/nv12_nomul_vert_bin_s3c6410.h" | ||
208 | }; | ||
209 | #endif | ||
210 | const char nv12_nomul_vert_glsl[] = | ||
211 | #include "shader/nv12_nomul_vert.h" | ||
212 | ; | ||
213 | Evas_GL_Program_Source shader_nv12_nomul_vert_src = | ||
214 | { | ||
215 | nv12_nomul_vert_glsl, | ||
216 | #if defined (GLES_VARIETY_S3C6410) | ||
217 | nv12_nomul_vert_bin, sizeof(nv12_nomul_vert_bin) | ||
218 | #else | ||
219 | NULL, 0 | ||
220 | #endif | ||
221 | }; | ||
222 | |||
223 | #if defined (GLES_VARIETY_S3C6410) | ||
224 | const unsigned int nv12_vert_bin[] = | ||
225 | { | ||
226 | # include "shader/nv12_vert_bin_s3c6410.h" | ||
227 | }; | ||
228 | #endif | ||
229 | const char nv12_vert_glsl[] = | ||
230 | #include "shader/nv12_vert.h" | ||
231 | ; | ||
232 | Evas_GL_Program_Source shader_nv12_vert_src = | ||
233 | { | ||
234 | nv12_vert_glsl, | ||
235 | #if defined (GLES_VARIETY_S3C6410) | ||
236 | nv12_vert_bin, sizeof(nv12_vert_bin) | ||
237 | #else | ||
238 | NULL, 0 | ||
239 | #endif | ||
240 | }; | ||
241 | |||
242 | #if defined (GLES_VARIETY_S3C6410) | ||
243 | const unsigned int nv12_nomul_frag_bin[] = | ||
244 | { | ||
245 | # include "shader/nv12_nomul_frag_bin_s3c6410.h" | ||
246 | }; | ||
247 | #endif | ||
248 | |||
249 | const char nv12_frag_glsl[] = | ||
250 | #include "shader/nv12_frag.h" | ||
251 | ; | ||
252 | Evas_GL_Program_Source shader_nv12_frag_src = | ||
253 | { | ||
254 | nv12_frag_glsl, | ||
255 | #if defined (GLES_VARIETY_S3C6410) | ||
256 | nv12_frag_bin, sizeof(nv12_frag_bin) | ||
257 | #else | ||
258 | NULL, 0 | ||
259 | #endif | ||
260 | }; | ||
261 | |||
262 | #if defined (GLES_VARIETY_S3C6410) | ||
263 | const unsigned int nv12_nomul_frag_bin[] = | ||
264 | { | ||
265 | # include "shader/nv12_nomul_frag_bin_s3c6410.h" | ||
266 | }; | ||
267 | #endif | ||
268 | |||
269 | const char nv12_nomul_frag_glsl[] = | ||
270 | #include "shader/nv12_nomul_frag.h" | ||
271 | ; | ||
272 | Evas_GL_Program_Source shader_nv12_nomul_frag_src = | ||
273 | { | ||
274 | nv12_nomul_frag_glsl, | ||
275 | #if defined (GLES_VARIETY_S3C6410) | ||
276 | nv12_nomul_frag_bin, sizeof(nv12_nomul_frag_bin) | ||
277 | #else | ||
278 | NULL, 0 | ||
279 | #endif | ||
280 | }; | ||
281 | |||
282 | ///////////////////////////////////////////// | ||
283 | #if defined (GLES_VARIETY_S3C6410) | ||
284 | const unsigned int yuv_nomul_frag_bin[] = | ||
285 | { | ||
286 | # include "shader/yuv_nomul_frag_bin_s3c6410.h" | ||
287 | }; | ||
288 | #endif | ||
289 | |||
290 | const char yuv_nomul_frag_glsl[] = | ||
291 | #include "shader/yuv_nomul_frag.h" | ||
292 | ; | ||
293 | Evas_GL_Program_Source shader_yuv_nomul_frag_src = | ||
294 | { | ||
295 | yuv_nomul_frag_glsl, | ||
296 | #if defined (GLES_VARIETY_S3C6410) | ||
297 | yuv_nomul_frag_bin, sizeof(yuv_nomul_frag_bin) | ||
298 | #else | ||
299 | NULL, 0 | ||
300 | #endif | ||
301 | }; | ||
302 | |||
303 | #if defined (GLES_VARIETY_S3C6410) | ||
304 | const unsigned int yuv_nomul_vert_bin[] = | ||
305 | { | ||
306 | # include "shader/yuv_nomul_vert_bin_s3c6410.h" | ||
307 | }; | ||
308 | #endif | ||
309 | const char yuv_nomul_vert_glsl[] = | ||
310 | #include "shader/yuv_nomul_vert.h" | ||
311 | ; | ||
312 | Evas_GL_Program_Source shader_yuv_nomul_vert_src = | ||
313 | { | ||
314 | yuv_nomul_vert_glsl, | ||
315 | #if defined (GLES_VARIETY_S3C6410) | ||
316 | yuv_nomul_vert_bin, sizeof(yuv_nomul_vert_bin) | ||
317 | #else | ||
318 | NULL, 0 | ||
319 | #endif | ||
320 | }; | ||
321 | |||
322 | ///////////////////////////////////////////// | ||
323 | #if defined (GLES_VARIETY_S3C6410) | ||
324 | const unsigned int tex_frag_bin[] = | ||
325 | { | ||
326 | # include "shader/tex_frag_bin_s3c6410.h" | ||
327 | }; | ||
328 | #endif | ||
329 | |||
330 | const char tex_frag_glsl[] = | ||
331 | #include "shader/tex_frag.h" | ||
332 | ; | ||
333 | Evas_GL_Program_Source shader_tex_frag_src = | ||
334 | { | ||
335 | tex_frag_glsl, | ||
336 | #if defined (GLES_VARIETY_S3C6410) | ||
337 | tex_frag_bin, sizeof(tex_frag_bin) | ||
338 | #else | ||
339 | NULL, 0 | ||
340 | #endif | ||
341 | }; | ||
342 | |||
343 | #if defined (GLES_VARIETY_S3C6410) | ||
344 | const unsigned int tex_vert_bin[] = | ||
345 | { | ||
346 | # include "shader/tex_vert_bin_s3c6410.h" | ||
347 | }; | ||
348 | #endif | ||
349 | const char tex_vert_glsl[] = | ||
350 | #include "shader/tex_vert.h" | ||
351 | ; | ||
352 | Evas_GL_Program_Source shader_tex_vert_src = | ||
353 | { | ||
354 | tex_vert_glsl, | ||
355 | #if defined (GLES_VARIETY_S3C6410) | ||
356 | tex_vert_bin, sizeof(tex_vert_bin) | ||
357 | #else | ||
358 | NULL, 0 | ||
359 | #endif | ||
360 | }; | ||
361 | |||
362 | ///////////////////////////////////////////// | ||
363 | #if defined (GLES_VARIETY_S3C6410) | ||
364 | const unsigned int tex_nomul_frag_bin[] = | ||
365 | { | ||
366 | # include "shader/tex_nomul_frag_bin_s3c6410.h" | ||
367 | }; | ||
368 | #endif | ||
369 | |||
370 | const char tex_nomul_frag_glsl[] = | ||
371 | #include "shader/tex_nomul_frag.h" | ||
372 | ; | ||
373 | Evas_GL_Program_Source shader_tex_nomul_frag_src = | ||
374 | { | ||
375 | tex_nomul_frag_glsl, | ||
376 | #if defined (GLES_VARIETY_S3C6410) | ||
377 | tex_nomul_frag_bin, sizeof(tex_nomul_frag_bin) | ||
378 | #else | ||
379 | NULL, 0 | ||
380 | #endif | ||
381 | }; | ||
382 | |||
383 | #if defined (GLES_VARIETY_S3C6410) | ||
384 | const unsigned int tex_nomul_vert_bin[] = | ||
385 | { | ||
386 | # include "shader/tex_nomul_vert_bin_s3c6410.h" | ||
387 | }; | ||
388 | #endif | ||
389 | const char tex_nomul_vert_glsl[] = | ||
390 | #include "shader/tex_nomul_vert.h" | ||
391 | ; | ||
392 | Evas_GL_Program_Source shader_tex_nomul_vert_src = | ||
393 | { | ||
394 | tex_nomul_vert_glsl, | ||
395 | #if defined (GLES_VARIETY_S3C6410) | ||
396 | tex_nomul_vert_bin, sizeof(tex_nomul_vert_bin) | ||
397 | #else | ||
398 | NULL, 0 | ||
399 | #endif | ||
400 | }; | ||
401 | |||
402 | ///////////////////////////////////////////// | ||
403 | #if defined (GLES_VARIETY_S3C6410) | ||
404 | const unsigned int img_frag_bin[] = | ||
405 | { | ||
406 | # include "shader/img_frag_bin_s3c6410.h" | ||
407 | }; | ||
408 | #endif | ||
409 | |||
410 | const char img_frag_glsl[] = | ||
411 | #include "shader/img_frag.h" | ||
412 | ; | ||
413 | Evas_GL_Program_Source shader_img_frag_src = | ||
414 | { | ||
415 | img_frag_glsl, | ||
416 | #if defined (GLES_VARIETY_S3C6410) | ||
417 | img_frag_bin, sizeof(img_frag_bin) | ||
418 | #else | ||
419 | NULL, 0 | ||
420 | #endif | ||
421 | }; | ||
422 | |||
423 | #if defined (GLES_VARIETY_S3C6410) | ||
424 | const unsigned int img_vert_bin[] = | ||
425 | { | ||
426 | # include "shader/img_vert_bin_s3c6410.h" | ||
427 | }; | ||
428 | #endif | ||
429 | const char img_vert_glsl[] = | ||
430 | #include "shader/img_vert.h" | ||
431 | ; | ||
432 | Evas_GL_Program_Source shader_img_vert_src = | ||
433 | { | ||
434 | img_vert_glsl, | ||
435 | #if defined (GLES_VARIETY_S3C6410) | ||
436 | img_vert_bin, sizeof(img_vert_bin) | ||
437 | #else | ||
438 | NULL, 0 | ||
439 | #endif | ||
440 | }; | ||
441 | |||
442 | ///////////////////////////////////////////// | ||
443 | #if defined (GLES_VARIETY_S3C6410) | ||
444 | const unsigned int img_nomul_frag_bin[] = | ||
445 | { | ||
446 | # include "shader/img_nomul_frag_bin_s3c6410.h" | ||
447 | }; | ||
448 | #endif | ||
449 | |||
450 | const char img_nomul_frag_glsl[] = | ||
451 | #include "shader/img_nomul_frag.h" | ||
452 | ; | ||
453 | Evas_GL_Program_Source shader_img_nomul_frag_src = | ||
454 | { | ||
455 | img_nomul_frag_glsl, | ||
456 | #if defined (GLES_VARIETY_S3C6410) | ||
457 | img_nomul_frag_bin, sizeof(img_nomul_frag_bin) | ||
458 | #else | ||
459 | NULL, 0 | ||
460 | #endif | ||
461 | }; | ||
462 | |||
463 | #if defined (GLES_VARIETY_S3C6410) | ||
464 | const unsigned int img_nomul_vert_bin[] = | ||
465 | { | ||
466 | # include "shader/img_nomul_vert_bin_s3c6410.h" | ||
467 | }; | ||
468 | #endif | ||
469 | const char img_nomul_vert_glsl[] = | ||
470 | #include "shader/img_nomul_vert.h" | ||
471 | ; | ||
472 | Evas_GL_Program_Source shader_img_nomul_vert_src = | ||
473 | { | ||
474 | img_nomul_vert_glsl, | ||
475 | #if defined (GLES_VARIETY_S3C6410) | ||
476 | img_nomul_vert_bin, sizeof(img_nomul_vert_bin) | ||
477 | #else | ||
478 | NULL, 0 | ||
479 | #endif | ||
480 | }; | ||
481 | |||
482 | ///////////////////////////////////////////// | ||
483 | #if defined (GLES_VARIETY_S3C6410) | ||
484 | const unsigned int img_bgra_frag_bin[] = | ||
485 | { | ||
486 | # include "shader/img_bgra_frag_bin_s3c6410.h" | ||
487 | }; | ||
488 | #endif | ||
489 | |||
490 | const char img_bgra_frag_glsl[] = | ||
491 | #include "shader/img_bgra_frag.h" | ||
492 | ; | ||
493 | Evas_GL_Program_Source shader_img_bgra_frag_src = | ||
494 | { | ||
495 | img_bgra_frag_glsl, | ||
496 | #if defined (GLES_VARIETY_S3C6410) | ||
497 | img_bgra_frag_bin, sizeof(img_bgra_frag_bin) | ||
498 | #else | ||
499 | NULL, 0 | ||
500 | #endif | ||
501 | }; | ||
502 | |||
503 | #if defined (GLES_VARIETY_S3C6410) | ||
504 | const unsigned int img_bgra_vert_bin[] = | ||
505 | { | ||
506 | # include "shader/img_bgra_vert_bin_s3c6410.h" | ||
507 | }; | ||
508 | #endif | ||
509 | const char img_bgra_vert_glsl[] = | ||
510 | #include "shader/img_bgra_vert.h" | ||
511 | ; | ||
512 | Evas_GL_Program_Source shader_img_bgra_vert_src = | ||
513 | { | ||
514 | img_bgra_vert_glsl, | ||
515 | #if defined (GLES_VARIETY_S3C6410) | ||
516 | img_bgra_vert_bin, sizeof(img_bgra_vert_bin) | ||
517 | #else | ||
518 | NULL, 0 | ||
519 | #endif | ||
520 | }; | ||
521 | |||
522 | |||
523 | ///////////////////////////////////////////// | ||
524 | #if defined (GLES_VARIETY_S3C6410) | ||
525 | const unsigned int img_mask_frag_bin[] = | ||
526 | { | ||
527 | # include "shader/img_mask_frag_bin_s3c6410.h" | ||
528 | }; | ||
529 | #endif | ||
530 | |||
531 | const char img_mask_frag_glsl[] = | ||
532 | #include "shader/img_mask_frag.h" | ||
533 | ; | ||
534 | Evas_GL_Program_Source shader_img_mask_frag_src = | ||
535 | { | ||
536 | img_mask_frag_glsl, | ||
537 | #if defined (GLES_VARIETY_S3C6410) | ||
538 | img_mask_frag_bin, sizeof(img_mask_frag_bin) | ||
539 | #else | ||
540 | NULL, 0 | ||
541 | #endif | ||
542 | }; | ||
543 | |||
544 | #if defined (GLES_VARIETY_S3C6410) | ||
545 | const unsigned int img_mask_vert_bin[] = | ||
546 | { | ||
547 | # include "shader/img_mask_vert_bin_s3c6410.h" | ||
548 | }; | ||
549 | #endif | ||
550 | const char img_mask_vert_glsl[] = | ||
551 | #include "shader/img_mask_vert.h" | ||
552 | ; | ||
553 | Evas_GL_Program_Source shader_img_mask_vert_src = | ||
554 | { | ||
555 | img_mask_vert_glsl, | ||
556 | #if defined (GLES_VARIETY_S3C6410) | ||
557 | img_mask_vert_bin, sizeof(img_mask_vert_bin) | ||
558 | #else | ||
559 | NULL, 0 | ||
560 | #endif | ||
561 | }; | ||
562 | |||
563 | |||
564 | ///////////////////////////////////////////// | ||
565 | #if defined (GLES_VARIETY_S3C6410) | ||
566 | const unsigned int img_bgra_nomul_frag_bin[] = | ||
567 | { | ||
568 | # include "shader/img_bgra_nomul_frag_bin_s3c6410.h" | ||
569 | }; | ||
570 | #endif | ||
571 | |||
572 | const char img_bgra_nomul_frag_glsl[] = | ||
573 | #include "shader/img_bgra_nomul_frag.h" | ||
574 | ; | ||
575 | Evas_GL_Program_Source shader_img_bgra_nomul_frag_src = | ||
576 | { | ||
577 | img_bgra_nomul_frag_glsl, | ||
578 | #if defined (GLES_VARIETY_S3C6410) | ||
579 | img_bgra_nomul_frag_bin, sizeof(img_bgra_nomul_frag_bin) | ||
580 | #else | ||
581 | NULL, 0 | ||
582 | #endif | ||
583 | }; | ||
584 | |||
585 | #if defined (GLES_VARIETY_S3C6410) | ||
586 | const unsigned int img_bgra_nomul_vert_bin[] = | ||
587 | { | ||
588 | # include "shader/img_bgra_nomul_vert_bin_s3c6410.h" | ||
589 | }; | ||
590 | #endif | ||
591 | const char img_bgra_nomul_vert_glsl[] = | ||
592 | #include "shader/img_bgra_nomul_vert.h" | ||
593 | ; | ||
594 | Evas_GL_Program_Source shader_img_bgra_nomul_vert_src = | ||
595 | { | ||
596 | img_bgra_nomul_vert_glsl, | ||
597 | #if defined (GLES_VARIETY_S3C6410) | ||
598 | img_bgra_nomul_vert_bin, sizeof(img_bgra_nomul_vert_bin) | ||
599 | #else | ||
600 | NULL, 0 | ||
601 | #endif | ||
602 | }; | ||
603 | |||
604 | ///////////////////////////////////////////// | ||
605 | const char filter_invert_frag_glsl[] = | ||
606 | #include "shader/filter_invert.h" | ||
607 | ; | ||
608 | Evas_GL_Program_Source shader_filter_invert_frag_src = | ||
609 | { | ||
610 | filter_invert_frag_glsl, | ||
611 | NULL, 0 | ||
612 | }; | ||
613 | |||
614 | const char filter_invert_nomul_frag_glsl[] = | ||
615 | #include "shader/filter_invert_nomul.h" | ||
616 | ; | ||
617 | Evas_GL_Program_Source shader_filter_invert_nomul_frag_src = | ||
618 | { | ||
619 | filter_invert_nomul_frag_glsl, | ||
620 | NULL, 0 | ||
621 | }; | ||
622 | |||
623 | const char filter_invert_bgra_frag_glsl[] = | ||
624 | #include "shader/filter_invert_bgra.h" | ||
625 | ; | ||
626 | Evas_GL_Program_Source shader_filter_invert_bgra_frag_src = | ||
627 | { | ||
628 | filter_invert_bgra_frag_glsl, | ||
629 | NULL, 0 | ||
630 | }; | ||
631 | const char filter_invert_bgra_nomul_frag_glsl[] = | ||
632 | #include "shader/filter_invert_bgra_nomul.h" | ||
633 | ; | ||
634 | Evas_GL_Program_Source shader_filter_invert_bgra_nomul_frag_src = | ||
635 | { | ||
636 | filter_invert_bgra_nomul_frag_glsl, | ||
637 | NULL, 0 | ||
638 | }; | ||
639 | |||
640 | ///////////////////////////////////////////// | ||
641 | const char filter_greyscale_frag_glsl[] = | ||
642 | #include "shader/filter_greyscale.h" | ||
643 | ; | ||
644 | Evas_GL_Program_Source shader_filter_greyscale_frag_src = | ||
645 | { | ||
646 | filter_greyscale_frag_glsl, | ||
647 | NULL, 0 | ||
648 | }; | ||
649 | |||
650 | const char filter_greyscale_nomul_frag_glsl[] = | ||
651 | #include "shader/filter_greyscale_nomul.h" | ||
652 | ; | ||
653 | Evas_GL_Program_Source shader_filter_greyscale_nomul_frag_src = | ||
654 | { | ||
655 | filter_greyscale_nomul_frag_glsl, | ||
656 | NULL, 0 | ||
657 | }; | ||
658 | |||
659 | const char filter_greyscale_bgra_frag_glsl[] = | ||
660 | #include "shader/filter_greyscale_bgra.h" | ||
661 | ; | ||
662 | Evas_GL_Program_Source shader_filter_greyscale_bgra_frag_src = | ||
663 | { | ||
664 | filter_greyscale_bgra_frag_glsl, | ||
665 | NULL, 0 | ||
666 | }; | ||
667 | const char filter_greyscale_bgra_nomul_frag_glsl[] = | ||
668 | #include "shader/filter_greyscale_bgra_nomul.h" | ||
669 | ; | ||
670 | Evas_GL_Program_Source shader_filter_greyscale_bgra_nomul_frag_src = | ||
671 | { | ||
672 | filter_greyscale_bgra_nomul_frag_glsl, | ||
673 | NULL, 0 | ||
674 | }; | ||
675 | |||
676 | ///////////////////////////////////////////// | ||
677 | const char filter_sepia_frag_glsl[] = | ||
678 | #include "shader/filter_sepia.h" | ||
679 | ; | ||
680 | Evas_GL_Program_Source shader_filter_sepia_frag_src = | ||
681 | { | ||
682 | filter_sepia_frag_glsl, | ||
683 | NULL, 0 | ||
684 | }; | ||
685 | |||
686 | const char filter_sepia_nomul_frag_glsl[] = | ||
687 | #include "shader/filter_sepia_nomul.h" | ||
688 | ; | ||
689 | Evas_GL_Program_Source shader_filter_sepia_nomul_frag_src = | ||
690 | { | ||
691 | filter_sepia_nomul_frag_glsl, | ||
692 | NULL, 0 | ||
693 | }; | ||
694 | |||
695 | const char filter_sepia_bgra_frag_glsl[] = | ||
696 | #include "shader/filter_sepia_bgra.h" | ||
697 | ; | ||
698 | Evas_GL_Program_Source shader_filter_sepia_bgra_frag_src = | ||
699 | { | ||
700 | filter_sepia_bgra_frag_glsl, | ||
701 | NULL, 0 | ||
702 | }; | ||
703 | const char filter_sepia_bgra_nomul_frag_glsl[] = | ||
704 | #include "shader/filter_sepia_bgra_nomul.h" | ||
705 | ; | ||
706 | Evas_GL_Program_Source shader_filter_sepia_bgra_nomul_frag_src = | ||
707 | { | ||
708 | filter_sepia_bgra_nomul_frag_glsl, | ||
709 | NULL, 0 | ||
710 | }; | ||
711 | |||
712 | ///////////////////////////////////////////// | ||
713 | #if 0 | ||
714 | Blur is a work in progress currently. | ||
715 | Mostly because GPUs are so hopeless. | ||
716 | const char filter_blur_vert_glsl[] = | ||
717 | #include "shader/filter_blur_vert.h" | ||
718 | ; | ||
719 | |||
720 | Evas_GL_Program_Source shader_filter_blur_vert_src = | ||
721 | { | ||
722 | filter_blur_vert_glsl, | ||
723 | NULL, 0 | ||
724 | }; | ||
725 | |||
726 | const char filter_blur_frag_glsl[] = | ||
727 | #include "shader/filter_blur.h" | ||
728 | ; | ||
729 | Evas_GL_Program_Source shader_filter_blur_frag_src = | ||
730 | { | ||
731 | filter_blur_frag_glsl, | ||
732 | NULL, 0 | ||
733 | }; | ||
734 | |||
735 | const char filter_blur_nomul_frag_glsl[] = | ||
736 | #include "shader/filter_blur_nomul.h" | ||
737 | ; | ||
738 | Evas_GL_Program_Source shader_filter_blur_nomul_frag_src = | ||
739 | { | ||
740 | filter_blur_nomul_frag_glsl, | ||
741 | NULL, 0 | ||
742 | }; | ||
743 | |||
744 | const char filter_blur_bgra_frag_glsl[] = | ||
745 | #include "shader/filter_blur_bgra.h" | ||
746 | ; | ||
747 | Evas_GL_Program_Source shader_filter_blur_bgra_frag_src = | ||
748 | { | ||
749 | filter_blur_bgra_frag_glsl, | ||
750 | NULL, 0 | ||
751 | }; | ||
752 | const char filter_blur_bgra_nomul_frag_glsl[] = | ||
753 | #include "shader/filter_blur_bgra_nomul.h" | ||
754 | ; | ||
755 | Evas_GL_Program_Source shader_filter_blur_bgra_nomul_frag_src = | ||
756 | { | ||
757 | filter_blur_bgra_nomul_frag_glsl, | ||
758 | NULL, 0 | ||
759 | }; | ||
760 | |||
761 | #endif | ||
762 | |||
763 | |||
764 | |||
765 | ///////////////////////////////////////////// | ||
766 | static void | ||
767 | gl_compile_link_error(GLuint target, const char *action) | ||
768 | { | ||
769 | int loglen = 0, chars = 0; | ||
770 | char *logtxt; | ||
771 | |||
772 | /* Shader info log */ | ||
773 | glGetShaderiv(target, GL_INFO_LOG_LENGTH, &loglen); | ||
774 | if (loglen > 0) | ||
775 | { | ||
776 | logtxt = calloc(loglen, sizeof(char)); | ||
777 | if (logtxt) | ||
778 | { | ||
779 | glGetShaderInfoLog(target, loglen, &chars, logtxt); | ||
780 | ERR("Failed to %s: %s", action, logtxt); | ||
781 | free(logtxt); | ||
782 | } | ||
783 | } | ||
784 | |||
785 | /* Program info log */ | ||
786 | glGetProgramiv(target, GL_INFO_LOG_LENGTH, &loglen); | ||
787 | if (loglen > 0) | ||
788 | { | ||
789 | logtxt = calloc(loglen, sizeof(char)); | ||
790 | if (logtxt) | ||
791 | { | ||
792 | glGetProgramInfoLog(target, loglen, &chars, logtxt); | ||
793 | ERR("Failed to %s: %s", action, logtxt); | ||
794 | free(logtxt); | ||
795 | } | ||
796 | } | ||
797 | } | ||
798 | |||
799 | static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; | ||
800 | |||
801 | static Eina_Bool | ||
802 | _evas_gl_shader_file_is_dir(const char *file) | ||
803 | { | ||
804 | struct stat st; | ||
805 | |||
806 | if (stat(file, &st) < 0) return EINA_FALSE; | ||
807 | if (S_ISDIR(st.st_mode)) return EINA_TRUE; | ||
808 | return EINA_FALSE; | ||
809 | } | ||
810 | |||
811 | static Eina_Bool | ||
812 | _evas_gl_shader_file_mkdir(const char *dir) | ||
813 | { | ||
814 | /* evas gl shader only call this function when the dir is not exist */ | ||
815 | if (mkdir(dir, default_mode) < 0) return EINA_FALSE; | ||
816 | return EINA_TRUE; | ||
817 | } | ||
818 | |||
819 | static Eina_Bool | ||
820 | _evas_gl_shader_file_exists(const char *file) | ||
821 | { | ||
822 | struct stat st; | ||
823 | if (!file) return EINA_FALSE; | ||
824 | if (stat(file, &st) < 0) return EINA_FALSE; | ||
825 | return EINA_TRUE; | ||
826 | } | ||
827 | |||
828 | static inline Eina_Bool | ||
829 | _evas_gl_shader_file_mkpath_if_not_exists(const char *path) | ||
830 | { | ||
831 | struct stat st; | ||
832 | |||
833 | if (stat(path, &st) < 0) | ||
834 | return _evas_gl_shader_file_mkdir(path); | ||
835 | else if (!S_ISDIR(st.st_mode)) | ||
836 | return EINA_FALSE; | ||
837 | else | ||
838 | return EINA_TRUE; | ||
839 | } | ||
840 | |||
841 | static Eina_Bool | ||
842 | _evas_gl_shader_file_mkpath(const char *path) | ||
843 | { | ||
844 | char ss[PATH_MAX]; | ||
845 | unsigned int i; | ||
846 | |||
847 | if (_evas_gl_shader_file_is_dir(path)) return EINA_TRUE; | ||
848 | |||
849 | for (i = 0; path[i]; ss[i] = path[i], i++) | ||
850 | { | ||
851 | if (i == sizeof(ss) - 1) return EINA_FALSE; | ||
852 | if ((path[i] == '/') && (i > 0)) | ||
853 | { | ||
854 | ss[i] = 0; | ||
855 | if (!_evas_gl_shader_file_mkpath_if_not_exists(ss)) | ||
856 | return EINA_FALSE; | ||
857 | } | ||
858 | } | ||
859 | ss[i] = 0; | ||
860 | return _evas_gl_shader_file_mkpath_if_not_exists(ss); | ||
861 | } | ||
862 | |||
863 | static int | ||
864 | _evas_gl_shader_dir_check(char *bin_shader_dir, int num) | ||
865 | { | ||
866 | char *home = NULL; | ||
867 | char *subdir = ".cache/evas_gl_common_shaders"; | ||
868 | |||
869 | home = getenv("HOME"); | ||
870 | if ((!home) || (!home[0])) return 0; | ||
871 | |||
872 | snprintf(bin_shader_dir, num, "%s/%s", home, subdir); | ||
873 | return _evas_gl_shader_file_exists(bin_shader_dir); | ||
874 | } | ||
875 | |||
876 | static int | ||
877 | _evas_gl_shader_file_check(const char *bin_shader_dir, char *bin_shader_file, int dir_num) | ||
878 | { | ||
879 | char before_name[PATH_MAX]; | ||
880 | char after_name[PATH_MAX]; | ||
881 | int new_path_len = 0; | ||
882 | int i = 0, j = 0; | ||
883 | |||
884 | char *vendor = NULL; | ||
885 | char *driver = NULL; | ||
886 | char *version = NULL; | ||
887 | |||
888 | vendor = (char *)glGetString(GL_VENDOR); | ||
889 | driver = (char *)glGetString(GL_RENDERER); | ||
890 | version = (char *)glGetString(GL_VERSION); | ||
891 | |||
892 | new_path_len = snprintf(before_name, sizeof(before_name), "%s::%s::%s::%s::binary_shader.eet", vendor, version, driver, MODULE_ARCH); | ||
893 | |||
894 | /* remove '/' from file name */ | ||
895 | for (i = 0; i < new_path_len; i++) | ||
896 | { | ||
897 | if (before_name[i] != '/') | ||
898 | { | ||
899 | after_name[j] = before_name[i]; | ||
900 | j++; | ||
901 | } | ||
902 | } | ||
903 | after_name[j] = 0; | ||
904 | |||
905 | snprintf(bin_shader_file, dir_num, "%s/%s", bin_shader_dir, after_name); | ||
906 | |||
907 | return _evas_gl_shader_file_exists(bin_shader_file); | ||
908 | } | ||
909 | |||
910 | static int | ||
911 | _evas_gl_common_shader_program_binary_init(Evas_GL_Program *p, | ||
912 | const char *pname, | ||
913 | Eet_File *ef) | ||
914 | { | ||
915 | int res = 0, num = 0, length = 0; | ||
916 | int *formats = NULL; | ||
917 | void *data = NULL; | ||
918 | GLint ok = 0; | ||
919 | |||
920 | if (!ef) return res; | ||
921 | |||
922 | data = eet_read(ef, pname, &length); | ||
923 | if ((!data) || (length <= 0)) goto finish; | ||
924 | |||
925 | glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &num); | ||
926 | if (num <= 0) goto finish; | ||
927 | |||
928 | formats = calloc(num, sizeof(int)); | ||
929 | if (!formats) goto finish; | ||
930 | |||
931 | glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, formats); | ||
932 | if (!formats[0]) goto finish; | ||
933 | |||
934 | p->prog = glCreateProgram(); | ||
935 | |||
936 | glsym_glProgramBinary(p->prog, formats[0], data, length); | ||
937 | |||
938 | glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex"); | ||
939 | glBindAttribLocation(p->prog, SHAD_COLOR, "color"); | ||
940 | glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord"); | ||
941 | glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2"); | ||
942 | glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3"); | ||
943 | glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm"); | ||
944 | |||
945 | glGetProgramiv(p->prog, GL_LINK_STATUS, &ok); | ||
946 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
947 | if (!ok) | ||
948 | { | ||
949 | gl_compile_link_error(p->prog, "load a program object"); | ||
950 | ERR("Abort load of program (%s)", pname); | ||
951 | goto finish; | ||
952 | } | ||
953 | |||
954 | res = 1; | ||
955 | |||
956 | finish: | ||
957 | if (formats) free(formats); | ||
958 | if (data) free(data); | ||
959 | if ((!res) && (p->prog)) | ||
960 | { | ||
961 | glDeleteProgram(p->prog); | ||
962 | p->prog = 0; | ||
963 | } | ||
964 | return res; | ||
965 | } | ||
966 | |||
967 | static int | ||
968 | _evas_gl_common_shader_program_binary_save(Evas_GL_Program *p, | ||
969 | const char *pname, | ||
970 | Eet_File *ef) | ||
971 | { | ||
972 | void* data = NULL; | ||
973 | GLenum format; | ||
974 | int length = 0, size = 0; | ||
975 | |||
976 | if (!glsym_glGetProgramBinary) return 0; | ||
977 | |||
978 | glGetProgramiv(p->prog, GL_PROGRAM_BINARY_LENGTH, &length); | ||
979 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
980 | if (length <= 0) return 0; | ||
981 | |||
982 | data = malloc(length); | ||
983 | if (!data) return 0; | ||
984 | |||
985 | glsym_glGetProgramBinary(p->prog, length, &size, &format, data); | ||
986 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
987 | |||
988 | if (length != size) | ||
989 | { | ||
990 | free(data); | ||
991 | return 0; | ||
992 | } | ||
993 | |||
994 | if (eet_write(ef, pname, data, length, 0) < 0) | ||
995 | { | ||
996 | if (data) free(data); | ||
997 | return 0; | ||
998 | } | ||
999 | if (data) free(data); | ||
1000 | return 1; | ||
1001 | } | ||
1002 | |||
1003 | static int | ||
1004 | _evas_gl_common_shader_program_source_init(Evas_GL_Program *p, | ||
1005 | Evas_GL_Program_Source *vert, | ||
1006 | Evas_GL_Program_Source *frag, | ||
1007 | const char *name) | ||
1008 | { | ||
1009 | GLint ok; | ||
1010 | |||
1011 | p->vert = glCreateShader(GL_VERTEX_SHADER); | ||
1012 | p->frag = glCreateShader(GL_FRAGMENT_SHADER); | ||
1013 | #if defined (GLES_VARIETY_S3C6410) | ||
1014 | glShaderBinary(1, &(p->vert), 0, vert->bin, vert->bin_size); | ||
1015 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1016 | glShaderBinary(1, &(p->frag), 0, frag->bin, frag->bin_size); | ||
1017 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1018 | #else | ||
1019 | glShaderSource(p->vert, 1, | ||
1020 | (const char **)&(vert->src), NULL); | ||
1021 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1022 | glCompileShader(p->vert); | ||
1023 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1024 | ok = 0; | ||
1025 | glGetShaderiv(p->vert, GL_COMPILE_STATUS, &ok); | ||
1026 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1027 | if (!ok) | ||
1028 | { | ||
1029 | gl_compile_link_error(p->vert, "compile vertex shader"); | ||
1030 | ERR("Abort compile of shader vert (%s): %s", name, vert->src); | ||
1031 | return 0; | ||
1032 | } | ||
1033 | glShaderSource(p->frag, 1, | ||
1034 | (const char **)&(frag->src), NULL); | ||
1035 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1036 | glCompileShader(p->frag); | ||
1037 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1038 | ok = 0; | ||
1039 | glGetShaderiv(p->frag, GL_COMPILE_STATUS, &ok); | ||
1040 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1041 | if (!ok) | ||
1042 | { | ||
1043 | gl_compile_link_error(p->frag, "compile fragment shader"); | ||
1044 | ERR("Abort compile of shader frag (%s): %s", name, frag->src); | ||
1045 | return 0; | ||
1046 | } | ||
1047 | #endif | ||
1048 | p->prog = glCreateProgram(); | ||
1049 | #if defined(GLES_VARIETY_S3C6410) || defined(GLES_VARIETY_SGX) | ||
1050 | #else | ||
1051 | if ((glsym_glGetProgramBinary) && (glsym_glProgramParameteri)) | ||
1052 | glsym_glProgramParameteri(p->prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, | ||
1053 | GL_TRUE); | ||
1054 | #endif | ||
1055 | glAttachShader(p->prog, p->vert); | ||
1056 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1057 | glAttachShader(p->prog, p->frag); | ||
1058 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1059 | |||
1060 | glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex"); | ||
1061 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1062 | glBindAttribLocation(p->prog, SHAD_COLOR, "color"); | ||
1063 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1064 | glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord"); | ||
1065 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1066 | glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2"); | ||
1067 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1068 | glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3"); | ||
1069 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1070 | glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm"); | ||
1071 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1072 | |||
1073 | glLinkProgram(p->prog); | ||
1074 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1075 | ok = 0; | ||
1076 | glGetProgramiv(p->prog, GL_LINK_STATUS, &ok); | ||
1077 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1078 | if (!ok) | ||
1079 | { | ||
1080 | gl_compile_link_error(p->prog, "link fragment and vertex shaders"); | ||
1081 | ERR("Abort compile of shader frag (%s): %s", name, frag->src); | ||
1082 | ERR("Abort compile of shader vert (%s): %s", name, vert->src); | ||
1083 | return 0; | ||
1084 | } | ||
1085 | return 1; | ||
1086 | } | ||
1087 | |||
1088 | #define SHADER_SOURCE_LINE(Big, Small) \ | ||
1089 | { SHADER_##Big, &(shader_##Small##_vert_src), &(shader_##Small##_frag_src), #Small } | ||
1090 | |||
1091 | #define SHADER_SOURCE_FILTER_LINE(Big, Small) \ | ||
1092 | { SHADER_##Big, &(shader_img_vert_src), &(shader_##Small##_frag_src), #Small } | ||
1093 | |||
1094 | static const struct { | ||
1095 | Evas_GL_Shader id; | ||
1096 | Evas_GL_Program_Source *vert; | ||
1097 | Evas_GL_Program_Source *frag; | ||
1098 | const char *name; | ||
1099 | } _shaders_source[] = { | ||
1100 | SHADER_SOURCE_LINE(RECT, rect), | ||
1101 | SHADER_SOURCE_LINE(FONT, font), | ||
1102 | SHADER_SOURCE_LINE(IMG, img), | ||
1103 | SHADER_SOURCE_LINE(IMG_NOMUL, img_nomul), | ||
1104 | SHADER_SOURCE_LINE(IMG_BGRA, img_bgra), | ||
1105 | SHADER_SOURCE_LINE(IMG_BGRA_NOMUL, img_bgra_nomul), | ||
1106 | SHADER_SOURCE_LINE(IMG_MASK, img_mask), | ||
1107 | SHADER_SOURCE_LINE(YUV, yuv), | ||
1108 | SHADER_SOURCE_LINE(YUV_NOMUL, yuv_nomul), | ||
1109 | SHADER_SOURCE_LINE(YUY2, yuy2), | ||
1110 | SHADER_SOURCE_LINE(YUY2_NOMUL, yuy2_nomul), | ||
1111 | SHADER_SOURCE_LINE(NV12, nv12), | ||
1112 | SHADER_SOURCE_LINE(NV12_NOMUL, nv12_nomul), | ||
1113 | SHADER_SOURCE_LINE(TEX, tex), | ||
1114 | SHADER_SOURCE_LINE(TEX_NOMUL, tex_nomul), | ||
1115 | /* Most of the filters use the image fragment shader */ | ||
1116 | SHADER_SOURCE_FILTER_LINE(FILTER_INVERT, filter_invert), | ||
1117 | SHADER_SOURCE_FILTER_LINE(FILTER_INVERT_NOMUL, filter_invert_nomul), | ||
1118 | SHADER_SOURCE_FILTER_LINE(FILTER_INVERT_BGRA, filter_invert_bgra), | ||
1119 | SHADER_SOURCE_FILTER_LINE(FILTER_INVERT_BGRA_NOMUL, filter_invert_bgra_nomul), | ||
1120 | SHADER_SOURCE_FILTER_LINE(FILTER_GREYSCALE, filter_greyscale), | ||
1121 | SHADER_SOURCE_FILTER_LINE(FILTER_GREYSCALE_NOMUL, filter_greyscale_nomul), | ||
1122 | SHADER_SOURCE_FILTER_LINE(FILTER_GREYSCALE_BGRA, filter_greyscale_bgra), | ||
1123 | SHADER_SOURCE_FILTER_LINE(FILTER_GREYSCALE_BGRA_NOMUL, filter_greyscale_bgra_nomul), | ||
1124 | SHADER_SOURCE_FILTER_LINE(FILTER_SEPIA, filter_sepia), | ||
1125 | SHADER_SOURCE_FILTER_LINE(FILTER_SEPIA_NOMUL, filter_sepia_nomul), | ||
1126 | SHADER_SOURCE_FILTER_LINE(FILTER_SEPIA_BGRA, filter_sepia_bgra), | ||
1127 | SHADER_SOURCE_FILTER_LINE(FILTER_SEPIA_BGRA_NOMUL, filter_sepia_bgra_nomul)/* , */ | ||
1128 | /* SHADER_SOURCE_LINE(FILTER_BLUR, filter_blur), */ | ||
1129 | /* SHADER_SOURCE_LINE(FILTER_BLUR_NOMUL, filter_blur_nomul), */ | ||
1130 | /* SHADER_SOURCE_LINE(FILTER_BLUR_BGRA, filter_blur_bgra), */ | ||
1131 | /* SHADER_SOURCE_LINE(FILTER_BLUR_BGRA_NOMUL, filter_blur_bgra_nomul) */ | ||
1132 | }; | ||
1133 | |||
1134 | static int | ||
1135 | _evas_gl_common_shader_source_init(Evas_GL_Shared *shared) | ||
1136 | { | ||
1137 | unsigned int i; | ||
1138 | |||
1139 | for (i = 0; i < sizeof (_shaders_source) / sizeof (_shaders_source[0]); ++i) | ||
1140 | if (!_evas_gl_common_shader_program_source_init(&(shared->shader[_shaders_source[i].id]), | ||
1141 | _shaders_source[i].vert, | ||
1142 | _shaders_source[i].frag, | ||
1143 | _shaders_source[i].name)) | ||
1144 | return 0; | ||
1145 | |||
1146 | return 1; | ||
1147 | } | ||
1148 | |||
1149 | static int | ||
1150 | _evas_gl_common_shader_binary_init(Evas_GL_Shared *shared) | ||
1151 | { | ||
1152 | /* check eet */ | ||
1153 | Eet_File *et = NULL; | ||
1154 | char bin_dir_path[PATH_MAX]; | ||
1155 | char bin_file_path[PATH_MAX]; | ||
1156 | unsigned int i; | ||
1157 | |||
1158 | if (!_evas_gl_shader_dir_check(bin_dir_path, sizeof(bin_dir_path))) | ||
1159 | return 0; | ||
1160 | |||
1161 | if (!_evas_gl_shader_file_check(bin_dir_path, bin_file_path, | ||
1162 | sizeof(bin_dir_path))) | ||
1163 | return 0; | ||
1164 | |||
1165 | /* use eet */ | ||
1166 | if (!eet_init()) return 0; | ||
1167 | et = eet_open(bin_file_path, EET_FILE_MODE_READ); | ||
1168 | if (!et) goto error; | ||
1169 | |||
1170 | for (i = 0; i < sizeof (_shaders_source) / sizeof (_shaders_source[0]); ++i) | ||
1171 | if (!_evas_gl_common_shader_program_binary_init(&(shared->shader[_shaders_source[i].id]), | ||
1172 | _shaders_source[i].name, | ||
1173 | et)) | ||
1174 | goto error; | ||
1175 | |||
1176 | if (et) eet_close(et); | ||
1177 | eet_shutdown(); | ||
1178 | return 1; | ||
1179 | |||
1180 | error: | ||
1181 | if (et) eet_close(et); | ||
1182 | eet_shutdown(); | ||
1183 | return 0; | ||
1184 | } | ||
1185 | |||
1186 | static int | ||
1187 | _evas_gl_common_shader_binary_save(Evas_GL_Shared *shared) | ||
1188 | { | ||
1189 | /* check eet */ | ||
1190 | Eet_File *et = NULL; //check eet file | ||
1191 | int tmpfd; | ||
1192 | int res = 0; | ||
1193 | char bin_dir_path[PATH_MAX]; | ||
1194 | char bin_file_path[PATH_MAX]; | ||
1195 | char tmp_file[PATH_MAX]; | ||
1196 | unsigned int i; | ||
1197 | |||
1198 | if (!_evas_gl_shader_dir_check(bin_dir_path, sizeof(bin_dir_path))) | ||
1199 | res = _evas_gl_shader_file_mkpath(bin_dir_path); | ||
1200 | if (!res) return 0; /* we can't make directory */ | ||
1201 | |||
1202 | _evas_gl_shader_file_check(bin_dir_path, bin_file_path, | ||
1203 | sizeof(bin_dir_path)); | ||
1204 | |||
1205 | /* use mkstemp for writing */ | ||
1206 | snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", bin_file_path); | ||
1207 | tmpfd = mkstemp(tmp_file); | ||
1208 | if (tmpfd < 0) goto error; | ||
1209 | close(tmpfd); | ||
1210 | |||
1211 | /* use eet */ | ||
1212 | if (!eet_init()) goto error; | ||
1213 | |||
1214 | et = eet_open(tmp_file, EET_FILE_MODE_WRITE); | ||
1215 | if (!et) goto error; | ||
1216 | |||
1217 | for (i = 0; i < sizeof (_shaders_source) / sizeof (_shaders_source[0]); ++i) | ||
1218 | if (!_evas_gl_common_shader_program_binary_save(&(shared->shader[_shaders_source[i].id]), | ||
1219 | _shaders_source[i].name, | ||
1220 | et)) | ||
1221 | goto error; | ||
1222 | |||
1223 | if (eet_close(et) != EET_ERROR_NONE) goto error; | ||
1224 | if (rename(tmp_file,bin_file_path) < 0) goto error; | ||
1225 | eet_shutdown(); | ||
1226 | return 1; | ||
1227 | |||
1228 | error: | ||
1229 | if (et) eet_close(et); | ||
1230 | if (_evas_gl_shader_file_exists(tmp_file)) unlink(tmp_file); | ||
1231 | eet_shutdown(); | ||
1232 | return 0; | ||
1233 | } | ||
1234 | |||
1235 | int | ||
1236 | evas_gl_common_shader_program_init(Evas_GL_Shared *shared) | ||
1237 | { | ||
1238 | // gl support binary shader and get env of binary shader path | ||
1239 | if (shared->info.bin_program && | ||
1240 | _evas_gl_common_shader_binary_init(shared)) return 1; | ||
1241 | /* compile all shader.*/ | ||
1242 | if (!_evas_gl_common_shader_source_init(shared)) return 0; | ||
1243 | /* success compile all shader. if gl support binary shader, we need to save */ | ||
1244 | if (shared->info.bin_program) _evas_gl_common_shader_binary_save(shared); | ||
1245 | return 1; | ||
1246 | } | ||
1247 | |||
1248 | void | ||
1249 | evas_gl_common_shader_program_init_done(void) | ||
1250 | { | ||
1251 | #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) | ||
1252 | glReleaseShaderCompiler(); | ||
1253 | #endif | ||
1254 | } | ||
1255 | |||
1256 | void | ||
1257 | evas_gl_common_shader_program_shutdown(Evas_GL_Program *p) | ||
1258 | { | ||
1259 | if (p->vert) glDeleteShader(p->vert); | ||
1260 | if (p->frag) glDeleteShader(p->frag); | ||
1261 | if (p->prog) glDeleteProgram(p->prog); | ||
1262 | } | ||