Iray SDK API nvidia_logo_transpbg.gif Up
target_code_types.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2025 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_TARGET_CODE_TYPES_H
8#define MI_NEURAYLIB_TARGET_CODE_TYPES_H
9
10// If neither TARGET_CODE_USE_CUDA_TYPES nor TARGET_CODE_USE_NEURAY_TYPES is set,
11// it will default to CUDA types when compiled by a CUDA compiler and use Neuray types otherwise.
12
13#if defined(TARGET_CODE_USE_CUDA_TYPES) && defined(TARGET_CODE_USE_NEURAY_TYPES)
14#error "Only one of TARGET_CODE_USE_CUDA_TYPES and TARGET_CODE_USE_NEURAY_TYPES may be defined."
15#endif
16
17#if !defined(TARGET_CODE_USE_NEURAY_TYPES) && \
18 (defined(TARGET_CODE_USE_CUDA_TYPES) || defined(__CUDA_ARCH__))
19
20#include <vector_types.h>
21
22// Disable all FORCE_32_BIT enum values.
23#define MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(X,Y)
24
25namespace mi {
26
27namespace neuraylib {
28
34using tct_float = float;
35
37using tct_float2 = float2;
38
40using tct_float3 = float3;
41
43using tct_float4 = float4;
44
46using tct_int = int;
47
49using tct_uint = unsigned;
50
51#else
52
55
56namespace mi {
57
58namespace neuraylib {
59
65using tct_float = float;
66
69
72
75
78
81
82#endif
83
85using tct_bool = bool;
86
87
89template<typename T>
91{
92 T val, dx, dy;
93};
94
96template<bool with_derivatives>
98
99template<>
100struct tct_traits<false>
101{
102 using tct_derivable_float = tct_float;
103 using tct_derivable_float2 = tct_float2;
104 using tct_derivable_float3 = tct_float3;
105 using tct_derivable_float4 = tct_float4;
106 using tct_coord2_type = const tct_float[2];
107};
108
109template<>
110struct tct_traits<true>
111{
112 using tct_derivable_float = tct_deriv<tct_float>;
113 using tct_derivable_float2 = tct_deriv<tct_float2>;
114 using tct_derivable_float3 = tct_deriv<tct_float3>;
115 using tct_derivable_float4 = tct_deriv<tct_float4>;
116 using tct_coord2_type = const tct_derivable_float2 *;
117};
118
121
124
127
130
133
136
139
140
155{
159
173 char const *ro_data_segment;
174};
175
176
204template<bool with_derivatives = false>
206{
208
214
218
221 typename traits::tct_derivable_float3 position;
222
226
230 typename traits::tct_derivable_float3 const *text_coords;
231
238
245
253
267 char const *ro_data_segment;
268
275
282
288
293};
294
297
300
301
306{
309
313
317
320 TEX_WRAP_CLIP = 3
322
325{
328
332
333
334// Forward declaration of texture handler structure.
335struct Texture_handler_base;
336
337
340template<bool with_derivatives = false>
342{
344
346 void (*m_tex_lookup_float4_2d)(
347 tct_float result[4],
348 Texture_handler_base const *self,
349 tct_uint texture_idx,
350 typename traits::tct_coord2_type coord,
351 Tex_wrap_mode wrap_u,
352 Tex_wrap_mode wrap_v,
353 tct_float const crop_u[2],
354 tct_float const crop_v[2],
355 tct_float frame);
356
358 void (*m_tex_lookup_float3_2d)(
359 tct_float result[3],
360 Texture_handler_base const *self,
361 tct_uint texture_idx,
362 typename traits::tct_coord2_type coord,
363 Tex_wrap_mode wrap_u,
364 Tex_wrap_mode wrap_v,
365 tct_float const crop_u[2],
366 tct_float const crop_v[2],
367 tct_float frame);
368
370 void (*m_tex_texel_float4_2d)(
371 tct_float result[4],
372 Texture_handler_base const *self,
373 tct_uint texture_idx,
374 tct_int const coord[2],
375 tct_int const uv_tile[2],
376 tct_float frame);
377
379 void (*m_tex_lookup_float4_3d)(
380 tct_float result[4],
381 Texture_handler_base const *self,
382 tct_uint texture_idx,
383 tct_float const coord[3],
384 Tex_wrap_mode wrap_u,
385 Tex_wrap_mode wrap_v,
386 Tex_wrap_mode wrap_w,
387 tct_float const crop_u[2],
388 tct_float const crop_v[2],
389 tct_float const crop_w[2],
390 tct_float frame);
391
393 void (*m_tex_lookup_float3_3d)(
394 tct_float result[3],
395 Texture_handler_base const *self,
396 tct_uint texture_idx,
397 tct_float const coord[3],
398 Tex_wrap_mode wrap_u,
399 Tex_wrap_mode wrap_v,
400 Tex_wrap_mode wrap_w,
401 tct_float const crop_u[2],
402 tct_float const crop_v[2],
403 tct_float const crop_w[2],
404 tct_float frame);
405
407 void (*m_tex_texel_float4_3d)(
408 tct_float result[4],
409 Texture_handler_base const *self,
410 tct_uint texture_idx,
411 tct_int const coord[3],
412 tct_float frame);
413
415 void (*m_tex_lookup_float4_cube)(
416 tct_float result[4],
417 Texture_handler_base const *self,
418 tct_uint texture_idx,
419 tct_float const coord[3]);
420
422 void (*m_tex_lookup_float3_cube)(
423 tct_float result[3],
424 Texture_handler_base const *self,
425 tct_uint texture_idx,
426 tct_float const coord[3]);
427
431 void (*m_tex_resolution_2d)(
432 tct_int result[2],
433 Texture_handler_base const *self,
434 tct_uint texture_idx,
435 tct_int const uv_tile[2],
436 tct_float frame);
437
441 void (*m_tex_resolution_3d)(
442 tct_int result[3],
443 Texture_handler_base const *self,
444 tct_uint texture_idx,
445 tct_float frame);
446
448 tct_bool (*m_tex_texture_isvalid)(
449 Texture_handler_base const *self,
450 tct_uint texture_idx);
451
454 void (*m_tex_frame)(
455 tct_int result[2],
456 Texture_handler_base const *self,
457 tct_uint texture_idx);
458
460 tct_float (*m_df_light_profile_power)(
461 Texture_handler_base const *self,
462 tct_uint light_profile_index);
463
465 tct_float (*m_df_light_profile_maximum)(
466 Texture_handler_base const *self,
467 tct_uint light_profile_index);
468
470 tct_bool (*m_df_light_profile_isvalid)(
471 Texture_handler_base const *self,
472 tct_uint light_profile_index);
473
475 tct_float (*m_df_light_profile_evaluate)(
476 Texture_handler_base const *self,
477 tct_uint light_profile_index,
478 tct_float const theta_phi[2]);
479
481 void (*m_df_light_profile_sample)(
482 tct_float result[3],
484 Texture_handler_base const *self,
485 tct_uint light_profile_index,
486 tct_float const xi[3]);
487
489 tct_float (*m_df_light_profile_pdf)(
490 Texture_handler_base const *self,
491 tct_uint light_profile_index,
492 tct_float const theta_phi[2]);
493
495 tct_bool (*m_df_bsdf_measurement_isvalid)(
496 Texture_handler_base const *self,
497 tct_uint bsdf_measurement_index);
498
503 void (*m_df_bsdf_measurement_resolution)(
504 tct_uint result[3],
505 Texture_handler_base const *self,
506 tct_uint bsdf_measurement_index,
507 Mbsdf_part part);
508
510 void (*m_df_bsdf_measurement_evaluate)(
511 tct_float result[3],
512 Texture_handler_base const *self,
513 tct_uint bsdf_measurement_index,
514 tct_float const theta_phi_in[2],
515 tct_float const theta_phi_out[2],
516 Mbsdf_part part);
517
519 void (*m_df_bsdf_measurement_sample)(
520 tct_float result[3],
522 Texture_handler_base const *self,
523 tct_uint bsdf_measurement_index,
524 tct_float const theta_phi_out[2],
525 tct_float const xi[3],
527 Mbsdf_part part);
528
530 tct_float (*m_df_bsdf_measurement_pdf)(
531 Texture_handler_base const *self,
532 tct_uint bsdf_measurement_index,
533 tct_float const theta_phi_in[2],
534 tct_float const theta_phi_out[2],
535 Mbsdf_part part);
536
538 void (*m_df_bsdf_measurement_albedos)(
539 tct_float result[4],
545 Texture_handler_base const *self,
546 tct_uint bsdf_measurement_index,
547 tct_float const theta_phi[2]);
548
550 void (*m_adapt_normal)(
551 tct_float result[3],
552 Texture_handler_base const *self_base,
554 tct_float const normal[3]);
555
557 tct_bool (*m_scene_data_isvalid)(
558 Texture_handler_base const *self_base,
560 tct_uint scene_data_id);
561
563 tct_float (*m_scene_data_lookup_float)(
564 Texture_handler_base const *self_base,
566 tct_uint scene_data_id,
567 tct_float default_value,
568 tct_bool uniform_lookup);
569
571 void (*m_scene_data_lookup_float2)(
572 tct_float result[2],
573 Texture_handler_base const *self_base,
575 tct_uint scene_data_id,
576 tct_float const default_value[2],
577 tct_bool uniform_lookup);
578
580 void (*m_scene_data_lookup_float3)(
581 tct_float result[3],
582 Texture_handler_base const *self_base,
584 tct_uint scene_data_id,
585 tct_float const default_value[3],
586 tct_bool uniform_lookup);
587
589 void (*m_scene_data_lookup_float4)(
590 tct_float result[4],
591 Texture_handler_base const *self_base,
593 tct_uint scene_data_id,
594 tct_float const default_value[4],
595 tct_bool uniform_lookup);
596
598 tct_int (*m_scene_data_lookup_int)(
599 Texture_handler_base const *self_base,
601 tct_uint scene_data_id,
602 tct_int default_value,
603 tct_bool uniform_lookup);
604
606 void (*m_scene_data_lookup_int2)(
607 tct_int result[2],
608 Texture_handler_base const *self_base,
610 tct_uint scene_data_id,
611 tct_int const default_value[2],
612 tct_bool uniform_lookup);
613
615 void (*m_scene_data_lookup_int3)(
616 tct_int result[3],
617 Texture_handler_base const *self_base,
619 tct_uint scene_data_id,
620 tct_int const default_value[3],
621 tct_bool uniform_lookup);
622
624 void (*m_scene_data_lookup_int4)(
625 tct_int result[4],
626 Texture_handler_base const *self_base,
628 tct_uint scene_data_id,
629 tct_int const default_value[4],
630 tct_bool uniform_lookup);
631
633 void (*m_scene_data_lookup_color)(
634 tct_float result[3],
635 Texture_handler_base const *self_base,
637 tct_uint scene_data_id,
638 tct_float const default_value[3],
639 tct_bool uniform_lookup);
640
643 void (*m_scene_data_lookup_float4x4)(
644 tct_float result[16],
645 Texture_handler_base const *self_base,
647 tct_uint scene_data_id,
648 tct_float const default_value[16],
649 tct_bool uniform_lookup);
650 //
651 // The following functions are only used in the derivative variant,
652 // and can be \c nullptr in the non-derivative variant
653 //
654
656 void (*m_scene_data_lookup_deriv_float)(
657 tct_deriv_float *result,
658 Texture_handler_base const *self_base,
660 tct_uint scene_data_id,
661 tct_deriv_float const *default_value,
662 tct_bool uniform_lookup);
663
665 void (*m_scene_data_lookup_deriv_float2)(
666 tct_deriv_arr_float_2 *result,
667 Texture_handler_base const *self_base,
669 tct_uint scene_data_id,
670 tct_deriv_arr_float_2 const *default_value,
671 tct_bool uniform_lookup);
672
674 void (*m_scene_data_lookup_deriv_float3)(
675 tct_deriv_arr_float_3 *result,
676 Texture_handler_base const *self_base,
678 tct_uint scene_data_id,
679 tct_deriv_arr_float_3 const *default_value,
680 tct_bool uniform_lookup);
681
683 void (*m_scene_data_lookup_deriv_float4)(
684 tct_deriv_arr_float_4 *result,
685 Texture_handler_base const *self_base,
687 tct_uint scene_data_id,
688 tct_deriv_arr_float_4 const *default_value,
689 tct_bool uniform_lookup);
690
692 void (*m_scene_data_lookup_deriv_color)(
693 tct_deriv_arr_float_3 *result,
694 Texture_handler_base const *self_base,
696 tct_uint scene_data_id,
697 tct_deriv_arr_float_3 const *default_value,
698 tct_bool uniform_lookup);
699};
700
703
706
711{
715};
716
721{
725};
726
727
730{
731 void const *shared_data;
734};
735
738{
739 BSDF_EVENT_ABSORB = 0,
740
741 BSDF_EVENT_DIFFUSE = 1,
742 BSDF_EVENT_GLOSSY = 1 << 1,
743 BSDF_EVENT_SPECULAR = 1 << 2,
744 BSDF_EVENT_REFLECTION = 1 << 3,
745 BSDF_EVENT_TRANSMISSION = 1 << 4,
746
747 BSDF_EVENT_DIFFUSE_REFLECTION = BSDF_EVENT_DIFFUSE | BSDF_EVENT_REFLECTION,
748 BSDF_EVENT_DIFFUSE_TRANSMISSION = BSDF_EVENT_DIFFUSE | BSDF_EVENT_TRANSMISSION,
749 BSDF_EVENT_GLOSSY_REFLECTION = BSDF_EVENT_GLOSSY | BSDF_EVENT_REFLECTION,
750 BSDF_EVENT_GLOSSY_TRANSMISSION = BSDF_EVENT_GLOSSY | BSDF_EVENT_TRANSMISSION,
751 BSDF_EVENT_SPECULAR_REFLECTION = BSDF_EVENT_SPECULAR | BSDF_EVENT_REFLECTION,
752 BSDF_EVENT_SPECULAR_TRANSMISSION = BSDF_EVENT_SPECULAR | BSDF_EVENT_TRANSMISSION
753 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(BSDF_EVENT_FORCE_32_BIT, 0xffffffffU)
754};
755
759#define MI_NEURAYLIB_BSDF_USE_MATERIAL_IOR (-1.0f)
760
763{
765
766 DF_FLAGS_ALLOW_REFLECT = 1,
767 DF_FLAGS_ALLOW_TRANSMIT = 2,
768 DF_FLAGS_ALLOW_REFLECT_AND_TRANSMIT = DF_FLAGS_ALLOW_REFLECT | DF_FLAGS_ALLOW_TRANSMIT,
769 DF_FLAGS_ALLOWED_SCATTER_MODE_MASK = DF_FLAGS_ALLOW_REFLECT_AND_TRANSMIT
770 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(DF_FLAGS_FORCE_32_BIT, 0xffffffffU)
771};
772
774struct alignas(16) Bsdf_sample_data
775{
779
786
789};
790
793{
800};
801
803struct alignas(16) Bsdf_evaluate_data_base {};
804
805template<Df_handle_slot_mode N>
806struct Bsdf_evaluate_data : public Bsdf_evaluate_data_base
807{
808 tct_float3 ior1;
809 tct_float3 ior2;
810 tct_float3 k1;
811
812 tct_float3 k2;
813 tct_int handle_offset;
816 tct_float3 bsdf_diffuse[static_cast<size_t>(N)];
818 tct_float3 bsdf_glossy[static_cast<size_t>(N)];
820 tct_float pdf;
821
822 Df_flags flags;
824};
825
826template<>
827struct Bsdf_evaluate_data<DF_HSM_POINTER> : public Bsdf_evaluate_data_base
828{
829 tct_float3 ior1;
830 tct_float3 ior2;
831 tct_float3 k1;
832
833 tct_float3 k2;
834 tct_int handle_offset;
836 tct_int handle_count;
837 tct_float3* bsdf_diffuse;
838 tct_float3* bsdf_glossy;
839 tct_float pdf;
840
841 Df_flags flags;
843};
844
845template<>
846struct Bsdf_evaluate_data<DF_HSM_NONE> : public Bsdf_evaluate_data_base
847{
848 tct_float3 ior1;
849 tct_float3 ior2;
850 tct_float3 k1;
851
852 tct_float3 k2;
853 tct_float3 bsdf_diffuse;
854 tct_float3 bsdf_glossy;
855 tct_float pdf;
856
857 Df_flags flags;
859};
860
862struct alignas(16) Bsdf_pdf_data
863{
867
870
873};
874
876struct alignas(16) Bsdf_auxiliary_data_base {};
877
878template<Df_handle_slot_mode N>
879struct Bsdf_auxiliary_data : public Bsdf_auxiliary_data_base
880{
881 tct_float3 ior1;
882 tct_float3 ior2;
883 tct_float3 k1;
884
885 tct_int handle_offset;
888 tct_float3 albedo_diffuse[static_cast<size_t>(N)];
890 tct_float3 albedo_glossy[static_cast<size_t>(N)];
891 tct_float3 normal[static_cast<size_t>(N)];
892 tct_float3 roughness[static_cast<size_t>(N)];
894
895 Df_flags flags;
897};
898
899template<>
900struct Bsdf_auxiliary_data<DF_HSM_POINTER> : public Bsdf_auxiliary_data_base
901{
902 tct_float3 ior1;
903 tct_float3 ior2;
904 tct_float3 k1;
905
906 tct_int handle_offset;
909 tct_int handle_count;
910 tct_float3* albedo_diffuse;
911 tct_float3* albedo_glossy;
912 tct_float3* normal;
913 tct_float3* roughness;
915
916 Df_flags flags;
918};
919
920template<>
921struct Bsdf_auxiliary_data<DF_HSM_NONE> : public Bsdf_auxiliary_data_base
922{
923 tct_float3 ior1;
924 tct_float3 ior2;
925 tct_float3 k1;
926
927 tct_float3 albedo_diffuse;
928 tct_float3 albedo_glossy;
929 tct_float3 normal;
930 tct_float3 roughness;
932
933 Df_flags flags;
935};
936
937// Signatures for generated target code functions.
938
948 void *result,
949 Shading_state_environment const *state,
950 Resource_data const *res_data,
951 char const *arg_block_data);
952
953
963 void *result,
964 Shading_state_material const *state,
965 Resource_data const *res_data,
966 char const *arg_block_data);
967
968
978 void *result,
980 Resource_data const *res_data,
981 char const *arg_block_data);
982
983
984// SWIG has problems with these function type definitions, so ignore in SWIG.
985#ifndef SWIG
986template<typename T>
987struct Material_function
988{
998 using Type = T(
999 Shading_state_material const *state,
1000 Resource_data const *res_data,
1001 char const *arg_block_data);
1002
1012 using Type_with_derivs = T(
1014 Resource_data const *res_data,
1015 char const *arg_block_data);
1016};
1017#endif // not SWIG
1018
1019
1033 Resource_data const *res_data,
1034 char const *arg_block_data);
1035
1036
1050 Resource_data const *res_data,
1051 char const *arg_block_data);
1052
1053
1063 Bsdf_sample_data *data,
1064 Shading_state_material const *state,
1065 Resource_data const *res_data,
1066 char const *arg_block_data);
1067
1068
1078 Bsdf_sample_data *data,
1080 Resource_data const *res_data,
1081 char const *arg_block_data);
1082
1083
1094 Shading_state_material const *state,
1095 Resource_data const *res_data,
1096 char const *arg_block_data);
1097
1098
1110 Resource_data const *res_data,
1111 char const *arg_block_data);
1112
1113
1123 Bsdf_pdf_data *data,
1124 Shading_state_material const *state,
1125 Resource_data const *res_data,
1126 char const *arg_block_data);
1127
1128
1138 Bsdf_pdf_data *data,
1140 Resource_data const *res_data,
1141 char const *arg_block_data);
1142
1153 Shading_state_material const *state,
1154 Resource_data const *res_data,
1155 char const *arg_block_data);
1156
1157
1169 Resource_data const *res_data,
1170 char const *arg_block_data);
1171
1174{
1175 EDF_EVENT_NONE = 0,
1176 EDF_EVENT_EMISSION = 1
1177 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(EDF_EVENT_FORCE_32_BIT, 0xffffffffU)
1178};
1179
1180
1182struct alignas(16) Edf_sample_data
1183{
1190};
1191
1193struct alignas(16) Edf_evaluate_data_base {};
1194
1195template<Df_handle_slot_mode N>
1196struct Edf_evaluate_data : public Edf_evaluate_data_base
1197{
1198 tct_float3 k1;
1199 tct_int handle_offset;
1202 tct_float cos;
1203 tct_float3 edf[static_cast<size_t>(N)];
1204 tct_float pdf;
1205};
1206
1207template<>
1208struct Edf_evaluate_data<DF_HSM_POINTER> : public Edf_evaluate_data_base
1209{
1210 tct_float3 k1;
1211 tct_int handle_offset;
1214 tct_int handle_count;
1215 tct_float cos;
1216 tct_float3* edf;
1217 tct_float pdf;
1218};
1219
1220template<>
1221struct Edf_evaluate_data<DF_HSM_NONE> : public Edf_evaluate_data_base
1222{
1223 tct_float3 k1;
1224 tct_float cos;
1225 tct_float3 edf;
1226 tct_float pdf;
1227};
1228
1230struct alignas(16) Edf_pdf_data
1231{
1234};
1235
1237struct alignas(16) Edf_auxiliary_data_base {};
1238
1239template<Df_handle_slot_mode N>
1240struct Edf_auxiliary_data : public Edf_auxiliary_data_base
1241{
1242 tct_float3 k1;
1243 tct_int handle_offset;
1246
1247 // reserved for future use
1248};
1249
1250template<>
1251struct Edf_auxiliary_data<DF_HSM_POINTER> : public Edf_auxiliary_data_base
1252{
1253 tct_float3 k1;
1254 tct_int handle_offset;
1257 tct_int handle_count;
1258
1259 // reserved for future use
1260};
1261
1262template<>
1263struct Edf_auxiliary_data<DF_HSM_NONE> : public Edf_auxiliary_data_base
1264{
1265 tct_float3 k1;
1266
1267 // reserved for future use
1268};
1269
1283 Resource_data const *res_data,
1284 char const *arg_block_data);
1285
1286
1300 Resource_data const *res_data,
1301 char const *arg_block_data);
1302
1303
1313 Edf_sample_data *data,
1314 Shading_state_material const *state,
1315 Resource_data const *res_data,
1316 char const *arg_block_data);
1317
1318
1328 Edf_sample_data *data,
1330 Resource_data const *res_data,
1331 char const *arg_block_data);
1332
1333
1344 Shading_state_material const *state,
1345 Resource_data const *res_data,
1346 char const *arg_block_data);
1347
1348
1360 Resource_data const *res_data,
1361 char const *arg_block_data);
1362
1363
1372using Edf_pdf_function = void(
1373 Edf_pdf_data *data,
1374 Shading_state_material const *state,
1375 Resource_data const *res_data,
1376 char const *arg_block_data);
1377
1378
1388 Edf_pdf_data *data,
1390 Resource_data const *res_data,
1391 char const *arg_block_data);
1392
1403 Shading_state_material const *state,
1404 Resource_data const *res_data,
1405 char const *arg_block_data);
1406
1407
1419 Resource_data const *res_data,
1420 char const *arg_block_data);
1421 // end group mi_neuray_mdl_compiler
1423
1424} // namespace neuraylib
1425
1426} // namespace mi
1427
1428#endif // MI_NEURAYLIB_TARGET_CODE_TYPES_H
int Sint32
32-bit signed integer.
Definition: types.h:46
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
Color cos(const Color &c)
Returns a color with the elementwise cosine of the color c.
Definition: color.h:546
math::Vector_struct<Float32, 2> Float32_2_struct
Vector of two Float32 (underlying POD type).
Definition: vector_typedefs.h:187
math::Vector_struct<Float32, 4> Float32_4_struct
Vector of four Float32 (underlying POD type).
Definition: vector_typedefs.h:201
math::Vector_struct<Float32, 3> Float32_3_struct
Vector of three Float32 (underlying POD type).
Definition: vector_typedefs.h:194
bool tct_bool
A bool.
Definition: target_code_types.h:85
float tct_float
A float.
Definition: target_code_types.h:65
void(void *result, Shading_state_environment const *state, Resource_data const *res_data, char const *arg_block_data) Environment_function
Signature of environment functions created via mi::neuraylib::IMdl_backend::translate_environment() a...
Definition: target_code_types.h:951
Df_handle_slot_mode
Type of Bsdf_evaluate_data variants, depending on the backend and its configuration.
Definition: target_code_types.h:793
mi::Float32_4_struct tct_float4
A float4.
Definition: target_code_types.h:74
mi::Float32_2_struct tct_float2
A float2.
Definition: target_code_types.h:68
Bsdf_event_type
The type of events created by BSDF importance sampling.
Definition: target_code_types.h:738
void(Edf_auxiliary_data_base *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data) Edf_auxiliary_function_with_derivs
Signature of the auxiliary function for material distribution functions created via mi::neuraylib::IM...
Definition: target_code_types.h:1420
void(Bsdf_auxiliary_data_base *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data) Bsdf_auxiliary_function
Signature of the auxiliary function for material distribution functions created via mi::neuraylib::IM...
Definition: target_code_types.h:1155
tct_traits<true>::tct_derivable_float tct_deriv_float
A float with derivatives.
Definition: target_code_types.h:120
void(void *result, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data) Material_expr_function
Signature of material expression functions created via mi::neuraylib::IMdl_backend::translate_materia...
Definition: target_code_types.h:966
void(Bsdf_evaluate_data_base *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data) Bsdf_evaluate_function_with_derivs
Signature of the evaluation function for material distribution functions created via mi::neuraylib::I...
Definition: target_code_types.h:1111
void(Edf_evaluate_data_base *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data) Edf_evaluate_function
Signature of the evaluation function for material distribution functions created via mi::neuraylib::I...
Definition: target_code_types.h:1346
void(Edf_auxiliary_data_base *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data) Edf_auxiliary_function
Signature of the auxiliary function for material distribution functions created via mi::neuraylib::IM...
Definition: target_code_types.h:1405
Mbsdf_part
MBSDFs can consist of two parts, which can be selected using this enumeration.
Definition: target_code_types.h:325
void(Shading_state_material *state, Resource_data const *res_data, char const *arg_block_data) Bsdf_init_function
Signature of the initialization function for material distribution functions created via mi::neurayli...
Definition: target_code_types.h:1034
Tex_wrap_mode
The texture wrap modes as defined by tex::wrap_mode in the MDL specification.
Definition: target_code_types.h:306
void(Bsdf_sample_data *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data) Bsdf_sample_function_with_derivs
Signature of the importance sampling function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1081
void(Edf_sample_data *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data) Edf_sample_function_with_derivs
Signature of the importance sampling function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1331
void(Shading_state_material_with_derivs *state, Resource_data const *res_data, char const *arg_block_data) Bsdf_init_function_with_derivs
Signature of the initialization function for material distribution functions created via mi::neurayli...
Definition: target_code_types.h:1051
mi::Float32_3_struct tct_float3
A float3.
Definition: target_code_types.h:71
void(Edf_evaluate_data_base *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data) Edf_evaluate_function_with_derivs
Signature of the evaluation function for material distribution functions created via mi::neuraylib::I...
Definition: target_code_types.h:1361
void(void *result, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data) Material_expr_function_with_derivs
Signature of material expression functions created via mi::neuraylib::IMdl_backend::translate_materia...
Definition: target_code_types.h:981
void(Bsdf_auxiliary_data_base *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data) Bsdf_auxiliary_function_with_derivs
Signature of the auxiliary function for material distribution functions created via mi::neuraylib::IM...
Definition: target_code_types.h:1170
void(Bsdf_sample_data *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data) Bsdf_sample_function
Signature of the importance sampling function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1066
Edf_event_type
The type of events created by EDF importance sampling.
Definition: target_code_types.h:1174
mi::Sint32 tct_int
An int.
Definition: target_code_types.h:77
void(Edf_pdf_data *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data) Edf_pdf_function
Signature of the probability density function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1376
mi::Uint32 tct_uint
An unsigned int.
Definition: target_code_types.h:80
void(Shading_state_material_with_derivs *state, Resource_data const *res_data, char const *arg_block_data) Edf_init_function_with_derivs
Signature of the initialization function for material distribution functions created via mi::neurayli...
Definition: target_code_types.h:1301
void(Bsdf_pdf_data *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data) Bsdf_pdf_function
Signature of the probability density function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1126
Df_flags
Flags controlling the calculation of DF results.
Definition: target_code_types.h:763
tct_traits<true>::tct_derivable_float2 tct_deriv_float2
A float2 with derivatives.
Definition: target_code_types.h:123
void(Bsdf_evaluate_data_base *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data) Bsdf_evaluate_function
Signature of the evaluation function for material distribution functions created via mi::neuraylib::I...
Definition: target_code_types.h:1096
void(Edf_pdf_data *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data) Edf_pdf_function_with_derivs
Signature of the probability density function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1391
void(Edf_sample_data *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data) Edf_sample_function
Signature of the importance sampling function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1316
void(Bsdf_pdf_data *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data) Bsdf_pdf_function_with_derivs
Signature of the probability density function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1141
tct_traits<true>::tct_derivable_float4 tct_deriv_float4
A float4 with derivatives.
Definition: target_code_types.h:129
void(Shading_state_material *state, Resource_data const *res_data, char const *arg_block_data) Edf_init_function
Signature of the initialization function for material distribution functions created via mi::neurayli...
Definition: target_code_types.h:1284
tct_traits<true>::tct_derivable_float3 tct_deriv_float3
A float3 with derivatives.
Definition: target_code_types.h:126
@ DF_HSM_POINTER
Uses renderer defined buffers; not supported by all backends.
Definition: target_code_types.h:794
@ DF_HSM_FIXED_2
fixed size array for processing 2 handle at a time
Definition: target_code_types.h:797
@ DF_HSM_NONE
No slots, handles are ignored completely.
Definition: target_code_types.h:795
@ DF_HSM_FIXED_8
fixed size array for processing 8 handle at a time
Definition: target_code_types.h:799
@ DF_HSM_FIXED_1
fixed size array for processing 1 handle at a time
Definition: target_code_types.h:796
@ DF_HSM_FIXED_4
fixed size array for processing 4 handle at a time
Definition: target_code_types.h:798
@ MBSDF_DATA_TRANSMISSION
the bidirectional transmission distribution function (BTDF)
Definition: target_code_types.h:330
@ MBSDF_DATA_REFLECTION
the bidirectional reflection distribution function (BRDF)
Definition: target_code_types.h:327
@ TEX_WRAP_CLIP
tex::wrap_clip: makes the texture lookup return zero for texture coordinates outside of the range
Definition: target_code_types.h:320
@ TEX_WRAP_MIRRORED_REPEAT
tex::wrap_mirrored_repeat: like wrap_repeat but takes one minus the fractional part every other inter...
Definition: target_code_types.h:316
@ TEX_WRAP_REPEAT
tex::wrap_repeat: takes the fractional part of the lookup coordinate effectively repeating the textur...
Definition: target_code_types.h:312
@ TEX_WRAP_CLAMP
tex::wrap_clamp: clamps the lookup coordinate to the range
Definition: target_code_types.h:308
@ DF_FLAGS_NONE
allows nothing -> black
Definition: target_code_types.h:764
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: neuraylib.h:179
Major and minor version number and an optional qualifier.
Generic storage class template for math vector representations storing DIM elements of type T.
Definition: vector.h:135
Input and output structure for BSDF auxiliary calculation data.
Definition: target_code_types.h:876
Input and output structure for BSDF evaluation data.
Definition: target_code_types.h:803
Input and output structure for BSDF PDF calculation data.
Definition: target_code_types.h:863
tct_float3 ior2
mutual input: IOR other side
Definition: target_code_types.h:865
Df_flags flags
input: flags controlling calculation of result (optional depending on backend options)
Definition: target_code_types.h:871
tct_float3 k2
input: incoming direction
Definition: target_code_types.h:868
tct_float3 ior1
mutual input: IOR current medium
Definition: target_code_types.h:864
tct_float pdf
output: pdf (non-projected hemisphere)
Definition: target_code_types.h:869
tct_float3 k1
mutual input: outgoing direction
Definition: target_code_types.h:866
Input and output structure for BSDF sampling data.
Definition: target_code_types.h:775
tct_float4 xi
input: pseudo-random sample numbers in range [0, 1)
Definition: target_code_types.h:781
tct_float pdf
output: pdf (non-projected hemisphere)
Definition: target_code_types.h:782
Df_flags flags
input: flags controlling calculation of result (optional depending on backend options)
Definition: target_code_types.h:787
tct_int handle
output: handle of the sampled elemental BSDF (lobe)
Definition: target_code_types.h:785
tct_float3 ior2
mutual input: IOR other side
Definition: target_code_types.h:777
tct_float3 k1
mutual input: outgoing direction
Definition: target_code_types.h:778
tct_float3 k2
output: incoming direction
Definition: target_code_types.h:780
Bsdf_event_type event_type
output: the type of event for the generated sample
Definition: target_code_types.h:784
tct_float3 ior1
mutual input: IOR current medium
Definition: target_code_types.h:776
tct_float3 bsdf_over_pdf
output: bsdf * dot(normal, k2) / pdf
Definition: target_code_types.h:783
Input and output structure for EDF auxiliary calculation data.
Definition: target_code_types.h:1237
Input and output structure for EDF evaluation data.
Definition: target_code_types.h:1193
Input and output structure for EDF PDF calculation data.
Definition: target_code_types.h:1231
tct_float pdf
output: pdf (non-projected hemisphere)
Definition: target_code_types.h:1233
tct_float3 k1
input: outgoing direction
Definition: target_code_types.h:1232
Input and output structure for EDF sampling data.
Definition: target_code_types.h:1183
tct_int handle
output: handle of the sampled elemental EDF (lobe)
Definition: target_code_types.h:1189
tct_float3 k1
output: outgoing direction
Definition: target_code_types.h:1185
tct_float3 edf_over_pdf
output: edf * dot(normal,k1) / pdf
Definition: target_code_types.h:1187
tct_float pdf
output: pdf (non-projected hemisphere)
Definition: target_code_types.h:1186
tct_float4 xi
input: pseudo-random sample numbers in range [0, 1)
Definition: target_code_types.h:1184
Edf_event_type event_type
output: the type of event for the generated sample
Definition: target_code_types.h:1188
The data structure providing access to resources for generated code.
Definition: target_code_types.h:730
void const * shared_data
currently unused, should be nullptr
Definition: target_code_types.h:731
Texture_handler_base const * texture_handler
will be provided as "self" parameter to texture functions
Definition: target_code_types.h:732
The MDL environment state structure inside the MDL SDK is a representation of the renderer state in t...
Definition: target_code_types.h:155
tct_float3 direction
The result of state::direction().
Definition: target_code_types.h:158
char const * ro_data_segment
A pointer to a read-only data segment.
Definition: target_code_types.h:173
The MDL material state structure inside the MDL SDK is a representation of the renderer state as defi...
Definition: target_code_types.h:206
tct_float3 normal
The result of state::normal().
Definition: target_code_types.h:213
char const * ro_data_segment
A pointer to a read-only data segment.
Definition: target_code_types.h:267
tct_int object_id
The result of state::object_id().
Definition: target_code_types.h:287
traits::tct_derivable_float3 position
The result of state::position().
Definition: target_code_types.h:221
tct_float4 const * world_to_object
A 4x4 transformation matrix in row-major order transforming from world to object coordinates.
Definition: target_code_types.h:274
tct_float3 const * tangent_v
An array containing the results of state::texture_tangent_v(i).
Definition: target_code_types.h:244
tct_float4 const * object_to_world
A 4x4 transformation matrix in row-major order transforming from object to world coordinates.
Definition: target_code_types.h:281
traits::tct_derivable_float3 const * text_coords
An array containing the results of state::texture_coordinate(i).
Definition: target_code_types.h:230
tct_float animation_time
The result of state::animation_time().
Definition: target_code_types.h:225
tct_float3 geom_normal
The result of state::geometry_normal().
Definition: target_code_types.h:217
tct_float3 const * tangent_u
An array containing the results of state::texture_tangent_u(i).
Definition: target_code_types.h:237
tct_float meters_per_scene_unit
The result of state::meters_per_scene_unit().
Definition: target_code_types.h:292
tct_float4 * text_results
The texture results lookup table.
Definition: target_code_types.h:252
The texture handler structure that is passed to the texturing functions.
Definition: target_code_types.h:711
Texture_handler_vtable const * vtable
In vtable-mode, the vtable field is used to call the texturing functions.
Definition: target_code_types.h:714
The texture handler structure that is passed to the texturing functions with derivative support.
Definition: target_code_types.h:721
Texture_handler_deriv_vtable const * vtable
In vtable-mode, the vtable field is used to call the texturing functions.
Definition: target_code_types.h:724
The runtime for bitmap texture access for the generated target code can optionally be implemented in ...
Definition: target_code_types.h:342
A template struct with derivatives.
Definition: target_code_types.h:91
Helper traits struct to switch between derivative and non-derivative types.
Definition: target_code_types.h:97
Typedefs for types from the math API.