Blender  V2.93
gpu_material_library.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2005 Blender Foundation.
17  * All rights reserved.
18  */
19 
26 #include <stdio.h>
27 #include <string.h>
28 
29 #include "MEM_guardedalloc.h"
30 
31 #include "BLI_dynstr.h"
32 #include "BLI_ghash.h"
33 #include "BLI_string.h"
34 #include "BLI_utildefines.h"
35 
36 #include "gpu_material_library.h"
37 
38 /* List of all gpu_shader_material_*.glsl files used by GLSL materials. These
39  * will be parsed to make all functions in them available to use for GPU_link().
40  *
41  * If a file uses functions from another file, it must be added to the list of
42  * dependencies, and be placed after that file in the list. */
43 
133 
136  .dependencies = {NULL},
137 };
138 
141  .dependencies = {NULL},
142 };
143 
146  .dependencies = {NULL},
147 };
148 
151  .dependencies = {&gpu_shader_material_hash_library, NULL},
152 };
153 
156  .dependencies = {&gpu_shader_material_noise_library, NULL},
157 };
158 
161  .dependencies = {NULL},
162 };
163 
166  .dependencies = {NULL},
167 };
168 
171  .dependencies = {NULL},
172 };
173 
176  .dependencies = {&gpu_shader_material_glossy_library, NULL},
177 };
178 
181  .dependencies = {NULL},
182 };
183 
186  .dependencies = {NULL},
187 };
188 
191  .dependencies = {NULL},
192 };
193 
196  .dependencies = {NULL},
197 };
198 
201  .dependencies = {NULL},
202 };
203 
206  .dependencies = {NULL},
207 };
208 
211  .dependencies = {NULL},
212 };
213 
216  .dependencies = {NULL},
217 };
218 
221  .dependencies = {NULL},
222 };
223 
226  .dependencies = {&gpu_shader_material_color_util_library, NULL},
227 };
228 
231  .dependencies = {NULL},
232 };
233 
236  .dependencies = {NULL},
237 };
238 
241  .dependencies = {NULL},
242 };
243 
246  .dependencies = {NULL},
247 };
248 
251  .dependencies = {NULL},
252 };
253 
256  .dependencies = {NULL},
257 };
258 
261  .dependencies = {NULL},
262 };
263 
266  .dependencies = {&gpu_shader_material_math_util_library, NULL},
267 };
268 
271  .dependencies = {NULL},
272 };
273 
276  .dependencies = {&gpu_shader_material_tangent_library, NULL},
277 };
278 
281  .dependencies = {NULL},
282 };
283 
286  .dependencies = {NULL},
287 };
288 
291  .dependencies = {NULL},
292 };
293 
296  .dependencies = {&gpu_shader_material_color_util_library, NULL},
297 };
298 
301  .dependencies = {NULL},
302 };
303 
306  .dependencies = {&gpu_shader_material_fresnel_library, NULL},
307 };
308 
311  .dependencies = {NULL},
312 };
313 
316  .dependencies = {NULL},
317 };
318 
321  .dependencies = {&gpu_shader_material_math_util_library, NULL},
322 };
323 
326  .dependencies = {&gpu_shader_material_math_util_library, NULL},
327 };
328 
331  .dependencies = {&gpu_shader_material_math_util_library, NULL},
332 };
333 
336  .dependencies = {&gpu_shader_material_color_util_library, NULL},
337 };
338 
341  .dependencies = {NULL},
342 };
343 
346  .dependencies = {NULL},
347 };
348 
351  .dependencies = {NULL},
352 };
353 
356  .dependencies = {NULL},
357 };
358 
361  .dependencies = {NULL},
362 };
363 
366  .dependencies = {NULL},
367 };
368 
371  .dependencies = {NULL},
372 };
373 
376  .dependencies = {NULL},
377 };
378 
381  .dependencies = {NULL},
382 };
383 
386  .dependencies = {NULL},
387 };
388 
391  .dependencies = {NULL},
392 };
393 
396  .dependencies = {NULL},
397 };
398 
401  .dependencies = {&gpu_shader_material_color_util_library, NULL},
402 };
403 
406  .dependencies = {NULL},
407 };
408 
411  .dependencies = {NULL},
412 };
413 
416  .dependencies = {NULL},
417 };
418 
421  .dependencies = {NULL},
422 };
423 
426  .dependencies = {NULL},
427 };
428 
431  .dependencies = {&gpu_shader_material_diffuse_library, NULL},
432 };
433 
436  .dependencies = {&gpu_shader_material_math_util_library,
438  NULL},
439 };
440 
443  .dependencies = {NULL},
444 };
445 
448  .dependencies = {&gpu_shader_material_math_util_library, NULL},
449 };
450 
453  .dependencies = {NULL},
454 };
455 
458  .dependencies = {NULL},
459 };
460 
463  .dependencies = {NULL},
464 };
465 
468  .dependencies = {&gpu_shader_material_noise_library, NULL},
469 };
470 
474 };
475 
478  .dependencies = {NULL},
479 };
480 
483  .dependencies = {NULL},
484 };
485 
488  .dependencies = {&gpu_shader_material_math_util_library,
490  NULL},
491 };
492 
496 };
497 
500  .dependencies = {&gpu_shader_material_hash_library, NULL},
501 };
502 
505  .dependencies = {&gpu_shader_material_diffuse_library, NULL},
506 };
507 
510  .dependencies = {&gpu_shader_material_diffuse_library, NULL},
511 };
512 
515  .dependencies = {NULL},
516 };
517 
520  .dependencies = {NULL},
521 };
522 
525  .dependencies = {NULL},
526 };
527 
530  .dependencies = {NULL},
531 };
532 
535  .dependencies = {&gpu_shader_material_math_util_library, NULL},
536 };
537 
540  .dependencies = {&gpu_shader_material_math_util_library, NULL},
541 };
542 
545  .dependencies = {&gpu_shader_material_diffuse_library, NULL},
546 };
547 
550  .dependencies = {NULL},
551 };
552 
555  .dependencies = {NULL},
556 };
557 
560  .dependencies = {NULL},
561 };
562 
565  .dependencies = {&gpu_shader_material_blackbody_library, NULL},
566 };
567 
570  .dependencies = {NULL},
571 };
572 
575  .dependencies = {NULL},
576 };
577 
581 };
582 
673  NULL};
674 
675 /* GLSL code parsing for finding function definitions.
676  * These are stored in a hash for lookup when creating a material. */
677 
679 
680 char *gpu_str_skip_token(char *str, char *token, int max)
681 {
682  int len = 0;
683 
684  /* skip a variable/function name */
685  while (*str) {
686  if (ELEM(*str, ' ', '(', ')', ',', ';', '\t', '\n', '\r')) {
687  break;
688  }
689 
690  if (token && len < max - 1) {
691  *token = *str;
692  token++;
693  len++;
694  }
695  str++;
696  }
697 
698  if (token) {
699  *token = '\0';
700  }
701 
702  /* skip the next special characters:
703  * note the missing ')' */
704  while (*str) {
705  if (ELEM(*str, ' ', '(', ',', ';', '\t', '\n', '\r')) {
706  str++;
707  }
708  else {
709  break;
710  }
711  }
712 
713  return str;
714 }
715 
716 /* Indices match the eGPUType enum */
717 static const char *GPU_DATATYPE_STR[17] = {
718  "",
719  "float",
720  "vec2",
721  "vec3",
722  "vec4",
723  NULL,
724  NULL,
725  NULL,
726  NULL,
727  "mat3",
728  NULL,
729  NULL,
730  NULL,
731  NULL,
732  NULL,
733  NULL,
734  "mat4",
735 };
736 
738 {
739  return GPU_DATATYPE_STR[type];
740 }
741 
743 {
744  GPUFunction *function;
745  eGPUType type;
746  GPUFunctionQual qual;
747  int i;
748  char *code = library->code;
749 
750  while ((code = strstr(code, "void "))) {
751  function = MEM_callocN(sizeof(GPUFunction), "GPUFunction");
752  function->library = library;
753 
754  code = gpu_str_skip_token(code, NULL, 0);
755  code = gpu_str_skip_token(code, function->name, MAX_FUNCTION_NAME);
756 
757  /* get parameters */
758  while (*code && *code != ')') {
759  if (BLI_str_startswith(code, "const ")) {
760  code = gpu_str_skip_token(code, NULL, 0);
761  }
762 
763  /* test if it's an input or output */
764  qual = FUNCTION_QUAL_IN;
765  if (BLI_str_startswith(code, "out ")) {
766  qual = FUNCTION_QUAL_OUT;
767  }
768  if (BLI_str_startswith(code, "inout ")) {
769  qual = FUNCTION_QUAL_INOUT;
770  }
771  if ((qual != FUNCTION_QUAL_IN) || BLI_str_startswith(code, "in ")) {
772  code = gpu_str_skip_token(code, NULL, 0);
773  }
774 
775  /* test for type */
776  type = GPU_NONE;
777  for (i = 1; i < ARRAY_SIZE(GPU_DATATYPE_STR); i++) {
779  type = i;
780  break;
781  }
782  }
783 
784  if (!type && BLI_str_startswith(code, "samplerCube")) {
785  type = GPU_TEXCUBE;
786  }
787  if (!type && BLI_str_startswith(code, "sampler2DShadow")) {
788  type = GPU_SHADOW2D;
789  }
790  if (!type && BLI_str_startswith(code, "sampler1DArray")) {
792  }
793  if (!type && BLI_str_startswith(code, "sampler2DArray")) {
795  }
796  if (!type && BLI_str_startswith(code, "sampler2D")) {
797  type = GPU_TEX2D;
798  }
799  if (!type && BLI_str_startswith(code, "sampler3D")) {
800  type = GPU_TEX3D;
801  }
802 
803  if (!type && BLI_str_startswith(code, "Closure")) {
804  type = GPU_CLOSURE;
805  }
806 
807  if (type) {
808  /* add parameter */
809  code = gpu_str_skip_token(code, NULL, 0);
810  code = gpu_str_skip_token(code, NULL, 0);
811  function->paramqual[function->totparam] = qual;
812  function->paramtype[function->totparam] = type;
813  function->totparam++;
814  }
815  else {
816  fprintf(stderr, "GPU invalid function parameter in %s.\n", function->name);
817  break;
818  }
819  }
820 
821  if (function->name[0] == '\0' || function->totparam == 0) {
822  fprintf(stderr, "GPU functions parse error.\n");
823  MEM_freeN(function);
824  break;
825  }
826 
827  BLI_ghash_insert(hash, function->name, function);
828  }
829 }
830 
831 /* Module */
832 
834 {
835  /* Only parse GLSL shader files once. */
836  if (FUNCTION_HASH) {
837  return;
838  }
839 
840  FUNCTION_HASH = BLI_ghash_str_new("GPU_lookup_function gh");
841  for (int i = 0; gpu_material_libraries[i]; i++) {
843  }
844 }
845 
847 {
848  if (FUNCTION_HASH) {
851  }
852 }
853 
854 /* Code Generation */
855 
858 {
859  if (BLI_gset_add(used_libraries, library->code)) {
860  for (int i = 0; library->dependencies[i]; i++) {
861  gpu_material_use_library_with_dependencies(used_libraries, library->dependencies[i]);
862  }
863  }
864 }
865 
866 GPUFunction *gpu_material_library_use_function(GSet *used_libraries, const char *name)
867 {
868  GPUFunction *function = BLI_ghash_lookup(FUNCTION_HASH, (const void *)name);
869  if (function) {
870  gpu_material_use_library_with_dependencies(used_libraries, function->library);
871  }
872  return function;
873 }
874 
875 char *gpu_material_library_generate_code(GSet *used_libraries, const char *frag_lib)
876 {
877  DynStr *ds = BLI_dynstr_new();
878 
879  if (frag_lib) {
880  BLI_dynstr_append(ds, frag_lib);
881  }
882 
883  /* Always include those because they may be needed by the execution function. */
886 
887  /* Add library code in order, for dependencies. */
888  for (int i = 0; gpu_material_libraries[i]; i++) {
890  if (BLI_gset_haskey(used_libraries, library->code)) {
891  BLI_dynstr_append(ds, library->code);
892  }
893  }
894 
895  char *result = BLI_dynstr_get_cstring(ds);
896  BLI_dynstr_free(ds);
897 
898  return result;
899 }
A dynamically sized string ADT.
DynStr * BLI_dynstr_new(void) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition: BLI_dynstr.c:71
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
Definition: BLI_dynstr.c:358
char * BLI_dynstr_get_cstring(DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: BLI_dynstr.c:323
void BLI_dynstr_append(DynStr *__restrict ds, const char *cstr) ATTR_NONNULL()
Definition: BLI_dynstr.c:107
struct GSet GSet
Definition: BLI_ghash.h:189
GHash * BLI_ghash_str_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
bool BLI_gset_haskey(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:1216
void BLI_ghash_insert(GHash *gh, void *key, void *val)
Definition: BLI_ghash.c:756
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
Definition: BLI_ghash.c:1008
bool BLI_gset_add(GSet *gs, void *key)
Definition: BLI_ghash.c:1160
void * BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:803
bool BLI_str_startswith(const char *__restrict str, const char *__restrict start) ATTR_NONNULL()
Definition: string.c:1006
#define ARRAY_SIZE(arr)
#define ELEM(...)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
eGPUType
Definition: GPU_material.h:59
@ GPU_SHADOW2D
Definition: GPU_material.h:76
@ GPU_TEX1D_ARRAY
Definition: GPU_material.h:72
@ GPU_TEXCUBE
Definition: GPU_material.h:77
@ GPU_TEX2D_ARRAY
Definition: GPU_material.h:74
@ GPU_TEX2D
Definition: GPU_material.h:73
@ GPU_NONE
Definition: GPU_material.h:62
@ GPU_CLOSURE
Definition: GPU_material.h:80
@ GPU_TEX3D
Definition: GPU_material.h:75
Read Guarded memory(de)allocation.
#define str(s)
static FT_Library library
Definition: freetypefont.c:51
char datatoc_gpu_shader_material_mapping_glsl[]
static GPUMaterialLibrary gpu_shader_material_geometry_library
static GPUMaterialLibrary gpu_shader_material_fractal_noise_library
static GPUMaterialLibrary gpu_shader_material_uv_map_library
static GPUMaterialLibrary gpu_shader_material_blackbody_library
static GPUMaterialLibrary gpu_shader_material_separate_xyz_library
char datatoc_gpu_shader_material_velvet_glsl[]
char datatoc_gpu_shader_material_hash_glsl[]
static GPUMaterialLibrary gpu_shader_material_tex_environment_library
static GPUMaterialLibrary gpu_shader_material_light_falloff_library
static GPUMaterialLibrary gpu_shader_material_map_range_library
static GPUMaterialLibrary gpu_shader_material_combine_hsv_library
static GPUMaterialLibrary gpu_shader_material_object_info_library
static GPUMaterialLibrary gpu_shader_material_refraction_library
static GPUMaterialLibrary gpu_shader_material_tex_sky_library
static GPUMaterialLibrary gpu_shader_material_tex_wave_library
char datatoc_gpu_shader_material_noise_glsl[]
static GPUMaterialLibrary gpu_shader_material_tex_white_noise_library
char datatoc_gpu_shader_material_volume_scatter_glsl[]
char datatoc_gpu_shader_material_refraction_glsl[]
static GPUMaterialLibrary gpu_shader_material_tex_voronoi_library
char datatoc_gpu_shader_material_anisotropic_glsl[]
char datatoc_gpu_shader_material_volume_info_glsl[]
static GPUMaterialLibrary gpu_shader_material_volume_absorption_library
char datatoc_gpu_shader_material_clamp_glsl[]
char datatoc_gpu_shader_material_tex_magic_glsl[]
static GPUMaterialLibrary gpu_shader_material_attribute_library
void gpu_material_library_exit(void)
char datatoc_gpu_shader_material_combine_rgb_glsl[]
static GPUMaterialLibrary gpu_shader_material_output_world_library
static GPUMaterialLibrary gpu_shader_material_texture_coordinates_library
static GPUMaterialLibrary gpu_shader_material_vector_math_library
static GPUMaterialLibrary gpu_shader_material_anisotropic_library
char datatoc_gpu_shader_material_displacement_glsl[]
static GPUMaterialLibrary gpu_shader_material_volume_info_library
char datatoc_gpu_shader_material_diffuse_glsl[]
static GPUMaterialLibrary gpu_shader_material_light_path_library
static void gpu_material_use_library_with_dependencies(GSet *used_libraries, GPUMaterialLibrary *library)
char datatoc_gpu_shader_material_bevel_glsl[]
static GPUMaterialLibrary gpu_shader_material_tex_musgrave_library
char datatoc_gpu_shader_material_math_glsl[]
static GPUMaterialLibrary gpu_shader_material_color_util_library
static GPUMaterialLibrary gpu_shader_material_separate_hsv_library
char datatoc_gpu_shader_material_vector_math_glsl[]
char datatoc_gpu_shader_material_object_info_glsl[]
char datatoc_gpu_shader_material_tex_gradient_glsl[]
char datatoc_gpu_shader_material_glossy_glsl[]
char datatoc_gpu_shader_material_holdout_glsl[]
char datatoc_gpu_shader_material_output_aov_glsl[]
static GPUMaterialLibrary gpu_shader_material_subsurface_scattering_library
char datatoc_gpu_shader_material_particle_info_glsl[]
char datatoc_gpu_shader_material_toon_glsl[]
char datatoc_gpu_shader_material_map_range_glsl[]
char datatoc_gpu_shader_material_attribute_glsl[]
char datatoc_gpu_shader_material_world_normals_glsl[]
char datatoc_gpu_shader_material_combine_hsv_glsl[]
char datatoc_gpu_shader_material_separate_xyz_glsl[]
char datatoc_gpu_shader_material_subsurface_scattering_glsl[]
char datatoc_gpu_shader_material_tex_brick_glsl[]
char datatoc_gpu_shader_material_gamma_glsl[]
static GPUMaterialLibrary gpu_shader_material_normal_library
static GPUMaterialLibrary gpu_shader_material_mix_shader_library
char datatoc_gpu_shader_material_principled_glsl[]
char datatoc_gpu_shader_material_combine_xyz_glsl[]
char datatoc_gpu_shader_material_vector_displacement_glsl[]
GPUFunction * gpu_material_library_use_function(GSet *used_libraries, const char *name)
static GPUMaterialLibrary gpu_shader_material_tex_brick_library
char datatoc_gpu_shader_material_translucent_glsl[]
static GPUMaterialLibrary gpu_shader_material_world_normals_library
char datatoc_gpu_shader_material_light_path_glsl[]
char datatoc_gpu_shader_material_set_glsl[]
char datatoc_gpu_shader_material_color_ramp_glsl[]
static GPUMaterialLibrary gpu_shader_material_transparent_library
static GPUMaterialLibrary gpu_shader_material_noise_library
static GPUMaterialLibrary gpu_shader_material_toon_library
char datatoc_gpu_shader_material_color_util_glsl[]
static GPUMaterialLibrary gpu_shader_material_mix_rgb_library
static GPUMaterialLibrary gpu_shader_material_set_library
static GPUMaterialLibrary gpu_shader_material_bump_library
char datatoc_gpu_shader_material_hue_sat_val_glsl[]
static GPUMaterialLibrary gpu_shader_material_math_library
static GPUMaterialLibrary gpu_shader_material_holdout_library
char datatoc_gpu_shader_material_bright_contrast_glsl[]
static GPUMaterialLibrary gpu_shader_material_hash_library
static GPUMaterialLibrary gpu_shader_material_color_ramp_library
char datatoc_gpu_shader_material_background_glsl[]
void gpu_material_library_init(void)
static GPUMaterialLibrary gpu_shader_material_layer_weight_library
char datatoc_gpu_shader_material_glass_glsl[]
static GPUMaterialLibrary gpu_shader_material_normal_map_library
static GPUMaterialLibrary gpu_shader_material_bevel_library
static GPUMaterialLibrary gpu_shader_material_hue_sat_val_library
char datatoc_gpu_shader_material_tex_checker_glsl[]
static GPUMaterialLibrary gpu_shader_material_vector_curves_library
static GPUMaterialLibrary gpu_shader_material_add_shader_library
char datatoc_gpu_shader_material_blackbody_glsl[]
char datatoc_gpu_shader_material_normal_glsl[]
static GPUMaterialLibrary gpu_shader_material_volume_principled_library
static GPUMaterialLibrary gpu_shader_material_combine_rgb_library
char datatoc_gpu_shader_material_uv_map_glsl[]
static GHash * FUNCTION_HASH
static GPUMaterialLibrary gpu_shader_material_tex_gradient_library
static void gpu_parse_material_library(GHash *hash, GPUMaterialLibrary *library)
char datatoc_gpu_shader_material_layer_weight_glsl[]
static GPUMaterialLibrary gpu_shader_material_gamma_library
static GPUMaterialLibrary gpu_shader_material_glossy_library
static GPUMaterialLibrary gpu_shader_material_squeeze_library
char datatoc_gpu_shader_material_hair_info_glsl[]
static GPUMaterialLibrary gpu_shader_material_wireframe_library
char datatoc_gpu_shader_material_tex_wave_glsl[]
static GPUMaterialLibrary gpu_shader_material_eevee_specular_library
char datatoc_gpu_shader_material_tex_musgrave_glsl[]
char datatoc_gpu_shader_material_shader_to_rgba_glsl[]
static GPUMaterialLibrary gpu_shader_material_shader_to_rgba_library
char datatoc_gpu_shader_material_volume_absorption_glsl[]
static GPUMaterialLibrary gpu_shader_material_bright_contrast_library
char datatoc_gpu_shader_material_tex_environment_glsl[]
static GPUMaterialLibrary gpu_shader_material_background_library
static GPUMaterialLibrary gpu_shader_material_math_util_library
static GPUMaterialLibrary gpu_shader_material_vector_rotate_library
static GPUMaterialLibrary gpu_shader_material_vector_displacement_library
char datatoc_gpu_shader_material_emission_glsl[]
char datatoc_gpu_shader_material_fractal_noise_glsl[]
static GPUMaterialLibrary gpu_shader_material_ambient_occlusion_library
static const char * GPU_DATATYPE_STR[17]
char datatoc_gpu_shader_material_squeeze_glsl[]
static GPUMaterialLibrary gpu_shader_material_velvet_library
static GPUMaterialLibrary * gpu_material_libraries[]
char datatoc_gpu_shader_material_separate_rgb_glsl[]
char datatoc_gpu_shader_material_camera_glsl[]
static GPUMaterialLibrary gpu_shader_material_tangent_library
char datatoc_gpu_shader_material_rgb_to_bw_glsl[]
char datatoc_gpu_shader_material_fresnel_glsl[]
char datatoc_gpu_shader_material_wireframe_glsl[]
static GPUMaterialLibrary gpu_shader_material_output_aov_library
char datatoc_gpu_shader_material_light_falloff_glsl[]
static GPUMaterialLibrary gpu_shader_material_translucent_library
char datatoc_gpu_shader_material_math_util_glsl[]
char datatoc_gpu_shader_material_texture_coordinates_glsl[]
char datatoc_gpu_shader_material_geometry_glsl[]
char datatoc_gpu_shader_material_mix_rgb_glsl[]
static GPUMaterialLibrary gpu_shader_material_emission_library
static GPUMaterialLibrary gpu_shader_material_tex_magic_library
char datatoc_gpu_shader_material_output_world_glsl[]
static GPUMaterialLibrary gpu_shader_material_particle_info_library
char datatoc_gpu_shader_material_eevee_specular_glsl[]
static GPUMaterialLibrary gpu_shader_material_rgb_curves_library
static GPUMaterialLibrary gpu_shader_material_diffuse_library
char datatoc_gpu_shader_material_bump_glsl[]
static GPUMaterialLibrary gpu_shader_material_camera_library
static GPUMaterialLibrary gpu_shader_material_tex_image_library
const char * gpu_data_type_to_string(const eGPUType type)
char datatoc_gpu_shader_material_add_shader_glsl[]
static GPUMaterialLibrary gpu_shader_material_tex_checker_library
char datatoc_gpu_shader_material_vertex_color_glsl[]
char * gpu_str_skip_token(char *str, char *token, int max)
char datatoc_gpu_shader_material_vector_rotate_glsl[]
static GPUMaterialLibrary gpu_shader_material_mapping_library
char datatoc_gpu_shader_material_tangent_glsl[]
static GPUMaterialLibrary gpu_shader_material_tex_noise_library
char datatoc_gpu_shader_material_normal_map_glsl[]
char datatoc_gpu_shader_material_volume_principled_glsl[]
char datatoc_gpu_shader_material_tex_sky_glsl[]
static GPUMaterialLibrary gpu_shader_material_combine_xyz_library
char datatoc_gpu_shader_material_output_material_glsl[]
char datatoc_gpu_shader_material_mix_shader_glsl[]
static GPUMaterialLibrary gpu_shader_material_displacement_library
char datatoc_gpu_shader_material_tex_white_noise_glsl[]
static GPUMaterialLibrary gpu_shader_material_glass_library
char datatoc_gpu_shader_material_invert_glsl[]
static GPUMaterialLibrary gpu_shader_material_output_material_library
static GPUMaterialLibrary gpu_shader_material_invert_library
char datatoc_gpu_shader_material_tex_image_glsl[]
char datatoc_gpu_shader_material_ambient_occlusion_glsl[]
static GPUMaterialLibrary gpu_shader_material_principled_library
char datatoc_gpu_shader_material_rgb_curves_glsl[]
static GPUMaterialLibrary gpu_shader_material_separate_rgb_library
static GPUMaterialLibrary gpu_shader_material_fresnel_library
char datatoc_gpu_shader_material_vector_curves_glsl[]
static GPUMaterialLibrary gpu_shader_material_hair_info_library
char datatoc_gpu_shader_material_transparent_glsl[]
char * gpu_material_library_generate_code(GSet *used_libraries, const char *frag_lib)
char datatoc_gpu_shader_material_tex_noise_glsl[]
static GPUMaterialLibrary gpu_shader_material_rgb_to_bw_library
static GPUMaterialLibrary gpu_shader_material_vertex_color_library
char datatoc_gpu_shader_material_tex_voronoi_glsl[]
static GPUMaterialLibrary gpu_shader_material_volume_scatter_library
static GPUMaterialLibrary gpu_shader_material_clamp_library
char datatoc_gpu_shader_material_separate_hsv_glsl[]
GPUFunctionQual
@ FUNCTION_QUAL_IN
@ FUNCTION_QUAL_OUT
@ FUNCTION_QUAL_INOUT
#define MAX_FUNCTION_NAME
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
#define hash
Definition: noise.c:169
float max
uint len