Iray SDK API nvidia_logo_transpbg.gif Up
imdl_backend.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2026 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_IMDL_BACKEND_H
8#define MI_NEURAYLIB_IMDL_BACKEND_H
9
12#include <mi/neuraylib/ivalue.h>
15#include <mi/neuraylib/version.h> // for MI_NEURAYLIB_DEPRECATED_ENUM_VALUE
16
17namespace mi {
18
19namespace neuraylib {
20
21class IBuffer;
22class ICompiled_material;
23class IFunction_definition;
24class IFunction_call;
25class ILink_unit;
26class IMdl_execution_context;
27class ITarget_code;
28class ITarget_argument_block;
29class ITransaction;
30
31struct Target_function_description;
32
38class IMdl_backend : public
39 mi::base::Interface_declare<0x9ecdd747,0x20b8,0x4a8a,0xb1,0xe2,0x62,0xb2,0x62,0x30,0xd3,0x67>
40{
41public:
80#if !defined(MDL_SOURCE_RELEASE) && defined(MDL_ENABLE_INTERPRETER)
86#endif
360 virtual Sint32 set_option( const char* name, const char* value) = 0;
361
377 const char* name,
378 const char* data,
379 Size size) = 0;
380
385 virtual const Uint8* get_device_library( Size &size) const = 0;
386
427 ITransaction* transaction,
428 const IFunction_call* call,
429 const char* fname,
430 IMdl_execution_context* context) = 0;
431
470 ITransaction* transaction,
471 const ICompiled_material* material,
472 const char* path,
473 const char* fname,
474 IMdl_execution_context* context) = 0;
475
509 ITransaction* transaction,
510 const ICompiled_material* material,
511 const char* path,
512 const char* base_fname,
513 IMdl_execution_context* context) = 0;
514
542 ITransaction* transaction,
543 const ICompiled_material* material,
544 Target_function_description* function_descriptions,
545 Size description_count,
546 IMdl_execution_context* context) = 0;
547
567 ITransaction* transaction,
568 IMdl_execution_context* context) = 0;
569
585 const ILink_unit* lu, IMdl_execution_context* context) = 0;
586
607 ITransaction* transaction,
608 const IBuffer* buffer,
609 IMdl_execution_context* context) const = 0;
610
632 ITransaction* transaction,
633 const Uint8* buffer_data,
634 Size buffer_size,
635 IMdl_execution_context* context) const = 0;
636};
637
642 mi::base::Interface_declare<0xe7559a88,0x9a9a,0x41d8,0xa1,0x9c,0x4a,0x52,0x4e,0x4b,0x7b,0x66>
643{
644public:
661#ifndef MDL_SOURCE_RELEASE
664#endif // MDL_SOURCE_RELEASE
669 virtual Uint32 get_resource_index(IValue_resource const *resource) = 0;
670
676 virtual Uint32 get_string_index(IValue_string const *s) = 0;
677};
678
686 mi::base::Interface_declare<0xf2a5db20,0x85ab,0x4c41,0x8c,0x5f,0x49,0xc8,0x29,0x4a,0x73,0x65>
687{
688public:
690 virtual const char* get_data() const = 0;
691
693 virtual char* get_data() = 0;
694
696 virtual Size get_size() const = 0;
697
699 virtual ITarget_argument_block *clone() const = 0;
700};
701
704 Target_value_layout_state(mi::Uint32 state_offs = 0, mi::Uint32 data_offs = 0)
705 : m_state_offs(state_offs)
706 , m_data_offs(data_offs)
707 {}
708
711
714};
715
726 mi::base::Interface_declare<0x1003351f,0x0c31,0x4a9d,0xb9,0x99,0x90,0xb5,0xe4,0xb4,0x71,0xe3>
727{
728public:
730 virtual Size get_size() const = 0;
731
738
750 IValue::Kind &kind,
751 Size &arg_size,
753
764 Size i,
766
784 char *block,
785 IValue const *value,
786 ITarget_resource_callback *resource_callback,
788};
789
791class ITarget_code : public
792 mi::base::Interface_declare<0xefca46ae,0xd530,0x4b97,0x9d,0xab,0x3a,0xdb,0x0c,0x58,0xc3,0xac>
793{
794public:
797 SU_POSITION = 0x0001u,
798 SU_NORMAL = 0x0002u,
800 SU_MOTION = 0x0008u,
805 SU_DIRECTION = 0x0100u,
808
810
811 SU_TRANSFORMS = 0x0800u,
812 SU_OBJECT_ID = 0x1000u,
813
814 SU_ALL_UNIFORM_MASK = 0x1800u
815
816 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(SU_FORCE_32_BIT, 0xFFFFFFFFu)
817 }; // can be or'ed
818
819 using State_usage = Uint32;
820
829 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(Texture_shape_FORCE_32_BIT, 0xFFFFFFFFu)
830 };
831
834 SL_CUDA,
835 SL_PTX,
836 SL_HLSL,
837 SL_GLSL,
838 SL_NUM_LANGUAGES
839 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(SL_FORCE_32_BIT, 0xFFFFFFFFu)
840 };
841
844 DK_NONE,
845 DK_BSDF,
846 DK_HAIR_BSDF,
847 DK_EDF,
848 DK_INVALID
849 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(DK_FORCE_32_BIT, 0xFFFFFFFFu)
850 };
851
854 FK_INVALID,
855 FK_LAMBDA,
856 FK_SWITCH_LAMBDA,
857 FK_ENVIRONMENT,
858 FK_CONST,
859 FK_DF_INIT,
860 FK_DF_SAMPLE,
861 FK_DF_EVALUATE,
862 FK_DF_PDF,
863 FK_DF_AUXILIARY
864 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(FK_FORCE_32_BIT, 0xFFFFFFFFu)
865 };
866
869 GM_GAMMA_DEFAULT,
870 GM_GAMMA_LINEAR,
871 GM_GAMMA_SRGB,
872 GM_GAMMA_UNKNOWN
873 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(GM_FORCE_32_BIT, 0xFFFFFFFFu)
874 };
875
878
880 virtual const char* get_code() const = 0;
881
883 virtual Size get_code_size() const = 0;
884
887
897 virtual const char* get_callable_function( Size index) const = 0;
898
900
901
903 virtual Size get_texture_count() const = 0;
904
911 virtual const char* get_texture( Size index) const = 0;
912
920 virtual const char* get_texture_url( Size index) const = 0;
921
928 virtual const char* get_texture_owner_module( Size index) const = 0;
929
936 virtual bool get_texture_is_body_resource( Size index) const = 0;
937
943 virtual Gamma_mode get_texture_gamma( Size index) const = 0;
944
951 virtual const char* get_texture_selector( Size index) const = 0;
952
958 virtual Texture_shape get_texture_shape( Size index) const = 0;
959
966 virtual Df_data_kind get_texture_df_data_kind( Size index) const = 0;
967
983 Size index,
984 Size& rx,
985 Size& ry,
986 Size& rz,
987 const char*& pixel_type) const = 0;
988
990
992
994 virtual Size get_light_profile_count() const = 0;
995
1001 virtual const char* get_light_profile( Size index) const = 0;
1002
1010 virtual const char* get_light_profile_url( Size index) const = 0;
1011
1018 virtual const char* get_light_profile_owner_module( Size index) const = 0;
1019
1026 virtual bool get_light_profile_is_body_resource( Size index) const = 0;
1027
1029
1031
1034
1040 virtual const char* get_bsdf_measurement(Size index) const = 0;
1041
1049 virtual const char* get_bsdf_measurement_url( Size index) const = 0;
1050
1057 virtual const char* get_bsdf_measurement_owner_module( Size index) const = 0;
1058
1066 virtual bool get_bsdf_measurement_is_body_resource( Size index) const = 0;
1067
1069
1071 virtual Size get_ro_data_segment_count() const = 0;
1072
1078 virtual const char* get_ro_data_segment_name( Size index) const = 0;
1079
1084 virtual Size get_ro_data_segment_size( Size index) const = 0;
1085
1091 virtual const char* get_ro_data_segment_data( Size index) const = 0;
1092
1094 virtual Size get_code_segment_count() const = 0;
1095
1100 virtual const char* get_code_segment( Size index) const = 0;
1101
1106 virtual Size get_code_segment_size( Size index) const = 0;
1107
1112 virtual const char* get_code_segment_description( Size index) const = 0;
1113
1118 virtual State_usage get_render_state_usage() const = 0;
1119
1121 virtual Size get_argument_block_count() const = 0;
1122
1129 virtual const ITarget_argument_block *get_argument_block(Size index) const = 0;
1130
1142 Size index,
1143 const ICompiled_material *material,
1144 ITarget_resource_callback *resource_callback) const = 0;
1145
1147 virtual Size get_argument_layout_count() const = 0;
1148
1154 virtual const ITarget_value_layout *get_argument_block_layout(Size index) const = 0;
1155
1157 virtual Size get_string_constant_count() const = 0;
1158
1164 virtual const char* get_string_constant(Size index) const = 0;
1165
1172 ITransaction* transaction,
1173 IValue_resource const *resource) const = 0;
1174
1183 const = 0;
1184
1192
1199
1207
1225 Size index,
1226 const Shading_state_environment& state,
1227 Texture_handler_base* tex_handler,
1228 Spectrum_struct* result) const = 0;
1229
1251 Size index,
1252 const Shading_state_material& state,
1253 Texture_handler_base* tex_handler,
1254 const ITarget_argument_block *cap_args,
1255 void* result) const = 0;
1256
1278 Size index,
1280 Texture_handler_base* tex_handler,
1281 const ITarget_argument_block *cap_args) const = 0;
1282
1301 Size index,
1302 Bsdf_sample_data *data,
1303 const Shading_state_material& state,
1304 Texture_handler_base* tex_handler,
1305 const ITarget_argument_block *cap_args) const = 0;
1306
1326 Size index,
1328 const Shading_state_material& state,
1329 Texture_handler_base* tex_handler,
1330 const ITarget_argument_block *cap_args) const = 0;
1331
1351 Size index,
1352 Bsdf_pdf_data *data,
1353 const Shading_state_material& state,
1354 Texture_handler_base* tex_handler,
1355 const ITarget_argument_block *cap_args) const = 0;
1356
1357
1377 Size index,
1379 const Shading_state_material& state,
1380 Texture_handler_base* tex_handler,
1381 const ITarget_argument_block *cap_args) const = 0;
1382
1383
1405 Size index,
1407 Texture_handler_base* tex_handler,
1408 const ITarget_argument_block *cap_args) const = 0;
1409
1428 Size index,
1429 Edf_sample_data *data,
1430 const Shading_state_material& state,
1431 Texture_handler_base* tex_handler,
1432 const ITarget_argument_block *cap_args) const = 0;
1433
1453 Size index,
1455 const Shading_state_material& state,
1456 Texture_handler_base* tex_handler,
1457 const ITarget_argument_block *cap_args) const = 0;
1458
1478 Size index,
1479 Edf_pdf_data *data,
1480 const Shading_state_material& state,
1481 Texture_handler_base* tex_handler,
1482 const ITarget_argument_block *cap_args) const = 0;
1483
1484
1504 Size index,
1506 const Shading_state_material& state,
1507 Texture_handler_base* tex_handler,
1508 const ITarget_argument_block *cap_args) const = 0;
1509
1516 virtual Size get_callable_function_df_handle_count( Size func_index) const = 0;
1517
1525 virtual const char* get_callable_function_df_handle( Size func_index, Size handle_index)
1526 const = 0;
1527
1530 virtual bool supports_serialization() const = 0;
1531
1549 virtual const IBuffer* serialize( IMdl_execution_context* context) const = 0;
1550
1558 virtual State_usage get_callable_function_render_state_usage( Size index) const = 0;
1559
1582 Size index,
1584 Texture_handler_base* tex_handler,
1585 const ITarget_argument_block *cap_args) const = 0;
1586};
1587
1589class ILink_unit : public
1590 mi::base::Interface_declare<0x1df9bbb0,0x5d96,0x475f,0x9a,0xf4,0x07,0xed,0x8c,0x2d,0xfd,0xdb>
1591{
1592public:
1619 const ICompiled_material* inst,
1620 const char* path,
1621 const char* fname,
1622 IMdl_execution_context* context) = 0;
1623
1660 const ICompiled_material* material,
1661 const char* path,
1662 const char* base_fname,
1663 IMdl_execution_context* context) = 0;
1664
1700 const ICompiled_material* material,
1701 Target_function_description* function_descriptions,
1702 Size description_count,
1703 IMdl_execution_context* context) = 0;
1704
1709 FEC_DISPLACEMENT = 2
1710 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(FEC_FORCE_32_BIT, 0xFFFFFFFFu)
1712
1733 const IFunction_call *call,
1735 const char *fname,
1736 IMdl_execution_context *context = nullptr) = 0;
1737
1758 const IFunction_definition *function,
1760 const char *fname,
1761 IMdl_execution_context *context) = 0;
1762};
1763
1766{
1768 const char* expression_path = nullptr,
1769 const char* base_function_name = nullptr)
1770 : path(expression_path)
1771 , base_fname(base_function_name)
1773 , function_index(~Size(0))
1774 ,
1775 return_code(~Sint32(0)) // not processed
1776 {
1777 }
1778
1781 const char* path;
1782
1787 const char* base_fname;
1788
1794
1804
1808
1841};
1842
1843} // namespace neuraylib
1844
1845} // namespace mi
1846
1847#endif // MI_NEURAYLIB_IMDL_BACKEND_H
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
Abstract interface for a simple buffer with binary data.
Definition: ibuffer.h:25
This interface represents a compiled material.
Definition: icompiled_material.h:94
This interface represents a function call.
Definition: ifunction_call.h:51
This interface represents a function definition.
Definition: ifunction_definition.h:45
Mdl_backend_kind
Currently available MDL backends.
Definition: imdl_backend_api.h:61
MDL backends allow to transform compiled material instances or function calls into target code.
Definition: imdl_backend.h:40
The execution context can be used to query status information like error and warning messages concern...
Definition: imdl_execution_context.h:163
Represents an argument block of a class-compiled material compiled for a specific target.
Definition: imdl_backend.h:687
Represents target code of an MDL backend.
Definition: imdl_backend.h:793
A callback interface to allow the user to handle resources when creating new mi::neuraylib::ITarget_a...
Definition: imdl_backend.h:643
Represents the layout of an mi::neuraylib::ITarget_argument_block with support for nested elements.
Definition: imdl_backend.h:727
A transaction provides a consistent view on the database.
Definition: itransaction.h:82
Base class for resource values.
Definition: ivalue.h:488
A value of type string.
Definition: ivalue.h:219
The interface to MDL values.
Definition: ivalue.h:34
Kind
The possible kinds of values.
Definition: ivalue.h:37
unsigned char Uint8
8-bit unsigned integer.
Definition: types.h:47
int Sint32
32-bit signed integer.
Definition: types.h:46
float Float32
32-bit float.
Definition: types.h:51
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
virtual Size get_size() const =0
Returns the size of the target argument block data.
virtual const char * get_texture_owner_module(Size index) const =0
Returns the owner module name of a relative texture file path.
virtual Sint32 execute(Size index, const Shading_state_material &state, Texture_handler_base *tex_handler, const ITarget_argument_block *cap_args, void *result) const =0
Run this code on the native CPU with the given captured arguments block.
ITarget_code::Distribution_kind distribution_kind
Return the distribution kind of this function (or NONE in case expressions).
Definition: imdl_backend.h:1807
virtual Sint32 execute_bsdf_pdf(Size index, Bsdf_pdf_data *data, const Shading_state_material &state, Texture_handler_base *tex_handler, const ITarget_argument_block *cap_args) const =0
Run the BSDF PDF calculation function for this code on the native CPU.
virtual const char * get_code() const =0
Returns the represented target code in ASCII representation.
virtual const ITarget_code * translate_link_unit(const ILink_unit *lu, IMdl_execution_context *context)=0
Transforms a link unit to target code.
virtual Sint32 set_option(const char *name, const char *value)=0
Sets a backend option.
virtual const char * get_texture(Size index) const =0
Returns the name of a texture resource used by the target code.
const char * path
The path from the material root to the expression that should be translated, e.g.,...
Definition: imdl_backend.h:1781
virtual Size get_bsdf_measurement_count() const =0
Returns the number of bsdf measurement resources used by the target code.
virtual Size get_num_elements(Target_value_layout_state state=Target_value_layout_state()) const =0
Get the number of arguments / elements at the given layout state.
Function_kind
Possible kinds of callable functions.
Definition: imdl_backend.h:853
virtual Texture_shape get_texture_shape(Size index) const =0
Returns the texture shape of a given texture resource used by the target code.
virtual Sint32 set_value(char *block, IValue const *value, ITarget_resource_callback *resource_callback, Target_value_layout_state state=Target_value_layout_state()) const =0
Set the value inside the given block at the given layout state.
virtual Size get_ro_data_segment_count() const =0
Returns the number of constant data initializers.
virtual bool get_light_profile_is_body_resource(Size index) const =0
Check whether the light profile resource is coming from the body of expressions (not solely from mate...
virtual const Uint8 * get_device_library(Size &size) const =0
Returns the representation of a device library for this backend if one exists.
virtual Size get_argument_layout_count() const =0
Returns the number of target argument block layouts.
virtual Sint32 add_material(const ICompiled_material *material, Target_function_description *function_descriptions, Size description_count, IMdl_execution_context *context)=0
Add (multiple) MDL distribution functions and expressions of a material to this link unit.
virtual Target_value_layout_state get_nested_state(Size i, Target_value_layout_state state=Target_value_layout_state()) const =0
Get the layout state for the i'th argument / element inside the argument value block at the given lay...
virtual const char * get_texture_selector(Size index) const =0
Returns the selector mode of a texture resource used by the target code.
virtual Sint32 execute_edf_auxiliary(Size index, Edf_auxiliary_data_base *data, const Shading_state_material &state, Texture_handler_base *tex_handler, const ITarget_argument_block *cap_args) const =0
Run the EDF auxiliary calculation function for this code on the native CPU.
virtual const char * get_callable_function_prototype(Size index, Prototype_language lang) const =0
Returns the prototype of a callable function in the target code.
virtual Size get_ro_data_segment_size(Size index) const =0
Returns the size of the constant data segment at the given index.
virtual const Float32 * get_texture_df_data(Size index, Size &rx, Size &ry, Size &rz, const char *&pixel_type) const =0
Returns the distribution function data this texture refers to.
virtual Function_kind get_callable_function_kind(Size index) const =0
Returns the function kind of a callable function in the target code.
virtual Sint32 add_function(const IFunction_definition *function, Function_execution_context fexc, const char *fname, IMdl_execution_context *context)=0
Add an MDL function definition as a function to this link unit.
virtual Size get_callable_function_argument_block_index(Size index) const =0
Get the index of the target argument block to use with a callable function.
virtual Df_data_kind get_texture_df_data_kind(Size index) const =0
Returns the distribution function data kind of a given texture resource used by the target code.
virtual Sint32 execute_edf_init(Size index, Shading_state_material &state, Texture_handler_base *tex_handler, const ITarget_argument_block *cap_args) const =0
Run the EDF init function for this code on the native CPU.
virtual IMdl_backend_api::Mdl_backend_kind get_backend_kind() const =0
Returns the kind of backend this information belongs to.
mi::Uint32 m_state_offs
The offset inside the layout state structure.
Definition: imdl_backend.h:710
virtual const char * get_ro_data_segment_data(Size index) const =0
Returns the data of the constant data segment at the given index.
virtual Uint32 get_string_index(IValue_string const *s)=0
Returns a string identifier for the given string value usable by the target code.
virtual Gamma_mode get_texture_gamma(Size index) const =0
Returns the gamma mode of a texture resource used by the target code.
virtual Sint32 execute_bsdf_init(Size index, Shading_state_material &state, Texture_handler_base *tex_handler, const ITarget_argument_block *cap_args) const =0
Run the BSDF init function for this code on the native CPU.
virtual Sint32 add_material_expression(const ICompiled_material *inst, const char *path, const char *fname, IMdl_execution_context *context)=0
Add an expression that is part of an MDL material instance as a function to this link unit.
virtual const ITarget_code * deserialize_target_code(ITransaction *transaction, const Uint8 *buffer_data, Size buffer_size, IMdl_execution_context *context) const =0
Restores an instance of ITarget_code from a buffer.
virtual Size get_callable_function_count() const =0
Returns the number of callable functions in the target code.
virtual bool get_texture_is_body_resource(Size index) const =0
Check whether the texture resource is coming from the body of expressions (not solely from material a...
virtual Sint32 execute_environment(Size index, const Shading_state_environment &state, Texture_handler_base *tex_handler, Spectrum_struct *result) const =0
Run this code on the native CPU.
virtual Size get_texture_count() const =0
Returns the number of texture resources used by the target code.
virtual Size get_layout(IValue::Kind &kind, Size &arg_size, Target_value_layout_state state=Target_value_layout_state()) const =0
Get the offset, the size and the kind of the argument / element inside the argument block at the give...
virtual const char * get_data() const =0
Returns the target argument block data.
virtual const char * get_light_profile_url(Size index) const =0
Returns the MDL file path of a light profile resource used by the target code if no database element ...
virtual ILink_unit * create_link_unit(ITransaction *transaction, IMdl_execution_context *context)=0
Creates a new link unit.
virtual bool supports_serialization() const =0
Indicates whether the target code can be serialized.
virtual const char * get_texture_url(Size index) const =0
Returns the MDL file path of a texture resource used by the target code if no database element is ass...
Texture_shape
Definition: imdl_backend.h:821
virtual Size get_argument_block_count() const =0
Returns the number of target argument blocks.
virtual Size get_code_segment_count() const =0
Returns the number of code segments of the target code.
Distribution_kind
Possible kinds of distribution functions.
Definition: imdl_backend.h:843
virtual Sint32 execute_init(Size index, Shading_state_material &state, Texture_handler_base *tex_handler, const ITarget_argument_block *cap_args) const =0
Run the init function for this code on the native CPU (single-init mode).
virtual const ITarget_code * translate_environment(ITransaction *transaction, const IFunction_call *call, const char *fname, IMdl_execution_context *context)=0
Transforms an MDL environment function call into target code.
virtual const ITarget_code * translate_material_expression(ITransaction *transaction, const ICompiled_material *material, const char *path, const char *fname, IMdl_execution_context *context)=0
Transforms an expression that is part of an MDL material instance to target code.
virtual const ITarget_code * translate_material_df(ITransaction *transaction, const ICompiled_material *material, const char *path, const char *base_fname, IMdl_execution_context *context)=0
Transforms an MDL distribution function to target code.
virtual Sint32 execute_edf_pdf(Size index, Edf_pdf_data *data, const Shading_state_material &state, Texture_handler_base *tex_handler, const ITarget_argument_block *cap_args) const =0
Run the EDF PDF calculation function for this code on the native CPU.
virtual const char * get_bsdf_measurement_owner_module(Size index) const =0
Returns the owner module name of a relative BSDF measurement file path.
Gamma_mode
Possible texture gamma modes.
Definition: imdl_backend.h:868
virtual const char * get_callable_function_df_handle(Size func_index, Size handle_index) const =0
Get the name of a distribution function handle referenced by a callable function.
Size function_index
The index of the generated function for accessing the callable function information of the link unit ...
Definition: imdl_backend.h:1803
virtual const char * get_callable_function(Size index) const =0
Returns the name of a callable function in the target code.
virtual Size get_string_constant_count() const =0
Returns the number of string constants used by the target code.
virtual Sint32 execute_edf_evaluate(Size index, Edf_evaluate_data_base *data, const Shading_state_material &state, Texture_handler_base *tex_handler, const ITarget_argument_block *cap_args) const =0
Run the EDF evaluation function for this code on the native CPU.
virtual Distribution_kind get_callable_function_distribution_kind(Size index) const =0
Returns the distribution kind of a callable function in the target code.
virtual ITarget_argument_block * clone() const =0
Clones the argument block (to make it writable).
virtual ITarget_argument_block * create_argument_block(Size index, const ICompiled_material *material, ITarget_resource_callback *resource_callback) const =0
Create a new target argument block of the class-compiled material for this target code.
virtual Sint32 execute_bsdf_sample(Size index, Bsdf_sample_data *data, const Shading_state_material &state, Texture_handler_base *tex_handler, const ITarget_argument_block *cap_args) const =0
Run the BSDF sample function for this code on the native CPU.
virtual const char * get_string_constant(Size index) const =0
Returns the string constant used by the target code.
virtual const ITarget_code * translate_material(ITransaction *transaction, const ICompiled_material *material, Target_function_description *function_descriptions, Size description_count, IMdl_execution_context *context)=0
Transforms (multiple) distribution functions and expressions of a material to target code.
Prototype_language
Language to use for the callable function prototype.
Definition: imdl_backend.h:833
virtual const ITarget_argument_block * get_argument_block(Size index) const =0
Get a target argument block if available.
State_usage_property
The potential state usage properties.
Definition: imdl_backend.h:796
virtual const char * get_light_profile_owner_module(Size index) const =0
Returns the owner module name of a relative light profile file path.
virtual Uint32 get_known_resource_index(ITransaction *transaction, IValue_resource const *resource) const =0
Returns the resource index for use in an ITarget_argument_block of resources already known when this ...
virtual const char * get_code_segment_description(Size index) const =0
Returns the description of the target code segment.
virtual Sint32 add_material_df(const ICompiled_material *material, const char *path, const char *base_fname, IMdl_execution_context *context)=0
Add an MDL distribution function to this link unit.
const char * base_fname
The base name of the generated functions.
Definition: imdl_backend.h:1787
virtual const char * get_code_segment(Size index) const =0
Returns the represented target code segment in ASCII representation.
virtual const IBuffer * serialize(IMdl_execution_context *context) const =0
Stores the data of this object in a buffer that can written to an external cache.
virtual State_usage get_render_state_usage() const =0
Returns the potential render state usage of the target code.
virtual State_usage get_callable_function_render_state_usage(Size index) const =0
Returns the potential render state usage of callable function in the target code.
virtual const ITarget_value_layout * get_argument_block_layout(Size index) const =0
Get a captured arguments block layout if available.
virtual Sint32 execute_edf_sample(Size index, Edf_sample_data *data, const Shading_state_material &state, Texture_handler_base *tex_handler, const ITarget_argument_block *cap_args) const =0
Run the EDF sample function for this code on the native CPU.
Sint32 return_code
A return code.
Definition: imdl_backend.h:1840
virtual Sint32 set_option_binary(const char *name, const char *data, Size size)=0
Sets a binary backend option.
virtual const char * get_ro_data_segment_name(Size index) const =0
Returns the name of the constant data segment at the given index.
virtual Size get_code_segment_size(Size index) const =0
Returns the length of the represented target code segment.
virtual char * get_data()=0
Returns the target argument block data.
virtual Size get_code_size() const =0
Returns the length of the represented target code.
virtual Size get_size() const =0
Returns the size of the target argument block.
virtual Sint32 execute_bsdf_auxiliary(Size index, Bsdf_auxiliary_data_base *data, const Shading_state_material &state, Texture_handler_base *tex_handler, const ITarget_argument_block *cap_args) const =0
Run the BSDF auxiliary calculation function for this code on the native CPU.
virtual const char * get_light_profile(Size index) const =0
Returns the name of a light profile resource used by the target code.
Size argument_block_index
The index of argument block that belongs to the compiled material the function is generated from or ~...
Definition: imdl_backend.h:1793
virtual const char * get_bsdf_measurement(Size index) const =0
Returns the name of a bsdf measurement resource used by the target code.
virtual const ITarget_code * deserialize_target_code(ITransaction *transaction, const IBuffer *buffer, IMdl_execution_context *context) const =0
Restores an instance of ITarget_code from a buffer.
virtual Sint32 execute_bsdf_evaluate(Size index, Bsdf_evaluate_data_base *data, const Shading_state_material &state, Texture_handler_base *tex_handler, const ITarget_argument_block *cap_args) const =0
Run the BSDF evaluation function for this code on the native CPU.
virtual Size get_light_profile_count() const =0
Returns the number of light profile resources used by the target code.
virtual Size get_callable_function_df_handle_count(Size func_index) const =0
Get the number of distribution function handles referenced by a callable function.
mi::Uint32 m_data_offs
The offset which needs to be added to the element data offset.
Definition: imdl_backend.h:713
virtual Sint32 add_function(const IFunction_call *call, Function_execution_context fexc, const char *fname, IMdl_execution_context *context=nullptr)=0
Add an MDL function call as a function to this link unit.
virtual const char * get_bsdf_measurement_url(Size index) const =0
Returns the MDL file path of a BSDF measurement resource used by the target code if no database eleme...
virtual bool get_bsdf_measurement_is_body_resource(Size index) const =0
Check whether the BSDF measurement resource is coming from the body of expressions (not solely from m...
Function_execution_context
Execution context for functions.
Definition: imdl_backend.h:1706
@ Texture_shape_invalid
Invalid texture.
Definition: imdl_backend.h:822
@ Texture_shape_ptex
PTEX texture.
Definition: imdl_backend.h:826
@ Texture_shape_bsdf_data
Three-dimensional texture representing a BSDF data table.
Definition: imdl_backend.h:827
@ Texture_shape_cube
Cube map texture.
Definition: imdl_backend.h:825
@ Texture_shape_3d
Three-dimensional texture.
Definition: imdl_backend.h:824
@ Texture_shape_2d
Two-dimensional texture.
Definition: imdl_backend.h:823
@ SU_TANGENT_SPACE
uses state::tangent_space()
Definition: imdl_backend.h:803
@ SU_GEOMETRY_NORMAL
uses state::geometry_normal()
Definition: imdl_backend.h:799
@ SU_DIRECTION
uses state::direction()
Definition: imdl_backend.h:805
@ SU_ANIMATION_TIME
uses state::animation_time()
Definition: imdl_backend.h:806
@ SU_TEXTURE_TANGENTS
uses state::texture_tangent_*()
Definition: imdl_backend.h:802
@ SU_TEXTURE_COORDINATE
uses state::texture_coordinate()
Definition: imdl_backend.h:801
@ SU_ALL_UNIFORM_MASK
set of uniform states
Definition: imdl_backend.h:814
@ SU_TRANSFORMS
uses uniform state::transform*()
Definition: imdl_backend.h:811
@ SU_NORMAL
uses state::normal()
Definition: imdl_backend.h:798
@ SU_MOTION
uses state::motion()
Definition: imdl_backend.h:800
@ SU_POSITION
uses state::position()
Definition: imdl_backend.h:797
@ SU_ALL_VARYING_MASK
set of varying states
Definition: imdl_backend.h:809
@ SU_ROUNDED_CORNER_NORMAL
uses state::rounded_corner_normal()
Definition: imdl_backend.h:807
@ SU_GEOMETRY_TANGENTS
uses state::geometry_tangent_*()
Definition: imdl_backend.h:804
@ SU_OBJECT_ID
uses uniform state::object_id()
Definition: imdl_backend.h:812
@ FEC_ENVIRONMENT
This function will be executed inside the environment.
Definition: imdl_backend.h:1707
@ FEC_CORE
This function will be executed in the renderer core.
Definition: imdl_backend.h:1708
@ FEC_DISPLACEMENT
This function will be executed inside displacement.
Definition: imdl_backend.h:1709
Df_data_kind
Possible kinds of distribution function data.
Definition: imdl_backend_api.h:38
API component for MDL backend related operations.
Mixin class template for deriving new interface declarations.
Values of the MDL type system.
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 a Spectrum representation storing three floating point elements.
Definition: color.h:47
Input and output structure for BSDF auxiliary calculation data.
Definition: target_code_types.h:877
Input and output structure for BSDF evaluation data.
Definition: target_code_types.h:804
Input and output structure for BSDF PDF calculation data.
Definition: target_code_types.h:864
Input and output structure for BSDF sampling data.
Definition: target_code_types.h:776
Input and output structure for EDF auxiliary calculation data.
Definition: target_code_types.h:1238
Input and output structure for EDF evaluation data.
Definition: target_code_types.h:1194
Input and output structure for EDF PDF calculation data.
Definition: target_code_types.h:1232
Input and output structure for EDF sampling data.
Definition: target_code_types.h:1184
The MDL environment state structure inside the MDL SDK is a representation of the renderer state in t...
Definition: target_code_types.h:155
The MDL material state structure inside the MDL SDK is a representation of the renderer state as defi...
Definition: target_code_types.h:206
Description of target function.
Definition: imdl_backend.h:1766
Structure representing the state during traversal of the nested layout.
Definition: imdl_backend.h:703
The texture handler structure that is passed to the texturing functions.
Definition: target_code_types.h:712
Types required for execution of generated native and CUDA code.
Typedefs for types from the math API.