MDL 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
22namespace mi {
23
24namespace neuraylib {
25
31using tct_float = float;
32
34using tct_float2 = float2;
35
37using tct_float3 = float3;
38
40using tct_float4 = float4;
41
43using tct_int = int;
44
46using tct_uint = unsigned;
47
48#else
49
51
52namespace mi {
53
54namespace neuraylib {
55
61using tct_float = float;
62
65
68
71
74
77
78#endif
79
81using tct_bool = bool;
82
83
85template<typename T>
87{
88 T val, dx, dy;
89};
90
92template<bool with_derivatives>
94
95template<>
96struct tct_traits<false>
97{
98 using tct_derivable_float = tct_float;
99 using tct_derivable_float2 = tct_float2;
100 using tct_derivable_float3 = tct_float3;
101 using tct_derivable_float4 = tct_float4;
102 using tct_coord2_type = const tct_float[2];
103};
104
105template<>
106struct tct_traits<true>
107{
108 using tct_derivable_float = tct_deriv<tct_float>;
109 using tct_derivable_float2 = tct_deriv<tct_float2>;
110 using tct_derivable_float3 = tct_deriv<tct_float3>;
111 using tct_derivable_float4 = tct_deriv<tct_float4>;
112 using tct_coord2_type = const tct_derivable_float2 *;
113};
114
117
120
123
126
129
132
135
136
151{
155
169 char const *ro_data_segment;
170};
171
172
200template<bool with_derivatives = false>
202{
204
210
214
217 typename traits::tct_derivable_float3 position;
218
222
226 typename traits::tct_derivable_float3 const *text_coords;
227
234
241
249
263 char const *ro_data_segment;
264
271
278
284
289};
290
293
296
297
302{
305
309
313
316 TEX_WRAP_CLIP = 3
318
321{
324
328
329
330// Forward declaration of texture handler structure.
331struct Texture_handler_base;
332
333
336template<bool with_derivatives = false>
338{
340
342 void (*m_tex_lookup_float4_2d)(
343 tct_float result[4],
344 Texture_handler_base const *self,
345 tct_uint texture_idx,
346 typename traits::tct_coord2_type coord,
347 Tex_wrap_mode wrap_u,
348 Tex_wrap_mode wrap_v,
349 tct_float const crop_u[2],
350 tct_float const crop_v[2],
351 tct_float frame);
352
354 void (*m_tex_lookup_float3_2d)(
355 tct_float result[3],
356 Texture_handler_base const *self,
357 tct_uint texture_idx,
358 typename traits::tct_coord2_type coord,
359 Tex_wrap_mode wrap_u,
360 Tex_wrap_mode wrap_v,
361 tct_float const crop_u[2],
362 tct_float const crop_v[2],
363 tct_float frame);
364
366 void (*m_tex_texel_float4_2d)(
367 tct_float result[4],
368 Texture_handler_base const *self,
369 tct_uint texture_idx,
370 tct_int const coord[2],
371 tct_int const uv_tile[2],
372 tct_float frame);
373
375 void (*m_tex_lookup_float4_3d)(
376 tct_float result[4],
377 Texture_handler_base const *self,
378 tct_uint texture_idx,
379 tct_float const coord[3],
380 Tex_wrap_mode wrap_u,
381 Tex_wrap_mode wrap_v,
382 Tex_wrap_mode wrap_w,
383 tct_float const crop_u[2],
384 tct_float const crop_v[2],
385 tct_float const crop_w[2],
386 tct_float frame);
387
389 void (*m_tex_lookup_float3_3d)(
390 tct_float result[3],
391 Texture_handler_base const *self,
392 tct_uint texture_idx,
393 tct_float const coord[3],
394 Tex_wrap_mode wrap_u,
395 Tex_wrap_mode wrap_v,
396 Tex_wrap_mode wrap_w,
397 tct_float const crop_u[2],
398 tct_float const crop_v[2],
399 tct_float const crop_w[2],
400 tct_float frame);
401
403 void (*m_tex_texel_float4_3d)(
404 tct_float result[4],
405 Texture_handler_base const *self,
406 tct_uint texture_idx,
407 tct_int const coord[3],
408 tct_float frame);
409
411 void (*m_tex_lookup_float4_cube)(
412 tct_float result[4],
413 Texture_handler_base const *self,
414 tct_uint texture_idx,
415 tct_float const coord[3]);
416
418 void (*m_tex_lookup_float3_cube)(
419 tct_float result[3],
420 Texture_handler_base const *self,
421 tct_uint texture_idx,
422 tct_float const coord[3]);
423
427 void (*m_tex_resolution_2d)(
428 tct_int result[2],
429 Texture_handler_base const *self,
430 tct_uint texture_idx,
431 tct_int const uv_tile[2],
432 tct_float frame);
433
437 void (*m_tex_resolution_3d)(
438 tct_int result[3],
439 Texture_handler_base const *self,
440 tct_uint texture_idx,
441 tct_float frame);
442
444 tct_bool (*m_tex_texture_isvalid)(
445 Texture_handler_base const *self,
446 tct_uint texture_idx);
447
450 void (*m_tex_frame)(
451 tct_int result[2],
452 Texture_handler_base const *self,
453 tct_uint texture_idx);
454
456 tct_float (*m_df_light_profile_power)(
457 Texture_handler_base const *self,
458 tct_uint light_profile_index);
459
461 tct_float (*m_df_light_profile_maximum)(
462 Texture_handler_base const *self,
463 tct_uint light_profile_index);
464
466 tct_bool (*m_df_light_profile_isvalid)(
467 Texture_handler_base const *self,
468 tct_uint light_profile_index);
469
471 tct_float (*m_df_light_profile_evaluate)(
472 Texture_handler_base const *self,
473 tct_uint light_profile_index,
474 tct_float const theta_phi[2]);
475
477 void (*m_df_light_profile_sample)(
478 tct_float result[3],
480 Texture_handler_base const *self,
481 tct_uint light_profile_index,
482 tct_float const xi[3]);
483
485 tct_float (*m_df_light_profile_pdf)(
486 Texture_handler_base const *self,
487 tct_uint light_profile_index,
488 tct_float const theta_phi[2]);
489
491 tct_bool (*m_df_bsdf_measurement_isvalid)(
492 Texture_handler_base const *self,
493 tct_uint bsdf_measurement_index);
494
499 void (*m_df_bsdf_measurement_resolution)(
500 tct_uint result[3],
501 Texture_handler_base const *self,
502 tct_uint bsdf_measurement_index,
503 Mbsdf_part part);
504
506 void (*m_df_bsdf_measurement_evaluate)(
507 tct_float result[3],
508 Texture_handler_base const *self,
509 tct_uint bsdf_measurement_index,
510 tct_float const theta_phi_in[2],
511 tct_float const theta_phi_out[2],
512 Mbsdf_part part);
513
515 void (*m_df_bsdf_measurement_sample)(
516 tct_float result[3],
518 Texture_handler_base const *self,
519 tct_uint bsdf_measurement_index,
520 tct_float const theta_phi_out[2],
521 tct_float const xi[3],
523 Mbsdf_part part);
524
526 tct_float (*m_df_bsdf_measurement_pdf)(
527 Texture_handler_base const *self,
528 tct_uint bsdf_measurement_index,
529 tct_float const theta_phi_in[2],
530 tct_float const theta_phi_out[2],
531 Mbsdf_part part);
532
534 void (*m_df_bsdf_measurement_albedos)(
535 tct_float result[4],
541 Texture_handler_base const *self,
542 tct_uint bsdf_measurement_index,
543 tct_float const theta_phi[2]);
544
546 void (*m_adapt_normal)(
547 tct_float result[3],
548 Texture_handler_base const *self_base,
550 tct_float const normal[3]);
551
553 tct_bool (*m_scene_data_isvalid)(
554 Texture_handler_base const *self_base,
556 tct_uint scene_data_id);
557
559 tct_float (*m_scene_data_lookup_float)(
560 Texture_handler_base const *self_base,
562 tct_uint scene_data_id,
563 tct_float default_value,
564 tct_bool uniform_lookup);
565
567 void (*m_scene_data_lookup_float2)(
568 tct_float result[2],
569 Texture_handler_base const *self_base,
571 tct_uint scene_data_id,
572 tct_float const default_value[2],
573 tct_bool uniform_lookup);
574
576 void (*m_scene_data_lookup_float3)(
577 tct_float result[3],
578 Texture_handler_base const *self_base,
580 tct_uint scene_data_id,
581 tct_float const default_value[3],
582 tct_bool uniform_lookup);
583
585 void (*m_scene_data_lookup_float4)(
586 tct_float result[4],
587 Texture_handler_base const *self_base,
589 tct_uint scene_data_id,
590 tct_float const default_value[4],
591 tct_bool uniform_lookup);
592
594 tct_int (*m_scene_data_lookup_int)(
595 Texture_handler_base const *self_base,
597 tct_uint scene_data_id,
598 tct_int default_value,
599 tct_bool uniform_lookup);
600
602 void (*m_scene_data_lookup_int2)(
603 tct_int result[2],
604 Texture_handler_base const *self_base,
606 tct_uint scene_data_id,
607 tct_int const default_value[2],
608 tct_bool uniform_lookup);
609
611 void (*m_scene_data_lookup_int3)(
612 tct_int result[3],
613 Texture_handler_base const *self_base,
615 tct_uint scene_data_id,
616 tct_int const default_value[3],
617 tct_bool uniform_lookup);
618
620 void (*m_scene_data_lookup_int4)(
621 tct_int result[4],
622 Texture_handler_base const *self_base,
624 tct_uint scene_data_id,
625 tct_int const default_value[4],
626 tct_bool uniform_lookup);
627
629 void (*m_scene_data_lookup_color)(
630 tct_float result[3],
631 Texture_handler_base const *self_base,
633 tct_uint scene_data_id,
634 tct_float const default_value[3],
635 tct_bool uniform_lookup);
636
639 void (*m_scene_data_lookup_float4x4)(
640 tct_float result[16],
641 Texture_handler_base const *self_base,
643 tct_uint scene_data_id,
644 tct_float const default_value[16],
645 tct_bool uniform_lookup);
646 //
647 // The following functions are only used in the derivative variant,
648 // and can be \c nullptr in the non-derivative variant
649 //
650
652 void (*m_scene_data_lookup_deriv_float)(
653 tct_deriv_float *result,
654 Texture_handler_base const *self_base,
656 tct_uint scene_data_id,
657 tct_deriv_float const *default_value,
658 tct_bool uniform_lookup);
659
661 void (*m_scene_data_lookup_deriv_float2)(
662 tct_deriv_arr_float_2 *result,
663 Texture_handler_base const *self_base,
665 tct_uint scene_data_id,
666 tct_deriv_arr_float_2 const *default_value,
667 tct_bool uniform_lookup);
668
670 void (*m_scene_data_lookup_deriv_float3)(
671 tct_deriv_arr_float_3 *result,
672 Texture_handler_base const *self_base,
674 tct_uint scene_data_id,
675 tct_deriv_arr_float_3 const *default_value,
676 tct_bool uniform_lookup);
677
679 void (*m_scene_data_lookup_deriv_float4)(
680 tct_deriv_arr_float_4 *result,
681 Texture_handler_base const *self_base,
683 tct_uint scene_data_id,
684 tct_deriv_arr_float_4 const *default_value,
685 tct_bool uniform_lookup);
686
688 void (*m_scene_data_lookup_deriv_color)(
689 tct_deriv_arr_float_3 *result,
690 Texture_handler_base const *self_base,
692 tct_uint scene_data_id,
693 tct_deriv_arr_float_3 const *default_value,
694 tct_bool uniform_lookup);
695};
696
699
702
707{
711};
712
717{
721};
722
723
726{
727 void const *shared_data;
730};
731
734{
735 BSDF_EVENT_ABSORB = 0,
736
737 BSDF_EVENT_DIFFUSE = 1,
738 BSDF_EVENT_GLOSSY = 1 << 1,
739 BSDF_EVENT_SPECULAR = 1 << 2,
740 BSDF_EVENT_REFLECTION = 1 << 3,
741 BSDF_EVENT_TRANSMISSION = 1 << 4,
742
743 BSDF_EVENT_DIFFUSE_REFLECTION = BSDF_EVENT_DIFFUSE | BSDF_EVENT_REFLECTION,
744 BSDF_EVENT_DIFFUSE_TRANSMISSION = BSDF_EVENT_DIFFUSE | BSDF_EVENT_TRANSMISSION,
745 BSDF_EVENT_GLOSSY_REFLECTION = BSDF_EVENT_GLOSSY | BSDF_EVENT_REFLECTION,
746 BSDF_EVENT_GLOSSY_TRANSMISSION = BSDF_EVENT_GLOSSY | BSDF_EVENT_TRANSMISSION,
747 BSDF_EVENT_SPECULAR_REFLECTION = BSDF_EVENT_SPECULAR | BSDF_EVENT_REFLECTION,
748 BSDF_EVENT_SPECULAR_TRANSMISSION = BSDF_EVENT_SPECULAR | BSDF_EVENT_TRANSMISSION,
749
750 BSDF_EVENT_FORCE_32_BIT = 0xffffffffU
751};
752
756#define MI_NEURAYLIB_BSDF_USE_MATERIAL_IOR (-1.0f)
757
760{
762
763 DF_FLAGS_ALLOW_REFLECT = 1,
764 DF_FLAGS_ALLOW_TRANSMIT = 2,
765 DF_FLAGS_ALLOW_REFLECT_AND_TRANSMIT = DF_FLAGS_ALLOW_REFLECT | DF_FLAGS_ALLOW_TRANSMIT,
766 DF_FLAGS_ALLOWED_SCATTER_MODE_MASK = DF_FLAGS_ALLOW_REFLECT_AND_TRANSMIT,
767
768 DF_FLAGS_FORCE_32_BIT = 0xffffffffU
769};
770
772struct alignas(16) Bsdf_sample_data
773{
777
784
787};
788
791{
798};
799
801struct alignas(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 alignas(16) Bsdf_pdf_data
861{
865
868
871};
872
874struct alignas(16) Bsdf_auxiliary_data_base {};
875
876template<Df_handle_slot_mode N>
877struct Bsdf_auxiliary_data : public Bsdf_auxiliary_data_base
878{
879 tct_float3 ior1;
880 tct_float3 ior2;
881 tct_float3 k1;
882
883 tct_int handle_offset;
886 tct_float3 albedo_diffuse[static_cast<size_t>(N)];
888 tct_float3 albedo_glossy[static_cast<size_t>(N)];
889 tct_float3 normal[static_cast<size_t>(N)];
890 tct_float3 roughness[static_cast<size_t>(N)];
892
893 Df_flags flags;
895};
896
897template<>
898struct Bsdf_auxiliary_data<DF_HSM_POINTER> : public Bsdf_auxiliary_data_base
899{
900 tct_float3 ior1;
901 tct_float3 ior2;
902 tct_float3 k1;
903
904 tct_int handle_offset;
907 tct_int handle_count;
908 tct_float3* albedo_diffuse;
909 tct_float3* albedo_glossy;
910 tct_float3* normal;
911 tct_float3* roughness;
913
914 Df_flags flags;
916};
917
918template<>
919struct Bsdf_auxiliary_data<DF_HSM_NONE> : public Bsdf_auxiliary_data_base
920{
921 tct_float3 ior1;
922 tct_float3 ior2;
923 tct_float3 k1;
924
925 tct_float3 albedo_diffuse;
926 tct_float3 albedo_glossy;
927 tct_float3 normal;
928 tct_float3 roughness;
930
931 Df_flags flags;
933};
934
935// Signatures for generated target code functions.
936
946 void *result,
947 Shading_state_environment const *state,
948 Resource_data const *res_data,
949 char const *arg_block_data);
950
951
961 void *result,
962 Shading_state_material const *state,
963 Resource_data const *res_data,
964 char const *arg_block_data);
965
966
976 void *result,
978 Resource_data const *res_data,
979 char const *arg_block_data);
980
981
982// SWIG has problems with these function type definitions, so ignore in SWIG.
983#ifndef SWIG
984template<typename T>
985struct Material_function
986{
996 using Type = T(
997 Shading_state_material const *state,
998 Resource_data const *res_data,
999 char const *arg_block_data);
1000
1010 using Type_with_derivs = T(
1012 Resource_data const *res_data,
1013 char const *arg_block_data);
1014};
1015#endif // not SWIG
1016
1017
1031 Resource_data const *res_data,
1032 char const *arg_block_data);
1033
1034
1048 Resource_data const *res_data,
1049 char const *arg_block_data);
1050
1051
1061 Bsdf_sample_data *data,
1062 Shading_state_material const *state,
1063 Resource_data const *res_data,
1064 char const *arg_block_data);
1065
1066
1076 Bsdf_sample_data *data,
1078 Resource_data const *res_data,
1079 char const *arg_block_data);
1080
1081
1092 Shading_state_material const *state,
1093 Resource_data const *res_data,
1094 char const *arg_block_data);
1095
1096
1108 Resource_data const *res_data,
1109 char const *arg_block_data);
1110
1111
1121 Bsdf_pdf_data *data,
1122 Shading_state_material const *state,
1123 Resource_data const *res_data,
1124 char const *arg_block_data);
1125
1126
1136 Bsdf_pdf_data *data,
1138 Resource_data const *res_data,
1139 char const *arg_block_data);
1140
1151 Shading_state_material const *state,
1152 Resource_data const *res_data,
1153 char const *arg_block_data);
1154
1155
1167 Resource_data const *res_data,
1168 char const *arg_block_data);
1169
1172{
1173 EDF_EVENT_NONE = 0,
1174 EDF_EVENT_EMISSION = 1,
1175
1176 EDF_EVENT_FORCE_32_BIT = 0xffffffffU
1177};
1178
1179
1181struct alignas(16) Edf_sample_data
1182{
1189};
1190
1192struct alignas(16) Edf_evaluate_data_base {};
1193
1194template<Df_handle_slot_mode N>
1195struct Edf_evaluate_data : public Edf_evaluate_data_base
1196{
1197 tct_float3 k1;
1198 tct_int handle_offset;
1201 tct_float cos;
1202 tct_float3 edf[static_cast<size_t>(N)];
1203 tct_float pdf;
1204};
1205
1206template<>
1207struct Edf_evaluate_data<DF_HSM_POINTER> : public Edf_evaluate_data_base
1208{
1209 tct_float3 k1;
1210 tct_int handle_offset;
1213 tct_int handle_count;
1214 tct_float cos;
1215 tct_float3* edf;
1216 tct_float pdf;
1217};
1218
1219template<>
1220struct Edf_evaluate_data<DF_HSM_NONE> : public Edf_evaluate_data_base
1221{
1222 tct_float3 k1;
1223 tct_float cos;
1224 tct_float3 edf;
1225 tct_float pdf;
1226};
1227
1229struct alignas(16) Edf_pdf_data
1230{
1233};
1234
1236struct alignas(16) Edf_auxiliary_data_base {};
1237
1238template<Df_handle_slot_mode N>
1239struct Edf_auxiliary_data : public Edf_auxiliary_data_base
1240{
1241 tct_float3 k1;
1242 tct_int handle_offset;
1245
1246 // reserved for future use
1247};
1248
1249template<>
1250struct Edf_auxiliary_data<DF_HSM_POINTER> : public Edf_auxiliary_data_base
1251{
1252 tct_float3 k1;
1253 tct_int handle_offset;
1256 tct_int handle_count;
1257
1258 // reserved for future use
1259};
1260
1261template<>
1262struct Edf_auxiliary_data<DF_HSM_NONE> : public Edf_auxiliary_data_base
1263{
1264 tct_float3 k1;
1265
1266 // reserved for future use
1267};
1268
1282 Resource_data const *res_data,
1283 char const *arg_block_data);
1284
1285
1299 Resource_data const *res_data,
1300 char const *arg_block_data);
1301
1302
1312 Edf_sample_data *data,
1313 Shading_state_material const *state,
1314 Resource_data const *res_data,
1315 char const *arg_block_data);
1316
1317
1327 Edf_sample_data *data,
1329 Resource_data const *res_data,
1330 char const *arg_block_data);
1331
1332
1343 Shading_state_material const *state,
1344 Resource_data const *res_data,
1345 char const *arg_block_data);
1346
1347
1359 Resource_data const *res_data,
1360 char const *arg_block_data);
1361
1362
1371using Edf_pdf_function = void(
1372 Edf_pdf_data *data,
1373 Shading_state_material const *state,
1374 Resource_data const *res_data,
1375 char const *arg_block_data);
1376
1377
1387 Edf_pdf_data *data,
1389 Resource_data const *res_data,
1390 char const *arg_block_data);
1391
1402 Shading_state_material const *state,
1403 Resource_data const *res_data,
1404 char const *arg_block_data);
1405
1406
1418 Resource_data const *res_data,
1419 char const *arg_block_data);
1420 // end group mi_neuray_mdl_compiler
1422
1423} // namespace neuraylib
1424
1425} // namespace mi
1426
1427#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:81
float tct_float
A float.
Definition: target_code_types.h:61
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:949
mi::Float32_4_struct tct_float4
A float4.
Definition: target_code_types.h:70
mi::Float32_2_struct tct_float2
A float2.
Definition: target_code_types.h:64
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:1419
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:1153
Mbsdf_part
MBSDFs can consist of two parts, which can be selected using this enumeration.
Definition: target_code_types.h:321
tct_traits<true>::tct_derivable_float tct_deriv_float
A float with derivatives.
Definition: target_code_types.h:116
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:964
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:1109
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:1345
Edf_event_type
The type of events created by EDF importance sampling.
Definition: target_code_types.h:1172
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:1404
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:1032
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:1079
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:1330
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:1049
Tex_wrap_mode
The texture wrap modes as defined by tex::wrap_mode in the MDL specification.
Definition: target_code_types.h:302
mi::Float32_3_struct tct_float3
A float3.
Definition: target_code_types.h:67
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:1360
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:979
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:1168
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:1064
Df_flags
Flags controlling the calculation of DF results.
Definition: target_code_types.h:760
mi::Sint32 tct_int
An int.
Definition: target_code_types.h:73
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:1375
mi::Uint32 tct_uint
An unsigned int.
Definition: target_code_types.h:76
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:1300
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:1124
Bsdf_event_type
The type of events created by BSDF importance sampling.
Definition: target_code_types.h:734
tct_traits<true>::tct_derivable_float2 tct_deriv_float2
A float2 with derivatives.
Definition: target_code_types.h:119
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:1094
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:1390
Df_handle_slot_mode
Type of Bsdf_evaluate_data variants, depending on the backend and its configuration.
Definition: target_code_types.h:791
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:1315
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:1139
tct_traits<true>::tct_derivable_float4 tct_deriv_float4
A float4 with derivatives.
Definition: target_code_types.h:125
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:1283
tct_traits<true>::tct_derivable_float3 tct_deriv_float3
A float3 with derivatives.
Definition: target_code_types.h:122
@ MBSDF_DATA_TRANSMISSION
the bidirectional transmission distribution function (BTDF)
Definition: target_code_types.h:326
@ MBSDF_DATA_REFLECTION
the bidirectional reflection distribution function (BRDF)
Definition: target_code_types.h:323
@ TEX_WRAP_CLIP
tex::wrap_clip: makes the texture lookup return zero for texture coordinates outside of the range
Definition: target_code_types.h:316
@ 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:312
@ TEX_WRAP_REPEAT
tex::wrap_repeat: takes the fractional part of the lookup coordinate effectively repeating the textur...
Definition: target_code_types.h:308
@ TEX_WRAP_CLAMP
tex::wrap_clamp: clamps the lookup coordinate to the range
Definition: target_code_types.h:304
@ DF_FLAGS_NONE
allows nothing -> black
Definition: target_code_types.h:761
@ 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:874
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:861
tct_float3 ior2
mutual input: IOR other side
Definition: target_code_types.h:863
Df_flags flags
input: flags controlling calculation of result (optional depending on backend options)
Definition: target_code_types.h:869
tct_float3 k2
input: incoming direction
Definition: target_code_types.h:866
tct_float3 ior1
mutual input: IOR current medium
Definition: target_code_types.h:862
tct_float pdf
output: pdf (non-projected hemisphere)
Definition: target_code_types.h:867
tct_float3 k1
mutual input: outgoing direction
Definition: target_code_types.h:864
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:1236
Input and output structure for EDF evaluation data.
Definition: target_code_types.h:1192
Input and output structure for EDF PDF calculation data.
Definition: target_code_types.h:1230
tct_float pdf
output: pdf (non-projected hemisphere)
Definition: target_code_types.h:1232
tct_float3 k1
input: outgoing direction
Definition: target_code_types.h:1231
Input and output structure for EDF sampling data.
Definition: target_code_types.h:1182
tct_int handle
output: handle of the sampled elemental EDF (lobe)
Definition: target_code_types.h:1188
tct_float3 k1
output: outgoing direction
Definition: target_code_types.h:1184
tct_float3 edf_over_pdf
output: edf * dot(normal,k1) / pdf
Definition: target_code_types.h:1186
tct_float pdf
output: pdf (non-projected hemisphere)
Definition: target_code_types.h:1185
tct_float4 xi
input: pseudo-random sample numbers in range [0, 1)
Definition: target_code_types.h:1183
Edf_event_type event_type
output: the type of event for the generated sample
Definition: target_code_types.h:1187
The data structure providing access to resources for generated code.
Definition: target_code_types.h:726
void const * shared_data
currently unused, should be nullptr
Definition: target_code_types.h:727
Texture_handler_base const * texture_handler
will be provided as "self" parameter to texture functions
Definition: target_code_types.h:728
The MDL environment state structure inside the MDL SDK is a representation of the renderer state in t...
Definition: target_code_types.h:151
tct_float3 direction
The result of state::direction().
Definition: target_code_types.h:154
char const * ro_data_segment
A pointer to a read-only data segment.
Definition: target_code_types.h:169
The MDL material state structure inside the MDL SDK is a representation of the renderer state as defi...
Definition: target_code_types.h:202
tct_float3 normal
The result of state::normal().
Definition: target_code_types.h:209
char const * ro_data_segment
A pointer to a read-only data segment.
Definition: target_code_types.h:263
tct_int object_id
The result of state::object_id().
Definition: target_code_types.h:283
traits::tct_derivable_float3 position
The result of state::position().
Definition: target_code_types.h:217
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:270
tct_float3 const * tangent_v
An array containing the results of state::texture_tangent_v(i).
Definition: target_code_types.h:240
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:277
traits::tct_derivable_float3 const * text_coords
An array containing the results of state::texture_coordinate(i).
Definition: target_code_types.h:226
tct_float animation_time
The result of state::animation_time().
Definition: target_code_types.h:221
tct_float3 geom_normal
The result of state::geometry_normal().
Definition: target_code_types.h:213
tct_float3 const * tangent_u
An array containing the results of state::texture_tangent_u(i).
Definition: target_code_types.h:233
tct_float meters_per_scene_unit
The result of state::meters_per_scene_unit().
Definition: target_code_types.h:288
tct_float4 * text_results
The texture results lookup table.
Definition: target_code_types.h:248
The texture handler structure that is passed to the texturing functions.
Definition: target_code_types.h:707
Texture_handler_vtable const * vtable
In vtable-mode, the vtable field is used to call the texturing functions.
Definition: target_code_types.h:710
The texture handler structure that is passed to the texturing functions with derivative support.
Definition: target_code_types.h:717
Texture_handler_deriv_vtable const * vtable
In vtable-mode, the vtable field is used to call the texturing functions.
Definition: target_code_types.h:720
The runtime for bitmap texture access for the generated target code can optionally be implemented in ...
Definition: target_code_types.h:338
A template struct with derivatives.
Definition: target_code_types.h:87
Helper traits struct to switch between derivative and non-derivative types.
Definition: target_code_types.h:93
Typedefs for types from the math API.