MDL SDK API nvidia_logo_transpbg.gif Up
imdl_backend.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2024 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
16namespace mi {
17
18namespace neuraylib {
19
20class IBuffer;
21class ICompiled_material;
22class IFunction_definition;
23class IFunction_call;
24class ILink_unit;
25class IMdl_execution_context;
26class ITarget_code;
27class ITarget_argument_block;
28class ITransaction;
29
30struct Target_function_description;
31
37class IMdl_backend : public
38 mi::base::Interface_declare<0x9ecdd747,0x20b8,0x4a8a,0xb1,0xe2,0x62,0xb2,0x62,0x30,0xd3,0x67>
39{
40public:
76#if !defined(MDL_SOURCE_RELEASE) && defined(MDL_ENABLE_INTERPRETER)
82#endif
337 virtual Sint32 set_option( const char* name, const char* value) = 0;
338
354 const char* name,
355 const char* data,
356 Size size) = 0;
357
362 virtual const Uint8* get_device_library( Size &size) const = 0;
363
403 ITransaction* transaction,
404 const IFunction_call* call,
405 const char* fname,
406 IMdl_execution_context* context) = 0;
407
446 ITransaction* transaction,
447 const ICompiled_material* material,
448 const char* path,
449 const char* fname,
450 IMdl_execution_context* context) = 0;
451
485 ITransaction* transaction,
486 const ICompiled_material* material,
487 const char* path,
488 const char* base_fname,
489 IMdl_execution_context* context) = 0;
490
518 ITransaction* transaction,
519 const ICompiled_material* material,
520 Target_function_description* function_descriptions,
521 Size description_count,
522 IMdl_execution_context* context) = 0;
523
543 ITransaction* transaction,
544 IMdl_execution_context* context) = 0;
545
561 const ILink_unit* lu, IMdl_execution_context* context) = 0;
562
583 ITransaction* transaction,
584 const IBuffer* buffer,
585 IMdl_execution_context* context) const = 0;
586
608 ITransaction* transaction,
609 const Uint8* buffer_data,
610 Size buffer_size,
611 IMdl_execution_context* context) const = 0;
612};
613
618 mi::base::Interface_declare<0xe7559a88,0x9a9a,0x41d8,0xa1,0x9c,0x4a,0x52,0x4e,0x4b,0x7b,0x66>
619{
620public:
637#ifndef MDL_SOURCE_RELEASE
640#endif // MDL_SOURCE_RELEASE
645 virtual Uint32 get_resource_index(IValue_resource const *resource) = 0;
646
652 virtual Uint32 get_string_index(IValue_string const *s) = 0;
653};
654
662 mi::base::Interface_declare<0xf2a5db20,0x85ab,0x4c41,0x8c,0x5f,0x49,0xc8,0x29,0x4a,0x73,0x65>
663{
664public:
666 virtual const char* get_data() const = 0;
667
669 virtual char* get_data() = 0;
670
672 virtual Size get_size() const = 0;
673
675 virtual ITarget_argument_block *clone() const = 0;
676};
677
680 Target_value_layout_state(mi::Uint32 state_offs = 0, mi::Uint32 data_offs = 0)
681 : m_state_offs(state_offs)
682 , m_data_offs(data_offs)
683 {}
684
687
690};
691
702 mi::base::Interface_declare<0x1003351f,0x0c31,0x4a9d,0xb9,0x99,0x90,0xb5,0xe4,0xb4,0x71,0xe3>
703{
704public:
706 virtual Size get_size() const = 0;
707
714
726 IValue::Kind &kind,
727 Size &arg_size,
729
740 Size i,
742
760 char *block,
761 IValue const *value,
762 ITarget_resource_callback *resource_callback,
764};
765
767class ITarget_code : public
768 mi::base::Interface_declare<0xefca46ae,0xd530,0x4b97,0x9d,0xab,0x3a,0xdb,0x0c,0x58,0xc3,0xac>
769{
770public:
773 SU_POSITION = 0x0001u,
774 SU_NORMAL = 0x0002u,
776 SU_MOTION = 0x0008u,
781 SU_DIRECTION = 0x0100u,
784
786
787 SU_TRANSFORMS = 0x0800u,
788 SU_OBJECT_ID = 0x1000u,
789
791
792 SU_FORCE_32_BIT = 0xFFFFFFFFu // Undocumented, for alignment only
793 }; // can be or'ed
794
795 typedef Uint32 State_usage;
796
805 Texture_shape_FORCE_32_BIT = 0xFFFFFFFFu // Undocumented, for alignment only
806 };
807
810 SL_CUDA,
811 SL_PTX,
812 SL_HLSL,
813 SL_GLSL,
814 SL_NUM_LANGUAGES,
815 SL_FORCE_32_BIT = 0xFFFFFFFFu // Undocumented, for alignment only
816 };
817
820 {
821 DK_NONE,
822 DK_BSDF,
823 DK_HAIR_BSDF,
824 DK_EDF,
825 DK_INVALID,
826 DK_FORCE_32_BIT = 0xFFFFFFFFu // Undocumented, for alignment only
827 };
828
831 FK_INVALID,
832 FK_LAMBDA,
833 FK_SWITCH_LAMBDA,
834 FK_ENVIRONMENT,
835 FK_CONST,
836 FK_DF_INIT,
837 FK_DF_SAMPLE,
838 FK_DF_EVALUATE,
839 FK_DF_PDF,
840 FK_DF_AUXILIARY,
841 FK_FORCE_32_BIT = 0xFFFFFFFFu // Undocumented, for alignment only
842 };
843
846 GM_GAMMA_DEFAULT,
847 GM_GAMMA_LINEAR,
848 GM_GAMMA_SRGB,
849 GM_GAMMA_UNKNOWN,
850 GM_FORCE_32_BIT = 0xFFFFFFFFu // Undocumented, for alignment only
851 };
852
855
857 virtual const char* get_code() const = 0;
858
860 virtual Size get_code_size() const = 0;
861
864
874 virtual const char* get_callable_function( Size index) const = 0;
875
877
878
880 virtual Size get_texture_count() const = 0;
881
888 virtual const char* get_texture( Size index) const = 0;
889
897 virtual const char* get_texture_url( Size index) const = 0;
898
905 virtual const char* get_texture_owner_module( Size index) const = 0;
906
913 virtual bool get_texture_is_body_resource( Size index) const = 0;
914
920 virtual Gamma_mode get_texture_gamma( Size index) const = 0;
921
928 virtual const char* get_texture_selector( Size index) const = 0;
929
935 virtual Texture_shape get_texture_shape( Size index) const = 0;
936
943 virtual Df_data_kind get_texture_df_data_kind( Size index) const = 0;
944
957 Size index,
958 Size &rx,
959 Size &ry,
960 Size &rz) const = 0;
961
963
965
967 virtual Size get_light_profile_count() const = 0;
968
974 virtual const char* get_light_profile( Size index) const = 0;
975
983 virtual const char* get_light_profile_url( Size index) const = 0;
984
991 virtual const char* get_light_profile_owner_module( Size index) const = 0;
992
999 virtual bool get_light_profile_is_body_resource( Size index) const = 0;
1000
1002
1004
1007
1013 virtual const char* get_bsdf_measurement(Size index) const = 0;
1014
1022 virtual const char* get_bsdf_measurement_url( Size index) const = 0;
1023
1030 virtual const char* get_bsdf_measurement_owner_module( Size index) const = 0;
1031
1039 virtual bool get_bsdf_measurement_is_body_resource( Size index) const = 0;
1040
1042
1044 virtual Size get_ro_data_segment_count() const = 0;
1045
1051 virtual const char* get_ro_data_segment_name( Size index) const = 0;
1052
1057 virtual Size get_ro_data_segment_size( Size index) const = 0;
1058
1064 virtual const char* get_ro_data_segment_data( Size index) const = 0;
1065
1067 virtual Size get_code_segment_count() const = 0;
1068
1073 virtual const char* get_code_segment( Size index) const = 0;
1074
1079 virtual Size get_code_segment_size( Size index) const = 0;
1080
1085 virtual const char* get_code_segment_description( Size index) const = 0;
1086
1091 virtual State_usage get_render_state_usage() const = 0;
1092
1094 virtual Size get_argument_block_count() const = 0;
1095
1102 virtual const ITarget_argument_block *get_argument_block(Size index) const = 0;
1103
1115 Size index,
1116 const ICompiled_material *material,
1117 ITarget_resource_callback *resource_callback) const = 0;
1118
1120 virtual Size get_argument_layout_count() const = 0;
1121
1127 virtual const ITarget_value_layout *get_argument_block_layout(Size index) const = 0;
1128
1130 virtual Size get_string_constant_count() const = 0;
1131
1137 virtual const char* get_string_constant(Size index) const = 0;
1138
1145 ITransaction* transaction,
1146 IValue_resource const *resource) const = 0;
1147
1156 const = 0;
1157
1165
1172
1180
1198 Size index,
1199 const Shading_state_environment& state,
1200 Texture_handler_base* tex_handler,
1201 Spectrum_struct* result) const = 0;
1202
1224 Size index,
1225 const Shading_state_material& state,
1226 Texture_handler_base* tex_handler,
1227 const ITarget_argument_block *cap_args,
1228 void* result) const = 0;
1229
1251 Size index,
1253 Texture_handler_base* tex_handler,
1254 const ITarget_argument_block *cap_args) const = 0;
1255
1274 Size index,
1275 Bsdf_sample_data *data,
1276 const Shading_state_material& state,
1277 Texture_handler_base* tex_handler,
1278 const ITarget_argument_block *cap_args) const = 0;
1279
1299 Size index,
1301 const Shading_state_material& state,
1302 Texture_handler_base* tex_handler,
1303 const ITarget_argument_block *cap_args) const = 0;
1304
1324 Size index,
1325 Bsdf_pdf_data *data,
1326 const Shading_state_material& state,
1327 Texture_handler_base* tex_handler,
1328 const ITarget_argument_block *cap_args) const = 0;
1329
1330
1350 Size index,
1352 const Shading_state_material& state,
1353 Texture_handler_base* tex_handler,
1354 const ITarget_argument_block *cap_args) const = 0;
1355
1356
1378 Size index,
1380 Texture_handler_base* tex_handler,
1381 const ITarget_argument_block *cap_args) const = 0;
1382
1401 Size index,
1402 Edf_sample_data *data,
1403 const Shading_state_material& state,
1404 Texture_handler_base* tex_handler,
1405 const ITarget_argument_block *cap_args) const = 0;
1406
1426 Size index,
1428 const Shading_state_material& state,
1429 Texture_handler_base* tex_handler,
1430 const ITarget_argument_block *cap_args) const = 0;
1431
1451 Size index,
1452 Edf_pdf_data *data,
1453 const Shading_state_material& state,
1454 Texture_handler_base* tex_handler,
1455 const ITarget_argument_block *cap_args) const = 0;
1456
1457
1477 Size index,
1479 const Shading_state_material& state,
1480 Texture_handler_base* tex_handler,
1481 const ITarget_argument_block *cap_args) const = 0;
1482
1489 virtual Size get_callable_function_df_handle_count( Size func_index) const = 0;
1490
1498 virtual const char* get_callable_function_df_handle( Size func_index, Size handle_index)
1499 const = 0;
1500
1503 virtual bool supports_serialization() const = 0;
1504
1522 virtual const IBuffer* serialize( IMdl_execution_context* context) const = 0;
1523
1531 virtual State_usage get_callable_function_render_state_usage( Size index) const = 0;
1532
1555 Size index,
1557 Texture_handler_base* tex_handler,
1558 const ITarget_argument_block *cap_args) const = 0;
1559
1560 virtual Size MI_NEURAYLIB_DEPRECATED_METHOD_14_0(get_body_texture_count)() const = 0;
1561
1562 virtual Size MI_NEURAYLIB_DEPRECATED_METHOD_14_0(get_body_light_profile_count)() const = 0;
1563
1564 virtual Size MI_NEURAYLIB_DEPRECATED_METHOD_14_0(get_body_bsdf_measurement_count)() const = 0;
1565};
1566
1568class ILink_unit : public
1569 mi::base::Interface_declare<0x1df9bbb0,0x5d96,0x475f,0x9a,0xf4,0x07,0xed,0x8c,0x2d,0xfd,0xdb>
1570{
1571public:
1598 const ICompiled_material* inst,
1599 const char* path,
1600 const char* fname,
1601 IMdl_execution_context* context) = 0;
1602
1639 const ICompiled_material* material,
1640 const char* path,
1641 const char* base_fname,
1642 IMdl_execution_context* context) = 0;
1643
1679 const ICompiled_material* material,
1680 Target_function_description* function_descriptions,
1681 Size description_count,
1682 IMdl_execution_context* context) = 0;
1683
1689 FEC_FORCE_32_BIT = 0xFFFFFFFFu // Undocumented, for alignment only
1690 };
1691
1712 const IFunction_call *call,
1714 const char *fname,
1715 IMdl_execution_context *context = 0) = 0;
1716
1737 const IFunction_definition *function,
1739 const char *fname,
1740 IMdl_execution_context *context) = 0;
1741
1742 virtual Sint32 MI_NEURAYLIB_DEPRECATED_METHOD_14_0(add_environment)(
1743 const IFunction_call *call,
1744 const char *fname,
1745 IMdl_execution_context *context = 0) = 0;
1746};
1747
1750{
1752 const char* expression_path = 0,
1753 const char* base_function_name = 0)
1754 : path(expression_path)
1755 , base_fname(base_function_name)
1757 , function_index(~Size(0))
1758 , distribution_kind(ITarget_code::DK_INVALID)
1759 , return_code(~Sint32(0)) // not processed
1760 {
1761 }
1762
1765 const char* path;
1766
1771 const char* base_fname;
1772
1778
1788
1792
1825};
1826
1834
1835} // namespace neuraylib
1836
1837} // namespace mi
1838
1839#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:52
This interface represents a function definition.
Definition: ifunction_definition.h:44
Mdl_backend_kind
Currently available MDL backends.
Definition: imdl_backend_api.h:60
MDL backends allow to transform compiled material instances or function calls into target code.
Definition: imdl_backend.h:39
The execution context can be used to query status information like error and warning messages concern...
Definition: imdl_execution_context.h:131
Represents an argument block of a class-compiled material compiled for a specific target.
Definition: imdl_backend.h:663
Represents target code of an MDL backend.
Definition: imdl_backend.h:769
A callback interface to allow the user to handle resources when creating new mi::neuraylib::ITarget_a...
Definition: imdl_backend.h:619
Represents the layout of an mi::neuraylib::ITarget_argument_block with support for nested elements.
Definition: imdl_backend.h:703
A transaction provides a consistent view on the database.
Definition: itransaction.h:83
Base class for resource values.
Definition: ivalue.h:490
A value of type string.
Definition: ivalue.h:221
The interface to MDL values.
Definition: ivalue.h:33
Kind
The possible kinds of values.
Definition: ivalue.h:36
#define mi_static_assert(expr)
Compile time assertion that raises a compilation error if the constant expression expr evaluates to f...
Definition: assert.h:58
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
unsigned char Uint8
8-bit unsigned integer.
Definition: types.h:47
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
float Float32
32-bit float.
Definition: types.h:51
signed int Sint32
32-bit signed integer.
Definition: types.h:46
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.
Function_execution_context
Execution context for functions.
Definition: imdl_backend.h:1685
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:1791
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 const Float32 * get_texture_df_data(Size index, Size &rx, Size &ry, Size &rz) const =0
Returns the distribution function data this texture refers to.
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:1765
State_usage_property
The potential state usage properties.
Definition: imdl_backend.h:772
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.
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.
Distribution_kind
Possible kinds of distribution functions.
Definition: imdl_backend.h:820
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 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:686
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 Sint32 add_function(const IFunction_call *call, Function_execution_context fexc, const char *fname, IMdl_execution_context *context=0)=0
Add an MDL function call as a function to this link unit.
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...
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.
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.
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:1787
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.
Texture_shape
Definition: imdl_backend.h:797
Gamma_mode
Possible texture gamma modes.
Definition: imdl_backend.h:845
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.
virtual const ITarget_argument_block * get_argument_block(Size index) const =0
Get a target argument block if available.
virtual const char * get_light_profile_owner_module(Size index) const =0
Returns the owner module name of a relative light profile file path.
Prototype_language
Language to use for the callable function prototype.
Definition: imdl_backend.h:809
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 ...
Function_kind
Possible kinds of callable functions.
Definition: imdl_backend.h:830
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:1771
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:1824
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:1777
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:689
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...
@ FEC_ENVIRONMENT
This function will be executed inside the environment.
Definition: imdl_backend.h:1686
@ FEC_CORE
This function will be executed in the renderer core.
Definition: imdl_backend.h:1687
@ FEC_DISPLACEMENT
This function will be executed inside displacement.
Definition: imdl_backend.h:1688
@ SU_TANGENT_SPACE
uses state::tangent_space()
Definition: imdl_backend.h:779
@ SU_GEOMETRY_NORMAL
uses state::geometry_normal()
Definition: imdl_backend.h:775
@ SU_DIRECTION
uses state::direction()
Definition: imdl_backend.h:781
@ SU_ANIMATION_TIME
uses state::animation_time()
Definition: imdl_backend.h:782
@ SU_TEXTURE_TANGENTS
uses state::texture_tangent_*()
Definition: imdl_backend.h:778
@ SU_TEXTURE_COORDINATE
uses state::texture_coordinate()
Definition: imdl_backend.h:777
@ SU_ALL_UNIFORM_MASK
set of uniform states
Definition: imdl_backend.h:790
@ SU_TRANSFORMS
uses uniform state::transform*()
Definition: imdl_backend.h:787
@ SU_NORMAL
uses state::normal()
Definition: imdl_backend.h:774
@ SU_MOTION
uses state::motion()
Definition: imdl_backend.h:776
@ SU_POSITION
uses state::position()
Definition: imdl_backend.h:773
@ SU_ALL_VARYING_MASK
set of varying states
Definition: imdl_backend.h:785
@ SU_ROUNDED_CORNER_NORMAL
uses state::rounded_corner_normal()
Definition: imdl_backend.h:783
@ SU_GEOMETRY_TANGENTS
uses state::geometry_tangent_*()
Definition: imdl_backend.h:780
@ SU_OBJECT_ID
uses uniform state::object_id()
Definition: imdl_backend.h:788
@ Texture_shape_invalid
Invalid texture.
Definition: imdl_backend.h:798
@ Texture_shape_ptex
PTEX texture.
Definition: imdl_backend.h:802
@ Texture_shape_bsdf_data
Three-dimensional texture representing a BSDF data table.
Definition: imdl_backend.h:803
@ Texture_shape_cube
Cube map texture.
Definition: imdl_backend.h:801
@ Texture_shape_3d
Three-dimensional texture.
Definition: imdl_backend.h:800
@ Texture_shape_2d
Two-dimensional texture.
Definition: imdl_backend.h:799
Df_data_kind
Possible kinds of distribution function data.
Definition: imdl_backend_api.h:37
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: example_derivatives.dox:5
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:846
Input and output structure for BSDF evaluation data.
Definition: target_code_types.h:786
Input and output structure for BSDF PDF calculation data.
Definition: target_code_types.h:836
Input and output structure for BSDF sampling data.
Definition: target_code_types.h:761
Input and output structure for EDF auxiliary calculation data.
Definition: target_code_types.h:1199
Input and output structure for EDF evaluation data.
Definition: target_code_types.h:1155
Input and output structure for EDF PDF calculation data.
Definition: target_code_types.h:1193
Input and output structure for EDF sampling data.
Definition: target_code_types.h:1145
The MDL environment state structure inside the MDL SDK is a representation of the renderer state in t...
Definition: target_code_types.h:160
The MDL material state structure inside the MDL SDK is a representation of the renderer state as defi...
Definition: target_code_types.h:210
Description of target function.
Definition: imdl_backend.h:1750
Structure representing the state during traversal of the nested layout.
Definition: imdl_backend.h:679
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.