1 | #ifndef SHADER_H |
1 | #ifndef SHADER_H |
2 | #define SHADER_H |
2 | #define SHADER_H |
3 | |
3 | |
|
|
4 | #include <cassert> |
|
|
5 | |
|
|
6 | #include <map> |
4 | #include <sstream> |
7 | #include <sstream> |
5 | |
8 | |
6 | #include "opengl.h" |
9 | #include "opengl.h" |
7 | #include "util.h" |
10 | #include "util.h" |
8 | |
11 | |
… | |
… | |
208 | |
211 | |
209 | struct shader_builder |
212 | struct shader_builder |
210 | { |
213 | { |
211 | vector<uniform> refs; // uniform parameters |
214 | vector<uniform> refs; // uniform parameters |
212 | vector<var> temps; // temporary variables |
215 | vector<var> temps; // temporary variables |
213 | vector<var> streams; // varying inputs & outputs |
|
|
214 | |
216 | |
215 | ostringstream source; |
217 | ostringstream source; |
216 | |
218 | |
217 | template<typename type> |
219 | template<typename type> |
218 | shader_builder &operator <<(const type &t) |
220 | shader_builder &operator <<(const type &t) |
… | |
… | |
257 | ~var_i (); |
259 | ~var_i (); |
258 | }; |
260 | }; |
259 | |
261 | |
260 | struct uniform_i : var_i |
262 | struct uniform_i : var_i |
261 | { |
263 | { |
262 | bool dirty; |
|
|
263 | GLint location; |
|
|
264 | |
|
|
265 | virtual void update () = 0; |
|
|
266 | |
|
|
267 | void build (shader_builder &b); |
264 | void build (shader_builder &b); |
268 | void build_decl (ostringstream &b); |
265 | void build_decl (ostringstream &b); |
269 | |
266 | |
270 | void update_location (GLint program) |
267 | GLint location (); |
271 | { |
|
|
272 | location = glGetUniformLocationARB (program, name); |
|
|
273 | } |
|
|
274 | |
268 | |
275 | uniform_i (const char *strtype); |
269 | uniform_i (const char *strtype); |
276 | }; |
270 | }; |
277 | |
271 | |
278 | template<int dimension, typename gltype, const char *strtype, void (*upd)(GLint, GLsizei, const gltype *)> |
272 | template<int dimension, typename gltype, const char *strtype> |
279 | struct uniform2_i : uniform_i |
273 | struct uniform2_i : uniform_i |
280 | { |
274 | { |
281 | gltype data[dimension]; |
275 | gltype data[dimension]; |
282 | |
276 | |
283 | void update () |
|
|
284 | { |
|
|
285 | if (dirty) |
|
|
286 | { |
|
|
287 | if (location >= 0) |
|
|
288 | upd (location, dimension, data); |
|
|
289 | |
|
|
290 | dirty = false; |
|
|
291 | } |
|
|
292 | } |
|
|
293 | |
|
|
294 | uniform2_i () : uniform_i (strtype) { } |
277 | uniform2_i () : uniform_i (strtype) { } |
295 | }; |
278 | }; |
296 | |
279 | |
297 | template<int dimension, const char *strtype, void (*update)(GLint, GLsizei, const GLfloat *)> |
280 | template<int dimension, const char *strtype> |
298 | struct uniform_f_i : uniform2_i<dimension, GLfloat, strtype, update> |
281 | struct uniform_f_i : uniform2_i<dimension, GLfloat, strtype> |
299 | { |
282 | { |
300 | }; |
283 | }; |
301 | |
284 | |
302 | struct uniform_1f_i : uniform_f_i<1, str_float, glUniform1fvARB> { |
285 | struct uniform_1f_i : uniform_f_i<1, str_float> { |
303 | void operator =(GLfloat v) |
286 | void set (GLfloat v) |
304 | { |
287 | { |
305 | data[0] = v; |
288 | data[0] = v; |
306 | dirty = true; |
|
|
307 | } |
|
|
308 | }; |
|
|
309 | |
289 | |
|
|
290 | GLint loc = location (); |
|
|
291 | if (loc >= 0) // workaround for buggy drivers |
|
|
292 | glUniform1fvARB (loc, 1, data); |
|
|
293 | } |
|
|
294 | }; |
|
|
295 | |
310 | struct uniform_2f_i : uniform_f_i<2, str_vec2, glUniform2fvARB> { }; |
296 | struct uniform_2f_i : uniform_f_i<2, str_vec2> { |
311 | |
297 | void set (GLfloat x, GLfloat y) |
312 | struct uniform_3f_i : uniform_f_i<3, str_vec3, glUniform3fvARB> { |
|
|
313 | void operator =(const vec3 &v) |
|
|
314 | { |
298 | { |
315 | data[0] = v.x; |
299 | data[0] = x; |
316 | data[1] = v.y; |
300 | data[1] = y; |
|
|
301 | |
|
|
302 | GLint loc = location (); |
|
|
303 | if (loc >= 0) // workaround for buggy drivers |
|
|
304 | glUniform2fvARB (loc, 1, data); |
|
|
305 | } |
|
|
306 | |
|
|
307 | void set (const vec2 &v) { set (v.x, v.y); } |
|
|
308 | }; |
|
|
309 | |
|
|
310 | struct uniform_3f_i : uniform_f_i<3, str_vec3> { |
|
|
311 | void set (GLfloat x, GLfloat y, GLfloat z) |
|
|
312 | { |
|
|
313 | data[0] = x; |
|
|
314 | data[1] = y; |
317 | data[2] = v.z; |
315 | data[2] = z; |
318 | dirty = true; |
|
|
319 | } |
|
|
320 | }; |
|
|
321 | |
316 | |
|
|
317 | GLint loc = location (); |
|
|
318 | if (loc >= 0) // workaround for buggy drivers |
|
|
319 | glUniform3fvARB (loc, 1, data); |
|
|
320 | } |
|
|
321 | |
|
|
322 | void set (const vec3 &v) { set (v.x, v.y, v.z); } |
|
|
323 | }; |
|
|
324 | |
322 | struct uniform_4f_i : uniform_f_i<4, str_vec4, glUniform4fvARB> { |
325 | struct uniform_4f_i : uniform_f_i<4, str_vec4> { |
323 | #if 0 |
326 | void set (GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
|
|
327 | { |
|
|
328 | data[0] = x; |
|
|
329 | data[1] = y; |
|
|
330 | data[2] = z; |
|
|
331 | data[3] = w; |
|
|
332 | |
|
|
333 | GLint loc = location (); |
|
|
334 | if (loc >= 0) // workaround for buggy drivers |
|
|
335 | glUniform4fvARB (loc, 1, data); |
|
|
336 | } |
|
|
337 | |
|
|
338 | void set (const vec4 &v) { set (v.x, v.y, v.z, v.w); } |
|
|
339 | }; |
|
|
340 | |
|
|
341 | struct uniform_matrix_2f_i : uniform_f_i< 4, str_mat2> |
|
|
342 | { |
|
|
343 | void set (const GLfloat d[4]) |
|
|
344 | { |
|
|
345 | memcpy (data, d, 4 * sizeof (GLfloat)); |
|
|
346 | |
|
|
347 | GLint loc = location (); |
|
|
348 | if (loc >= 0) // workaround for buggy drivers |
|
|
349 | glUniformMatrix2fvARB (loc, 1, 0, data); |
|
|
350 | } |
|
|
351 | }; |
|
|
352 | |
|
|
353 | struct uniform_matrix_3f_i : uniform_f_i< 9, str_mat3> |
|
|
354 | { |
|
|
355 | void set (const GLfloat d[9]) |
|
|
356 | { |
|
|
357 | memcpy (data, d, 9 * sizeof (GLfloat)); |
|
|
358 | |
|
|
359 | GLint loc = location (); |
|
|
360 | if (loc >= 0) // workaround for buggy drivers |
|
|
361 | glUniformMatrix3fvARB (loc, 1, 0, data); |
|
|
362 | } |
|
|
363 | }; |
|
|
364 | |
|
|
365 | struct uniform_matrix_4f_i : uniform_f_i<16, str_mat4> |
|
|
366 | { |
324 | void operator =(const gl::matrix &m) |
367 | void set (const gl::matrix &m) |
325 | { |
368 | { |
326 | memcpy (data, m.data, 16 * sizeof (GLfloat)); |
369 | memcpy (data, m.data, 16 * sizeof (GLfloat)); |
327 | dirty = true; |
|
|
328 | } |
|
|
329 | #endif |
|
|
330 | }; |
|
|
331 | |
370 | |
332 | inline void UniformMatrix2fv (GLint l, GLsizei s, const GLfloat *m) { glUniformMatrix2fvARB (l, s, 0, m); } |
371 | GLint loc = location (); |
333 | inline void UniformMatrix3fv (GLint l, GLsizei s, const GLfloat *m) { glUniformMatrix3fvARB (l, s, 0, m); } |
372 | if (loc >= 0) // workaround for buggy drivers |
334 | inline void UniformMatrix4fv (GLint l, GLsizei s, const GLfloat *m) { glUniformMatrix4fvARB (l, s, 0, m); } |
373 | glUniformMatrix4fvARB (loc, 1, 0, data); |
335 | |
374 | } |
336 | struct uniform_matrix_2f_i : uniform_f_i< 4, str_mat2, UniformMatrix2fv> { }; |
375 | }; |
337 | struct uniform_matrix_3f_i : uniform_f_i< 9, str_mat3, UniformMatrix3fv> { }; |
|
|
338 | struct uniform_matrix_4f_i : uniform_f_i<16, str_mat4, UniformMatrix4fv> { }; |
|
|
339 | |
376 | |
340 | template<class var_i> |
377 | template<class var_i> |
341 | struct var_ref : ref<var_i> |
378 | struct var_ref : ref<var_i> |
342 | { |
379 | { |
343 | var_ref (const char *glname = 0) |
380 | var_ref (const char *glname = 0) |
… | |
… | |
375 | }; |
412 | }; |
376 | |
413 | |
377 | template<int dimension, const char *strtype> |
414 | template<int dimension, const char *strtype> |
378 | struct varying_f_i : varying_i<dimension, GL_FLOAT, strtype> |
415 | struct varying_f_i : varying_i<dimension, GL_FLOAT, strtype> |
379 | { |
416 | { |
380 | void set (const gl::vertex_buffer_object &vb, GLint offset) |
417 | void set (const gl::vertex_buffer &vb, GLint offset) |
381 | { |
418 | { |
382 | varying_i<dimension, GL_FLOAT, strtype>::set (gl::format_stride (vb.format), (GLvoid *)(long)offset); |
419 | varying_i<dimension, GL_FLOAT, strtype>::set (gl::format_stride (vb.format), (GLvoid *)(long)offset); |
383 | } |
420 | } |
384 | }; |
421 | }; |
385 | |
422 | |
… | |
… | |
387 | { |
424 | { |
388 | }; |
425 | }; |
389 | |
426 | |
390 | struct varying_2f_i : varying_f_i<2, str_vec2> |
427 | struct varying_2f_i : varying_f_i<2, str_vec2> |
391 | { |
428 | { |
392 | void set_t (const gl::vertex_buffer_object &vb) |
429 | void set_t (const gl::vertex_buffer &vb) |
393 | { |
430 | { |
394 | set (vb, gl::format_offset_t (vb.format)); |
431 | set (vb, gl::format_offset_t (vb.format)); |
395 | } |
432 | } |
396 | }; |
433 | }; |
397 | |
434 | |
398 | struct varying_3f_i : varying_f_i<3, str_vec3> |
435 | struct varying_3f_i : varying_f_i<3, str_vec3> |
399 | { |
436 | { |
400 | void set_p (const gl::vertex_buffer_object &vb) |
437 | void set_p (const gl::vertex_buffer &vb) |
401 | { |
438 | { |
402 | set (vb, gl::format_offset_p (vb.format)); |
439 | set (vb, gl::format_offset_p (vb.format)); |
403 | } |
440 | } |
404 | |
441 | |
405 | void set_n (const gl::vertex_buffer_object &vb) |
442 | void set_n (const gl::vertex_buffer &vb) |
406 | { |
443 | { |
407 | set (vb, gl::format_offset_n (vb.format)); |
444 | set (vb, gl::format_offset_n (vb.format)); |
408 | } |
445 | } |
409 | }; |
446 | }; |
410 | |
447 | |
… | |
… | |
451 | typedef temp_ref<str_vec4> temp_4f; |
488 | typedef temp_ref<str_vec4> temp_4f; |
452 | typedef temp_ref<str_mat2> temp_matrix_2f; |
489 | typedef temp_ref<str_mat2> temp_matrix_2f; |
453 | typedef temp_ref<str_mat3> temp_matrix_3f; |
490 | typedef temp_ref<str_mat3> temp_matrix_3f; |
454 | typedef temp_ref<str_mat4> temp_matrix_4f; |
491 | typedef temp_ref<str_mat4> temp_matrix_4f; |
455 | |
492 | |
|
|
493 | struct texture_units |
|
|
494 | { |
|
|
495 | static int units[8]; |
|
|
496 | static int unit_count; |
|
|
497 | |
|
|
498 | static GLenum get_texture_unit () |
|
|
499 | { |
|
|
500 | assert (unit_count); |
|
|
501 | return units[--unit_count]; |
|
|
502 | } |
|
|
503 | |
|
|
504 | static void put_texture_unit (GLenum unit) |
|
|
505 | { |
|
|
506 | assert (unit_count < 8); |
|
|
507 | units[unit_count++] = unit; |
|
|
508 | } |
|
|
509 | }; |
|
|
510 | |
456 | template<GLenum gltype, const char *strtype> |
511 | template<GLenum gltype, const char *strtype> |
457 | struct sampler_i : uniform_i |
512 | struct sampler_i : uniform_i, texture_units |
458 | { |
513 | { |
459 | GLuint unit; |
514 | int unit; |
|
|
515 | GLuint name; |
460 | |
516 | |
461 | void update () |
517 | void enable () |
462 | { |
518 | { |
463 | if (dirty) |
519 | #if DEBUG |
|
|
520 | assert (unit < 0); |
|
|
521 | #endif |
|
|
522 | GLint loc = location (); |
|
|
523 | |
|
|
524 | if (loc >= 0) |
464 | { |
525 | { |
465 | //cgGLSetTextureParameter (param, texture); |
526 | unit = get_texture_unit (); |
466 | dirty = false; |
527 | glActiveTexture (GL_TEXTURE0 + unit); |
|
|
528 | glBindTexture (gltype, name); |
|
|
529 | glUniform1iARB (loc, unit); |
467 | } |
530 | } |
468 | } |
531 | } |
469 | |
532 | |
470 | void begin () |
533 | void disable () |
471 | { |
|
|
472 | cgGLEnableTextureParameter (unit); |
|
|
473 | } |
534 | { |
|
|
535 | if (unit >= 0) |
|
|
536 | { |
|
|
537 | put_texture_unit (unit); |
|
|
538 | unit = -1; |
|
|
539 | } |
|
|
540 | } |
474 | |
541 | |
475 | sampler_i (GLuint textureunit) : uniform_i (strtype), unit (textureunit) { } |
542 | template<class bufferclass, class vectype> |
476 | }; |
543 | void set (const gl::vertex_buffer &vb, const vectype bufferclass::*vp) |
|
|
544 | { |
|
|
545 | glTexCoordPointer ( |
|
|
546 | vector_traits<vectype>::dimension (), |
|
|
547 | gltype_traits<typename vector_traits<vectype>::basetype>::gltype, |
|
|
548 | sizeof (bufferclass), |
|
|
549 | (GLvoid)(char bufferclass::*)vp |
|
|
550 | ); |
|
|
551 | } |
477 | |
552 | |
|
|
553 | sampler_i (GLuint texture) |
|
|
554 | : uniform_i (strtype) |
|
|
555 | , name (texture) |
|
|
556 | #if DEBUG |
|
|
557 | , unit (-1) |
|
|
558 | #endif |
|
|
559 | { |
|
|
560 | } |
|
|
561 | }; |
|
|
562 | |
478 | struct sampler_1d_i : sampler_i<CG_SAMPLER1D, str_sampler_1d> |
563 | struct sampler_1d_i : sampler_i<GL_TEXTURE_1D, str_sampler_1d> |
479 | { |
564 | { |
480 | sampler_1d_i (GLuint textureunit) : sampler_i<CG_SAMPLER1D, str_sampler_1d> (textureunit) { } |
565 | sampler_1d_i (GLuint texture) : sampler_i<GL_TEXTURE_1D, str_sampler_1d> (texture) { } |
481 | }; |
566 | }; |
482 | |
567 | |
483 | struct sampler_1d_shadow_i : sampler_i<CG_SAMPLER1D, str_sampler_1d_shadow> |
568 | struct sampler_1d_shadow_i : sampler_i<GL_TEXTURE_1D, str_sampler_1d_shadow> |
484 | { |
569 | { |
485 | sampler_1d_shadow_i (GLuint textureunit) : sampler_i<CG_SAMPLER1D, str_sampler_1d_shadow> (textureunit) { } |
570 | sampler_1d_shadow_i (GLuint texture) : sampler_i<GL_TEXTURE_1D, str_sampler_1d_shadow> (texture) { } |
486 | }; |
571 | }; |
487 | |
572 | |
488 | struct sampler_2d_i : sampler_i<CG_SAMPLER2D, str_sampler_2d> |
573 | struct sampler_2d_i : sampler_i<GL_TEXTURE_2D, str_sampler_2d> |
489 | { |
574 | { |
490 | sampler_2d_i (GLuint textureunit) : sampler_i<CG_SAMPLER2D, str_sampler_2d> (textureunit) { } |
575 | sampler_2d_i (GLuint texture) : sampler_i<GL_TEXTURE_2D, str_sampler_2d> (texture) { } |
491 | }; |
576 | }; |
492 | |
577 | |
493 | struct sampler_2d_shadow_i : sampler_i<CG_SAMPLER2D, str_sampler_2d_shadow> |
578 | struct sampler_2d_shadow_i : sampler_i<GL_TEXTURE_2D, str_sampler_2d_shadow> |
494 | { |
579 | { |
495 | sampler_2d_shadow_i (GLuint textureunit) : sampler_i<CG_SAMPLER2D, str_sampler_2d_shadow> (textureunit) { } |
580 | sampler_2d_shadow_i (GLuint texture) : sampler_i<GL_TEXTURE_2D, str_sampler_2d_shadow> (texture) { } |
496 | }; |
581 | }; |
497 | |
582 | |
498 | struct sampler_2d_rect_i : sampler_i<CG_SAMPLERRECT, str_sampler_2d_rect> |
583 | struct sampler_2d_rect_i : sampler_i<GL_TEXTURE_2D, str_sampler_2d_rect> |
499 | { |
584 | { |
500 | sampler_2d_rect_i (GLuint textureunit) : sampler_i<CG_SAMPLERRECT, str_sampler_2d_rect> (textureunit) { } |
585 | sampler_2d_rect_i (GLuint texture) : sampler_i<GL_TEXTURE_2D, str_sampler_2d_rect> (texture) { } |
501 | }; |
586 | }; |
502 | |
587 | |
503 | struct sampler_2d_rect_shadow_i : sampler_i<CG_SAMPLERRECT, str_sampler_2d_rect_shadow> |
588 | struct sampler_2d_rect_shadow_i : sampler_i<GL_TEXTURE_2D, str_sampler_2d_rect_shadow> |
504 | { |
589 | { |
505 | sampler_2d_rect_shadow_i (GLuint textureunit) : sampler_i<CG_SAMPLERRECT, str_sampler_2d_rect_shadow> (textureunit) { } |
590 | sampler_2d_rect_shadow_i (GLuint texture) : sampler_i<GL_TEXTURE_2D, str_sampler_2d_rect_shadow> (texture) { } |
506 | }; |
591 | }; |
507 | |
592 | |
508 | struct sampler_3d_i : sampler_i<CG_SAMPLER3D, str_sampler_3d> |
593 | struct sampler_3d_i : sampler_i<GL_TEXTURE_3D, str_sampler_3d> |
509 | { |
594 | { |
510 | sampler_3d_i (GLuint textureunit) : sampler_i<CG_SAMPLER3D, str_sampler_3d> (textureunit) { } |
595 | sampler_3d_i (GLuint texture) : sampler_i<GL_TEXTURE_3D, str_sampler_3d> (texture) { } |
511 | }; |
596 | }; |
512 | |
597 | |
513 | struct sampler_3d_rect_i : sampler_i<CG_SAMPLER3D, str_sampler_3d_rect> |
598 | struct sampler_3d_rect_i : sampler_i<GL_TEXTURE_3D, str_sampler_3d_rect> |
514 | { |
599 | { |
515 | sampler_3d_rect_i (GLuint textureunit) : sampler_i<CG_SAMPLER3D, str_sampler_3d_rect> (textureunit) { } |
600 | sampler_3d_rect_i (GLuint texture) : sampler_i<GL_TEXTURE_3D, str_sampler_3d_rect> (texture) { } |
516 | }; |
601 | }; |
517 | |
602 | |
518 | struct sampler_cube_i : sampler_i<CG_SAMPLERCUBE, str_sampler_cube> |
603 | struct sampler_cube_i : sampler_i<GL_TEXTURE_CUBE_MAP, str_sampler_cube> |
519 | { |
604 | { |
520 | sampler_cube_i (GLuint textureunit) : sampler_i<CG_SAMPLERCUBE, str_sampler_cube> (textureunit) { } |
605 | sampler_cube_i (GLuint texture) : sampler_i<GL_TEXTURE_CUBE_MAP, str_sampler_cube> (texture) { } |
521 | }; |
606 | }; |
522 | |
607 | |
|
|
608 | template<class sampler_i> |
|
|
609 | struct sampler_ref : auto_ref1<sampler_i, GLuint> |
|
|
610 | { |
|
|
611 | sampler_ref (GLuint texture) |
|
|
612 | : auto_ref1<sampler_i, GLuint> (texture) |
|
|
613 | { |
|
|
614 | } |
|
|
615 | }; |
|
|
616 | |
523 | typedef auto_ref1<sampler_1d_i, GLuint> sampler_1d; |
617 | typedef sampler_ref<sampler_1d_i> sampler_1d; |
524 | typedef auto_ref1<sampler_1d_shadow_i, GLuint> sampler_1d_shadow; |
618 | typedef sampler_ref<sampler_1d_shadow_i> sampler_1d_shadow; |
525 | typedef auto_ref1<sampler_2d_i, GLuint> sampler_2d; |
619 | typedef sampler_ref<sampler_2d_i> sampler_2d; |
526 | typedef auto_ref1<sampler_2d_shadow_i, GLuint> sampler_2d_shadow; |
620 | typedef sampler_ref<sampler_2d_shadow_i> sampler_2d_shadow; |
527 | typedef auto_ref1<sampler_2d_rect_i, GLuint> sampler_2d_rect; |
621 | typedef sampler_ref<sampler_2d_rect_i> sampler_2d_rect; |
528 | typedef auto_ref1<sampler_2d_rect_shadow_i, GLuint> sampler_2d_rect_shadow; |
622 | typedef sampler_ref<sampler_2d_rect_shadow_i> sampler_2d_rect_shadow; |
529 | typedef auto_ref1<sampler_3d_i, GLuint> sampler_3d; |
623 | typedef sampler_ref<sampler_3d_i> sampler_3d; |
530 | typedef auto_ref1<sampler_3d_rect_i, GLuint> sampler_3d_rect; |
624 | typedef sampler_ref<sampler_3d_rect_i> sampler_3d_rect; |
531 | typedef auto_ref1<sampler_cube_i, GLuint> sampler_cube; |
625 | typedef sampler_ref<sampler_cube_i> sampler_cube; |
532 | |
626 | |
533 | struct fragment_const_string_i : fragment_i |
627 | struct fragment_const_string_i : fragment_i |
534 | { |
628 | { |
535 | const char *str; |
629 | const char *str; |
536 | |
630 | |
… | |
… | |
608 | typedef shader_object<GL_VERTEX_SHADER_ARB> vertex_shader; |
702 | typedef shader_object<GL_VERTEX_SHADER_ARB> vertex_shader; |
609 | typedef shader_object<GL_FRAGMENT_SHADER_ARB> fragment_shader; |
703 | typedef shader_object<GL_FRAGMENT_SHADER_ARB> fragment_shader; |
610 | |
704 | |
611 | struct program_object |
705 | struct program_object |
612 | { |
706 | { |
|
|
707 | static struct program_object *cur; // currently bound program |
|
|
708 | |
613 | GLuint id; |
709 | GLuint id; |
614 | |
710 | |
615 | vertex_shader vsh; |
711 | vertex_shader vsh; |
616 | fragment_shader fsh; |
712 | fragment_shader fsh; |
617 | |
713 | |
|
|
714 | map<uniform_i *,GLint> uloc; // uniform location |
|
|
715 | |
618 | program_object (); |
716 | program_object (); |
619 | ~program_object (); |
717 | ~program_object (); |
620 | |
718 | |
621 | void link (); |
719 | void link (); |
|
|
720 | |
|
|
721 | void enable (); |
|
|
722 | void disable (); |
622 | }; |
723 | }; |
623 | |
724 | |
624 | template<typename T> |
725 | template<typename T> |
625 | struct sl_append |
726 | struct sl_append |
626 | { |
727 | { |
… | |
… | |
771 | sl_append< temp_ref<strtype> > (v) |
872 | sl_append< temp_ref<strtype> > (v) |
772 | ); |
873 | ); |
773 | } |
874 | } |
774 | }; |
875 | }; |
775 | |
876 | |
|
|
877 | template<> |
|
|
878 | template<class sampler_i> |
|
|
879 | struct sl_convert< sampler_ref<sampler_i> > |
|
|
880 | { |
|
|
881 | typedef sl_expr< sl_append< sampler_ref<sampler_i> > > T; |
|
|
882 | static inline const T convert (const sampler_ref<sampler_i> &v) |
|
|
883 | { |
|
|
884 | return sl_append< sampler_ref<sampler_i> > (v); |
|
|
885 | } |
|
|
886 | }; |
|
|
887 | |
|
|
888 | namespace compile { |
776 | extern const fragment_const_string str_2sp; |
889 | extern const fragment_const_string str_2sp; |
777 | extern const fragment_const_string str_equal; |
890 | extern const fragment_const_string str_equal; |
778 | extern const fragment_const_string str_comma; |
891 | extern const fragment_const_string str_comma; |
779 | extern const fragment_const_string str_endl; |
892 | extern const fragment_const_string str_endl; |
780 | |
893 | |
781 | template<class fragment, typename expr> |
894 | template<class fragment, typename expr> |
782 | inline void sl_assign (const fragment &f, const expr &e) |
895 | inline void sl_assign (const fragment &f, const expr &e) |
783 | { |
896 | { |
784 | cur->append (str_2sp); |
897 | cur->append (str_2sp); |
785 | cur->append (f); |
898 | cur->append (f); |
786 | cur->append (str_equal); |
899 | cur->append (str_equal); |
787 | sl_convert<expr>::convert (e) (); |
900 | sl_convert<expr>::convert (e) (); |
788 | cur->append (str_endl); |
901 | cur->append (str_endl); |
|
|
902 | } |
789 | } |
903 | } |
790 | |
904 | |
791 | template<class type> |
905 | template<class type> |
792 | template<typename expr> |
906 | template<typename expr> |
793 | inline const auto_lvalue_ref0<type> &auto_lvalue_ref0<type>::operator =(const expr &e) const |
907 | inline const auto_lvalue_ref0<type> &auto_lvalue_ref0<type>::operator =(const expr &e) const |
794 | { |
908 | { |
795 | sl_assign (*this, e); |
909 | compile::sl_assign (*this, e); |
796 | return *this; |
910 | return *this; |
797 | } |
911 | } |
798 | |
912 | |
799 | template<class type, typename arg1> |
913 | template<class type, typename arg1> |
800 | template<typename expr> |
914 | template<typename expr> |
801 | inline const auto_lvalue_ref1<type,arg1> &auto_lvalue_ref1<type,arg1>::operator =(const expr &e) const |
915 | inline const auto_lvalue_ref1<type,arg1> &auto_lvalue_ref1<type,arg1>::operator =(const expr &e) const |
802 | { |
916 | { |
803 | sl_assign (*this, e); |
917 | compile::sl_assign (*this, e); |
804 | return *this; |
918 | return *this; |
805 | } |
919 | } |
806 | |
920 | |
807 | template<class T> |
921 | template<class T> |
808 | template<typename expr> |
922 | template<typename expr> |
809 | inline const sl_expr<T> &sl_expr<T>::operator =(const expr &e) const |
923 | inline const sl_expr<T> &sl_expr<T>::operator =(const expr &e) const |
810 | { |
924 | { |
811 | sl_assign (*this, e); |
925 | compile::sl_assign (*this, e); |
812 | return *this; |
926 | return *this; |
813 | } |
927 | } |
814 | |
928 | |
815 | template<const char *strtype> |
929 | template<const char *strtype> |
816 | template<typename expr> |
930 | template<typename expr> |
817 | inline const temp_ref<strtype> &temp_ref<strtype>::operator =(const expr &e) const |
931 | inline const temp_ref<strtype> &temp_ref<strtype>::operator =(const expr &e) const |
818 | { |
932 | { |
819 | sl_assign (*this, e); |
933 | compile::sl_assign (*this, e); |
820 | return *this; |
934 | return *this; |
821 | } |
935 | } |
822 | |
936 | |
823 | struct sl_append_const_string |
937 | struct sl_append_const_string |
824 | { |
938 | { |
… | |
… | |
831 | { |
945 | { |
832 | cur->push_back (str); |
946 | cur->push_back (str); |
833 | } |
947 | } |
834 | }; |
948 | }; |
835 | |
949 | |
|
|
950 | namespace compile { |
836 | extern const sl_append_const_string str_lpar; |
951 | extern const sl_append_const_string str_lpar; |
837 | extern const sl_append_const_string str_rpar; |
952 | extern const sl_append_const_string str_rpar; |
|
|
953 | extern const sl_append_const_string str_minus; |
838 | |
954 | |
|
|
955 | using namespace shader; |
|
|
956 | |
|
|
957 | template<typename T> |
|
|
958 | inline const sl_expr< sl_concat2< sl_append_const_string, |
|
|
959 | typename sl_convert<T>::T |
|
|
960 | > > |
|
|
961 | operator -(const T &t) |
|
|
962 | { |
|
|
963 | return concat (str_minus, sl_convert<T>::convert (t), s); |
|
|
964 | } |
|
|
965 | |
839 | template<class A, class B, class C> |
966 | template<class A, class B, class C> |
840 | struct sl_binop |
967 | struct sl_binop |
841 | { |
968 | { |
842 | const A a; const B b; const C c; |
969 | const A a; const B b; const C c; |
843 | sl_binop (const A &a, const B &b, const C &c) : a(a), b(b), c(c) { } |
970 | sl_binop (const A &a, const B &b, const C &c) : a(a), b(b), c(c) { } |
844 | void operator ()() const { str_lpar (); a (); b (); c (); str_rpar (); } |
971 | void operator ()() const { str_lpar (); a (); b (); c (); str_rpar (); } |
845 | }; |
972 | }; |
846 | |
973 | |
847 | # define SHADER_BINOP(op, str) \ |
974 | # define SHADER_BINOP(op, str) \ |
848 | extern const sl_append_const_string str_ ## str; \ |
975 | extern const sl_append_const_string str_ ## str; \ |
849 | template<typename A, typename B> \ |
976 | template<typename A, typename B> \ |
850 | inline const sl_expr< sl_binop< typename sl_convert<A>::T, \ |
977 | inline const sl_expr< sl_binop< typename sl_convert<A>::T, \ |
851 | sl_append_const_string, \ |
978 | sl_append_const_string, \ |
852 | typename sl_convert<B>::T > > \ |
979 | typename sl_convert<B>::T > > \ |
853 | operator op(const A &a, const B &b) \ |
980 | operator op(const A &a, const B &b) \ |
854 | { \ |
981 | { \ |
855 | return sl_binop< typename sl_convert<A>::T, sl_append_const_string, typename sl_convert<B>::T > \ |
982 | return sl_binop< typename sl_convert<A>::T, sl_append_const_string, typename sl_convert<B>::T > \ |
856 | (sl_convert<A>::convert (a), str_ ## str, sl_convert<B>::convert (b)); \ |
983 | (sl_convert<A>::convert (a), str_ ## str, sl_convert<B>::convert (b)); \ |
857 | } |
984 | } |
858 | |
985 | |
859 | SHADER_BINOP (+, plus); |
986 | SHADER_BINOP (+, plus); |
860 | SHADER_BINOP (-, minus); |
987 | SHADER_BINOP (-, minus); |
861 | SHADER_BINOP (*, mul); |
988 | SHADER_BINOP (*, mul); |
862 | SHADER_BINOP (/, div); |
989 | SHADER_BINOP (/, div); |
863 | SHADER_BINOP (%, mod); |
990 | SHADER_BINOP (%, mod); |
864 | |
991 | |
|
|
992 | SHADER_BINOP (<, lt); |
|
|
993 | SHADER_BINOP (<=, lte); |
|
|
994 | SHADER_BINOP (==, eq); |
|
|
995 | SHADER_BINOP (!=, ne); |
|
|
996 | SHADER_BINOP (>=, gte); |
|
|
997 | SHADER_BINOP (>, gt); |
|
|
998 | |
865 | # undef SHADER_BINOP |
999 | # undef SHADER_BINOP |
866 | |
1000 | |
867 | void swizzle_mask (sl_string<7> &s, int mask); |
1001 | void swizzle_mask (sl_string<7> &s, int mask); |
868 | |
1002 | |
869 | template<typename T> |
1003 | template<typename T> |
870 | inline const sl_expr< sl_concat3< sl_append_const_string, |
1004 | inline const sl_expr< sl_concat3< sl_append_const_string, |
871 | typename sl_convert<T>::T, |
1005 | typename sl_convert<T>::T, |
872 | sl_string<7> |
1006 | sl_string<7> |
873 | > > |
1007 | > > |
874 | swizzle (const T &t, int a, int b = 0, int c = 0, int d = 0) |
1008 | swizzle (const T &t, int a, int b = 0, int c = 0, int d = 0) |
875 | { |
1009 | { |
876 | sl_string<7> s; |
1010 | sl_string<7> s; |
877 | swizzle_mask (s, ((d * 5 + c) * 5 + b) * 5 + a); |
1011 | swizzle_mask (s, ((d * 5 + c) * 5 + b) * 5 + a); |
878 | return concat (str_lpar, sl_convert<T>::convert (t), s); |
1012 | return concat (str_lpar, sl_convert<T>::convert (t), s); |
|
|
1013 | } |
|
|
1014 | |
|
|
1015 | # define SHADER_SWIZZLE_OP(abcd,type) \ |
|
|
1016 | template<typename T> \ |
|
|
1017 | inline const sl_expr< sl_concat3< sl_append_const_string, \ |
|
|
1018 | typename sl_convert<T>::T, \ |
|
|
1019 | sl_string<7> \ |
|
|
1020 | > > \ |
|
|
1021 | type (const T &t) \ |
|
|
1022 | { \ |
|
|
1023 | return swizzle (t, (abcd / 1000) % 5, (abcd / 100) % 5, (abcd / 10) % 5, (abcd / 1) % 5); \ |
|
|
1024 | } |
|
|
1025 | |
|
|
1026 | // brute force is lovely, ain't it? |
|
|
1027 | SHADER_SWIZZLE_OP (1 , x ) SHADER_SWIZZLE_OP (11 , xx ) SHADER_SWIZZLE_OP (111 , xxx ) SHADER_SWIZZLE_OP (1111, xxxx) |
|
|
1028 | SHADER_SWIZZLE_OP (1112, xxxy) SHADER_SWIZZLE_OP (1113, xxxz) SHADER_SWIZZLE_OP (1114, xxxw) SHADER_SWIZZLE_OP (112 , xxy ) |
|
|
1029 | SHADER_SWIZZLE_OP (1121, xxyx) SHADER_SWIZZLE_OP (1122, xxyy) SHADER_SWIZZLE_OP (1123, xxyz) SHADER_SWIZZLE_OP (1124, xxyw) |
|
|
1030 | SHADER_SWIZZLE_OP (113 , xxz ) SHADER_SWIZZLE_OP (1131, xxzx) SHADER_SWIZZLE_OP (1132, xxzy) SHADER_SWIZZLE_OP (1133, xxzz) |
|
|
1031 | SHADER_SWIZZLE_OP (1134, xxzw) SHADER_SWIZZLE_OP (114 , xxw ) SHADER_SWIZZLE_OP (1141, xxwx) SHADER_SWIZZLE_OP (1142, xxwy) |
|
|
1032 | SHADER_SWIZZLE_OP (1143, xxwz) SHADER_SWIZZLE_OP (1144, xxww) SHADER_SWIZZLE_OP (12 , xy ) SHADER_SWIZZLE_OP (121 , xyx ) |
|
|
1033 | SHADER_SWIZZLE_OP (1211, xyxx) SHADER_SWIZZLE_OP (1212, xyxy) SHADER_SWIZZLE_OP (1213, xyxz) SHADER_SWIZZLE_OP (1214, xyxw) |
|
|
1034 | SHADER_SWIZZLE_OP (122 , xyy ) SHADER_SWIZZLE_OP (1221, xyyx) SHADER_SWIZZLE_OP (1222, xyyy) SHADER_SWIZZLE_OP (1223, xyyz) |
|
|
1035 | SHADER_SWIZZLE_OP (1224, xyyw) SHADER_SWIZZLE_OP (123 , xyz ) SHADER_SWIZZLE_OP (1231, xyzx) SHADER_SWIZZLE_OP (1232, xyzy) |
|
|
1036 | SHADER_SWIZZLE_OP (1233, xyzz) SHADER_SWIZZLE_OP (1234, xyzw) SHADER_SWIZZLE_OP (124 , xyw ) SHADER_SWIZZLE_OP (1241, xywx) |
|
|
1037 | SHADER_SWIZZLE_OP (1242, xywy) SHADER_SWIZZLE_OP (1243, xywz) SHADER_SWIZZLE_OP (1244, xyww) SHADER_SWIZZLE_OP (13 , xz ) |
|
|
1038 | SHADER_SWIZZLE_OP (131 , xzx ) SHADER_SWIZZLE_OP (1311, xzxx) SHADER_SWIZZLE_OP (1312, xzxy) SHADER_SWIZZLE_OP (1313, xzxz) |
|
|
1039 | SHADER_SWIZZLE_OP (1314, xzxw) SHADER_SWIZZLE_OP (132 , xzy ) SHADER_SWIZZLE_OP (1321, xzyx) SHADER_SWIZZLE_OP (1322, xzyy) |
|
|
1040 | SHADER_SWIZZLE_OP (1323, xzyz) SHADER_SWIZZLE_OP (1324, xzyw) SHADER_SWIZZLE_OP (133 , xzz ) SHADER_SWIZZLE_OP (1331, xzzx) |
|
|
1041 | SHADER_SWIZZLE_OP (1332, xzzy) SHADER_SWIZZLE_OP (1333, xzzz) SHADER_SWIZZLE_OP (1334, xzzw) SHADER_SWIZZLE_OP (134 , xzw ) |
|
|
1042 | SHADER_SWIZZLE_OP (1341, xzwx) SHADER_SWIZZLE_OP (1342, xzwy) SHADER_SWIZZLE_OP (1343, xzwz) SHADER_SWIZZLE_OP (1344, xzww) |
|
|
1043 | SHADER_SWIZZLE_OP (14 , xw ) SHADER_SWIZZLE_OP (141 , xwx ) SHADER_SWIZZLE_OP (1411, xwxx) SHADER_SWIZZLE_OP (1412, xwxy) |
|
|
1044 | SHADER_SWIZZLE_OP (1413, xwxz) SHADER_SWIZZLE_OP (1414, xwxw) SHADER_SWIZZLE_OP (142 , xwy ) SHADER_SWIZZLE_OP (1421, xwyx) |
|
|
1045 | SHADER_SWIZZLE_OP (1422, xwyy) SHADER_SWIZZLE_OP (1423, xwyz) SHADER_SWIZZLE_OP (1424, xwyw) SHADER_SWIZZLE_OP (143 , xwz ) |
|
|
1046 | SHADER_SWIZZLE_OP (1431, xwzx) SHADER_SWIZZLE_OP (1432, xwzy) SHADER_SWIZZLE_OP (1433, xwzz) SHADER_SWIZZLE_OP (1434, xwzw) |
|
|
1047 | SHADER_SWIZZLE_OP (144 , xww ) SHADER_SWIZZLE_OP (1441, xwwx) SHADER_SWIZZLE_OP (1442, xwwy) SHADER_SWIZZLE_OP (1443, xwwz) |
|
|
1048 | SHADER_SWIZZLE_OP (1444, xwww) SHADER_SWIZZLE_OP (2 , y ) SHADER_SWIZZLE_OP (21 , yx ) SHADER_SWIZZLE_OP (211 , yxx ) |
|
|
1049 | SHADER_SWIZZLE_OP (2111, yxxx) SHADER_SWIZZLE_OP (2112, yxxy) SHADER_SWIZZLE_OP (2113, yxxz) SHADER_SWIZZLE_OP (2114, yxxw) |
|
|
1050 | SHADER_SWIZZLE_OP (212 , yxy ) SHADER_SWIZZLE_OP (2121, yxyx) SHADER_SWIZZLE_OP (2122, yxyy) SHADER_SWIZZLE_OP (2123, yxyz) |
|
|
1051 | SHADER_SWIZZLE_OP (2124, yxyw) SHADER_SWIZZLE_OP (213 , yxz ) SHADER_SWIZZLE_OP (2131, yxzx) SHADER_SWIZZLE_OP (2132, yxzy) |
|
|
1052 | SHADER_SWIZZLE_OP (2133, yxzz) SHADER_SWIZZLE_OP (2134, yxzw) SHADER_SWIZZLE_OP (214 , yxw ) SHADER_SWIZZLE_OP (2141, yxwx) |
|
|
1053 | SHADER_SWIZZLE_OP (2142, yxwy) SHADER_SWIZZLE_OP (2143, yxwz) SHADER_SWIZZLE_OP (2144, yxww) SHADER_SWIZZLE_OP (22 , yy ) |
|
|
1054 | SHADER_SWIZZLE_OP (221 , yyx ) SHADER_SWIZZLE_OP (2211, yyxx) SHADER_SWIZZLE_OP (2212, yyxy) SHADER_SWIZZLE_OP (2213, yyxz) |
|
|
1055 | SHADER_SWIZZLE_OP (2214, yyxw) SHADER_SWIZZLE_OP (222 , yyy ) SHADER_SWIZZLE_OP (2221, yyyx) SHADER_SWIZZLE_OP (2222, yyyy) |
|
|
1056 | SHADER_SWIZZLE_OP (2223, yyyz) SHADER_SWIZZLE_OP (2224, yyyw) SHADER_SWIZZLE_OP (223 , yyz ) SHADER_SWIZZLE_OP (2231, yyzx) |
|
|
1057 | SHADER_SWIZZLE_OP (2232, yyzy) SHADER_SWIZZLE_OP (2233, yyzz) SHADER_SWIZZLE_OP (2234, yyzw) SHADER_SWIZZLE_OP (224 , yyw ) |
|
|
1058 | SHADER_SWIZZLE_OP (2241, yywx) SHADER_SWIZZLE_OP (2242, yywy) SHADER_SWIZZLE_OP (2243, yywz) SHADER_SWIZZLE_OP (2244, yyww) |
|
|
1059 | SHADER_SWIZZLE_OP (23 , yz ) SHADER_SWIZZLE_OP (231 , yzx ) SHADER_SWIZZLE_OP (2311, yzxx) SHADER_SWIZZLE_OP (2312, yzxy) |
|
|
1060 | SHADER_SWIZZLE_OP (2313, yzxz) SHADER_SWIZZLE_OP (2314, yzxw) SHADER_SWIZZLE_OP (232 , yzy ) SHADER_SWIZZLE_OP (2321, yzyx) |
|
|
1061 | SHADER_SWIZZLE_OP (2322, yzyy) SHADER_SWIZZLE_OP (2323, yzyz) SHADER_SWIZZLE_OP (2324, yzyw) SHADER_SWIZZLE_OP (233 , yzz ) |
|
|
1062 | SHADER_SWIZZLE_OP (2331, yzzx) SHADER_SWIZZLE_OP (2332, yzzy) SHADER_SWIZZLE_OP (2333, yzzz) SHADER_SWIZZLE_OP (2334, yzzw) |
|
|
1063 | SHADER_SWIZZLE_OP (234 , yzw ) SHADER_SWIZZLE_OP (2341, yzwx) SHADER_SWIZZLE_OP (2342, yzwy) SHADER_SWIZZLE_OP (2343, yzwz) |
|
|
1064 | SHADER_SWIZZLE_OP (2344, yzww) SHADER_SWIZZLE_OP (24 , yw ) SHADER_SWIZZLE_OP (241 , ywx ) SHADER_SWIZZLE_OP (2411, ywxx) |
|
|
1065 | SHADER_SWIZZLE_OP (2412, ywxy) SHADER_SWIZZLE_OP (2413, ywxz) SHADER_SWIZZLE_OP (2414, ywxw) SHADER_SWIZZLE_OP (242 , ywy ) |
|
|
1066 | SHADER_SWIZZLE_OP (2421, ywyx) SHADER_SWIZZLE_OP (2422, ywyy) SHADER_SWIZZLE_OP (2423, ywyz) SHADER_SWIZZLE_OP (2424, ywyw) |
|
|
1067 | SHADER_SWIZZLE_OP (243 , ywz ) SHADER_SWIZZLE_OP (2431, ywzx) SHADER_SWIZZLE_OP (2432, ywzy) SHADER_SWIZZLE_OP (2433, ywzz) |
|
|
1068 | SHADER_SWIZZLE_OP (2434, ywzw) SHADER_SWIZZLE_OP (244 , yww ) SHADER_SWIZZLE_OP (2441, ywwx) SHADER_SWIZZLE_OP (2442, ywwy) |
|
|
1069 | SHADER_SWIZZLE_OP (2443, ywwz) SHADER_SWIZZLE_OP (2444, ywww) SHADER_SWIZZLE_OP (3 , z ) SHADER_SWIZZLE_OP (31 , zx ) |
|
|
1070 | SHADER_SWIZZLE_OP (311 , zxx ) SHADER_SWIZZLE_OP (3111, zxxx) SHADER_SWIZZLE_OP (3112, zxxy) SHADER_SWIZZLE_OP (3113, zxxz) |
|
|
1071 | SHADER_SWIZZLE_OP (3114, zxxw) SHADER_SWIZZLE_OP (312 , zxy ) SHADER_SWIZZLE_OP (3121, zxyx) SHADER_SWIZZLE_OP (3122, zxyy) |
|
|
1072 | SHADER_SWIZZLE_OP (3123, zxyz) SHADER_SWIZZLE_OP (3124, zxyw) SHADER_SWIZZLE_OP (313 , zxz ) SHADER_SWIZZLE_OP (3131, zxzx) |
|
|
1073 | SHADER_SWIZZLE_OP (3132, zxzy) SHADER_SWIZZLE_OP (3133, zxzz) SHADER_SWIZZLE_OP (3134, zxzw) SHADER_SWIZZLE_OP (314 , zxw ) |
|
|
1074 | SHADER_SWIZZLE_OP (3141, zxwx) SHADER_SWIZZLE_OP (3142, zxwy) SHADER_SWIZZLE_OP (3143, zxwz) SHADER_SWIZZLE_OP (3144, zxww) |
|
|
1075 | SHADER_SWIZZLE_OP (32 , zy ) SHADER_SWIZZLE_OP (321 , zyx ) SHADER_SWIZZLE_OP (3211, zyxx) SHADER_SWIZZLE_OP (3212, zyxy) |
|
|
1076 | SHADER_SWIZZLE_OP (3213, zyxz) SHADER_SWIZZLE_OP (3214, zyxw) SHADER_SWIZZLE_OP (322 , zyy ) SHADER_SWIZZLE_OP (3221, zyyx) |
|
|
1077 | SHADER_SWIZZLE_OP (3222, zyyy) SHADER_SWIZZLE_OP (3223, zyyz) SHADER_SWIZZLE_OP (3224, zyyw) SHADER_SWIZZLE_OP (323 , zyz ) |
|
|
1078 | SHADER_SWIZZLE_OP (3231, zyzx) SHADER_SWIZZLE_OP (3232, zyzy) SHADER_SWIZZLE_OP (3233, zyzz) SHADER_SWIZZLE_OP (3234, zyzw) |
|
|
1079 | SHADER_SWIZZLE_OP (324 , zyw ) SHADER_SWIZZLE_OP (3241, zywx) SHADER_SWIZZLE_OP (3242, zywy) SHADER_SWIZZLE_OP (3243, zywz) |
|
|
1080 | SHADER_SWIZZLE_OP (3244, zyww) SHADER_SWIZZLE_OP (33 , zz ) SHADER_SWIZZLE_OP (331 , zzx ) SHADER_SWIZZLE_OP (3311, zzxx) |
|
|
1081 | SHADER_SWIZZLE_OP (3312, zzxy) SHADER_SWIZZLE_OP (3313, zzxz) SHADER_SWIZZLE_OP (3314, zzxw) SHADER_SWIZZLE_OP (332 , zzy ) |
|
|
1082 | SHADER_SWIZZLE_OP (3321, zzyx) SHADER_SWIZZLE_OP (3322, zzyy) SHADER_SWIZZLE_OP (3323, zzyz) SHADER_SWIZZLE_OP (3324, zzyw) |
|
|
1083 | SHADER_SWIZZLE_OP (333 , zzz ) SHADER_SWIZZLE_OP (3331, zzzx) SHADER_SWIZZLE_OP (3332, zzzy) SHADER_SWIZZLE_OP (3333, zzzz) |
|
|
1084 | SHADER_SWIZZLE_OP (3334, zzzw) SHADER_SWIZZLE_OP (334 , zzw ) SHADER_SWIZZLE_OP (3341, zzwx) SHADER_SWIZZLE_OP (3342, zzwy) |
|
|
1085 | SHADER_SWIZZLE_OP (3343, zzwz) SHADER_SWIZZLE_OP (3344, zzww) SHADER_SWIZZLE_OP (34 , zw ) SHADER_SWIZZLE_OP (341 , zwx ) |
|
|
1086 | SHADER_SWIZZLE_OP (3411, zwxx) SHADER_SWIZZLE_OP (3412, zwxy) SHADER_SWIZZLE_OP (3413, zwxz) SHADER_SWIZZLE_OP (3414, zwxw) |
|
|
1087 | SHADER_SWIZZLE_OP (342 , zwy ) SHADER_SWIZZLE_OP (3421, zwyx) SHADER_SWIZZLE_OP (3422, zwyy) SHADER_SWIZZLE_OP (3423, zwyz) |
|
|
1088 | SHADER_SWIZZLE_OP (3424, zwyw) SHADER_SWIZZLE_OP (343 , zwz ) SHADER_SWIZZLE_OP (3431, zwzx) SHADER_SWIZZLE_OP (3432, zwzy) |
|
|
1089 | SHADER_SWIZZLE_OP (3433, zwzz) SHADER_SWIZZLE_OP (3434, zwzw) SHADER_SWIZZLE_OP (344 , zww ) SHADER_SWIZZLE_OP (3441, zwwx) |
|
|
1090 | SHADER_SWIZZLE_OP (3442, zwwy) SHADER_SWIZZLE_OP (3443, zwwz) SHADER_SWIZZLE_OP (3444, zwww) SHADER_SWIZZLE_OP (4 , w ) |
|
|
1091 | SHADER_SWIZZLE_OP (41 , wx ) SHADER_SWIZZLE_OP (411 , wxx ) SHADER_SWIZZLE_OP (4111, wxxx) SHADER_SWIZZLE_OP (4112, wxxy) |
|
|
1092 | SHADER_SWIZZLE_OP (4113, wxxz) SHADER_SWIZZLE_OP (4114, wxxw) SHADER_SWIZZLE_OP (412 , wxy ) SHADER_SWIZZLE_OP (4121, wxyx) |
|
|
1093 | SHADER_SWIZZLE_OP (4122, wxyy) SHADER_SWIZZLE_OP (4123, wxyz) SHADER_SWIZZLE_OP (4124, wxyw) SHADER_SWIZZLE_OP (413 , wxz ) |
|
|
1094 | SHADER_SWIZZLE_OP (4131, wxzx) SHADER_SWIZZLE_OP (4132, wxzy) SHADER_SWIZZLE_OP (4133, wxzz) SHADER_SWIZZLE_OP (4134, wxzw) |
|
|
1095 | SHADER_SWIZZLE_OP (414 , wxw ) SHADER_SWIZZLE_OP (4141, wxwx) SHADER_SWIZZLE_OP (4142, wxwy) SHADER_SWIZZLE_OP (4143, wxwz) |
|
|
1096 | SHADER_SWIZZLE_OP (4144, wxww) SHADER_SWIZZLE_OP (42 , wy ) SHADER_SWIZZLE_OP (421 , wyx ) SHADER_SWIZZLE_OP (4211, wyxx) |
|
|
1097 | SHADER_SWIZZLE_OP (4212, wyxy) SHADER_SWIZZLE_OP (4213, wyxz) SHADER_SWIZZLE_OP (4214, wyxw) SHADER_SWIZZLE_OP (422 , wyy ) |
|
|
1098 | SHADER_SWIZZLE_OP (4221, wyyx) SHADER_SWIZZLE_OP (4222, wyyy) SHADER_SWIZZLE_OP (4223, wyyz) SHADER_SWIZZLE_OP (4224, wyyw) |
|
|
1099 | SHADER_SWIZZLE_OP (423 , wyz ) SHADER_SWIZZLE_OP (4231, wyzx) SHADER_SWIZZLE_OP (4232, wyzy) SHADER_SWIZZLE_OP (4233, wyzz) |
|
|
1100 | SHADER_SWIZZLE_OP (4234, wyzw) SHADER_SWIZZLE_OP (424 , wyw ) SHADER_SWIZZLE_OP (4241, wywx) SHADER_SWIZZLE_OP (4242, wywy) |
|
|
1101 | SHADER_SWIZZLE_OP (4243, wywz) SHADER_SWIZZLE_OP (4244, wyww) SHADER_SWIZZLE_OP (43 , wz ) SHADER_SWIZZLE_OP (431 , wzx ) |
|
|
1102 | SHADER_SWIZZLE_OP (4311, wzxx) SHADER_SWIZZLE_OP (4312, wzxy) SHADER_SWIZZLE_OP (4313, wzxz) SHADER_SWIZZLE_OP (4314, wzxw) |
|
|
1103 | SHADER_SWIZZLE_OP (432 , wzy ) SHADER_SWIZZLE_OP (4321, wzyx) SHADER_SWIZZLE_OP (4322, wzyy) SHADER_SWIZZLE_OP (4323, wzyz) |
|
|
1104 | SHADER_SWIZZLE_OP (4324, wzyw) SHADER_SWIZZLE_OP (433 , wzz ) SHADER_SWIZZLE_OP (4331, wzzx) SHADER_SWIZZLE_OP (4332, wzzy) |
|
|
1105 | SHADER_SWIZZLE_OP (4333, wzzz) SHADER_SWIZZLE_OP (4334, wzzw) SHADER_SWIZZLE_OP (434 , wzw ) SHADER_SWIZZLE_OP (4341, wzwx) |
|
|
1106 | SHADER_SWIZZLE_OP (4342, wzwy) SHADER_SWIZZLE_OP (4343, wzwz) SHADER_SWIZZLE_OP (4344, wzww) SHADER_SWIZZLE_OP (44 , ww ) |
|
|
1107 | SHADER_SWIZZLE_OP (441 , wwx ) SHADER_SWIZZLE_OP (4411, wwxx) SHADER_SWIZZLE_OP (4412, wwxy) SHADER_SWIZZLE_OP (4413, wwxz) |
|
|
1108 | SHADER_SWIZZLE_OP (4414, wwxw) SHADER_SWIZZLE_OP (442 , wwy ) SHADER_SWIZZLE_OP (4421, wwyx) SHADER_SWIZZLE_OP (4422, wwyy) |
|
|
1109 | SHADER_SWIZZLE_OP (4423, wwyz) SHADER_SWIZZLE_OP (4424, wwyw) SHADER_SWIZZLE_OP (443 , wwz ) SHADER_SWIZZLE_OP (4431, wwzx) |
|
|
1110 | SHADER_SWIZZLE_OP (4432, wwzy) SHADER_SWIZZLE_OP (4433, wwzz) SHADER_SWIZZLE_OP (4434, wwzw) SHADER_SWIZZLE_OP (444 , www ) |
|
|
1111 | SHADER_SWIZZLE_OP (4441, wwwx) SHADER_SWIZZLE_OP (4442, wwwy) SHADER_SWIZZLE_OP (4443, wwwz) SHADER_SWIZZLE_OP (4444, wwww) |
|
|
1112 | |
|
|
1113 | # undef SHADER_SWIZZLE_OP |
|
|
1114 | |
|
|
1115 | # define SHADER_FUNC0_(name, glname) \ |
|
|
1116 | template<typename A> \ |
|
|
1117 | inline const sl_expr<sl_func0> \ |
|
|
1118 | name () \ |
|
|
1119 | { \ |
|
|
1120 | return sl_func0 (#glname " ("); \ |
|
|
1121 | } |
|
|
1122 | |
|
|
1123 | # define SHADER_FUNC0(name) SHADER_FUNC0_(name,name) |
|
|
1124 | |
|
|
1125 | # define SHADER_FUNC1_(name, glname) \ |
|
|
1126 | template<typename A> \ |
|
|
1127 | inline const sl_expr< sl_func1<typename sl_convert<A>::T> > \ |
|
|
1128 | name (const A &a) \ |
|
|
1129 | { \ |
|
|
1130 | return sl_func1<typename sl_convert<A>::T> (#glname " (", sl_convert<A>::convert (a));\ |
|
|
1131 | } |
|
|
1132 | |
|
|
1133 | # define SHADER_FUNC1(name) SHADER_FUNC1_(name,name) |
|
|
1134 | |
|
|
1135 | # define SHADER_FUNC2_(name, glname) \ |
|
|
1136 | template<typename A, typename B> \ |
|
|
1137 | inline const sl_expr< sl_func2<typename sl_convert<A>::T, typename sl_convert<B>::T> > \ |
|
|
1138 | name (const A &a, const B &b) \ |
|
|
1139 | { \ |
|
|
1140 | return sl_func2<typename sl_convert<A>::T, typename sl_convert<B>::T> (#glname " (", sl_convert<A>::convert (a), sl_convert<B>::convert (b));\ |
|
|
1141 | } |
|
|
1142 | |
|
|
1143 | # define SHADER_FUNC2(name) SHADER_FUNC2_(name,name) |
|
|
1144 | |
|
|
1145 | # define SHADER_FUNC3_(name, glname) \ |
|
|
1146 | template<typename A, typename B, typename C> \ |
|
|
1147 | inline const sl_expr< sl_func3<typename sl_convert<A>::T, typename sl_convert<B>::T, typename sl_convert<C>::T> > \ |
|
|
1148 | name (const A &a, const B &b, const C &c) \ |
|
|
1149 | { \ |
|
|
1150 | return sl_func3<typename sl_convert<A>::T, typename sl_convert<B>::T, typename sl_convert<C>::T> (#glname " (", sl_convert<A>::convert (a), sl_convert<B>::convert (b), sl_convert<C>::convert (c));\ |
|
|
1151 | } |
|
|
1152 | |
|
|
1153 | # define SHADER_FUNC3(name) SHADER_FUNC3_(name,name) |
|
|
1154 | |
|
|
1155 | # define SHADER_FUNC4_(name, glname) \ |
|
|
1156 | template<typename A, typename B, typename C, typename D> \ |
|
|
1157 | inline const sl_expr< sl_func4<typename sl_convert<A>::T, typename sl_convert<B>::T, typename sl_convert<C>::T, typename sl_convert<D>::T > > \ |
|
|
1158 | name (const A &a, const B &b, const C &c, const D &d) \ |
|
|
1159 | { \ |
|
|
1160 | return sl_func4<typename sl_convert<A>::T, typename sl_convert<B>::T, typename sl_convert<C>::T, typename sl_convert<D>::T> (#glname " (", sl_convert<A>::convert (a), sl_convert<B>::convert (b), sl_convert<C>::convert (c), sl_convert<D>::convert (d));\ |
|
|
1161 | } |
|
|
1162 | |
|
|
1163 | # define SHADER_FUNC4(name) SHADER_FUNC4_(name,name) |
|
|
1164 | |
|
|
1165 | SHADER_FUNC1 (abs) |
|
|
1166 | SHADER_FUNC1 (acos) |
|
|
1167 | SHADER_FUNC1 (all) |
|
|
1168 | SHADER_FUNC1 (any) |
|
|
1169 | SHADER_FUNC1 (asin) |
|
|
1170 | SHADER_FUNC1 (atan) |
|
|
1171 | SHADER_FUNC2 (atan) |
|
|
1172 | SHADER_FUNC1 (ceil) |
|
|
1173 | SHADER_FUNC3 (clamp) |
|
|
1174 | SHADER_FUNC1 (cos) |
|
|
1175 | SHADER_FUNC2 (cross) |
|
|
1176 | SHADER_FUNC1 (dFdx) |
|
|
1177 | SHADER_FUNC1 (dFdy) |
|
|
1178 | SHADER_FUNC1 (degrees) |
|
|
1179 | SHADER_FUNC2 (distance) |
|
|
1180 | SHADER_FUNC2 (dot) |
|
|
1181 | SHADER_FUNC2_(equal, equal) |
|
|
1182 | SHADER_FUNC1 (exp) |
|
|
1183 | SHADER_FUNC1 (exp2) |
|
|
1184 | SHADER_FUNC3 (faceforward) |
|
|
1185 | SHADER_FUNC1 (floor) |
|
|
1186 | SHADER_FUNC1 (fract) |
|
|
1187 | SHADER_FUNC0 (ftransform) |
|
|
1188 | SHADER_FUNC1 (fwidth) |
|
|
1189 | SHADER_FUNC2_(greater_than_equal, greaterThanEqual) |
|
|
1190 | SHADER_FUNC2_(greater_then, greaterThan) |
|
|
1191 | SHADER_FUNC1 (inversesqrt) |
|
|
1192 | SHADER_FUNC1 (length) |
|
|
1193 | SHADER_FUNC2_(less_than, lessThan) |
|
|
1194 | SHADER_FUNC2_(less_than_equal, lessThanEqual) |
|
|
1195 | SHADER_FUNC1 (log) |
|
|
1196 | SHADER_FUNC1 (log2) |
|
|
1197 | SHADER_FUNC2_(matrix_comp_mult, matrixCompMult) |
|
|
1198 | SHADER_FUNC2 (max) |
|
|
1199 | SHADER_FUNC2 (min) |
|
|
1200 | SHADER_FUNC3 (mix) |
|
|
1201 | SHADER_FUNC2 (mod) |
|
|
1202 | SHADER_FUNC1 (noise1) |
|
|
1203 | SHADER_FUNC1 (noise2) |
|
|
1204 | SHADER_FUNC1 (noise3) |
|
|
1205 | SHADER_FUNC1 (noise4) |
|
|
1206 | SHADER_FUNC1 (normalize) |
|
|
1207 | SHADER_FUNC1 (gl_not) // TODO |
|
|
1208 | SHADER_FUNC2_(notequal, notEqual) |
|
|
1209 | SHADER_FUNC2 (pow) |
|
|
1210 | SHADER_FUNC1 (radians) |
|
|
1211 | SHADER_FUNC2 (reflect) |
|
|
1212 | SHADER_FUNC3 (refract) |
|
|
1213 | SHADER_FUNC2_(shadow_1d, shadow1D) |
|
|
1214 | SHADER_FUNC3_(shadow_1d, shadow1D) |
|
|
1215 | SHADER_FUNC3_(shadow_1d_lod, shadow1DLod) |
|
|
1216 | SHADER_FUNC2_(shadow_1d_proj, shadow1DProj) |
|
|
1217 | SHADER_FUNC3_(shadow_1d_proj, shadow1DProj) |
|
|
1218 | SHADER_FUNC3_(shadow_1d_proj_lod, shadow1DProjLod) |
|
|
1219 | SHADER_FUNC2_(shadow_2d, shadow2D) |
|
|
1220 | SHADER_FUNC3_(shadow_2d, shadow2D) |
|
|
1221 | SHADER_FUNC3_(shadow_2d_lod, shadow2DLod) |
|
|
1222 | SHADER_FUNC2_(shadow_2d_proj, shadow2DProj) |
|
|
1223 | SHADER_FUNC3_(shadow_2d_proj, shadow2DProj) |
|
|
1224 | SHADER_FUNC3_(shadow_2d_proj_lod, shadow2DProjLod) |
|
|
1225 | SHADER_FUNC1 (sign) |
|
|
1226 | SHADER_FUNC1 (sin) |
|
|
1227 | SHADER_FUNC3 (smoothstep) |
|
|
1228 | SHADER_FUNC1 (sqrt) |
|
|
1229 | SHADER_FUNC2 (step) |
|
|
1230 | SHADER_FUNC1 (tan) |
|
|
1231 | SHADER_FUNC2_(texture_1d, texture1D) |
|
|
1232 | SHADER_FUNC3_(texture_1d, texture1D) |
|
|
1233 | SHADER_FUNC3_(texture_1d_lod, texture1DLod) |
|
|
1234 | SHADER_FUNC2_(texture_1d_proj, texture1DProj) |
|
|
1235 | SHADER_FUNC3_(texture_1d_proj, texture1DProj) |
|
|
1236 | SHADER_FUNC3_(texture_1d_proj_lod, texture1DProjLod) |
|
|
1237 | SHADER_FUNC2_(texture_2d, texture2D) |
|
|
1238 | SHADER_FUNC3_(texture_2d, texture2D) |
|
|
1239 | SHADER_FUNC3_(texture_2d_lod, texture2DLod) |
|
|
1240 | SHADER_FUNC2_(texture_2d_proj, texture2DProj) |
|
|
1241 | SHADER_FUNC3_(texture_2d_proj, texture2DProj) |
|
|
1242 | SHADER_FUNC3_(texture_2d_proj_lod, texture2DProjLod) |
|
|
1243 | SHADER_FUNC2_(texture_3d, texture3D) |
|
|
1244 | SHADER_FUNC3_(texture_3d, texture3D) |
|
|
1245 | SHADER_FUNC3_(texture_3d_lod, texture3DLod) |
|
|
1246 | SHADER_FUNC2_(texture_3d_proj, texture3DProj) |
|
|
1247 | SHADER_FUNC3_(texture_3d_proj, texture3DProj) |
|
|
1248 | SHADER_FUNC3_(texture_3d_proj_lod, texture3DProjLod) |
|
|
1249 | SHADER_FUNC2_(texture_cube, textureCube) |
|
|
1250 | SHADER_FUNC3_(texture_cube, textureCube) |
|
|
1251 | SHADER_FUNC3_(texture_cude_lod, textureCubeLod) |
|
|
1252 | SHADER_FUNC1 (vec2) SHADER_FUNC2 (vec2) |
|
|
1253 | SHADER_FUNC1 (vec3) SHADER_FUNC2 (vec3) SHADER_FUNC3 (vec3) |
|
|
1254 | SHADER_FUNC1 (vec4) SHADER_FUNC2 (vec4) SHADER_FUNC3 (vec4) SHADER_FUNC4 (vec4) |
|
|
1255 | SHADER_FUNC1 (mat2) SHADER_FUNC2 (mat2) |
|
|
1256 | SHADER_FUNC1 (mat3) SHADER_FUNC2 (mat3) SHADER_FUNC3 (mat3) |
|
|
1257 | SHADER_FUNC1 (mat4) SHADER_FUNC2 (mat4) SHADER_FUNC3 (mat4) SHADER_FUNC4 (mat4) |
|
|
1258 | |
|
|
1259 | # undef SHADER_FUNC0 |
|
|
1260 | # undef SHADER_FUNC0_ |
|
|
1261 | # undef SHADER_FUNC1 |
|
|
1262 | # undef SHADER_FUNC1_ |
|
|
1263 | # undef SHADER_FUNC2 |
|
|
1264 | # undef SHADER_FUNC2_ |
|
|
1265 | # undef SHADER_FUNC3 |
|
|
1266 | # undef SHADER_FUNC3_ |
|
|
1267 | # undef SHADER_FUNC4 |
|
|
1268 | # undef SHADER_FUNC5_ |
879 | } |
1269 | } |
880 | |
|
|
881 | # define SHADER_SWIZZLE_OP(abcd,type) \ |
|
|
882 | template<typename T> \ |
|
|
883 | inline const sl_expr< sl_concat3< sl_append_const_string, \ |
|
|
884 | typename sl_convert<T>::T, \ |
|
|
885 | sl_string<7> \ |
|
|
886 | > > \ |
|
|
887 | type (const T &t) \ |
|
|
888 | { \ |
|
|
889 | return swizzle (t, (abcd / 1000) % 5, (abcd / 100) % 5, (abcd / 10) % 5, (abcd / 1) % 5); \ |
|
|
890 | } |
|
|
891 | |
|
|
892 | // brute force is lovely, ain't it? |
|
|
893 | SHADER_SWIZZLE_OP (1 , x ) SHADER_SWIZZLE_OP (11 , xx ) SHADER_SWIZZLE_OP (111 , xxx ) SHADER_SWIZZLE_OP (1111, xxxx) |
|
|
894 | SHADER_SWIZZLE_OP (1112, xxxy) SHADER_SWIZZLE_OP (1113, xxxz) SHADER_SWIZZLE_OP (1114, xxxw) SHADER_SWIZZLE_OP (112 , xxy ) |
|
|
895 | SHADER_SWIZZLE_OP (1121, xxyx) SHADER_SWIZZLE_OP (1122, xxyy) SHADER_SWIZZLE_OP (1123, xxyz) SHADER_SWIZZLE_OP (1124, xxyw) |
|
|
896 | SHADER_SWIZZLE_OP (113 , xxz ) SHADER_SWIZZLE_OP (1131, xxzx) SHADER_SWIZZLE_OP (1132, xxzy) SHADER_SWIZZLE_OP (1133, xxzz) |
|
|
897 | SHADER_SWIZZLE_OP (1134, xxzw) SHADER_SWIZZLE_OP (114 , xxw ) SHADER_SWIZZLE_OP (1141, xxwx) SHADER_SWIZZLE_OP (1142, xxwy) |
|
|
898 | SHADER_SWIZZLE_OP (1143, xxwz) SHADER_SWIZZLE_OP (1144, xxww) SHADER_SWIZZLE_OP (12 , xy ) SHADER_SWIZZLE_OP (121 , xyx ) |
|
|
899 | SHADER_SWIZZLE_OP (1211, xyxx) SHADER_SWIZZLE_OP (1212, xyxy) SHADER_SWIZZLE_OP (1213, xyxz) SHADER_SWIZZLE_OP (1214, xyxw) |
|
|
900 | SHADER_SWIZZLE_OP (122 , xyy ) SHADER_SWIZZLE_OP (1221, xyyx) SHADER_SWIZZLE_OP (1222, xyyy) SHADER_SWIZZLE_OP (1223, xyyz) |
|
|
901 | SHADER_SWIZZLE_OP (1224, xyyw) SHADER_SWIZZLE_OP (123 , xyz ) SHADER_SWIZZLE_OP (1231, xyzx) SHADER_SWIZZLE_OP (1232, xyzy) |
|
|
902 | SHADER_SWIZZLE_OP (1233, xyzz) SHADER_SWIZZLE_OP (1234, xyzw) SHADER_SWIZZLE_OP (124 , xyw ) SHADER_SWIZZLE_OP (1241, xywx) |
|
|
903 | SHADER_SWIZZLE_OP (1242, xywy) SHADER_SWIZZLE_OP (1243, xywz) SHADER_SWIZZLE_OP (1244, xyww) SHADER_SWIZZLE_OP (13 , xz ) |
|
|
904 | SHADER_SWIZZLE_OP (131 , xzx ) SHADER_SWIZZLE_OP (1311, xzxx) SHADER_SWIZZLE_OP (1312, xzxy) SHADER_SWIZZLE_OP (1313, xzxz) |
|
|
905 | SHADER_SWIZZLE_OP (1314, xzxw) SHADER_SWIZZLE_OP (132 , xzy ) SHADER_SWIZZLE_OP (1321, xzyx) SHADER_SWIZZLE_OP (1322, xzyy) |
|
|
906 | SHADER_SWIZZLE_OP (1323, xzyz) SHADER_SWIZZLE_OP (1324, xzyw) SHADER_SWIZZLE_OP (133 , xzz ) SHADER_SWIZZLE_OP (1331, xzzx) |
|
|
907 | SHADER_SWIZZLE_OP (1332, xzzy) SHADER_SWIZZLE_OP (1333, xzzz) SHADER_SWIZZLE_OP (1334, xzzw) SHADER_SWIZZLE_OP (134 , xzw ) |
|
|
908 | SHADER_SWIZZLE_OP (1341, xzwx) SHADER_SWIZZLE_OP (1342, xzwy) SHADER_SWIZZLE_OP (1343, xzwz) SHADER_SWIZZLE_OP (1344, xzww) |
|
|
909 | SHADER_SWIZZLE_OP (14 , xw ) SHADER_SWIZZLE_OP (141 , xwx ) SHADER_SWIZZLE_OP (1411, xwxx) SHADER_SWIZZLE_OP (1412, xwxy) |
|
|
910 | SHADER_SWIZZLE_OP (1413, xwxz) SHADER_SWIZZLE_OP (1414, xwxw) SHADER_SWIZZLE_OP (142 , xwy ) SHADER_SWIZZLE_OP (1421, xwyx) |
|
|
911 | SHADER_SWIZZLE_OP (1422, xwyy) SHADER_SWIZZLE_OP (1423, xwyz) SHADER_SWIZZLE_OP (1424, xwyw) SHADER_SWIZZLE_OP (143 , xwz ) |
|
|
912 | SHADER_SWIZZLE_OP (1431, xwzx) SHADER_SWIZZLE_OP (1432, xwzy) SHADER_SWIZZLE_OP (1433, xwzz) SHADER_SWIZZLE_OP (1434, xwzw) |
|
|
913 | SHADER_SWIZZLE_OP (144 , xww ) SHADER_SWIZZLE_OP (1441, xwwx) SHADER_SWIZZLE_OP (1442, xwwy) SHADER_SWIZZLE_OP (1443, xwwz) |
|
|
914 | SHADER_SWIZZLE_OP (1444, xwww) SHADER_SWIZZLE_OP (2 , y ) SHADER_SWIZZLE_OP (21 , yx ) SHADER_SWIZZLE_OP (211 , yxx ) |
|
|
915 | SHADER_SWIZZLE_OP (2111, yxxx) SHADER_SWIZZLE_OP (2112, yxxy) SHADER_SWIZZLE_OP (2113, yxxz) SHADER_SWIZZLE_OP (2114, yxxw) |
|
|
916 | SHADER_SWIZZLE_OP (212 , yxy ) SHADER_SWIZZLE_OP (2121, yxyx) SHADER_SWIZZLE_OP (2122, yxyy) SHADER_SWIZZLE_OP (2123, yxyz) |
|
|
917 | SHADER_SWIZZLE_OP (2124, yxyw) SHADER_SWIZZLE_OP (213 , yxz ) SHADER_SWIZZLE_OP (2131, yxzx) SHADER_SWIZZLE_OP (2132, yxzy) |
|
|
918 | SHADER_SWIZZLE_OP (2133, yxzz) SHADER_SWIZZLE_OP (2134, yxzw) SHADER_SWIZZLE_OP (214 , yxw ) SHADER_SWIZZLE_OP (2141, yxwx) |
|
|
919 | SHADER_SWIZZLE_OP (2142, yxwy) SHADER_SWIZZLE_OP (2143, yxwz) SHADER_SWIZZLE_OP (2144, yxww) SHADER_SWIZZLE_OP (22 , yy ) |
|
|
920 | SHADER_SWIZZLE_OP (221 , yyx ) SHADER_SWIZZLE_OP (2211, yyxx) SHADER_SWIZZLE_OP (2212, yyxy) SHADER_SWIZZLE_OP (2213, yyxz) |
|
|
921 | SHADER_SWIZZLE_OP (2214, yyxw) SHADER_SWIZZLE_OP (222 , yyy ) SHADER_SWIZZLE_OP (2221, yyyx) SHADER_SWIZZLE_OP (2222, yyyy) |
|
|
922 | SHADER_SWIZZLE_OP (2223, yyyz) SHADER_SWIZZLE_OP (2224, yyyw) SHADER_SWIZZLE_OP (223 , yyz ) SHADER_SWIZZLE_OP (2231, yyzx) |
|
|
923 | SHADER_SWIZZLE_OP (2232, yyzy) SHADER_SWIZZLE_OP (2233, yyzz) SHADER_SWIZZLE_OP (2234, yyzw) SHADER_SWIZZLE_OP (224 , yyw ) |
|
|
924 | SHADER_SWIZZLE_OP (2241, yywx) SHADER_SWIZZLE_OP (2242, yywy) SHADER_SWIZZLE_OP (2243, yywz) SHADER_SWIZZLE_OP (2244, yyww) |
|
|
925 | SHADER_SWIZZLE_OP (23 , yz ) SHADER_SWIZZLE_OP (231 , yzx ) SHADER_SWIZZLE_OP (2311, yzxx) SHADER_SWIZZLE_OP (2312, yzxy) |
|
|
926 | SHADER_SWIZZLE_OP (2313, yzxz) SHADER_SWIZZLE_OP (2314, yzxw) SHADER_SWIZZLE_OP (232 , yzy ) SHADER_SWIZZLE_OP (2321, yzyx) |
|
|
927 | SHADER_SWIZZLE_OP (2322, yzyy) SHADER_SWIZZLE_OP (2323, yzyz) SHADER_SWIZZLE_OP (2324, yzyw) SHADER_SWIZZLE_OP (233 , yzz ) |
|
|
928 | SHADER_SWIZZLE_OP (2331, yzzx) SHADER_SWIZZLE_OP (2332, yzzy) SHADER_SWIZZLE_OP (2333, yzzz) SHADER_SWIZZLE_OP (2334, yzzw) |
|
|
929 | SHADER_SWIZZLE_OP (234 , yzw ) SHADER_SWIZZLE_OP (2341, yzwx) SHADER_SWIZZLE_OP (2342, yzwy) SHADER_SWIZZLE_OP (2343, yzwz) |
|
|
930 | SHADER_SWIZZLE_OP (2344, yzww) SHADER_SWIZZLE_OP (24 , yw ) SHADER_SWIZZLE_OP (241 , ywx ) SHADER_SWIZZLE_OP (2411, ywxx) |
|
|
931 | SHADER_SWIZZLE_OP (2412, ywxy) SHADER_SWIZZLE_OP (2413, ywxz) SHADER_SWIZZLE_OP (2414, ywxw) SHADER_SWIZZLE_OP (242 , ywy ) |
|
|
932 | SHADER_SWIZZLE_OP (2421, ywyx) SHADER_SWIZZLE_OP (2422, ywyy) SHADER_SWIZZLE_OP (2423, ywyz) SHADER_SWIZZLE_OP (2424, ywyw) |
|
|
933 | SHADER_SWIZZLE_OP (243 , ywz ) SHADER_SWIZZLE_OP (2431, ywzx) SHADER_SWIZZLE_OP (2432, ywzy) SHADER_SWIZZLE_OP (2433, ywzz) |
|
|
934 | SHADER_SWIZZLE_OP (2434, ywzw) SHADER_SWIZZLE_OP (244 , yww ) SHADER_SWIZZLE_OP (2441, ywwx) SHADER_SWIZZLE_OP (2442, ywwy) |
|
|
935 | SHADER_SWIZZLE_OP (2443, ywwz) SHADER_SWIZZLE_OP (2444, ywww) SHADER_SWIZZLE_OP (3 , z ) SHADER_SWIZZLE_OP (31 , zx ) |
|
|
936 | SHADER_SWIZZLE_OP (311 , zxx ) SHADER_SWIZZLE_OP (3111, zxxx) SHADER_SWIZZLE_OP (3112, zxxy) SHADER_SWIZZLE_OP (3113, zxxz) |
|
|
937 | SHADER_SWIZZLE_OP (3114, zxxw) SHADER_SWIZZLE_OP (312 , zxy ) SHADER_SWIZZLE_OP (3121, zxyx) SHADER_SWIZZLE_OP (3122, zxyy) |
|
|
938 | SHADER_SWIZZLE_OP (3123, zxyz) SHADER_SWIZZLE_OP (3124, zxyw) SHADER_SWIZZLE_OP (313 , zxz ) SHADER_SWIZZLE_OP (3131, zxzx) |
|
|
939 | SHADER_SWIZZLE_OP (3132, zxzy) SHADER_SWIZZLE_OP (3133, zxzz) SHADER_SWIZZLE_OP (3134, zxzw) SHADER_SWIZZLE_OP (314 , zxw ) |
|
|
940 | SHADER_SWIZZLE_OP (3141, zxwx) SHADER_SWIZZLE_OP (3142, zxwy) SHADER_SWIZZLE_OP (3143, zxwz) SHADER_SWIZZLE_OP (3144, zxww) |
|
|
941 | SHADER_SWIZZLE_OP (32 , zy ) SHADER_SWIZZLE_OP (321 , zyx ) SHADER_SWIZZLE_OP (3211, zyxx) SHADER_SWIZZLE_OP (3212, zyxy) |
|
|
942 | SHADER_SWIZZLE_OP (3213, zyxz) SHADER_SWIZZLE_OP (3214, zyxw) SHADER_SWIZZLE_OP (322 , zyy ) SHADER_SWIZZLE_OP (3221, zyyx) |
|
|
943 | SHADER_SWIZZLE_OP (3222, zyyy) SHADER_SWIZZLE_OP (3223, zyyz) SHADER_SWIZZLE_OP (3224, zyyw) SHADER_SWIZZLE_OP (323 , zyz ) |
|
|
944 | SHADER_SWIZZLE_OP (3231, zyzx) SHADER_SWIZZLE_OP (3232, zyzy) SHADER_SWIZZLE_OP (3233, zyzz) SHADER_SWIZZLE_OP (3234, zyzw) |
|
|
945 | SHADER_SWIZZLE_OP (324 , zyw ) SHADER_SWIZZLE_OP (3241, zywx) SHADER_SWIZZLE_OP (3242, zywy) SHADER_SWIZZLE_OP (3243, zywz) |
|
|
946 | SHADER_SWIZZLE_OP (3244, zyww) SHADER_SWIZZLE_OP (33 , zz ) SHADER_SWIZZLE_OP (331 , zzx ) SHADER_SWIZZLE_OP (3311, zzxx) |
|
|
947 | SHADER_SWIZZLE_OP (3312, zzxy) SHADER_SWIZZLE_OP (3313, zzxz) SHADER_SWIZZLE_OP (3314, zzxw) SHADER_SWIZZLE_OP (332 , zzy ) |
|
|
948 | SHADER_SWIZZLE_OP (3321, zzyx) SHADER_SWIZZLE_OP (3322, zzyy) SHADER_SWIZZLE_OP (3323, zzyz) SHADER_SWIZZLE_OP (3324, zzyw) |
|
|
949 | SHADER_SWIZZLE_OP (333 , zzz ) SHADER_SWIZZLE_OP (3331, zzzx) SHADER_SWIZZLE_OP (3332, zzzy) SHADER_SWIZZLE_OP (3333, zzzz) |
|
|
950 | SHADER_SWIZZLE_OP (3334, zzzw) SHADER_SWIZZLE_OP (334 , zzw ) SHADER_SWIZZLE_OP (3341, zzwx) SHADER_SWIZZLE_OP (3342, zzwy) |
|
|
951 | SHADER_SWIZZLE_OP (3343, zzwz) SHADER_SWIZZLE_OP (3344, zzww) SHADER_SWIZZLE_OP (34 , zw ) SHADER_SWIZZLE_OP (341 , zwx ) |
|
|
952 | SHADER_SWIZZLE_OP (3411, zwxx) SHADER_SWIZZLE_OP (3412, zwxy) SHADER_SWIZZLE_OP (3413, zwxz) SHADER_SWIZZLE_OP (3414, zwxw) |
|
|
953 | SHADER_SWIZZLE_OP (342 , zwy ) SHADER_SWIZZLE_OP (3421, zwyx) SHADER_SWIZZLE_OP (3422, zwyy) SHADER_SWIZZLE_OP (3423, zwyz) |
|
|
954 | SHADER_SWIZZLE_OP (3424, zwyw) SHADER_SWIZZLE_OP (343 , zwz ) SHADER_SWIZZLE_OP (3431, zwzx) SHADER_SWIZZLE_OP (3432, zwzy) |
|
|
955 | SHADER_SWIZZLE_OP (3433, zwzz) SHADER_SWIZZLE_OP (3434, zwzw) SHADER_SWIZZLE_OP (344 , zww ) SHADER_SWIZZLE_OP (3441, zwwx) |
|
|
956 | SHADER_SWIZZLE_OP (3442, zwwy) SHADER_SWIZZLE_OP (3443, zwwz) SHADER_SWIZZLE_OP (3444, zwww) SHADER_SWIZZLE_OP (4 , w ) |
|
|
957 | SHADER_SWIZZLE_OP (41 , wx ) SHADER_SWIZZLE_OP (411 , wxx ) SHADER_SWIZZLE_OP (4111, wxxx) SHADER_SWIZZLE_OP (4112, wxxy) |
|
|
958 | SHADER_SWIZZLE_OP (4113, wxxz) SHADER_SWIZZLE_OP (4114, wxxw) SHADER_SWIZZLE_OP (412 , wxy ) SHADER_SWIZZLE_OP (4121, wxyx) |
|
|
959 | SHADER_SWIZZLE_OP (4122, wxyy) SHADER_SWIZZLE_OP (4123, wxyz) SHADER_SWIZZLE_OP (4124, wxyw) SHADER_SWIZZLE_OP (413 , wxz ) |
|
|
960 | SHADER_SWIZZLE_OP (4131, wxzx) SHADER_SWIZZLE_OP (4132, wxzy) SHADER_SWIZZLE_OP (4133, wxzz) SHADER_SWIZZLE_OP (4134, wxzw) |
|
|
961 | SHADER_SWIZZLE_OP (414 , wxw ) SHADER_SWIZZLE_OP (4141, wxwx) SHADER_SWIZZLE_OP (4142, wxwy) SHADER_SWIZZLE_OP (4143, wxwz) |
|
|
962 | SHADER_SWIZZLE_OP (4144, wxww) SHADER_SWIZZLE_OP (42 , wy ) SHADER_SWIZZLE_OP (421 , wyx ) SHADER_SWIZZLE_OP (4211, wyxx) |
|
|
963 | SHADER_SWIZZLE_OP (4212, wyxy) SHADER_SWIZZLE_OP (4213, wyxz) SHADER_SWIZZLE_OP (4214, wyxw) SHADER_SWIZZLE_OP (422 , wyy ) |
|
|
964 | SHADER_SWIZZLE_OP (4221, wyyx) SHADER_SWIZZLE_OP (4222, wyyy) SHADER_SWIZZLE_OP (4223, wyyz) SHADER_SWIZZLE_OP (4224, wyyw) |
|
|
965 | SHADER_SWIZZLE_OP (423 , wyz ) SHADER_SWIZZLE_OP (4231, wyzx) SHADER_SWIZZLE_OP (4232, wyzy) SHADER_SWIZZLE_OP (4233, wyzz) |
|
|
966 | SHADER_SWIZZLE_OP (4234, wyzw) SHADER_SWIZZLE_OP (424 , wyw ) SHADER_SWIZZLE_OP (4241, wywx) SHADER_SWIZZLE_OP (4242, wywy) |
|
|
967 | SHADER_SWIZZLE_OP (4243, wywz) SHADER_SWIZZLE_OP (4244, wyww) SHADER_SWIZZLE_OP (43 , wz ) SHADER_SWIZZLE_OP (431 , wzx ) |
|
|
968 | SHADER_SWIZZLE_OP (4311, wzxx) SHADER_SWIZZLE_OP (4312, wzxy) SHADER_SWIZZLE_OP (4313, wzxz) SHADER_SWIZZLE_OP (4314, wzxw) |
|
|
969 | SHADER_SWIZZLE_OP (432 , wzy ) SHADER_SWIZZLE_OP (4321, wzyx) SHADER_SWIZZLE_OP (4322, wzyy) SHADER_SWIZZLE_OP (4323, wzyz) |
|
|
970 | SHADER_SWIZZLE_OP (4324, wzyw) SHADER_SWIZZLE_OP (433 , wzz ) SHADER_SWIZZLE_OP (4331, wzzx) SHADER_SWIZZLE_OP (4332, wzzy) |
|
|
971 | SHADER_SWIZZLE_OP (4333, wzzz) SHADER_SWIZZLE_OP (4334, wzzw) SHADER_SWIZZLE_OP (434 , wzw ) SHADER_SWIZZLE_OP (4341, wzwx) |
|
|
972 | SHADER_SWIZZLE_OP (4342, wzwy) SHADER_SWIZZLE_OP (4343, wzwz) SHADER_SWIZZLE_OP (4344, wzww) SHADER_SWIZZLE_OP (44 , ww ) |
|
|
973 | SHADER_SWIZZLE_OP (441 , wwx ) SHADER_SWIZZLE_OP (4411, wwxx) SHADER_SWIZZLE_OP (4412, wwxy) SHADER_SWIZZLE_OP (4413, wwxz) |
|
|
974 | SHADER_SWIZZLE_OP (4414, wwxw) SHADER_SWIZZLE_OP (442 , wwy ) SHADER_SWIZZLE_OP (4421, wwyx) SHADER_SWIZZLE_OP (4422, wwyy) |
|
|
975 | SHADER_SWIZZLE_OP (4423, wwyz) SHADER_SWIZZLE_OP (4424, wwyw) SHADER_SWIZZLE_OP (443 , wwz ) SHADER_SWIZZLE_OP (4431, wwzx) |
|
|
976 | SHADER_SWIZZLE_OP (4432, wwzy) SHADER_SWIZZLE_OP (4433, wwzz) SHADER_SWIZZLE_OP (4434, wwzw) SHADER_SWIZZLE_OP (444 , www ) |
|
|
977 | SHADER_SWIZZLE_OP (4441, wwwx) SHADER_SWIZZLE_OP (4442, wwwy) SHADER_SWIZZLE_OP (4443, wwwz) SHADER_SWIZZLE_OP (4444, wwww) |
|
|
978 | |
|
|
979 | # undef SHADER_SWIZZLE_OP |
|
|
980 | |
|
|
981 | # define SHADER_FUNC0_(name, glname) \ |
|
|
982 | template<typename A> \ |
|
|
983 | inline const sl_expr<sl_func0> \ |
|
|
984 | name () \ |
|
|
985 | { \ |
|
|
986 | return sl_func0 (#glname " ("); \ |
|
|
987 | } |
|
|
988 | |
|
|
989 | # define SHADER_FUNC0(name) SHADER_FUNC0_(name,name) |
|
|
990 | |
|
|
991 | # define SHADER_FUNC1_(name, glname) \ |
|
|
992 | template<typename A> \ |
|
|
993 | inline const sl_expr< sl_func1<typename sl_convert<A>::T> > \ |
|
|
994 | name (const A &a) \ |
|
|
995 | { \ |
|
|
996 | return sl_func1<typename sl_convert<A>::T> (#glname " (", sl_convert<A>::convert (a));\ |
|
|
997 | } |
|
|
998 | |
|
|
999 | # define SHADER_FUNC1(name) SHADER_FUNC1_(name,name) |
|
|
1000 | |
|
|
1001 | # define SHADER_FUNC2_(name, glname) \ |
|
|
1002 | template<typename A, typename B> \ |
|
|
1003 | inline const sl_expr< sl_func2<typename sl_convert<A>::T, typename sl_convert<B>::T> > \ |
|
|
1004 | name (const A &a, const B &b) \ |
|
|
1005 | { \ |
|
|
1006 | return sl_func2<typename sl_convert<A>::T, typename sl_convert<B>::T> (#glname " (", sl_convert<A>::convert (a), sl_convert<B>::convert (b));\ |
|
|
1007 | } |
|
|
1008 | |
|
|
1009 | # define SHADER_FUNC2(name) SHADER_FUNC2_(name,name) |
|
|
1010 | |
|
|
1011 | # define SHADER_FUNC3_(name, glname) \ |
|
|
1012 | template<typename A, typename B, typename C> \ |
|
|
1013 | inline const sl_expr< sl_func3<typename sl_convert<A>::T, typename sl_convert<B>::T, typename sl_convert<C>::T> > \ |
|
|
1014 | name (const A &a, const B &b, const C &c) \ |
|
|
1015 | { \ |
|
|
1016 | return sl_func3<typename sl_convert<A>::T, typename sl_convert<B>::T, typename sl_convert<C>::T> (#glname " (", sl_convert<A>::convert (a), sl_convert<B>::convert (b), sl_convert<C>::convert (c));\ |
|
|
1017 | } |
|
|
1018 | |
|
|
1019 | # define SHADER_FUNC3(name) SHADER_FUNC3_(name,name) |
|
|
1020 | |
|
|
1021 | # define SHADER_FUNC4_(name, glname) \ |
|
|
1022 | template<typename A, typename B, typename C, typename D> \ |
|
|
1023 | inline const sl_expr< sl_func4<typename sl_convert<A>::T, typename sl_convert<B>::T, typename sl_convert<C>::T, typename sl_convert<D>::T > > \ |
|
|
1024 | name (const A &a, const B &b, const C &c, const D &d) \ |
|
|
1025 | { \ |
|
|
1026 | return sl_func4<typename sl_convert<A>::T, typename sl_convert<B>::T, typename sl_convert<C>::T, typename sl_convert<D>::T> (#glname " (", sl_convert<A>::convert (a), sl_convert<B>::convert (b), sl_convert<C>::convert (c), sl_convert<D>::convert (d));\ |
|
|
1027 | } |
|
|
1028 | |
|
|
1029 | # define SHADER_FUNC4(name) SHADER_FUNC4_(name,name) |
|
|
1030 | |
|
|
1031 | SHADER_FUNC1 (abs) |
|
|
1032 | SHADER_FUNC1 (acos) |
|
|
1033 | SHADER_FUNC1 (all) |
|
|
1034 | SHADER_FUNC1 (any) |
|
|
1035 | SHADER_FUNC1 (asin) |
|
|
1036 | SHADER_FUNC1 (atan) |
|
|
1037 | SHADER_FUNC2 (atan) |
|
|
1038 | SHADER_FUNC1 (ceil) |
|
|
1039 | SHADER_FUNC3 (clamp) |
|
|
1040 | SHADER_FUNC1 (cos) |
|
|
1041 | SHADER_FUNC2 (cross) |
|
|
1042 | SHADER_FUNC1 (dFdx) |
|
|
1043 | SHADER_FUNC1 (dFdy) |
|
|
1044 | SHADER_FUNC1 (degrees) |
|
|
1045 | SHADER_FUNC2 (distance) |
|
|
1046 | SHADER_FUNC2 (dot) |
|
|
1047 | SHADER_FUNC2_(equal, equal) |
|
|
1048 | SHADER_FUNC1 (exp) |
|
|
1049 | SHADER_FUNC1 (exp2) |
|
|
1050 | SHADER_FUNC3 (faceforward) |
|
|
1051 | SHADER_FUNC1 (floor) |
|
|
1052 | SHADER_FUNC1 (fract) |
|
|
1053 | SHADER_FUNC0 (ftransform) |
|
|
1054 | SHADER_FUNC1 (fwidth) |
|
|
1055 | SHADER_FUNC2_(greater_than_equal, greaterThanEqual) |
|
|
1056 | SHADER_FUNC2_(greater_then, greaterThan) |
|
|
1057 | SHADER_FUNC1 (inversesqrt) |
|
|
1058 | SHADER_FUNC1 (length) |
|
|
1059 | SHADER_FUNC2_(less_than, lessThan) |
|
|
1060 | SHADER_FUNC2_(less_than_equal, lessThanEqual) |
|
|
1061 | SHADER_FUNC1 (log) |
|
|
1062 | SHADER_FUNC1 (log2) |
|
|
1063 | SHADER_FUNC2_(matrix_comp_mult, matrixCompMult) |
|
|
1064 | SHADER_FUNC2 (max) |
|
|
1065 | SHADER_FUNC2 (min) |
|
|
1066 | SHADER_FUNC3 (mix) |
|
|
1067 | SHADER_FUNC2 (mod) |
|
|
1068 | SHADER_FUNC1 (noise1) |
|
|
1069 | SHADER_FUNC1 (noise2) |
|
|
1070 | SHADER_FUNC1 (noise3) |
|
|
1071 | SHADER_FUNC1 (noise4) |
|
|
1072 | SHADER_FUNC1 (normalize) |
|
|
1073 | SHADER_FUNC1 (gl_not) // TODO |
|
|
1074 | SHADER_FUNC2_(notequal, notEqual) |
|
|
1075 | SHADER_FUNC2 (pow) |
|
|
1076 | SHADER_FUNC1 (radians) |
|
|
1077 | SHADER_FUNC2 (reflect) |
|
|
1078 | SHADER_FUNC3 (refract) |
|
|
1079 | SHADER_FUNC2_(shadow_1d, shadow1D) |
|
|
1080 | SHADER_FUNC3_(shadow_1d, shadow1D) |
|
|
1081 | SHADER_FUNC3_(shadow_1d_lod, shadow1DLod) |
|
|
1082 | SHADER_FUNC2_(shadow_1d_proj, shadow1DProj) |
|
|
1083 | SHADER_FUNC3_(shadow_1d_proj, shadow1DProj) |
|
|
1084 | SHADER_FUNC3_(shadow_1d_proj_lod, shadow1DProjLod) |
|
|
1085 | SHADER_FUNC2_(shadow_2d, shadow2D) |
|
|
1086 | SHADER_FUNC3_(shadow_2d, shadow2D) |
|
|
1087 | SHADER_FUNC3_(shadow_2d_lod, shadow2DLod) |
|
|
1088 | SHADER_FUNC2_(shadow_2d_proj, shadow2DProj) |
|
|
1089 | SHADER_FUNC3_(shadow_2d_proj, shadow2DProj) |
|
|
1090 | SHADER_FUNC3_(shadow_2d_proj_lod, shadow2DProjLod) |
|
|
1091 | SHADER_FUNC1 (sign) |
|
|
1092 | SHADER_FUNC1 (sin) |
|
|
1093 | SHADER_FUNC3 (smoothstep) |
|
|
1094 | SHADER_FUNC1 (sqrt) |
|
|
1095 | SHADER_FUNC2 (step) |
|
|
1096 | SHADER_FUNC1 (tan) |
|
|
1097 | SHADER_FUNC2_(texture_1d, texture1D) |
|
|
1098 | SHADER_FUNC3_(texture_1d, texture1D) |
|
|
1099 | SHADER_FUNC3_(texture_1d_lod, texture1DLod) |
|
|
1100 | SHADER_FUNC2_(texture_1d_proj, texture1DProj) |
|
|
1101 | SHADER_FUNC3_(texture_1d_proj, texture1DProj) |
|
|
1102 | SHADER_FUNC3_(texture_1d_proj_lod, texture1DProjLod) |
|
|
1103 | SHADER_FUNC2_(texture_2d, texture2D) |
|
|
1104 | SHADER_FUNC3_(texture_2d, texture2D) |
|
|
1105 | SHADER_FUNC3_(texture_2d_lod, texture2DLod) |
|
|
1106 | SHADER_FUNC2_(texture_2d_proj, texture2DProj) |
|
|
1107 | SHADER_FUNC3_(texture_2d_proj, texture2DProj) |
|
|
1108 | SHADER_FUNC3_(texture_2d_proj_lod, texture2DProjLod) |
|
|
1109 | SHADER_FUNC2_(texture_3d, texture3D) |
|
|
1110 | SHADER_FUNC3_(texture_3d, texture3D) |
|
|
1111 | SHADER_FUNC3_(texture_3d_lod, texture3DLod) |
|
|
1112 | SHADER_FUNC2_(texture_3d_proj, texture3DProj) |
|
|
1113 | SHADER_FUNC3_(texture_3d_proj, texture3DProj) |
|
|
1114 | SHADER_FUNC3_(texture_3d_proj_lod, texture3DProjLod) |
|
|
1115 | SHADER_FUNC2_(texture_cube, textureCube) |
|
|
1116 | SHADER_FUNC3_(texture_cube, textureCube) |
|
|
1117 | SHADER_FUNC3_(texture_cude_lod, textureCubeLod) |
|
|
1118 | SHADER_FUNC1 (vec2) SHADER_FUNC2 (vec2) |
|
|
1119 | SHADER_FUNC1 (vec3) SHADER_FUNC2 (vec3) SHADER_FUNC3 (vec3) |
|
|
1120 | SHADER_FUNC1 (vec4) SHADER_FUNC2 (vec4) SHADER_FUNC3 (vec4) SHADER_FUNC4 (vec4) |
|
|
1121 | SHADER_FUNC1 (mat2) SHADER_FUNC2 (mat2) |
|
|
1122 | SHADER_FUNC1 (mat3) SHADER_FUNC2 (mat3) SHADER_FUNC3 (mat3) |
|
|
1123 | SHADER_FUNC1 (mat4) SHADER_FUNC2 (mat4) SHADER_FUNC3 (mat4) SHADER_FUNC4 (mat4) |
|
|
1124 | |
|
|
1125 | # undef SHADER_FUNC0 |
|
|
1126 | # undef SHADER_FUNC0_ |
|
|
1127 | # undef SHADER_FUNC1 |
|
|
1128 | # undef SHADER_FUNC1_ |
|
|
1129 | # undef SHADER_FUNC2 |
|
|
1130 | # undef SHADER_FUNC2_ |
|
|
1131 | # undef SHADER_FUNC3 |
|
|
1132 | # undef SHADER_FUNC3_ |
|
|
1133 | # undef SHADER_FUNC4 |
|
|
1134 | # undef SHADER_FUNC5_ |
|
|
1135 | |
1270 | |
1136 | void debdebdebdebug ();//D |
1271 | void debdebdebdebug ();//D |
1137 | } |
1272 | } |
1138 | |
1273 | |
1139 | #endif |
1274 | #endif |
1140 | |
1275 | |
|
|
1276 | #include "shader_vars.h" |
|
|
1277 | |
|
|
1278 | |