MDL SDK API nvidia_logo_transpbg.gif Up
target_code_types.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2024 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// Portable alignment macro supporting pre C++11.
11#ifndef __align__
12#ifdef _MSC_VER
13#define __align__(n) __declspec(align(n))
14#else
15#define __align__(n) __attribute__((aligned(n)))
16#endif
17#endif
18
19
20// If neither TARGET_CODE_USE_CUDA_TYPES nor TARGET_CODE_USE_NEURAY_TYPES is set,
21// it will default to CUDA types when compiled by a CUDA compiler and use Neuray types otherwise.
22
23#if defined(TARGET_CODE_USE_CUDA_TYPES) && defined(TARGET_CODE_USE_NEURAY_TYPES)
24#error "Only one of TARGET_CODE_USE_CUDA_TYPES and TARGET_CODE_USE_NEURAY_TYPES may be defined."
25#endif
26
27#if !defined(TARGET_CODE_USE_NEURAY_TYPES) && \
28 (defined(TARGET_CODE_USE_CUDA_TYPES) || defined(__CUDA_ARCH__))
29
30#include <vector_types.h>
31
32namespace mi {
33
34namespace neuraylib {
35
41typedef float tct_float;
42
44typedef float2 tct_float2;
45
47typedef float3 tct_float3;
48
50typedef float4 tct_float4;
51
53typedef int tct_int;
54
56typedef unsigned tct_uint;
57
58#else
59
61
62namespace mi {
63
64namespace neuraylib {
65
71typedef float tct_float;
72
75
78
81
84
87
88#endif
89
91typedef bool tct_bool;
92
93
95template<typename T>
97{
98 T val, dx, dy;
99};
100
102template<bool with_derivatives>
104
105template<>
106struct tct_traits<false>
107{
108 typedef tct_float tct_derivable_float;
109 typedef tct_float2 tct_derivable_float2;
110 typedef tct_float3 tct_derivable_float3;
111 typedef tct_float4 tct_derivable_float4;
112 typedef tct_float const tct_coord2_type[2];
113};
114
115template<>
116struct tct_traits<true>
117{
118 typedef tct_deriv<tct_float> tct_derivable_float;
119 typedef tct_deriv<tct_float2> tct_derivable_float2;
120 typedef tct_deriv<tct_float3> tct_derivable_float3;
121 typedef tct_deriv<tct_float4> tct_derivable_float4;
122 typedef tct_derivable_float2 const * tct_coord2_type;
123};
124
127
130
133
136
139
142
145
146
164
178 char const *ro_data_segment;
179};
180
181
209template<bool with_derivatives = false>
212
218
222
225 typename traits::tct_derivable_float3 position;
226
230
234 typename traits::tct_derivable_float3 const *text_coords;
235
242
249
257
271 char const *ro_data_segment;
272
279
286
292
297};
298
301
304
305
312
316
320
323 TEX_WRAP_CLIP = 3
325
328{
331
335
336
337// Forward declaration of texture handler structure.
338struct Texture_handler_base;
339
340
343template<bool with_derivatives = false>
346
348 void (*m_tex_lookup_float4_2d)(
349 tct_float result[4],
350 Texture_handler_base const *self,
351 tct_uint texture_idx,
352 typename traits::tct_coord2_type coord,
353 Tex_wrap_mode wrap_u,
354 Tex_wrap_mode wrap_v,
355 tct_float const crop_u[2],
356 tct_float const crop_v[2],
357 tct_float frame);
358
360 void (*m_tex_lookup_float3_2d)(
361 tct_float result[3],
362 Texture_handler_base const *self,
363 tct_uint texture_idx,
364 typename traits::tct_coord2_type coord,
365 Tex_wrap_mode wrap_u,
366 Tex_wrap_mode wrap_v,
367 tct_float const crop_u[2],
368 tct_float const crop_v[2],
369 tct_float frame);
370
372 void (*m_tex_texel_float4_2d)(
373 tct_float result[4],
374 Texture_handler_base const *self,
375 tct_uint texture_idx,
376 tct_int const coord[2],
377 tct_int const uv_tile[2],
378 tct_float frame);
379
381 void (*m_tex_lookup_float4_3d)(
382 tct_float result[4],
383 Texture_handler_base const *self,
384 tct_uint texture_idx,
385 tct_float const coord[3],
386 Tex_wrap_mode wrap_u,
387 Tex_wrap_mode wrap_v,
388 Tex_wrap_mode wrap_w,
389 tct_float const crop_u[2],
390 tct_float const crop_v[2],
391 tct_float const crop_w[2],
392 tct_float frame);
393
395 void (*m_tex_lookup_float3_3d)(
396 tct_float result[3],
397 Texture_handler_base const *self,
398 tct_uint texture_idx,
399 tct_float const coord[3],
400 Tex_wrap_mode wrap_u,
401 Tex_wrap_mode wrap_v,
402 Tex_wrap_mode wrap_w,
403 tct_float const crop_u[2],
404 tct_float const crop_v[2],
405 tct_float const crop_w[2],
406 tct_float frame);
407
409 void (*m_tex_texel_float4_3d)(
410 tct_float result[4],
411 Texture_handler_base const *self,
412 tct_uint texture_idx,
413 tct_int const coord[3],
414 tct_float frame);
415
417 void (*m_tex_lookup_float4_cube)(
418 tct_float result[4],
419 Texture_handler_base const *self,
420 tct_uint texture_idx,
421 tct_float const coord[3]);
422
424 void (*m_tex_lookup_float3_cube)(
425 tct_float result[3],
426 Texture_handler_base const *self,
427 tct_uint texture_idx,
428 tct_float const coord[3]);
429
433 void (*m_tex_resolution_2d)(
434 tct_int result[2],
435 Texture_handler_base const *self,
436 tct_uint texture_idx,
437 tct_int const uv_tile[2],
438 tct_float frame);
439
443 void (*m_tex_resolution_3d)(
444 tct_int result[3],
445 Texture_handler_base const *self,
446 tct_uint texture_idx,
447 tct_float frame);
448
450 tct_bool (*m_tex_texture_isvalid)(
451 Texture_handler_base const *self,
452 tct_uint texture_idx);
453
456 void (*m_tex_frame)(
457 tct_int result[2],
458 Texture_handler_base const *self,
459 tct_uint texture_idx);
460
462 tct_float (*m_df_light_profile_power)(
463 Texture_handler_base const *self,
464 tct_uint light_profile_index);
465
467 tct_float (*m_df_light_profile_maximum)(
468 Texture_handler_base const *self,
469 tct_uint light_profile_index);
470
472 tct_bool (*m_df_light_profile_isvalid)(
473 Texture_handler_base const *self,
474 tct_uint light_profile_index);
475
477 tct_float (*m_df_light_profile_evaluate)(
478 Texture_handler_base const *self,
479 tct_uint light_profile_index,
480 tct_float const theta_phi[2]);
481
483 void (*m_df_light_profile_sample)(
484 tct_float result[3],
486 Texture_handler_base const *self,
487 tct_uint light_profile_index,
488 tct_float const xi[3]);
489
491 tct_float (*m_df_light_profile_pdf)(
492 Texture_handler_base const *self,
493 tct_uint light_profile_index,
494 tct_float const theta_phi[2]);
495
497 tct_bool (*m_df_bsdf_measurement_isvalid)(
498 Texture_handler_base const *self,
499 tct_uint bsdf_measurement_index);
500
505 void (*m_df_bsdf_measurement_resolution)(
506 tct_uint result[3],
507 Texture_handler_base const *self,
508 tct_uint bsdf_measurement_index,
509 Mbsdf_part part);
510
512 void (*m_df_bsdf_measurement_evaluate)(
513 tct_float result[3],
514 Texture_handler_base const *self,
515 tct_uint bsdf_measurement_index,
516 tct_float const theta_phi_in[2],
517 tct_float const theta_phi_out[2],
518 Mbsdf_part part);
519
521 void (*m_df_bsdf_measurement_sample)(
522 tct_float result[3],
524 Texture_handler_base const *self,
525 tct_uint bsdf_measurement_index,
526 tct_float const theta_phi_out[2],
527 tct_float const xi[3],
529 Mbsdf_part part);
530
532 tct_float (*m_df_bsdf_measurement_pdf)(
533 Texture_handler_base const *self,
534 tct_uint bsdf_measurement_index,
535 tct_float const theta_phi_in[2],
536 tct_float const theta_phi_out[2],
537 Mbsdf_part part);
538
540 void (*m_df_bsdf_measurement_albedos)(
541 tct_float result[4],
547 Texture_handler_base const *self,
548 tct_uint bsdf_measurement_index,
549 tct_float const theta_phi[2]);
550
552 void (*m_adapt_normal)(
553 tct_float result[3],
554 Texture_handler_base const *self_base,
556 tct_float const normal[3]);
557
559 tct_bool (*m_scene_data_isvalid)(
560 Texture_handler_base const *self_base,
562 tct_uint scene_data_id);
563
565 tct_float (*m_scene_data_lookup_float)(
566 Texture_handler_base const *self_base,
568 tct_uint scene_data_id,
569 tct_float default_value,
570 tct_bool uniform_lookup);
571
573 void (*m_scene_data_lookup_float2)(
574 tct_float result[2],
575 Texture_handler_base const *self_base,
577 tct_uint scene_data_id,
578 tct_float const default_value[2],
579 tct_bool uniform_lookup);
580
582 void (*m_scene_data_lookup_float3)(
583 tct_float result[3],
584 Texture_handler_base const *self_base,
586 tct_uint scene_data_id,
587 tct_float const default_value[3],
588 tct_bool uniform_lookup);
589
591 void (*m_scene_data_lookup_float4)(
592 tct_float result[4],
593 Texture_handler_base const *self_base,
595 tct_uint scene_data_id,
596 tct_float const default_value[4],
597 tct_bool uniform_lookup);
598
600 tct_int (*m_scene_data_lookup_int)(
601 Texture_handler_base const *self_base,
603 tct_uint scene_data_id,
604 tct_int default_value,
605 tct_bool uniform_lookup);
606
608 void (*m_scene_data_lookup_int2)(
609 tct_int result[2],
610 Texture_handler_base const *self_base,
612 tct_uint scene_data_id,
613 tct_int const default_value[2],
614 tct_bool uniform_lookup);
615
617 void (*m_scene_data_lookup_int3)(
618 tct_int result[3],
619 Texture_handler_base const *self_base,
621 tct_uint scene_data_id,
622 tct_int const default_value[3],
623 tct_bool uniform_lookup);
624
626 void (*m_scene_data_lookup_int4)(
627 tct_int result[4],
628 Texture_handler_base const *self_base,
630 tct_uint scene_data_id,
631 tct_int const default_value[4],
632 tct_bool uniform_lookup);
633
635 void (*m_scene_data_lookup_color)(
636 tct_float result[3],
637 Texture_handler_base const *self_base,
639 tct_uint scene_data_id,
640 tct_float const default_value[3],
641 tct_bool uniform_lookup);
642
645 void (*m_scene_data_lookup_float4x4)(
646 tct_float result[16],
647 Texture_handler_base const *self_base,
649 tct_uint scene_data_id,
650 tct_float const default_value[16],
651 tct_bool uniform_lookup);
652 //
653 // The following functions are only used in the derivative variant,
654 // and can be nullptr in the non-derivative variant
655 //
656
658 void (*m_scene_data_lookup_deriv_float)(
659 tct_deriv_float *result,
660 Texture_handler_base const *self_base,
662 tct_uint scene_data_id,
663 tct_deriv_float const *default_value,
664 tct_bool uniform_lookup);
665
667 void (*m_scene_data_lookup_deriv_float2)(
668 tct_deriv_arr_float_2 *result,
669 Texture_handler_base const *self_base,
671 tct_uint scene_data_id,
672 tct_deriv_arr_float_2 const *default_value,
673 tct_bool uniform_lookup);
674
676 void (*m_scene_data_lookup_deriv_float3)(
677 tct_deriv_arr_float_3 *result,
678 Texture_handler_base const *self_base,
680 tct_uint scene_data_id,
681 tct_deriv_arr_float_3 const *default_value,
682 tct_bool uniform_lookup);
683
685 void (*m_scene_data_lookup_deriv_float4)(
686 tct_deriv_arr_float_4 *result,
687 Texture_handler_base const *self_base,
689 tct_uint scene_data_id,
690 tct_deriv_arr_float_4 const *default_value,
691 tct_bool uniform_lookup);
692
694 void (*m_scene_data_lookup_deriv_color)(
695 tct_deriv_arr_float_3 *result,
696 Texture_handler_base const *self_base,
698 tct_uint scene_data_id,
699 tct_deriv_arr_float_3 const *default_value,
700 tct_bool uniform_lookup);
701};
702
705
708
716};
717
725};
726
727
730 void const *shared_data;
733};
734
737 BSDF_EVENT_ABSORB = 0,
738
739 BSDF_EVENT_DIFFUSE = 1,
740 BSDF_EVENT_GLOSSY = 1 << 1,
741 BSDF_EVENT_SPECULAR = 1 << 2,
742 BSDF_EVENT_REFLECTION = 1 << 3,
743 BSDF_EVENT_TRANSMISSION = 1 << 4,
744
745 BSDF_EVENT_DIFFUSE_REFLECTION = BSDF_EVENT_DIFFUSE | BSDF_EVENT_REFLECTION,
746 BSDF_EVENT_DIFFUSE_TRANSMISSION = BSDF_EVENT_DIFFUSE | BSDF_EVENT_TRANSMISSION,
747 BSDF_EVENT_GLOSSY_REFLECTION = BSDF_EVENT_GLOSSY | BSDF_EVENT_REFLECTION,
748 BSDF_EVENT_GLOSSY_TRANSMISSION = BSDF_EVENT_GLOSSY | BSDF_EVENT_TRANSMISSION,
749 BSDF_EVENT_SPECULAR_REFLECTION = BSDF_EVENT_SPECULAR | BSDF_EVENT_REFLECTION,
750 BSDF_EVENT_SPECULAR_TRANSMISSION = BSDF_EVENT_SPECULAR | BSDF_EVENT_TRANSMISSION,
751
752 BSDF_EVENT_FORCE_32_BIT = 0xffffffffU
753};
754
758#define MI_NEURAYLIB_BSDF_USE_MATERIAL_IOR (-1.0f)
759
763
764 DF_FLAGS_ALLOW_REFLECT = 1,
765 DF_FLAGS_ALLOW_TRANSMIT = 2,
766 DF_FLAGS_ALLOW_REFLECT_AND_TRANSMIT = DF_FLAGS_ALLOW_REFLECT | DF_FLAGS_ALLOW_TRANSMIT,
767 DF_FLAGS_ALLOWED_SCATTER_MODE_MASK = DF_FLAGS_ALLOW_REFLECT_AND_TRANSMIT,
768
769 DF_FLAGS_FORCE_32_BIT = 0xffffffffU
770};
771
773struct __align__(16) Bsdf_sample_data {
777
784
787};
788
791{
798};
799
801struct __align__(16) Bsdf_evaluate_data_base {};
802
803template<Df_handle_slot_mode N>
804struct Bsdf_evaluate_data : public Bsdf_evaluate_data_base
805{
806 tct_float3 ior1;
807 tct_float3 ior2;
808 tct_float3 k1;
809
810 tct_float3 k2;
811 tct_int handle_offset;
814 tct_float3 bsdf_diffuse[static_cast<size_t>(N)];
816 tct_float3 bsdf_glossy[static_cast<size_t>(N)];
818 tct_float pdf;
819
820 Df_flags flags;
822};
823
824template<>
825struct Bsdf_evaluate_data<DF_HSM_POINTER> : public Bsdf_evaluate_data_base
826{
827 tct_float3 ior1;
828 tct_float3 ior2;
829 tct_float3 k1;
830
831 tct_float3 k2;
832 tct_int handle_offset;
834 tct_int handle_count;
835 tct_float3* bsdf_diffuse;
836 tct_float3* bsdf_glossy;
837 tct_float pdf;
838
839 Df_flags flags;
841};
842
843template<>
844struct Bsdf_evaluate_data<DF_HSM_NONE> : public Bsdf_evaluate_data_base
845{
846 tct_float3 ior1;
847 tct_float3 ior2;
848 tct_float3 k1;
849
850 tct_float3 k2;
851 tct_float3 bsdf_diffuse;
852 tct_float3 bsdf_glossy;
853 tct_float pdf;
854
855 Df_flags flags;
857};
858
860struct __align__(16) Bsdf_pdf_data {
864
867
870};
871
873struct __align__(16) Bsdf_auxiliary_data_base {};
874
875template<Df_handle_slot_mode N>
876struct Bsdf_auxiliary_data : public Bsdf_auxiliary_data_base
877{
878 tct_float3 ior1;
879 tct_float3 ior2;
880 tct_float3 k1;
881
882 tct_int handle_offset;
885 tct_float3 albedo_diffuse[static_cast<size_t>(N)];
887 tct_float3 albedo_glossy[static_cast<size_t>(N)];
888 tct_float3 normal[static_cast<size_t>(N)];
889 tct_float3 roughness[static_cast<size_t>(N)];
891
892 Df_flags flags;
894};
895
896template<>
897struct Bsdf_auxiliary_data<DF_HSM_POINTER> : public Bsdf_auxiliary_data_base
898{
899 tct_float3 ior1;
900 tct_float3 ior2;
901 tct_float3 k1;
902
903 tct_int handle_offset;
906 tct_int handle_count;
907 tct_float3* albedo_diffuse;
908 tct_float3* albedo_glossy;
909 tct_float3* normal;
910 tct_float3* roughness;
912
913 Df_flags flags;
915};
916
917template<>
918struct Bsdf_auxiliary_data<DF_HSM_NONE> : public Bsdf_auxiliary_data_base
919{
920 tct_float3 ior1;
921 tct_float3 ior2;
922 tct_float3 k1;
923
924 tct_float3 albedo_diffuse;
925 tct_float3 albedo_glossy;
926 tct_float3 normal;
927 tct_float3 roughness;
929
930 Df_flags flags;
932};
933
934// Signatures for generated target code functions.
935
944typedef void (Environment_function)(
945 void *result,
946 Shading_state_environment const *state,
947 Resource_data const *res_data,
948 char const *arg_block_data);
949
950
960 void *result,
961 Shading_state_material const *state,
962 Resource_data const *res_data,
963 char const *arg_block_data);
964
965
975 void *result,
977 Resource_data const *res_data,
978 char const *arg_block_data);
979
980
981// SWIG has problems with these function type definitions, so ignore in SWIG.
982#ifndef SWIG
983template<typename T>
984struct Material_function
985{
995 typedef T (Type)(
996 Shading_state_material const *state,
997 Resource_data const *res_data,
998 char const *arg_block_data);
999
1009 typedef T (Type_with_derivs)(
1011 Resource_data const *res_data,
1012 char const *arg_block_data);
1013};
1014#endif // not SWIG
1015
1016
1028typedef void (Bsdf_init_function)(
1030 Resource_data const *res_data,
1031 char const *arg_block_data);
1032
1033
1047 Resource_data const *res_data,
1048 char const *arg_block_data);
1049
1050
1060 Bsdf_sample_data *data,
1061 Shading_state_material const *state,
1062 Resource_data const *res_data,
1063 char const *arg_block_data);
1064
1065
1075 Bsdf_sample_data *data,
1077 Resource_data const *res_data,
1078 char const *arg_block_data);
1079
1080
1091 Shading_state_material const *state,
1092 Resource_data const *res_data,
1093 char const *arg_block_data);
1094
1095
1107 Resource_data const *res_data,
1108 char const *arg_block_data);
1109
1110
1119typedef void (Bsdf_pdf_function)(
1120 Bsdf_pdf_data *data,
1121 Shading_state_material const *state,
1122 Resource_data const *res_data,
1123 char const *arg_block_data);
1124
1125
1135 Bsdf_pdf_data *data,
1137 Resource_data const *res_data,
1138 char const *arg_block_data);
1139
1150 Shading_state_material const *state,
1151 Resource_data const *res_data,
1152 char const *arg_block_data);
1153
1154
1166 Resource_data const *res_data,
1167 char const *arg_block_data);
1168
1171{
1172 EDF_EVENT_NONE = 0,
1173 EDF_EVENT_EMISSION = 1,
1174
1175 EDF_EVENT_FORCE_32_BIT = 0xffffffffU
1176};
1177
1178
1180struct __align__(16) Edf_sample_data
1181{
1188};
1189
1191struct __align__(16) Edf_evaluate_data_base {};
1192
1193template<Df_handle_slot_mode N>
1194struct Edf_evaluate_data : public Edf_evaluate_data_base
1195{
1196 tct_float3 k1;
1197 tct_int handle_offset;
1200 tct_float cos;
1201 tct_float3 edf[static_cast<size_t>(N)];
1202 tct_float pdf;
1203};
1204
1205template<>
1206struct Edf_evaluate_data<DF_HSM_POINTER> : public Edf_evaluate_data_base
1207{
1208 tct_float3 k1;
1209 tct_int handle_offset;
1212 tct_int handle_count;
1213 tct_float cos;
1214 tct_float3* edf;
1215 tct_float pdf;
1216};
1217
1218template<>
1219struct Edf_evaluate_data<DF_HSM_NONE> : public Edf_evaluate_data_base
1220{
1221 tct_float3 k1;
1222 tct_float cos;
1223 tct_float3 edf;
1224 tct_float pdf;
1225};
1226
1228struct __align__(16) Edf_pdf_data
1229{
1232};
1233
1235struct __align__(16) Edf_auxiliary_data_base {};
1236
1237template<Df_handle_slot_mode N>
1238struct Edf_auxiliary_data : public Edf_auxiliary_data_base
1239{
1240 tct_float3 k1;
1241 tct_int handle_offset;
1244
1245 // reserved for future use
1246};
1247
1248template<>
1249struct Edf_auxiliary_data<DF_HSM_POINTER> : public Edf_auxiliary_data_base
1250{
1251 tct_float3 k1;
1252 tct_int handle_offset;
1255 tct_int handle_count;
1256
1257 // reserved for future use
1258};
1259
1260template<>
1261struct Edf_auxiliary_data<DF_HSM_NONE> : public Edf_auxiliary_data_base
1262{
1263 tct_float3 k1;
1264
1265 // reserved for future use
1266};
1267
1279typedef void (Edf_init_function)(
1281 Resource_data const *res_data,
1282 char const *arg_block_data);
1283
1284
1298 Resource_data const *res_data,
1299 char const *arg_block_data);
1300
1301
1310typedef void (Edf_sample_function)(
1311 Edf_sample_data *data,
1312 Shading_state_material const *state,
1313 Resource_data const *res_data,
1314 char const *arg_block_data);
1315
1316
1326 Edf_sample_data *data,
1328 Resource_data const *res_data,
1329 char const *arg_block_data);
1330
1331
1342 Shading_state_material const *state,
1343 Resource_data const *res_data,
1344 char const *arg_block_data);
1345
1346
1358 Resource_data const *res_data,
1359 char const *arg_block_data);
1360
1361
1370typedef void (Edf_pdf_function)(
1371 Edf_pdf_data *data,
1372 Shading_state_material const *state,
1373 Resource_data const *res_data,
1374 char const *arg_block_data);
1375
1376
1386 Edf_pdf_data *data,
1388 Resource_data const *res_data,
1389 char const *arg_block_data);
1390
1401 Shading_state_material const *state,
1402 Resource_data const *res_data,
1403 char const *arg_block_data);
1404
1405
1417 Resource_data const *res_data,
1418 char const *arg_block_data);
1419 // end group mi_neuray_mdl_compiler
1421
1422} // namespace neuraylib
1423
1424} // namespace mi
1425
1426#endif // MI_NEURAYLIB_TARGET_CODE_TYPES_H
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
signed int Sint32
32-bit signed integer.
Definition: types.h:46
Color cos(const Color &c)
Returns a color with the elementwise cosine of the color c.
Definition: color.h:558
tct_traits<true>::tct_derivable_float2 tct_deriv_float2
A float2 with derivatives.
Definition: target_code_types.h:129
void() Bsdf_pdf_function_with_derivs(Bsdf_pdf_data *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the probability density function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1134
void() Bsdf_init_function_with_derivs(Shading_state_material_with_derivs *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the initialization function for material distribution functions created via mi::neurayli...
Definition: target_code_types.h:1045
mi::Float32_2_struct tct_float2
A float2.
Definition: target_code_types.h:74
void() Bsdf_evaluate_function(Bsdf_evaluate_data_base *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the evaluation function for material distribution functions created via mi::neuraylib::I...
Definition: target_code_types.h:1089
void() Material_expr_function_with_derivs(void *result, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of material expression functions created via mi::neuraylib::IMdl_backend::translate_materia...
Definition: target_code_types.h:974
bool tct_bool
A bool.
Definition: target_code_types.h:91
void() Bsdf_sample_function_with_derivs(Bsdf_sample_data *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the importance sampling function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1074
void() Bsdf_init_function(Shading_state_material *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the initialization function for material distribution functions created via mi::neurayli...
Definition: target_code_types.h:1028
mi::Uint32 tct_uint
An unsigned int.
Definition: target_code_types.h:86
void() Edf_pdf_function_with_derivs(Edf_pdf_data *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the probability density function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1385
void() Bsdf_evaluate_function_with_derivs(Bsdf_evaluate_data_base *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the evaluation function for material distribution functions created via mi::neuraylib::I...
Definition: target_code_types.h:1104
void() Bsdf_auxiliary_function(Bsdf_auxiliary_data_base *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the auxiliary function for material distribution functions created via mi::neuraylib::IM...
Definition: target_code_types.h:1148
Mbsdf_part
MBSDFs can consist of two parts, which can be selected using this enumeration.
Definition: target_code_types.h:328
tct_deriv< float[4]> tct_deriv_arr_float_4
A float[4] with derivatives (needed to avoid problems with wrong alignment).
Definition: target_code_types.h:144
tct_traits<true>::tct_derivable_float3 tct_deriv_float3
A float3 with derivatives.
Definition: target_code_types.h:132
void() Edf_evaluate_function_with_derivs(Edf_evaluate_data_base *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the evaluation function for material distribution functions created via mi::neuraylib::I...
Definition: target_code_types.h:1355
void() Edf_sample_function(Edf_sample_data *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the importance sampling function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1310
Edf_event_type
The type of events created by EDF importance sampling.
Definition: target_code_types.h:1171
void() Material_expr_function(void *result, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of material expression functions created via mi::neuraylib::IMdl_backend::translate_materia...
Definition: target_code_types.h:959
tct_traits<true>::tct_derivable_float tct_deriv_float
A float with derivatives.
Definition: target_code_types.h:126
mi::Float32_3_struct tct_float3
A float3.
Definition: target_code_types.h:77
Tex_wrap_mode
The texture wrap modes as defined by tex::wrap_mode in the MDL specification.
Definition: target_code_types.h:309
void() Edf_pdf_function(Edf_pdf_data *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the probability density function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1370
void() Edf_sample_function_with_derivs(Edf_sample_data *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the importance sampling function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1325
mi::Float32_4_struct tct_float4
A float4.
Definition: target_code_types.h:80
tct_deriv< float[2]> tct_deriv_arr_float_2
A float[2] with derivatives (needed to avoid problems with wrong alignment).
Definition: target_code_types.h:138
tct_traits<true>::tct_derivable_float4 tct_deriv_float4
A float4 with derivatives.
Definition: target_code_types.h:135
Df_flags
Flags controlling the calculation of DF results.
Definition: target_code_types.h:761
void() Bsdf_auxiliary_function_with_derivs(Bsdf_auxiliary_data_base *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the auxiliary function for material distribution functions created via mi::neuraylib::IM...
Definition: target_code_types.h:1163
tct_deriv< float[3]> tct_deriv_arr_float_3
A float[3] with derivatives (needed to avoid problems with wrong alignment).
Definition: target_code_types.h:141
void() Edf_init_function_with_derivs(Shading_state_material_with_derivs *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the initialization function for material distribution functions created via mi::neurayli...
Definition: target_code_types.h:1296
Bsdf_event_type
The type of events created by BSDF importance sampling.
Definition: target_code_types.h:736
mi::Sint32 tct_int
An int.
Definition: target_code_types.h:83
void() Bsdf_sample_function(Bsdf_sample_data *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the importance sampling function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1059
Texture_handler_vtable_impl<false> Texture_handler_vtable
The texture handler vtable struct.
Definition: target_code_types.h:704
float tct_float
A float.
Definition: target_code_types.h:71
Df_handle_slot_mode
Type of Bsdf_evaluate_data variants, depending on the backend and its configuration.
Definition: target_code_types.h:791
void() Bsdf_pdf_function(Bsdf_pdf_data *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the probability density function for material distribution functions created via mi::neu...
Definition: target_code_types.h:1119
void() Edf_auxiliary_function_with_derivs(Edf_auxiliary_data_base *data, Shading_state_material_with_derivs const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the auxiliary function for material distribution functions created via mi::neuraylib::IM...
Definition: target_code_types.h:1414
void() Edf_auxiliary_function(Edf_auxiliary_data_base *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the auxiliary function for material distribution functions created via mi::neuraylib::IM...
Definition: target_code_types.h:1399
void() Environment_function(void *result, Shading_state_environment const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of environment functions created via mi::neuraylib::IMdl_backend::translate_environment() a...
Definition: target_code_types.h:944
void() Edf_init_function(Shading_state_material *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the initialization function for material distribution functions created via mi::neurayli...
Definition: target_code_types.h:1279
void() Edf_evaluate_function(Edf_evaluate_data_base *data, Shading_state_material const *state, Resource_data const *res_data, char const *arg_block_data)
Signature of the evaluation function for material distribution functions created via mi::neuraylib::I...
Definition: target_code_types.h:1340
Texture_handler_vtable_impl<true> Texture_handler_deriv_vtable
The texture handler vtable struct with derivatives for the texture coordinates.
Definition: target_code_types.h:707
@ MBSDF_DATA_TRANSMISSION
the bidirectional transmission distribution function (BTDF)
Definition: target_code_types.h:333
@ MBSDF_DATA_REFLECTION
the bidirectional reflection distribution function (BRDF)
Definition: target_code_types.h:330
@ TEX_WRAP_CLIP
tex::wrap_clip: makes the texture lookup return zero for texture coordinates outside of the range
Definition: target_code_types.h:323
@ 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:319
@ TEX_WRAP_REPEAT
tex::wrap_repeat: takes the fractional part of the lookup coordinate effectively repeating the textur...
Definition: target_code_types.h:315
@ TEX_WRAP_CLAMP
tex::wrap_clamp: clamps the lookup coordinate to the range
Definition: target_code_types.h:311
@ DF_FLAGS_NONE
allows nothing -> black
Definition: target_code_types.h:762
@ DF_HSM_POINTER
Uses renderer defined buffers; not supported by all backends.
Definition: target_code_types.h:792
@ DF_HSM_FIXED_2
fixed size array for processing 2 handle at a time
Definition: target_code_types.h:795
@ DF_HSM_NONE
No slots, handles are ignored completely.
Definition: target_code_types.h:793
@ DF_HSM_FIXED_8
fixed size array for processing 8 handle at a time
Definition: target_code_types.h:797
@ DF_HSM_FIXED_1
fixed size array for processing 1 handle at a time
Definition: target_code_types.h:794
@ DF_HSM_FIXED_4
fixed size array for processing 4 handle at a time
Definition: target_code_types.h:796
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5
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:873
Input and output structure for BSDF evaluation data.
Definition: target_code_types.h:801
Input and output structure for BSDF PDF calculation data.
Definition: target_code_types.h:860
tct_float3 ior2
mutual input: IOR other side
Definition: target_code_types.h:862
Df_flags flags
input: flags controlling calculation of result (optional depending on backend options)
Definition: target_code_types.h:868
tct_float3 k2
input: incoming direction
Definition: target_code_types.h:865
tct_float3 ior1
mutual input: IOR current medium
Definition: target_code_types.h:861
tct_float pdf
output: pdf (non-projected hemisphere)
Definition: target_code_types.h:866
tct_float3 k1
mutual input: outgoing direction
Definition: target_code_types.h:863
Input and output structure for BSDF sampling data.
Definition: target_code_types.h:773
tct_float4 xi
input: pseudo-random sample numbers in range [0, 1)
Definition: target_code_types.h:779
tct_float pdf
output: pdf (non-projected hemisphere)
Definition: target_code_types.h:780
Df_flags flags
input: flags controlling calculation of result (optional depending on backend options)
Definition: target_code_types.h:785
tct_int handle
output: handle of the sampled elemental BSDF (lobe)
Definition: target_code_types.h:783
tct_float3 ior2
mutual input: IOR other side
Definition: target_code_types.h:775
tct_float3 k1
mutual input: outgoing direction
Definition: target_code_types.h:776
tct_float3 k2
output: incoming direction
Definition: target_code_types.h:778
Bsdf_event_type event_type
output: the type of event for the generated sample
Definition: target_code_types.h:782
tct_float3 ior1
mutual input: IOR current medium
Definition: target_code_types.h:774
tct_float3 bsdf_over_pdf
output: bsdf * dot(normal, k2) / pdf
Definition: target_code_types.h:781
Input and output structure for EDF auxiliary calculation data.
Definition: target_code_types.h:1235
Input and output structure for EDF evaluation data.
Definition: target_code_types.h:1191
Input and output structure for EDF PDF calculation data.
Definition: target_code_types.h:1229
tct_float pdf
output: pdf (non-projected hemisphere)
Definition: target_code_types.h:1231
tct_float3 k1
input: outgoing direction
Definition: target_code_types.h:1230
Input and output structure for EDF sampling data.
Definition: target_code_types.h:1181
tct_int handle
output: handle of the sampled elemental EDF (lobe)
Definition: target_code_types.h:1187
tct_float3 k1
output: outgoing direction
Definition: target_code_types.h:1183
tct_float3 edf_over_pdf
output: edf * dot(normal,k1) / pdf
Definition: target_code_types.h:1185
tct_float pdf
output: pdf (non-projected hemisphere)
Definition: target_code_types.h:1184
tct_float4 xi
input: pseudo-random sample numbers in range [0, 1)
Definition: target_code_types.h:1182
Edf_event_type event_type
output: the type of event for the generated sample
Definition: target_code_types.h:1186
The data structure providing access to resources for generated code.
Definition: target_code_types.h:729
void const * shared_data
currently unused, should be NULL
Definition: target_code_types.h:730
Texture_handler_base const * texture_handler
will be provided as "self" parameter to texture functions
Definition: target_code_types.h:731
The MDL environment state structure inside the MDL SDK is a representation of the renderer state in t...
Definition: target_code_types.h:160
tct_float3 direction
The result of state::direction().
Definition: target_code_types.h:163
char const * ro_data_segment
A pointer to a read-only data segment.
Definition: target_code_types.h:178
The MDL material state structure inside the MDL SDK is a representation of the renderer state as defi...
Definition: target_code_types.h:210
tct_float3 normal
The result of state::normal().
Definition: target_code_types.h:217
char const * ro_data_segment
A pointer to a read-only data segment.
Definition: target_code_types.h:271
tct_int object_id
The result of state::object_id().
Definition: target_code_types.h:291
traits::tct_derivable_float3 position
The result of state::position().
Definition: target_code_types.h:225
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:278
tct_float3 const * tangent_v
An array containing the results of state::texture_tangent_v(i).
Definition: target_code_types.h:248
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:285
traits::tct_derivable_float3 const * text_coords
An array containing the results of state::texture_coordinate(i).
Definition: target_code_types.h:234
tct_float animation_time
The result of state::animation_time().
Definition: target_code_types.h:229
tct_float3 geom_normal
The result of state::geometry_normal().
Definition: target_code_types.h:221
tct_float3 const * tangent_u
An array containing the results of state::texture_tangent_u(i).
Definition: target_code_types.h:241
tct_float meters_per_scene_unit
The result of state::meters_per_scene_unit().
Definition: target_code_types.h:296
tct_float4 * text_results
The texture results lookup table.
Definition: target_code_types.h:256
The texture handler structure that is passed to the texturing functions.
Definition: target_code_types.h:712
Texture_handler_vtable const * vtable
In vtable-mode, the vtable field is used to call the texturing functions.
Definition: target_code_types.h:715
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:344
A template struct with derivatives.
Definition: target_code_types.h:97
Helper traits struct to switch between derivative and non-derivative types.
Definition: target_code_types.h:103
Typedefs for types from the math API.