Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::neuraylib::ILink_unit Class Referenceabstract

Represents a link-unit of an MDL backend. More...

Inheritance diagram for mi::neuraylib::ILink_unit:
mi::base::Interface_declare< 0x1df9bbb0, 0x5d96, 0x475f, 0x9a, 0xf4, 0x07, 0xed, 0x8c, 0x2d, 0xfd, 0xdb > mi::base::IInterface

Public Member Functions

virtual Sint32 deprecated_add_environment (const IFunction_call *call, const char *fname, Float32 mdl_meters_per_scene_unit, Float32 mdl_wavelength_min, Float32 mdl_wavelength_max)=0
 Add an MDL environment function call as a function to this link unit. More...
 
virtual Sint32 add_environment (const IFunction_call *call, const char *fname, IMdl_execution_context *context=0)=0
 Add an MDL environment function call as a function to this link unit. More...
 
virtual Sint32 deprecated_add_material_expression (const ICompiled_material *inst, const char *path, const char *fname)=0
 Add an expression that is part of an MDL material instance as a function to this link unit. More...
 
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. More...
 
virtual Sint32 deprecated_add_material_df (const ICompiled_material *material, const char *path, const char *base_fname, bool include_geometry_normal)=0
 Add an MDL distribution function to this link unit. More...
 
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. More...
 
virtual Sint32 deprecated_add_material (const ICompiled_material *material, Target_function_description *function_descriptions, Size description_count, bool include_geometry_normal)=0
 Add (multiple) MDL distribution functions and expressions of a material to this link unit. More...
 
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. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x1df9bbb0, 0x5d96, 0x475f, 0x9a, 0xf4, 0x07, 0xed, 0x8c, 0x2d, 0xfd, 0xdb >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
Self
 Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x1df9bbb0, 0x5d96, 0x475f, 0x9a, 0xf4, 0x07, 0xed, 0x8c, 0x2d, 0xfd, 0xdb >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 

Detailed Description

Represents a link-unit of an MDL backend.

Member Function Documentation

virtual Sint32 mi::neuraylib::ILink_unit::add_environment ( const IFunction_call call,
const char *  fname,
IMdl_execution_context context = 0 
)
pure virtual

Add an MDL environment function call as a function to this link unit.

Parameters
callThe MDL function call for the environment.
fnameThe name of the function that is created.
[in,out]contextA pointer to an mi::neuraylib::IMdl_execution_context which can be used to pass compilation options to the MDL compiler. The following options are supported for this operation:
  • Float32 "meters_per_scene_unit": The conversion ratio between meters and scene units for this material. Default: 1.0f.
  • Float32 "wavelength_min": The smallest supported wavelength. Default: 380.0f.
  • Float32 "wavelength_max": The largest supported wavelength. Default: 780.0f. During material compilation messages like errors and warnings will be passed to the context for later evaluation by the caller. Can be NULL.
Returns
A return code. The return codes have the following meaning:
virtual Sint32 mi::neuraylib::ILink_unit::add_material ( const ICompiled_material material,
Target_function_description *  function_descriptions,
Size  description_count,
IMdl_execution_context context 
)
pure virtual

Add (multiple) MDL distribution functions and expressions of a material to this link unit.

For each distribution function this results in four functions, suffixed with "_init", "_sample", "_evaluate", and "_pdf". Functions can be selected by providing a list of Target_function_descriptions. Each of them needs to define the path, the root of the expression that should be translated. After calling this function, each element of the list will contain information for later usage in the application, e.g., the argument_block_index and the function_index.

Parameters
materialThe compiled MDL material.
function_descriptionsThe list of descriptions of function to translate.
description_countThe size of the list of descriptions.
[in,out]contextA pointer to an mi::neuraylib::IMdl_execution_context which can be used to pass compilation options to the MDL compiler. The following options are supported for this operation:
  • bool "include_geometry_normal". If true, the "geometry.normal" field will be applied to the MDL state prior to evaluation of the given DF (default true). During material compilation messages like errors and warnings will be passed to the context for later evaluation by the caller. Can be NULL.
Returns
A return code. The error codes have the following meaning:
virtual Sint32 mi::neuraylib::ILink_unit::add_material_df ( const ICompiled_material material,
const char *  path,
const char *  base_fname,
IMdl_execution_context context 
)
pure virtual

Add an MDL distribution function to this link unit.

Note that currently this is only supported for BSDFs. For a BSDF it results in four functions, suffixed with "_init", "_sample", "_evaluate" and "_pdf".

Parameters
materialThe compiled MDL material.
pathThe path from the material root to the expression that should be translated, e.g., "surface.scattering".
base_fnameThe base name of the generated functions. If NULL is passed, "lambda" will be used.
[in,out]contextA pointer to an mi::neuraylib::IMdl_execution_context which can be used to pass compilation options to the MDL compiler. The following options are supported for this operation:
  • bool "include_geometry_normal". If true, the "geometry.normal" field will be applied to the MDL state prior to evaluation of the given DF (default true). During material compilation messages like errors and warnings will be passed to the context for later evaluation by the caller. Can be NULL.
Returns
A return code. The return codes have the following meaning:
virtual Sint32 mi::neuraylib::ILink_unit::add_material_expression ( const ICompiled_material inst,
const char *  path,
const char *  fname,
IMdl_execution_context context 
)
pure virtual

Add an expression that is part of an MDL material instance as a function to this link unit.

Parameters
instThe compiled MDL material instance.
pathThe path from the material root to the expression that should be translated, e.g., "geometry.displacement".
fnameThe name of the function that is created.
[in,out]contextA pointer to an mi::neuraylib::IMdl_execution_context which can be used to pass compilation options to the MDL compiler. Currently, no options are supported by this operation. During material compilation messages like errors and warnings will be passed to the context for later evaluation by the caller. Can be NULL.
Returns
A return code. The return codes have the following meaning:
virtual Sint32 mi::neuraylib::ILink_unit::deprecated_add_environment ( const IFunction_call call,
const char *  fname,
Float32  mdl_meters_per_scene_unit,
Float32  mdl_wavelength_min,
Float32  mdl_wavelength_max 
)
pure virtual

Add an MDL environment function call as a function to this link unit.

Parameters
callThe MDL function call for the environment.
fnameThe name of the function that is created.
mdl_meters_per_scene_unitThe conversion ratio between meters and scene units for this environment function.
mdl_wavelength_minThe smallest supported wavelength, typical value: 380.
mdl_wavelength_maxThe largest supported wavelength, typical value: 780.
Returns
A return code. The return codes have the following meaning:
  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: Invalid expression.
  • -3: The backend failed to compile the function.
virtual Sint32 mi::neuraylib::ILink_unit::deprecated_add_material ( const ICompiled_material material,
Target_function_description *  function_descriptions,
Size  description_count,
bool  include_geometry_normal 
)
pure virtual

Add (multiple) MDL distribution functions and expressions of a material to this link unit.

For each distribution function this results in four functions, suffixed with "_init", "_sample", "_evaluate", and "_pdf". Functions can be selected by providing a list of Target_function_descriptions. Each of them needs to define the path, the root of the expression that should be translated. After calling this function, each element of the list will contain information for later usage in the application, e.g., the argument_block_index and the function_index.

Parameters
materialThe compiled MDL material.
function_descriptionsThe list of descriptions of function to translate.
description_countThe size of the list of descriptions.
include_geometry_normalIf true, the "geometry.normal" field will be applied to the MDL state prior to evaluation of the given DF.
Returns
A return code. The error codes have the following meaning:
  • 0: Success.
  • -1: An error occurred while processing the entries in the list. For more detailed error information, each list entry contains the error code of the corresponding function type (see the return codes of add_material_expression and add_material_df). In case of an error, rely only on the first return code different from 0.
virtual Sint32 mi::neuraylib::ILink_unit::deprecated_add_material_df ( const ICompiled_material material,
const char *  path,
const char *  base_fname,
bool  include_geometry_normal 
)
pure virtual

Add an MDL distribution function to this link unit.

Note that currently this is only supported for BSDFs. For a BSDF it results in four functions, suffixed with "_init", "_sample", "_evaluate" and "_pdf".

Parameters
materialThe compiled MDL material.
pathThe path from the material root to the expression that should be translated, e.g., "surface.scattering".
base_fnameThe base name of the generated functions. If NULL is passed, "lambda" will be used.
include_geometry_normalIf true, the "geometry.normal" field will be applied to the MDL state prior to evaluation of the given DF.
Returns
A return code. The error codes have the following meaning:
  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: Invalid path (non-existing).
  • -3: The backend failed to generate target code for the material.
  • -4: The requested expression is a constant.
  • -5: Only distribution functions are allowed.
  • -6: The backend does not support compiled MDL materials obtained from class compilation mode.
  • -7: The backend does not implement this function, yet.
  • -8: EDFs are not supported. (deprecated, will not occur anymore)
  • -9: VDFs are not supported.
  • -10: The requested DF is not supported, yet.
virtual Sint32 mi::neuraylib::ILink_unit::deprecated_add_material_expression ( const ICompiled_material inst,
const char *  path,
const char *  fname 
)
pure virtual

Add an expression that is part of an MDL material instance as a function to this link unit.

Parameters
instThe compiled MDL material instance.
pathThe path from the material root to the expression that should be translated, e.g., "geometry.displacement".
fnameThe name of the function that is created.
Returns
A return code. The return codes have the following meaning:
  • 0: Success.
  • -1: The JIT backend is not available.
  • -2: Invalid field name (non-existing).
  • -3: invalid function name.
  • -4: The JIT backend failed to compile the function.
  • -5: The requested expression is a constant.
  • -6: Neither BSDFs, EDFs, VDFs, nor resource type expressions can be compiled.
The generated target code, or NULL in case of failure.