neuray API Programmer's Manual

mi::neuraylib::Target_function_description Struct Reference

[MDL compiler]

Description

Description of target function.

Public Variables

Size argument_block_index
The index of argument block that belongs to the compiled material the function is generated from or ~0 if none of the added function required arguments. More...
const  base_fname
The base name of the generated functions. More...
ITarget_code::​Distribution_kind distribution_kind
Return the distribution kind of this function (or NONE in case expressions). More...
Size function_index
The index of the generated function for accessing the callable function information of the link unit or ~0 if the selected function is an invalid distribution function. More...
const  path
The path from the material root to the expression that should be translated, e.g., "surface.scattering".
Sint32 return_code
A return code. More...

Variables

Size mi::​neuraylib::​Target_function_description::argument_block_index

The index of argument block that belongs to the compiled material the function is generated from or ~0 if none of the added function required arguments. It allows to get the layout and a writable pointer to argument data. This is an output parameter which is available after adding the function to the link unit.

const mi::​neuraylib::​Target_function_description::base_fname

The base name of the generated functions. If NULL is passed, the function name will be 'lambda' followed by an increasing counter. Note, that this counter is tracked per link unit. That means, you need to provide functions names when using multiple link units in order to avoid collisions.

ITarget_code::​Distribution_kind mi::​neuraylib::​Target_function_description::distribution_kind

Return the distribution kind of this function (or NONE in case expressions). This is an output parameter which is available after adding the function to the link unit.

Size mi::​neuraylib::​Target_function_description::function_index

The index of the generated function for accessing the callable function information of the link unit or ~0 if the selected function is an invalid distribution function. ~0 is not an error case, it just means, that evaluating the function will result in 0. In case the function is a distribution function, the returned index will be the index of the init function, while sample, evaluate, and pdf will be accessible by the consecutive indices, i.e., function_index + 1, function_index + 2, function_index + 3. This is an output parameter which is available after adding the function to the link unit.

const mi::​neuraylib::​Target_function_description::path

The path from the material root to the expression that should be translated, e.g., "surface.scattering".

Sint32 mi::​neuraylib::​Target_function_description::return_code

A return code. The error codes correspond to the codes returned by mi::neuraylib::ILink_unit::add_material_expression() (multiplied by 10) and mi::neuraylib::ILink_unit::add_material_df (multiplied by 100).

  • 0: Success.

  • ~0: The function has not yet been processed

  • -1: Invalid parameters (NULL pointer).

  • -2: Invalid path (non-existing).

  • -7: The backend does not implement this function, yet.

Codes for expressions, i.e., distribution_kind == DK_NONE

  • -10: The JIT backend is not available.

  • -20: Invalid field name (non-existing).

  • -30: invalid function name.

  • -40: The JIT backend failed to compile the function.

  • -50: The requested expression is a constant.

  • -60: Neither BSDFs, EDFs, VDFs, nor resource type expressions can be compiled.

Codes for distribution functions, i.e., distribution_kind == DK_BSDF, DK_EDF, ...

  • -100: Invalid parameters (NULL pointer).

  • -200: Invalid path (non-existing).

  • -300: The backend failed to generate target code for the material.

  • -400: The requested expression is a constant.

  • -500: Only distribution functions are allowed.

  • -600: The backend does not support compiled MDL materials obtained from class compilation mode.

  • -700: The backend does not implement this function, yet.

  • -800: EDFs are not supported. (deprecated, will not occur anymore)

  • -900: VDFs are not supported.

  • -1000: The requested DF is not supported, yet.