Skip to content

Commit

Permalink
MDL SDK 2023.1.3 (373000.2208)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkroll-nv committed Feb 20, 2024
1 parent 41100f4 commit 08830ab
Show file tree
Hide file tree
Showing 43 changed files with 336 additions and 212 deletions.
37 changes: 36 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
Change Log
==========
MDL SDK 2023.1.2 (373000.1755): 23 Jan 2024
MDL SDK 2023.1.3 (373000.2208): 14 Feb 2024
-----------------------------------------------

ABI compatible with the MDL SDK 2023.1.3 (373000.2208) binary release
(see [https://developer.nvidia.com/mdl-sdk](https://developer.nvidia.com/mdl-sdk))

**Added and Changed Features**

- General
- Update to zlib 1.3.1.

- MDL SDK examples
- Example AXF to MDL
- Simplified the code that constructs an instance of the spectral color constructor. This
also demonstrates how to use the `Argument_editor` to set array arguments.

**Fixed Bugs**

- General
- Fixed `IMdl_factory_impl::get_db_definition_name()` for entities from the `::<builtins>`
module.
- Fixed export of MDL modules with uvtile and/or animated textures, where under certain
conditions the first tile/frame was repeated for all tiles/frames of a particular resource
set.
- Fixed a bug that caused DB changes to become visible in concurrent transactions.
- Fixed missing dependencies on `libdl` on Linux that triggered the recently added undefined
symbol check on Ubuntu 20.04.

- MDL Compiler and Backends
- Fixed indeterministic generation of `rmem*` variables for HLSL/GLSL.
- Fixed invalid HLSL/GLSL code generation.

- MDL SDK examples
- Example Distilling Target
- Visual Studio project names for the executable and library use now different names.

MDL SDK 2023.1.2 (373000.1755): 23 Jan 2024
-----------------------------------------------

ABI compatible with the MDL SDK 2023.1.2 (373000.1755) binary release
(see [https://developer.nvidia.com/mdl-sdk](https://developer.nvidia.com/mdl-sdk))
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ dependencies are required:

- **SWIG** *(4.0.2)*
Follow the instructions for downloading or building on
[python.org](http://www.swig.org/download.html).
[swig.org](http://www.swig.org/download.html).

The following third-party dependencies are used by several and/or major
examples. Installation is strongly recommended unless the corresponding group
Expand Down
2 changes: 2 additions & 0 deletions cmake/dependencies/add_llvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ if(NOT __TARGET_ADD_DEPENDENCY_NO_LINKING)
${LINKER_START_GROUP}
${_STATIC_LIB_FILE_LIST}
${LINKER_END_GROUP}
# LLVMSupport uses dlopen()
${CMAKE_DL_LIBS}
)

add_dependencies(${__TARGET_ADD_DEPENDENCY_TARGET} mdl-jit-llvm) # add dependency manually
Expand Down
2 changes: 1 addition & 1 deletion doc/base_module/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ <h3>Edge</h3>

</div><div id="blackfooter">
<span class="footeritem">
23&#160;January&#160;2024,&#160;11:22,&#160;rev374755, v1.3
12&#160;February&#160;2024,&#160;20:26,&#160;rev375208, v1.3
</span>
<span class="footeritem">
<a href="https://www.nvidia.com/en-us/about-nvidia/legal-info/">&copy; 2024 NVIDIA&nbsp;Corporation.</a> All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion doc/build/doxygen_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path">
<span class="footeritem">MDL SDK 2023.1.2 (373000.1755): $datetime</span>
<span class="footeritem">MDL SDK 2023.1.3 (373000.2208): $datetime</span>
<span class="footeritem">
<a href="http://www.nvidia.com/">
&copy;&#160;2024&#160;NVIDIA&#160;Corporation.</a>
Expand Down
6 changes: 3 additions & 3 deletions doc/core_definitions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ <h2>Page cannot be loaded</h2>
bottom of the page or from the following links:</p>

<div style="padding-left:2em;">
<a href="mdl_core_definitions.240123.A4.pdf">View documentation in A4 format</a><br>
<a href="mdl_core_definitions.240123.LTR.pdf">View documentation in US Letter format</a><br>
<a href="mdl_core_definitions.240212.A4.pdf">View documentation in A4 format</a><br>
<a href="mdl_core_definitions.240212.LTR.pdf">View documentation in US Letter format</a><br>
</div>
<h3>Overriding security settings</h3>

Expand Down Expand Up @@ -277,7 +277,7 @@ <h3>Edge</h3>
<span class="footeritem">
</span>
<span class="footeritem">
23&#160;January&#160;2024,&#160;11:24,&#160;rev374755, v1.4
12&#160;February&#160;2024,&#160;20:27,&#160;rev375208, v1.4
</span>
<span class="footeritem">
<a href="https://www.nvidia.com/en-us/about-nvidia/legal-info/">&copy; 2024 NVIDIA&nbsp;Corporation.</a> All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</div>
<div id="blackfooter">
<span class="footeritem">
MDL SDK 2023.1.2 (373000.1755): 23 Jan 2024
MDL SDK 2023.1.3 (373000.2208): 14 Feb 2024
</span>
<span class="footeritem">
<a href="http://www.nvidia.com/">&copy;&#160;2024&#160;NVIDIA&#160;Corporation.</a> &#160;All&#160;rights&#160;reserved.
Expand Down
73 changes: 25 additions & 48 deletions examples/mdl_sdk/axf_to_mdl/axf_importer_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2487,8 +2487,7 @@ bool set_bsdf_param(
void set_spectral_param(
Axf_impexp_state* impexp_state,
mi::neuraylib::IExpression_list* default_parameters,
mi::neuraylib::IType_factory* type_factory,
mi::neuraylib::IValue_factory* val_factory,
mi::neuraylib::IMdl_factory* mdl_factory,
mi::neuraylib::IExpression_factory* expr_factory,
const mi::neuraylib::IFunction_definition* material,
const char* material_name,
Expand All @@ -2508,54 +2507,32 @@ void set_spectral_param(
return;
}

assert(wavelengths.size() == values.size());
const size_t num_wavelengths = wavelengths.size();

//
// create a spectral color constructor call
//

mi::base::Handle<const mi::neuraylib::IFunction_definition> function_definition(
transaction->access<mi::neuraylib::IFunction_definition>(
"mdl::color(float[N],float[N])"));
mi::base::Handle<mi::neuraylib::IExpression_list> arguments(
expr_factory->create_expression_list());
mi::base::Handle<const mi::neuraylib::IType> elem_type(type_factory->create_float());
mi::base::Handle<const mi::neuraylib::IType_array> array_type(
type_factory->create_immediate_sized_array(elem_type.get(), num_wavelengths));

// attach wavelengths and values arrays
for (unsigned int i = 0; i < 2; ++i)
{
const char *array_name = function_definition->get_parameter_name(i);

const float *f = (i == 0) ? wavelengths.data() : values.data();

// create and fill the array
mi::base::Handle<mi::neuraylib::IValue_array> ar(
val_factory->create_array(array_type.get()));
for (mi::Size j = 0; j < num_wavelengths; ++j)
{
mi::base::Handle<mi::neuraylib::IValue> val(
val_factory->create_float(f[j]));
ar->set_value(j, val.get());
}

mi::base::Handle<mi::neuraylib::IExpression> array_expr(
expr_factory->create_constant(ar.get()));
arguments->add_expression(array_name, array_expr.get());
}

mi::Sint32 res;
mi::base::Handle<mi::neuraylib::IFunction_call> function_call(
function_definition->create_function_call(arguments.get(), &res));
const string color_constructor_name =
get_axf_spectrum_prefix() +
impexp_state->get_module_prefix() + string("_") +
material_name + string("_") + param_name;
transaction->store(function_call.get(), color_constructor_name.c_str());


assert(wavelengths.size() == values.size());

mi::neuraylib::Definition_wrapper dw(transaction, "mdl::color(float[N],float[N])", mdl_factory);
assert(dw.is_valid());

mi::Sint32 result = 0;
mi::base::Handle<mi::neuraylib::IFunction_call> fc(dw.create_instance(nullptr, &result));
assert(result == 0);

string color_constructor_name
= get_axf_spectrum_prefix()
+ impexp_state->get_module_prefix() + string("_")
+ material_name + string("_")
+ param_name;
transaction->store(fc.get(), color_constructor_name.c_str());

mi::neuraylib::Argument_editor ae(transaction, color_constructor_name.c_str(), mdl_factory, true);
result = ae.set_value("wavelengths", wavelengths.data(), wavelengths.size());
assert(result == 0);
result = ae.set_value("amplitudes", values.data(), values.size());
assert(result == 0);

//
// attach call to parameter
//
Expand Down Expand Up @@ -2774,13 +2751,13 @@ void Axf_reader::create_variant(
param_name = "sigma_s";
set_spectral_param(
impexp_state,
default_parameters.get(), type_factory.get(), val_factory.get(),
default_parameters.get(), mdl_factory.get(),
expr_factory.get(), m_volumetric_material.get(), material_name.c_str(),
m_transaction, param_name, m_wavelengths, m_sigma_s);
param_name = "sigma_a";
set_spectral_param(
impexp_state,
default_parameters.get(), type_factory.get(), val_factory.get(),
default_parameters.get(), mdl_factory.get(),
expr_factory.get(), m_volumetric_material.get(), material_name.c_str(),
m_transaction, param_name, m_wavelengths, m_sigma_a);
}
Expand Down
9 changes: 9 additions & 0 deletions examples/mdl_sdk/distilling_target/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ target_add_dependencies(TARGET ${PLUGIN_PROJECT_NAME}
${LINKER_NO_WHOLE_ARCHIVE}
)

# extend to project names
get_target_property(_PROJECT_LABEL ${PROJECT_NAME} PROJECT_LABEL)
set_target_properties(${PROJECT_NAME} PROPERTIES
PROJECT_LABEL "${_PROJECT_LABEL} (main)" # project name
)
set_target_properties(${PLUGIN_PROJECT_NAME} PROPERTIES
PROJECT_LABEL "${_PROJECT_LABEL} (plugin)" # project name
)

# -------------------------------------------------------------------------------------------------
# Code Generation Step
# -------------------------------------------------------------------------------------------------
Expand Down
14 changes: 8 additions & 6 deletions include/mi/neuraylib/imdl_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,31 +328,33 @@ class IMdl_factory : public
/// For example, given \c "::state", the method returns \c "mdl::state".
///
/// \note This method does not check for existence of the corresponding DB element, nor does it
/// check that the input is a valid module name.
/// necessarily reject an invalid module name.
///
/// \note Usage of this method is strongly recommended instead of manually prepending \c "mdl",
/// since (a) the mapping is more complicated than that, e.g., for MDLE modules, and (b)
/// the mapping might change in the future.
///
/// \param mdl_name The MDL name of the module (non-MDLE and MDLE module), or the file path
/// of an MDLE module.
/// \return The DB name of that module, or \c NULL if \p mdl_name is invalid.
/// \return The DB name of that module, or \c NULL if \p mdl_name was detected as
/// invalid.
virtual const IString* get_db_module_name( const char* mdl_name) = 0;

/// Returns the DB name for the MDL name of an material or function definition.
///
/// For example, given \c "::state::normal()", the method returns \c "mdl::state::normal()".
///
/// \note This method does not check for existence of the corresponding DB element, nor does it
/// check that the input is a valid material or definition name.
/// necessarily reject an invalid material or function definition name.
///
/// \note Usage of this method is strongly recommended instead of manually prepending \c "mdl",
/// since (a) the mapping is more complicated than that, e.g., for MDLE modules, and (b)
/// the mapping might change in the future.
/// since (a) the mapping is more complicated than that, e.g., for definitions from the
/// \c ::&lt;builtins&gt; module or MDLE modules, and (b) the mapping might change in the
/// future.
///
/// \param mdl_name The MDL name of the material or function definition.
/// \return The DB name of that material or function definition, or \c NULL if
/// \p mdl_name is invalid.
/// \p mdl_name was detected as invalid.
virtual const IString* get_db_definition_name( const char* mdl_name) = 0;

/// Analyzes whether an expression graph violates the uniform constraints.
Expand Down
4 changes: 2 additions & 2 deletions include/mi/neuraylib/ineuray.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/***************************************************************************************************
/**************************************************************************************************
* Copyright (c) 2008-2024, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -105,7 +105,7 @@ class INeuray : public
/// - -2: Authentication failure (challenge-response).
/// - -4: Provided license expired.
/// - -5: No professional GPU as required by the license in use was found.
/// - -6: Authentication failure (FLEXlm).
/// (historical - -6: Authentication failure (FLEXlm).)
/// - -7: No NVIDIA VCA as required by the license in use was found.
virtual Sint32 start( bool blocking = true) = 0;

Expand Down
2 changes: 1 addition & 1 deletion include/mi/neuraylib/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
#endif // MI_NEURAYLIB_VERSION_QUALIFIER_EMPTY

/// \NeurayProductName product version number in a string representation, such as \c "2.0".
#define MI_NEURAYLIB_PRODUCT_VERSION_STRING "2023.1.2"
#define MI_NEURAYLIB_PRODUCT_VERSION_STRING "2023.1.3"

/// Type of plugins for the \NeurayApiName.
/// \see #mi::base::Plugin::get_type().
Expand Down
13 changes: 11 additions & 2 deletions src/api/api/neuray/neuray_mdl_factory_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,18 @@ const mi::IString* Mdl_factory_impl::get_db_definition_name( const char* mdl_nam
if( !mdl_name)
return nullptr;

// Reject invalid names that trigger an assertion in MDL::get_db_name()
bool mdle = MDL::is_mdle( mdl_name);
std::string mdl_name_str = mdl_name;
if( !MDL::starts_with_scope( mdl_name_str))
return nullptr;
if( !mdle && !MDL::starts_with_scope( mdl_name_str)) {
// The name is the builtins module (or an entity from the builtins module). Check this by
// verifying that there is no scope at all (excluding the signature).
size_t left_paren = mdl_name_str.find( '(');
size_t scope = mdl_name_str.find( "::");
if( (scope != std::string::npos)
&& ((left_paren == std::string::npos) || (scope < left_paren)))
return nullptr;
}

std::string result = MDL::get_db_name( mdl_name);
return new String_impl( result.c_str());
Expand Down
6 changes: 3 additions & 3 deletions src/base/data/dblight/data/test_gc_explicit_call.dump.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ Index 0: tag = 1, count = 2, pin count = 1, removed = 0

Count of all transactions: 1
Count of open transactions: 1
ID 0: pin count = 2, state = OPEN, next sequence number = 2, visibility ID = 4294967295
ID 0: pin count = 3, state = OPEN, next sequence number = 2, visibility ID = 4294967295

Count of infos by distinct names: 1
Index 0: name = "foo", count = 1
Index 0: transaction ID = 0 (cleared), version = 1, pin count = 0, tag = 1, removal = 0, references = { }
Index 0: transaction ID = 0 (set), version = 1, pin count = 0, tag = 1, removal = 0, references = { }

Count of infos by distinct tags: 1
Index 0: tag = 1, count = 1, pin count = 1, removed = 0
Index 0: transaction ID = 0 (cleared), version = 1, pin count = 0, tag = 1, removal = 0, name = "foo", references = { }
Index 0: transaction ID = 0 (set), version = 1, pin count = 0, tag = 1, removal = 0, name = "foo", references = { }


Count of all transactions: 1
Expand Down
16 changes: 8 additions & 8 deletions src/base/data/dblight/dblight_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ bool operator>=( const Info_impl& lhs, const Info_impl& rhs)
return (lhs > rhs) || (lhs == rhs);
}

/// Indicates whether the transaction has been committed.
bool is_committed( const Transaction_impl_ptr& transaction)
{
return transaction && (transaction->get_state() == Transaction_impl::COMMITTED);
}

/// Non-trivial code shared between Infos_per_name and Infos_per_tag.
namespace IMPL {

Expand Down Expand Up @@ -284,7 +290,6 @@ Info_impl* lookup_info(
--it;
}

MI_ASSERT( false);
return nullptr;
}

Expand Down Expand Up @@ -977,12 +982,6 @@ bool is_aborted( const Transaction_impl_ptr& transaction)
return transaction && (transaction->get_state() == Transaction_impl::ABORTED);
}

/// Indicates whether the creator transaction is visible for the given transaction ID.
bool is_visible_for( const Transaction_impl_ptr& transaction, DB::Transaction_id id)
{
return !transaction || (transaction->is_visible_for( id));
}

/// Indicates whether two transactions definitely have the same visibility.
///
/// Assumes that both transactions are from the same scope, and that globally visible transactions
Expand Down Expand Up @@ -1042,7 +1041,8 @@ void Info_manager::cleanup_tag_general( DB::Tag tag, DB::Transaction_id lowest_o

// Clear creator transaction for infos that are globally visible. This is required to
// eventually release the transaction, but does not count as GC progress w.r.t. the infos.
bool globally_visible = is_visible_for( transaction, lowest_open);
bool globally_visible = !transaction
|| (is_committed( transaction) && transaction->is_visible_for( lowest_open));
if( transaction) {
if( globally_visible) {
current->clear_transaction();
Expand Down
1 change: 1 addition & 0 deletions src/base/hal/link/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ create_from_base_preset(
target_add_dependencies(TARGET ${PROJECT_NAME}
DEPENDS
boost
system
)
10 changes: 10 additions & 0 deletions src/base/lib/zlib/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@

ChangeLog file for zlib

Changes in 1.3.1 (22 Jan 2024)
- Reject overflows of zip header fields in minizip
- Fix bug in inflateSync() for data held in bit buffer
- Add LIT_MEM define to use more memory for a small deflate speedup
- Fix decision on the emission of Zip64 end records in minizip
- Add bounds checking to ERR_MSG() macro, used by zError()
- Neutralize zip file traversal attacks in miniunz
- Fix a bug in ZLIB_DEBUG compiles in check_match()
- Various portability and appearance improvements

Changes in 1.3 (18 Aug 2023)
- Remove K&R function definitions and zlib2ansi
- Fix bug in deflateBound() for level 0 and memLevel 9
Expand Down
Loading

0 comments on commit 08830ab

Please sign in to comment.