aboutsummaryrefslogtreecommitdiff
path: root/APEX_1.4/NvParameterized
diff options
context:
space:
mode:
authorgit perforce import user <a@b>2016-10-25 12:29:14 -0600
committerSheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees>2016-10-25 18:56:37 -0500
commit3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch)
treefa6485c169e50d7415a651bf838f5bcd0fd3bfbd /APEX_1.4/NvParameterized
downloadphysx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz
physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip
Initial commit:
PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167]
Diffstat (limited to 'APEX_1.4/NvParameterized')
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc11win32-PhysX_3.4/NvParameterized.sln30
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc11win32-PhysX_3.4/NvParameterized.vcxproj297
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc11win32-PhysX_3.4/NvParameterized.vcxproj.filters126
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc11win64-PhysX_3.4/NvParameterized.sln30
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc11win64-PhysX_3.4/NvParameterized.vcxproj293
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc11win64-PhysX_3.4/NvParameterized.vcxproj.filters126
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc12win32-PhysX_3.4/NvParameterized.sln30
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc12win32-PhysX_3.4/NvParameterized.vcxproj297
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc12win32-PhysX_3.4/NvParameterized.vcxproj.filters126
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc12win64-PhysX_3.4/NvParameterized.sln30
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc12win64-PhysX_3.4/NvParameterized.vcxproj293
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc12win64-PhysX_3.4/NvParameterized.vcxproj.filters126
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc14win32-PhysX_3.4/NvParameterized.sln30
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc14win32-PhysX_3.4/NvParameterized.vcxproj280
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc14win32-PhysX_3.4/NvParameterized.vcxproj.filters126
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc14win64-PhysX_3.4/NvParameterized.sln30
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc14win64-PhysX_3.4/NvParameterized.vcxproj280
-rw-r--r--APEX_1.4/NvParameterized/compiler/vc14win64-PhysX_3.4/NvParameterized.vcxproj.filters126
-rw-r--r--APEX_1.4/NvParameterized/include/AbstractSerializer.h173
-rw-r--r--APEX_1.4/NvParameterized/include/ApbDefinitions.h217
-rw-r--r--APEX_1.4/NvParameterized/include/BinSerializer.h132
-rw-r--r--APEX_1.4/NvParameterized/include/BinaryHelper.h290
-rw-r--r--APEX_1.4/NvParameterized/include/NvDefaultTraits.h503
-rw-r--r--APEX_1.4/NvParameterized/include/NvParamConversionTemplate.h147
-rw-r--r--APEX_1.4/NvParameterized/include/NvParameters.h650
-rw-r--r--APEX_1.4/NvParameterized/include/NvParametersTypes.h58
-rw-r--r--APEX_1.4/NvParameterized/include/NvRegistrationsForTraitsBase.h29
-rw-r--r--APEX_1.4/NvParameterized/include/NvSerializerInternal.h63
-rw-r--r--APEX_1.4/NvParameterized/include/NvTraitsInternal.h85
-rw-r--r--APEX_1.4/NvParameterized/include/PlatformABI.h135
-rw-r--r--APEX_1.4/NvParameterized/include/PlatformABI.inl267
-rw-r--r--APEX_1.4/NvParameterized/include/PlatformInputStream.h115
-rw-r--r--APEX_1.4/NvParameterized/include/PlatformInputStream.inl117
-rw-r--r--APEX_1.4/NvParameterized/include/PlatformOutputStream.h212
-rw-r--r--APEX_1.4/NvParameterized/include/PlatformOutputStream.inl138
-rw-r--r--APEX_1.4/NvParameterized/include/PlatformStream.h151
-rw-r--r--APEX_1.4/NvParameterized/include/SerializerCommon.h172
-rw-r--r--APEX_1.4/NvParameterized/include/XmlDeserializer.h307
-rw-r--r--APEX_1.4/NvParameterized/include/XmlSerializer.h114
-rw-r--r--APEX_1.4/NvParameterized/src/BinSerializer.cpp1828
-rw-r--r--APEX_1.4/NvParameterized/src/BinaryHelper.cpp123
-rw-r--r--APEX_1.4/NvParameterized/src/NvParameterized.cpp5957
-rw-r--r--APEX_1.4/NvParameterized/src/NvParameterizedTraits.cpp363
-rw-r--r--APEX_1.4/NvParameterized/src/NvSerializer.cpp358
-rw-r--r--APEX_1.4/NvParameterized/src/NvTraits.cpp446
-rw-r--r--APEX_1.4/NvParameterized/src/NvTraits.h41
-rw-r--r--APEX_1.4/NvParameterized/src/PlatformABI.cpp414
-rw-r--r--APEX_1.4/NvParameterized/src/PlatformInputStream.cpp336
-rw-r--r--APEX_1.4/NvParameterized/src/PlatformOutputStream.cpp560
-rw-r--r--APEX_1.4/NvParameterized/src/SerializerCommon.cpp234
-rw-r--r--APEX_1.4/NvParameterized/src/XmlDeserializer.cpp759
-rw-r--r--APEX_1.4/NvParameterized/src/XmlSerializer.cpp1270
52 files changed, 19440 insertions, 0 deletions
diff --git a/APEX_1.4/NvParameterized/compiler/vc11win32-PhysX_3.4/NvParameterized.sln b/APEX_1.4/NvParameterized/compiler/vc11win32-PhysX_3.4/NvParameterized.sln
new file mode 100644
index 00000000..2cee03ca
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc11win32-PhysX_3.4/NvParameterized.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NvParameterized", "./NvParameterized.vcxproj", "{116CDA44-9950-8942-1462-6A904E0C4817}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ checked|Win32 = checked|Win32
+ debug|Win32 = debug|Win32
+ profile|Win32 = profile|Win32
+ release|Win32 = release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {116CDA44-9950-8942-1462-6A904E0C4817}.checked|Win32.ActiveCfg = checked|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.checked|Win32.Build.0 = checked|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.debug|Win32.ActiveCfg = debug|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.debug|Win32.Build.0 = debug|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.profile|Win32.ActiveCfg = profile|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.profile|Win32.Build.0 = profile|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.release|Win32.ActiveCfg = release|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.release|Win32.Build.0 = release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/APEX_1.4/NvParameterized/compiler/vc11win32-PhysX_3.4/NvParameterized.vcxproj b/APEX_1.4/NvParameterized/compiler/vc11win32-PhysX_3.4/NvParameterized.vcxproj
new file mode 100644
index 00000000..6e1178a9
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc11win32-PhysX_3.4/NvParameterized.vcxproj
@@ -0,0 +1,297 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project
+ DefaultTargets="Build"
+ ToolsVersion="4.0"
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|Win32">
+ <Configuration>debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|Win32">
+ <Configuration>release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="profile|Win32">
+ <Configuration>profile</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="checked|Win32">
+ <Configuration>checked</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{116CDA44-9950-8942-1462-6A904E0C4817}</ProjectGuid>
+ <RootNamespace>NvParameterized</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='release|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='profile|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='checked|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings"></ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <OutDir>./../../lib/vc11win32\</OutDir>
+ <IntDir>./build/Win32/NvParameterized/debug\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)DEBUG</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc11win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <OutDir>./../../lib/vc11win32\</OutDir>
+ <IntDir>./build/Win32/NvParameterized/release\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc11win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName).lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <OutDir>./../../lib/vc11win32\</OutDir>
+ <IntDir>./build/Win32/NvParameterized/profile\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)PROFILE</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc11win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <OutDir>./../../lib/vc11win32\</OutDir>
+ <IntDir>./build/Win32/NvParameterized/checked\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)CHECKED</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc11win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\BinaryHelper.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\BinSerializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvParameterized.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvParameterizedTraits.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvSerializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvTraits.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformABI.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformInputStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformOutputStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\SerializerCommon.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\XmlDeserializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\XmlSerializer.cpp"></ClCompile>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\AbstractSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\ApbDefinitions.h"></ClInclude>
+ <ClInclude Include="..\..\include\BinaryHelper.h"></ClInclude>
+ <ClInclude Include="..\..\include\BinSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvDefaultTraits.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParamConversionTemplate.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParameters.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParametersTypes.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvRegistrationsForTraitsBase.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvSerializerInternal.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvTraitsInternal.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\SerializerCommon.h"></ClInclude>
+ <ClInclude Include="..\..\include\XmlDeserializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\XmlSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.inl"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.inl"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.inl"></ClInclude>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/APEX_1.4/NvParameterized/compiler/vc11win32-PhysX_3.4/NvParameterized.vcxproj.filters b/APEX_1.4/NvParameterized/compiler/vc11win32-PhysX_3.4/NvParameterized.vcxproj.filters
new file mode 100644
index 00000000..3f822a73
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc11win32-PhysX_3.4/NvParameterized.vcxproj.filters
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_SRC">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_SRC\src">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\BinaryHelper.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\BinSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvParameterized.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvParameterizedTraits.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvTraits.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformABI.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformInputStream.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformOutputStream.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\SerializerCommon.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\XmlDeserializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\XmlSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_HEADER">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_HEADER\include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\AbstractSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ApbDefinitions.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\BinaryHelper.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\BinSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvDefaultTraits.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParamConversionTemplate.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParameters.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParametersTypes.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvRegistrationsForTraitsBase.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvSerializerInternal.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvTraitsInternal.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\SerializerCommon.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\XmlDeserializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\XmlSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/APEX_1.4/NvParameterized/compiler/vc11win64-PhysX_3.4/NvParameterized.sln b/APEX_1.4/NvParameterized/compiler/vc11win64-PhysX_3.4/NvParameterized.sln
new file mode 100644
index 00000000..c34b1092
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc11win64-PhysX_3.4/NvParameterized.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NvParameterized", "./NvParameterized.vcxproj", "{116CDA44-9950-8942-1462-6A904E0C4817}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ checked|x64 = checked|x64
+ debug|x64 = debug|x64
+ profile|x64 = profile|x64
+ release|x64 = release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {116CDA44-9950-8942-1462-6A904E0C4817}.checked|x64.ActiveCfg = checked|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.checked|x64.Build.0 = checked|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.debug|x64.ActiveCfg = debug|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.debug|x64.Build.0 = debug|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.profile|x64.ActiveCfg = profile|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.profile|x64.Build.0 = profile|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.release|x64.ActiveCfg = release|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.release|x64.Build.0 = release|x64
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/APEX_1.4/NvParameterized/compiler/vc11win64-PhysX_3.4/NvParameterized.vcxproj b/APEX_1.4/NvParameterized/compiler/vc11win64-PhysX_3.4/NvParameterized.vcxproj
new file mode 100644
index 00000000..6c193bf9
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc11win64-PhysX_3.4/NvParameterized.vcxproj
@@ -0,0 +1,293 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project
+ DefaultTargets="Build"
+ ToolsVersion="4.0"
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|x64">
+ <Configuration>debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|x64">
+ <Configuration>release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="profile|x64">
+ <Configuration>profile</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="checked|x64">
+ <Configuration>checked</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{116CDA44-9950-8942-1462-6A904E0C4817}</ProjectGuid>
+ <RootNamespace>NvParameterized</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='debug|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='release|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='profile|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='checked|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings"></ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <OutDir>./../../lib/vc11win64\</OutDir>
+ <IntDir>./build/x64/NvParameterized/debug\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)DEBUG</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc11win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <OutDir>./../../lib/vc11win64\</OutDir>
+ <IntDir>./build/x64/NvParameterized/release\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc11win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName).lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <OutDir>./../../lib/vc11win64\</OutDir>
+ <IntDir>./build/x64/NvParameterized/profile\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)PROFILE</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc11win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <OutDir>./../../lib/vc11win64\</OutDir>
+ <IntDir>./build/x64/NvParameterized/checked\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)CHECKED</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc11win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\BinaryHelper.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\BinSerializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvParameterized.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvParameterizedTraits.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvSerializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvTraits.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformABI.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformInputStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformOutputStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\SerializerCommon.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\XmlDeserializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\XmlSerializer.cpp"></ClCompile>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\AbstractSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\ApbDefinitions.h"></ClInclude>
+ <ClInclude Include="..\..\include\BinaryHelper.h"></ClInclude>
+ <ClInclude Include="..\..\include\BinSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvDefaultTraits.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParamConversionTemplate.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParameters.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParametersTypes.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvRegistrationsForTraitsBase.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvSerializerInternal.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvTraitsInternal.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\SerializerCommon.h"></ClInclude>
+ <ClInclude Include="..\..\include\XmlDeserializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\XmlSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.inl"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.inl"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.inl"></ClInclude>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/APEX_1.4/NvParameterized/compiler/vc11win64-PhysX_3.4/NvParameterized.vcxproj.filters b/APEX_1.4/NvParameterized/compiler/vc11win64-PhysX_3.4/NvParameterized.vcxproj.filters
new file mode 100644
index 00000000..3f822a73
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc11win64-PhysX_3.4/NvParameterized.vcxproj.filters
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_SRC">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_SRC\src">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\BinaryHelper.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\BinSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvParameterized.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvParameterizedTraits.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvTraits.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformABI.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformInputStream.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformOutputStream.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\SerializerCommon.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\XmlDeserializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\XmlSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_HEADER">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_HEADER\include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\AbstractSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ApbDefinitions.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\BinaryHelper.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\BinSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvDefaultTraits.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParamConversionTemplate.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParameters.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParametersTypes.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvRegistrationsForTraitsBase.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvSerializerInternal.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvTraitsInternal.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\SerializerCommon.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\XmlDeserializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\XmlSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/APEX_1.4/NvParameterized/compiler/vc12win32-PhysX_3.4/NvParameterized.sln b/APEX_1.4/NvParameterized/compiler/vc12win32-PhysX_3.4/NvParameterized.sln
new file mode 100644
index 00000000..5a9d56e1
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc12win32-PhysX_3.4/NvParameterized.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NvParameterized", "./NvParameterized.vcxproj", "{116CDA44-9950-8942-1462-6A904E0C4817}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ checked|Win32 = checked|Win32
+ debug|Win32 = debug|Win32
+ profile|Win32 = profile|Win32
+ release|Win32 = release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {116CDA44-9950-8942-1462-6A904E0C4817}.checked|Win32.ActiveCfg = checked|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.checked|Win32.Build.0 = checked|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.debug|Win32.ActiveCfg = debug|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.debug|Win32.Build.0 = debug|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.profile|Win32.ActiveCfg = profile|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.profile|Win32.Build.0 = profile|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.release|Win32.ActiveCfg = release|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.release|Win32.Build.0 = release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/APEX_1.4/NvParameterized/compiler/vc12win32-PhysX_3.4/NvParameterized.vcxproj b/APEX_1.4/NvParameterized/compiler/vc12win32-PhysX_3.4/NvParameterized.vcxproj
new file mode 100644
index 00000000..81086c1c
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc12win32-PhysX_3.4/NvParameterized.vcxproj
@@ -0,0 +1,297 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project
+ DefaultTargets="Build"
+ ToolsVersion="12.0"
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|Win32">
+ <Configuration>debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|Win32">
+ <Configuration>release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="profile|Win32">
+ <Configuration>profile</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="checked|Win32">
+ <Configuration>checked</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{116CDA44-9950-8942-1462-6A904E0C4817}</ProjectGuid>
+ <RootNamespace>NvParameterized</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='release|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='profile|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='checked|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings"></ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <OutDir>./../../lib/vc12win32\</OutDir>
+ <IntDir>./build/Win32/NvParameterized/debug\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)DEBUG</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc12win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <OutDir>./../../lib/vc12win32\</OutDir>
+ <IntDir>./build/Win32/NvParameterized/release\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc12win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName).lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <OutDir>./../../lib/vc12win32\</OutDir>
+ <IntDir>./build/Win32/NvParameterized/profile\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)PROFILE</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc12win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <OutDir>./../../lib/vc12win32\</OutDir>
+ <IntDir>./build/Win32/NvParameterized/checked\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)CHECKED</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc12win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\BinaryHelper.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\BinSerializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvParameterized.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvParameterizedTraits.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvSerializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvTraits.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformABI.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformInputStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformOutputStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\SerializerCommon.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\XmlDeserializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\XmlSerializer.cpp"></ClCompile>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\AbstractSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\ApbDefinitions.h"></ClInclude>
+ <ClInclude Include="..\..\include\BinaryHelper.h"></ClInclude>
+ <ClInclude Include="..\..\include\BinSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvDefaultTraits.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParamConversionTemplate.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParameters.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParametersTypes.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvRegistrationsForTraitsBase.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvSerializerInternal.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvTraitsInternal.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\SerializerCommon.h"></ClInclude>
+ <ClInclude Include="..\..\include\XmlDeserializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\XmlSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.inl"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.inl"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.inl"></ClInclude>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/APEX_1.4/NvParameterized/compiler/vc12win32-PhysX_3.4/NvParameterized.vcxproj.filters b/APEX_1.4/NvParameterized/compiler/vc12win32-PhysX_3.4/NvParameterized.vcxproj.filters
new file mode 100644
index 00000000..3f822a73
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc12win32-PhysX_3.4/NvParameterized.vcxproj.filters
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_SRC">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_SRC\src">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\BinaryHelper.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\BinSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvParameterized.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvParameterizedTraits.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvTraits.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformABI.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformInputStream.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformOutputStream.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\SerializerCommon.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\XmlDeserializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\XmlSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_HEADER">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_HEADER\include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\AbstractSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ApbDefinitions.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\BinaryHelper.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\BinSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvDefaultTraits.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParamConversionTemplate.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParameters.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParametersTypes.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvRegistrationsForTraitsBase.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvSerializerInternal.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvTraitsInternal.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\SerializerCommon.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\XmlDeserializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\XmlSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/APEX_1.4/NvParameterized/compiler/vc12win64-PhysX_3.4/NvParameterized.sln b/APEX_1.4/NvParameterized/compiler/vc12win64-PhysX_3.4/NvParameterized.sln
new file mode 100644
index 00000000..356e8e7e
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc12win64-PhysX_3.4/NvParameterized.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NvParameterized", "./NvParameterized.vcxproj", "{116CDA44-9950-8942-1462-6A904E0C4817}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ checked|x64 = checked|x64
+ debug|x64 = debug|x64
+ profile|x64 = profile|x64
+ release|x64 = release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {116CDA44-9950-8942-1462-6A904E0C4817}.checked|x64.ActiveCfg = checked|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.checked|x64.Build.0 = checked|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.debug|x64.ActiveCfg = debug|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.debug|x64.Build.0 = debug|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.profile|x64.ActiveCfg = profile|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.profile|x64.Build.0 = profile|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.release|x64.ActiveCfg = release|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.release|x64.Build.0 = release|x64
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/APEX_1.4/NvParameterized/compiler/vc12win64-PhysX_3.4/NvParameterized.vcxproj b/APEX_1.4/NvParameterized/compiler/vc12win64-PhysX_3.4/NvParameterized.vcxproj
new file mode 100644
index 00000000..c23234a3
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc12win64-PhysX_3.4/NvParameterized.vcxproj
@@ -0,0 +1,293 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project
+ DefaultTargets="Build"
+ ToolsVersion="12.0"
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|x64">
+ <Configuration>debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|x64">
+ <Configuration>release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="profile|x64">
+ <Configuration>profile</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="checked|x64">
+ <Configuration>checked</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{116CDA44-9950-8942-1462-6A904E0C4817}</ProjectGuid>
+ <RootNamespace>NvParameterized</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='debug|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='release|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='profile|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='checked|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings"></ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <OutDir>./../../lib/vc12win64\</OutDir>
+ <IntDir>./build/x64/NvParameterized/debug\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)DEBUG</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc12win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <OutDir>./../../lib/vc12win64\</OutDir>
+ <IntDir>./build/x64/NvParameterized/release\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc12win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName).lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <OutDir>./../../lib/vc12win64\</OutDir>
+ <IntDir>./build/x64/NvParameterized/profile\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)PROFILE</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc12win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <OutDir>./../../lib/vc12win64\</OutDir>
+ <IntDir>./build/x64/NvParameterized/checked\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)CHECKED</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc12win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\BinaryHelper.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\BinSerializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvParameterized.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvParameterizedTraits.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvSerializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvTraits.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformABI.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformInputStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformOutputStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\SerializerCommon.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\XmlDeserializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\XmlSerializer.cpp"></ClCompile>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\AbstractSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\ApbDefinitions.h"></ClInclude>
+ <ClInclude Include="..\..\include\BinaryHelper.h"></ClInclude>
+ <ClInclude Include="..\..\include\BinSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvDefaultTraits.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParamConversionTemplate.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParameters.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParametersTypes.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvRegistrationsForTraitsBase.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvSerializerInternal.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvTraitsInternal.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\SerializerCommon.h"></ClInclude>
+ <ClInclude Include="..\..\include\XmlDeserializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\XmlSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.inl"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.inl"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.inl"></ClInclude>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/APEX_1.4/NvParameterized/compiler/vc12win64-PhysX_3.4/NvParameterized.vcxproj.filters b/APEX_1.4/NvParameterized/compiler/vc12win64-PhysX_3.4/NvParameterized.vcxproj.filters
new file mode 100644
index 00000000..3f822a73
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc12win64-PhysX_3.4/NvParameterized.vcxproj.filters
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_SRC">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_SRC\src">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\BinaryHelper.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\BinSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvParameterized.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvParameterizedTraits.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvTraits.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformABI.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformInputStream.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformOutputStream.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\SerializerCommon.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\XmlDeserializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\XmlSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_HEADER">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_HEADER\include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\AbstractSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ApbDefinitions.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\BinaryHelper.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\BinSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvDefaultTraits.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParamConversionTemplate.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParameters.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParametersTypes.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvRegistrationsForTraitsBase.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvSerializerInternal.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvTraitsInternal.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\SerializerCommon.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\XmlDeserializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\XmlSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/APEX_1.4/NvParameterized/compiler/vc14win32-PhysX_3.4/NvParameterized.sln b/APEX_1.4/NvParameterized/compiler/vc14win32-PhysX_3.4/NvParameterized.sln
new file mode 100644
index 00000000..b2dd9dab
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc14win32-PhysX_3.4/NvParameterized.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NvParameterized", "./NvParameterized.vcxproj", "{116CDA44-9950-8942-1462-6A904E0C4817}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ checked|Win32 = checked|Win32
+ debug|Win32 = debug|Win32
+ profile|Win32 = profile|Win32
+ release|Win32 = release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {116CDA44-9950-8942-1462-6A904E0C4817}.checked|Win32.ActiveCfg = checked|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.checked|Win32.Build.0 = checked|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.debug|Win32.ActiveCfg = debug|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.debug|Win32.Build.0 = debug|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.profile|Win32.ActiveCfg = profile|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.profile|Win32.Build.0 = profile|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.release|Win32.ActiveCfg = release|Win32
+ {116CDA44-9950-8942-1462-6A904E0C4817}.release|Win32.Build.0 = release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/APEX_1.4/NvParameterized/compiler/vc14win32-PhysX_3.4/NvParameterized.vcxproj b/APEX_1.4/NvParameterized/compiler/vc14win32-PhysX_3.4/NvParameterized.vcxproj
new file mode 100644
index 00000000..10a0e63a
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc14win32-PhysX_3.4/NvParameterized.vcxproj
@@ -0,0 +1,280 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project
+ DefaultTargets="Build"
+ ToolsVersion="14.0"
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|Win32">
+ <Configuration>debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|Win32">
+ <Configuration>release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="profile|Win32">
+ <Configuration>profile</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="checked|Win32">
+ <Configuration>checked</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{116CDA44-9950-8942-1462-6A904E0C4817}</ProjectGuid>
+ <RootNamespace>NvParameterized</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='release|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='profile|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='checked|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings"></ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <OutDir>./../../lib/vc14win32\</OutDir>
+ <IntDir>./build/Win32/NvParameterized/debug\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)DEBUG</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /arch:SSE2 /MP /Od /RTCsu /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc14win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <OutDir>./../../lib/vc14win32\</OutDir>
+ <IntDir>./build/Win32/NvParameterized/release\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /arch:SSE2 /MP /Ox /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc14win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName).lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <OutDir>./../../lib/vc14win32\</OutDir>
+ <IntDir>./build/Win32/NvParameterized/profile\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)PROFILE</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /arch:SSE2 /MP /Ox /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc14win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <OutDir>./../../lib/vc14win32\</OutDir>
+ <IntDir>./build/Win32/NvParameterized/checked\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)CHECKED</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /arch:SSE2 /MP /Ox /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc14win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\BinaryHelper.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\BinSerializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvParameterized.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvParameterizedTraits.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvSerializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvTraits.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformABI.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformInputStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformOutputStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\SerializerCommon.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\XmlDeserializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\XmlSerializer.cpp"></ClCompile>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\AbstractSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\ApbDefinitions.h"></ClInclude>
+ <ClInclude Include="..\..\include\BinaryHelper.h"></ClInclude>
+ <ClInclude Include="..\..\include\BinSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvDefaultTraits.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParamConversionTemplate.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParameters.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParametersTypes.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvRegistrationsForTraitsBase.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvSerializerInternal.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvTraitsInternal.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\SerializerCommon.h"></ClInclude>
+ <ClInclude Include="..\..\include\XmlDeserializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\XmlSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.inl"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.inl"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.inl"></ClInclude>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/APEX_1.4/NvParameterized/compiler/vc14win32-PhysX_3.4/NvParameterized.vcxproj.filters b/APEX_1.4/NvParameterized/compiler/vc14win32-PhysX_3.4/NvParameterized.vcxproj.filters
new file mode 100644
index 00000000..3f822a73
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc14win32-PhysX_3.4/NvParameterized.vcxproj.filters
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_SRC">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_SRC\src">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\BinaryHelper.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\BinSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvParameterized.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvParameterizedTraits.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvTraits.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformABI.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformInputStream.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformOutputStream.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\SerializerCommon.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\XmlDeserializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\XmlSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_HEADER">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_HEADER\include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\AbstractSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ApbDefinitions.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\BinaryHelper.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\BinSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvDefaultTraits.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParamConversionTemplate.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParameters.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParametersTypes.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvRegistrationsForTraitsBase.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvSerializerInternal.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvTraitsInternal.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\SerializerCommon.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\XmlDeserializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\XmlSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/APEX_1.4/NvParameterized/compiler/vc14win64-PhysX_3.4/NvParameterized.sln b/APEX_1.4/NvParameterized/compiler/vc14win64-PhysX_3.4/NvParameterized.sln
new file mode 100644
index 00000000..15df09c9
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc14win64-PhysX_3.4/NvParameterized.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NvParameterized", "./NvParameterized.vcxproj", "{116CDA44-9950-8942-1462-6A904E0C4817}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ checked|x64 = checked|x64
+ debug|x64 = debug|x64
+ profile|x64 = profile|x64
+ release|x64 = release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {116CDA44-9950-8942-1462-6A904E0C4817}.checked|x64.ActiveCfg = checked|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.checked|x64.Build.0 = checked|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.debug|x64.ActiveCfg = debug|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.debug|x64.Build.0 = debug|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.profile|x64.ActiveCfg = profile|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.profile|x64.Build.0 = profile|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.release|x64.ActiveCfg = release|x64
+ {116CDA44-9950-8942-1462-6A904E0C4817}.release|x64.Build.0 = release|x64
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/APEX_1.4/NvParameterized/compiler/vc14win64-PhysX_3.4/NvParameterized.vcxproj b/APEX_1.4/NvParameterized/compiler/vc14win64-PhysX_3.4/NvParameterized.vcxproj
new file mode 100644
index 00000000..77a41969
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc14win64-PhysX_3.4/NvParameterized.vcxproj
@@ -0,0 +1,280 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project
+ DefaultTargets="Build"
+ ToolsVersion="14.0"
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|x64">
+ <Configuration>debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|x64">
+ <Configuration>release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="profile|x64">
+ <Configuration>profile</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="checked|x64">
+ <Configuration>checked</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{116CDA44-9950-8942-1462-6A904E0C4817}</ProjectGuid>
+ <RootNamespace>NvParameterized</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='debug|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='release|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='profile|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='checked|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings"></ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <OutDir>./../../lib/vc14win64\</OutDir>
+ <IntDir>./build/x64/NvParameterized/debug\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)DEBUG</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /MP /Od /RTCsu /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc14win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <OutDir>./../../lib/vc14win64\</OutDir>
+ <IntDir>./build/x64/NvParameterized/release\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /MP /Ox /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc14win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName).lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <OutDir>./../../lib/vc14win64\</OutDir>
+ <IntDir>./build/x64/NvParameterized/profile\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)PROFILE</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /MP /Ox /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc14win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <OutDir>./../../lib/vc14win64\</OutDir>
+ <IntDir>./build/x64/NvParameterized/checked\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)CHECKED</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /MP /Ox /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/include/filebuf;../../../../PxShared/include/foundation;../../../../PxShared/include/task;../../../../PxShared/include/cudamanager;../../../../PxShared/include/pvd;../../../../PxShared/src/foundation/include;../../../../PxShared/src/filebuf/include;../../../../PxShared/src/fastxml/include;../../../../PxShared/src/pvd/include;./../../../include;./../../../include/PhysX3;./../../include;./../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;PX_FOUNDATION_DLL=0;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../PxShared/lib/vc14win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\BinaryHelper.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\BinSerializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvParameterized.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvParameterizedTraits.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvSerializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\NvTraits.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformABI.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformInputStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PlatformOutputStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\SerializerCommon.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\XmlDeserializer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\XmlSerializer.cpp"></ClCompile>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\AbstractSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\ApbDefinitions.h"></ClInclude>
+ <ClInclude Include="..\..\include\BinaryHelper.h"></ClInclude>
+ <ClInclude Include="..\..\include\BinSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvDefaultTraits.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParamConversionTemplate.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParameters.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvParametersTypes.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvRegistrationsForTraitsBase.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvSerializerInternal.h"></ClInclude>
+ <ClInclude Include="..\..\include\NvTraitsInternal.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\SerializerCommon.h"></ClInclude>
+ <ClInclude Include="..\..\include\XmlDeserializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\XmlSerializer.h"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.inl"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.inl"></ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.inl"></ClInclude>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/APEX_1.4/NvParameterized/compiler/vc14win64-PhysX_3.4/NvParameterized.vcxproj.filters b/APEX_1.4/NvParameterized/compiler/vc14win64-PhysX_3.4/NvParameterized.vcxproj.filters
new file mode 100644
index 00000000..3f822a73
--- /dev/null
+++ b/APEX_1.4/NvParameterized/compiler/vc14win64-PhysX_3.4/NvParameterized.vcxproj.filters
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_SRC">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_SRC\src">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\BinaryHelper.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\BinSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvParameterized.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvParameterizedTraits.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\NvTraits.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformABI.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformInputStream.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PlatformOutputStream.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\SerializerCommon.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\XmlDeserializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\XmlSerializer.cpp">
+ <Filter>NV_PARAMETERIZED_SRC\src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_HEADER">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="NV_PARAMETERIZED_HEADER\include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\AbstractSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ApbDefinitions.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\BinaryHelper.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\BinSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvDefaultTraits.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParamConversionTemplate.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParameters.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvParametersTypes.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvRegistrationsForTraitsBase.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvSerializerInternal.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\NvTraitsInternal.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformStream.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\SerializerCommon.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\XmlDeserializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\XmlSerializer.h">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformABI.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformInputStream.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PlatformOutputStream.inl">
+ <Filter>NV_PARAMETERIZED_HEADER\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/APEX_1.4/NvParameterized/include/AbstractSerializer.h b/APEX_1.4/NvParameterized/include/AbstractSerializer.h
new file mode 100644
index 00000000..1b7b43b1
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/AbstractSerializer.h
@@ -0,0 +1,173 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PX_ABSTRACT_SERIALIZER_H
+#define PX_ABSTRACT_SERIALIZER_H
+
+#include "nvparameterized/NvParameterized.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+#include "nvparameterized/NvSerializer.h"
+
+#include "NvSerializerInternal.h"
+#include "NvTraitsInternal.h"
+
+#include "SerializerCommon.h"
+
+namespace NvParameterized
+{
+
+// Base for other serializers which takes care of common stuff
+
+class AbstractSerializer : public Serializer
+{
+public:
+ AbstractSerializer(Traits *traits):
+ mDoUpdate(true),
+ mPlatform(GetCurrentPlatform()),
+ mTraits(traits) {}
+
+ virtual ~AbstractSerializer() {}
+
+ Traits *getTraits() const { return mTraits; }
+
+ //This is used in static Serializer::deserializer
+ void setTraits(Traits *traits) { mTraits = traits; }
+
+ void setAutoUpdate(bool doUpdate)
+ {
+ mDoUpdate = doUpdate;
+ }
+
+ Serializer::ErrorType peekInplaceAlignment(physx::PxFileBuf& /*stream*/, uint32_t& /*align*/)
+ {
+ return Serializer::ERROR_NOT_IMPLEMENTED;
+ }
+
+ Serializer::ErrorType setTargetPlatform(const SerializePlatform &platform)
+ {
+ mPlatform = platform;
+ return Serializer::ERROR_NONE; //Only pdb cares about platforms
+ }
+
+ Serializer::ErrorType serialize(physx::PxFileBuf &stream,const NvParameterized::Interface **objs, uint32_t nobjs, bool doMetadata)
+ {
+#ifdef WITHOUT_APEX_SERIALIZATION
+ PX_UNUSED(stream);
+ PX_UNUSED(objs);
+ PX_UNUSED(nobjs);
+ PX_UNUSED(doMetadata);
+
+ return Serializer::ERROR_NOT_IMPLEMENTED;
+#else
+
+ NV_BOOL_ERR_CHECK_WARN_RETURN(
+ stream.isOpen(),
+ Serializer::ERROR_STREAM_ERROR,
+ "Stream not opened" );
+
+ for(uint32_t i = 0; i < nobjs; ++i)
+ {
+ NV_BOOL_ERR_CHECK_WARN_RETURN(
+ objs[i]->callPreSerializeCallback() == 0,
+ Serializer::ERROR_PRESERIALIZE_FAILED,
+ "Preserialize callback failed" );
+ }
+
+ return internalSerialize(stream, objs, nobjs, doMetadata);
+#endif
+ }
+
+ using Serializer::deserialize;
+ virtual Serializer::ErrorType deserialize(physx::PxFileBuf &stream, Serializer::DeserializedData &res, bool &isUpdated)
+ {
+ NV_BOOL_ERR_CHECK_WARN_RETURN(
+ stream.isOpen(),
+ Serializer::ERROR_STREAM_ERROR,
+ "Stream not opened" );
+
+ isUpdated = false;
+ bool doesNeedUpdate = true;
+ NV_ERR_CHECK_RETURN( internalDeserialize(stream, res, doesNeedUpdate) );
+ return doesNeedUpdate && mDoUpdate ? upgrade(res, isUpdated) : Serializer::ERROR_NONE;
+ }
+
+ using Serializer::deserializeInplace;
+ Serializer::ErrorType deserializeInplace(void *data, uint32_t dataLen, Serializer::DeserializedData &res, bool &isUpdated)
+ {
+ isUpdated = false;
+ bool doesNeedUpdate = true;
+ NV_ERR_CHECK_RETURN( internalDeserializeInplace(data, dataLen, res, doesNeedUpdate) );
+ return doesNeedUpdate && mDoUpdate ? upgrade(res, isUpdated) : Serializer::ERROR_NONE;
+ }
+
+protected:
+
+ bool mDoUpdate;
+ SerializePlatform mPlatform;
+ Traits *mTraits;
+
+#ifndef WITHOUT_APEX_SERIALIZATION
+ virtual Serializer::ErrorType internalSerialize(
+ physx::PxFileBuf &stream,
+ const NvParameterized::Interface **objs,
+ uint32_t n,
+ bool doMetadata) = 0;
+#endif
+
+ // doesNeedUpdate allows serializer to avoid costly depth-first scanning of included refs
+ virtual Serializer::ErrorType internalDeserialize(
+ physx::PxFileBuf &stream,
+ Serializer::DeserializedData &res,
+ bool &doesNeedUpdate) = 0;
+
+ // See note for internalDeserialize
+ virtual Serializer::ErrorType internalDeserializeInplace(
+ void * /*data*/,
+ uint32_t /*dataLen*/,
+ Serializer::DeserializedData & /*res*/,
+ bool & /*doesNeedUpdate*/)
+ {
+ DEBUG_ALWAYS_ASSERT();
+ return Serializer::ERROR_NOT_IMPLEMENTED;
+ }
+
+private:
+ Serializer::ErrorType upgrade(Serializer::DeserializedData &res, bool &isUpdated)
+ {
+ //Upgrade legacy objects
+ NV_BOOL_ERR_CHECK_WARN_RETURN(
+ UpgradeLegacyObjects(res, isUpdated, mTraits),
+ Serializer::ERROR_CONVERSION_FAILED,
+ "Upgrading legacy objects failed" );
+
+ return Serializer::ERROR_NONE;
+ }
+};
+
+} // namespace NvParameterized
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/ApbDefinitions.h b/APEX_1.4/NvParameterized/include/ApbDefinitions.h
new file mode 100644
index 00000000..467ea025
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/ApbDefinitions.h
@@ -0,0 +1,217 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef APB_DEFINITIONS_H_
+#define APB_DEFINITIONS_H_
+
+// This file contains definitions of various parts of APB file format
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+#include "SerializerCommon.h"
+#include "BinaryHelper.h"
+
+namespace NvParameterized
+{
+
+#define APB_MAGIC 0x5A5B5C5D
+
+namespace BinVersions
+{
+ static const uint32_t Initial = 0x00010000,
+ AllRefsCounted = 0x00010001,
+ WithAlignment = 0x00010002,
+ WithExtendedHeader = 0x00010003;
+}
+
+// Type of relocation in binary file
+enum RelocType
+{
+ //Raw bytes
+ RELOC_ABS_RAW = 0,
+
+ //NvParameterized (will be initialized on deserialization)
+ RELOC_ABS_REF,
+
+ RELOC_LAST
+};
+
+// Relocation record in binary file
+struct BinaryReloc
+{
+ uint32_t type;
+ uint32_t off;
+};
+
+// Format of data in binary file; only BINARY_TYPE_PLAIN is used for now
+enum BinaryType
+{
+ BINARY_TYPE_PLAIN = 0,
+ BINARY_TYPE_XML_GZ,
+ BINARY_TYPE_LAST
+};
+
+// Some dummy version control systems insert '\r' before '\n'.
+// This short string in header is used to catch this.
+// We also use 0xff byte to guarantee that we have non-printable chars
+// (s.t. VCS can detect that file is binary).
+#define VCS_SAFETY_FLAGS "ab\n\xff"
+
+// File header
+#pragma pack(push,1) // For cross-platform compatibility!
+
+// Convert to platform-independent format
+static void CanonizeArrayOfU32s(char *data, uint32_t len)
+{
+ PX_ASSERT(len % 4U == 0);
+
+ if( IsBigEndian() )
+ return;
+
+ for(uint32_t i = 0; i < len; i += 4U)
+ SwapBytes(data + i, 4U, TYPE_U32);
+}
+
+// Main binary header
+struct BinaryHeader
+{
+ uint32_t magic;
+ uint32_t type;
+ uint32_t version;
+ int32_t numObjects;
+
+ uint32_t fileLength;
+ uint32_t dictOffset;
+ uint32_t dataOffset;
+ uint32_t relocOffset;
+
+ uint32_t metadataOffset;
+ uint32_t archType;
+ uint32_t compilerType;
+ uint32_t compilerVer;
+
+ uint32_t osType;
+ uint32_t osVer;
+ uint32_t numMetadata;
+ uint32_t alignment;
+
+ static bool CheckAlignment()
+ {
+ bool isPushPackOk = 4 != offsetof(BinaryHeader, type);
+ if( isPushPackOk )
+ {
+ DEBUG_ASSERT( 0 && "PX_PUSH_PACK failed!" );
+ return false;
+ }
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
+ if( sizeof(BinaryHeader) % 16 != 0 )
+ {
+ return false;
+ }
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+ return true;
+ }
+
+ Serializer::ErrorType getPlatform(SerializePlatform &platform) const
+ {
+ if( archType >= SerializePlatform::ARCH_LAST
+ || compilerType >= SerializePlatform::COMP_LAST
+ || osType >= SerializePlatform::OS_LAST )
+ {
+ DEBUG_ALWAYS_ASSERT();
+ return Serializer::ERROR_INVALID_PLATFORM;
+ }
+
+ platform = SerializePlatform(
+ static_cast<SerializePlatform::ArchType>(archType),
+ static_cast<SerializePlatform::CompilerType>(compilerType),
+ compilerVer,
+ static_cast<SerializePlatform::OsType>(osType),
+ osVer
+ );
+
+ return Serializer::ERROR_NONE;
+ }
+
+ void canonize()
+ {
+ CanonizeArrayOfU32s((char*)this, sizeof(BinaryHeader));
+ }
+
+ void decanonize() { canonize(); }
+};
+
+// Extended header (only in new versions)
+struct BinaryHeaderExt
+{
+ uint32_t vcsSafetyFlags;
+ uint32_t res[3 + 8]; // Pad to multiple of 16 byte
+
+ void canonize()
+ {
+ // vcsSafetyFlags should be stored as-is
+ }
+
+ void decanonize()
+ {
+ // vcsSafetyFlags should be stored as-is
+ }
+};
+
+#pragma pack(pop)
+
+// NvParameterized object header
+struct ObjHeader
+{
+ uint32_t dataOffset;
+ const char *className;
+ const char *name;
+ bool isIncluded;
+ uint32_t version;
+ uint32_t checksumSize;
+ const uint32_t *checksum;
+};
+
+// Element of root references table
+struct ObjectTableEntry
+{
+ Interface *obj;
+ const char *className;
+ const char *name;
+ const char *filename;
+};
+
+} // namespace NvParameterized
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/BinSerializer.h b/APEX_1.4/NvParameterized/include/BinSerializer.h
new file mode 100644
index 00000000..97306946
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/BinSerializer.h
@@ -0,0 +1,132 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PX_BIN_SERIALIZER_H
+#define PX_BIN_SERIALIZER_H
+
+// APB serializer
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+#include "nvparameterized/NvParameterized.h"
+#include "nvparameterized/NvSerializer.h"
+
+#include "AbstractSerializer.h"
+
+#include "ApbDefinitions.h"
+
+namespace NvParameterized
+{
+
+class DefinitionImpl;
+class PlatformInputStream;
+class PlatformOutputStream;
+struct PlatformABI;
+
+class BinSerializer : public AbstractSerializer
+{
+ // Methods for updating legacy formats
+ Serializer::ErrorType updateInitial2AllCounted(BinaryHeader &hdr, char *start);
+ Serializer::ErrorType updateAllCounted2WithAlignment(BinaryHeader &hdr, char *start);
+
+ Serializer::ErrorType readMetadataInfo(const BinaryHeader &hdr, PlatformInputStream &s, DefinitionImpl *def);
+
+ // Read array of arbitrary type (slow version)
+ Serializer::ErrorType readArraySlow(Handle &handle, PlatformInputStream &s);
+
+ // Read NvParameterized object data
+ Serializer::ErrorType readObject(NvParameterized::Interface *&obj, PlatformInputStream &data);
+
+ // Read binary data of NvParameterized object addressed by handle
+ Serializer::ErrorType readBinaryData(Handle &handle, PlatformInputStream &data);
+
+#ifndef WITHOUT_APEX_SERIALIZATION
+ Serializer::ErrorType storeMetadataInfo(const Definition *def, PlatformOutputStream &s);
+
+ // Store array of arbitrary type (slow version)
+ Serializer::ErrorType storeArraySlow(Handle &handle, PlatformOutputStream &s);
+
+ // Print binary data for part of NvParameterized object addressed by handle
+ Serializer::ErrorType storeBinaryData(const NvParameterized::Interface &obj, Handle &handle, PlatformOutputStream &res, bool isRootObject = true);
+#endif
+
+ BinSerializer(BinSerializer &); // Don't
+ void operator=(BinSerializer &); // Don't
+
+ Serializer::ErrorType verifyFileHeader(
+ const BinaryHeader &hdr,
+ const BinaryHeaderExt *ext,
+ uint32_t dataLen ) const;
+
+ Serializer::ErrorType getPlatformInfo(
+ BinaryHeader &hdr,
+ BinaryHeaderExt *ext,
+ PlatformABI &abi ) const;
+
+ Serializer::ErrorType verifyObjectHeader(const ObjHeader &hdr, const Interface *obj, Traits *traits) const;
+
+protected:
+
+ Serializer::ErrorType internalDeserialize(physx::PxFileBuf &stream, Serializer::DeserializedData &res, bool &doesNeedUpdate);
+ Serializer::ErrorType internalDeserializeInplace(void *mdata, uint32_t dataLen, Serializer::DeserializedData &res, bool &doesNeedUpdate);
+
+#ifndef WITHOUT_APEX_SERIALIZATION
+ Serializer::ErrorType internalSerialize(physx::PxFileBuf &stream,const NvParameterized::Interface **objs, uint32_t nobjs, bool doMetadata);
+#endif
+
+public:
+ BinSerializer(Traits *traits): AbstractSerializer(traits) {}
+
+ void release()
+ {
+ Traits *t = mTraits;
+ this->~BinSerializer();
+ serializerMemFree(this, t);
+ }
+
+ static const uint32_t Magic = APB_MAGIC;
+ static const uint32_t Version = BinVersions::WithExtendedHeader;
+
+ Serializer::ErrorType peekNumObjects(physx::PxFileBuf &stream, uint32_t &numObjects);
+
+ Serializer::ErrorType peekNumObjectsInplace(const void *data, uint32_t dataLen, uint32_t &numObjects);
+
+ Serializer::ErrorType peekClassNames(physx::PxFileBuf &stream, char **classNames, uint32_t &numClassNames);
+
+ Serializer::ErrorType peekInplaceAlignment(physx::PxFileBuf& stream, uint32_t& align);
+
+ Serializer::ErrorType deserializeMetadata(physx::PxFileBuf &stream, DeserializedMetadata &desData);
+};
+
+bool isBinaryFormat(physx::PxFileBuf &stream);
+
+Serializer::ErrorType peekBinaryPlatform(physx::PxFileBuf &stream, SerializePlatform &platform);
+
+} // namespace NvParameterized
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/BinaryHelper.h b/APEX_1.4/NvParameterized/include/BinaryHelper.h
new file mode 100644
index 00000000..15e56386
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/BinaryHelper.h
@@ -0,0 +1,290 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PX_SERIALIZE_BINARY_HELPER_H
+#define PX_SERIALIZE_BINARY_HELPER_H
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+#include "PxAssert.h"
+
+#include <PsArray.h>
+
+#include "nvparameterized/NvParameterized.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+
+namespace NvParameterized
+{
+
+template<typename T> static PX_INLINE T NvMax3(T x, T y, T z)
+{
+ return physx::PxMax<T>(x, physx::PxMax<T>(y, z));
+}
+
+#ifndef offsetof
+# define offsetof(StructType, field) reinterpret_cast<size_t>(&((StructType *)0)->field)
+#endif
+
+// Alignment calculator
+template<typename T> class GetAlignment {
+ struct TestStruct {
+ char _;
+ T x;
+ };
+
+public:
+ static const size_t value = offsetof(struct TestStruct, x);
+};
+
+// Maps C type to NvParameterized::DataType
+template<typename T> struct GetDataType {
+ static const DataType value = NvParameterized::TYPE_UNDEFINED;
+};
+
+// Currently we only need to distinguish PxVec2 from other 64-bit stuff
+// (like uint64_t, int64_t, double, pointer) in SwapBytes
+
+template<> struct GetDataType <physx::PxVec2> {
+ static const DataType value = NvParameterized::TYPE_VEC2;
+};
+
+//Copied from NvApexStream
+PX_INLINE static bool IsBigEndian()
+{
+ uint32_t i = 1;
+ return 0 == *(char *)&i;
+}
+
+PX_INLINE static void SwapBytes(char *data, uint32_t size, NvParameterized::DataType type)
+{
+ // XDK compiler does not like switch here
+ if( 1 == size )
+ {
+ // Do nothing
+ }
+ else if( 2 == size )
+ {
+ char one_byte;
+ one_byte = data[0]; data[0] = data[1]; data[1] = one_byte;
+ }
+ else if( 4 == size )
+ {
+ char one_byte;
+ one_byte = data[0]; data[0] = data[3]; data[3] = one_byte;
+ one_byte = data[1]; data[1] = data[2]; data[2] = one_byte;
+ }
+ else if( 8 == size )
+ {
+ //Handling of PxVec2 agregate is different from 64-bit atomic types
+ if( TYPE_VEC2 == type )
+ {
+ //PxVec2 => swap each field separately
+ SwapBytes(data + 0, 4, TYPE_F32);
+ SwapBytes(data + 4, 4, TYPE_F32);
+ }
+ else
+ {
+ char one_byte;
+ one_byte = data[0]; data[0] = data[7]; data[7] = one_byte;
+ one_byte = data[1]; data[1] = data[6]; data[6] = one_byte;
+ one_byte = data[2]; data[2] = data[5]; data[5] = one_byte;
+ one_byte = data[3]; data[3] = data[4]; data[4] = one_byte;
+ }
+ }
+ else
+ {
+ //Generic algorithm for containers of float
+
+ const size_t elemSize = sizeof(float); //We assume that float sizes match on both platforms
+ PX_ASSERT( elemSize >= GetAlignment<float>::value ); //If alignment is non-trivial below algorithm will not work
+ PX_ASSERT( size > elemSize );
+
+ //Just swap all PxReals
+ for(size_t i = 0; i < size; i += elemSize)
+ SwapBytes(data + i, elemSize, TYPE_F32);
+ }
+}
+
+//Convert value to platform-independent format (network byte order)
+template<typename T> PX_INLINE static T Canonize(T x)
+{
+ if( !IsBigEndian() )
+ SwapBytes((char *)&x, sizeof(T), GetDataType<T>::value);
+
+ return x;
+}
+
+//Convert value to native format (from network byte order)
+template<typename T> PX_INLINE static T Decanonize(T x)
+{
+ return Canonize(x);
+}
+
+//Read platform-independent value from stream and convert it to native format
+template<typename T> static PX_INLINE T readAndConvert(const char *&p)
+{
+ T val;
+ memcpy((char *)&val, p, sizeof(T));
+ val = Decanonize(val);
+ p += sizeof(T);
+
+ return val;
+}
+
+//Byte array used for data serialization
+//TODO: replace this with Array?
+class StringBuf
+{
+ Traits *mTraits;
+ char *mData;
+ uint32_t mSize, mCapacity;
+
+ PX_INLINE void internalAppend(const char *data, uint32_t size, bool doCopy = true)
+ {
+ if( 0 == size )
+ return;
+
+ if( mCapacity < mSize + size )
+ reserve(physx::PxMax(mSize + size, 3 * mCapacity / 2));
+
+ if( doCopy )
+ memcpy(mData + mSize, data, size);
+ else
+ memset(mData + mSize, 0, size); //We want padding bytes filled with 0
+
+ mSize += size;
+ }
+
+public:
+
+ PX_INLINE StringBuf(Traits *traits)
+ : mTraits(traits), mData(0), mSize(0), mCapacity(0)
+ {}
+
+ PX_INLINE StringBuf(const StringBuf &s)
+ : mTraits(s.mTraits), mSize(s.mSize), mCapacity(s.mSize)
+ {
+ mData = (char *)mTraits->alloc(mSize);
+ memcpy(mData, s.mData, mSize);
+ }
+
+ PX_INLINE ~StringBuf() { mTraits->free((void *)mData); }
+
+ PX_INLINE void reserve(uint32_t newCapacity)
+ {
+ if( mCapacity >= newCapacity )
+ return;
+
+ char *newData = (char *)mTraits->alloc(newCapacity);
+ PX_ASSERT(newData);
+
+ if( mData )
+ {
+ memcpy(newData, mData, mSize);
+ mTraits->free(mData);
+ }
+
+ mData = newData;
+ mCapacity = newCapacity;
+ }
+
+ PX_INLINE char *getBuffer()
+ {
+ char *data = mData;
+
+ mSize = mCapacity = 0;
+ mData = 0;
+
+ return data;
+ }
+
+ PX_INLINE uint32_t size() const { return mSize; }
+
+ template< typename T > PX_INLINE void append(T x)
+ {
+ internalAppend((char *)&x, sizeof(T));
+ }
+
+ template< typename T > PX_INLINE void append(T *x)
+ {
+ PX_UNUSED(x);
+ PX_ASSERT(0 && "Unable to append pointer");
+ }
+
+ PX_INLINE void appendBytes(const char *data, uint32_t size) { internalAppend(data, size); }
+
+ PX_INLINE void skipBytes(uint32_t size) { internalAppend(0, size, false); }
+
+ PX_INLINE char &operator [](uint32_t i)
+ {
+ PX_ASSERT( i < mSize );
+ return mData[i];
+ }
+
+ PX_INLINE operator char *() { return mData; }
+
+ PX_INLINE operator const char *() const { return mData; }
+};
+
+//Dictionary of strings used for binary serialization
+class Dictionary
+{
+ struct Entry
+ {
+ const char *s;
+ uint32_t offset;
+ };
+
+ physx::shdfnd::Array<Entry, Traits::Allocator> entries; //TODO: use hash map after DE402 is fixed
+
+public:
+ Dictionary(Traits *traits_): entries(Traits::Allocator(traits_)) {}
+
+ uint32_t put(const char *s);
+
+ void setOffset(const char *s, uint32_t off);
+
+ PX_INLINE void setOffset(uint32_t i, uint32_t off) { setOffset(get(i), off); }
+
+ uint32_t getOffset(const char *s) const;
+
+ uint32_t getOffset(uint32_t i) const { return getOffset(get(i)); }
+
+ const char *get(uint32_t i) const { return entries[i].s; }
+
+ PX_INLINE uint32_t size() const { return entries.size(); }
+
+ void serialize(StringBuf &res) const;
+};
+
+//Binary file pretty-printer (mimics xxd)
+void dumpBytes(const char *data, uint32_t nbytes);
+
+}
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/NvDefaultTraits.h b/APEX_1.4/NvParameterized/include/NvDefaultTraits.h
new file mode 100644
index 00000000..ed70ed17
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/NvDefaultTraits.h
@@ -0,0 +1,503 @@
+#ifndef PX_MODULE_DEFAULT_TRAITS_H
+#define PX_MODULE_DEFAULT_TRAITS_H
+
+// overload new and delete operators
+#include "PsAllocator.h"
+
+// NxParameterized headers
+#include "nvparameterized/NvParameterized.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+#include "PxAssert.h"
+#include "PxErrorCallback.h"
+
+// NsFoundation and NvFoundation
+#include "PsArray.h"
+#include "PsAlignedMalloc.h"
+#include "PxFoundation.h"
+
+// system
+#include <stdio.h>
+#include <stdint.h>
+
+namespace NvParameterized
+{
+ class DefaultTraits : public NvParameterized::Traits
+ {
+ public:
+ struct BehaviourFlags
+ {
+ enum Enum
+ {
+ CLEAN_FACTORIES = 0x1 << 0, ///< DefaultTraits is responsible destruct factories
+ CLEAN_CONVERTES = 0x1 << 1, ///< DefaultTraits is responsible destruct converters
+ COLLECT_ALLOCATE_OBJECTS = 0x1 << 2, ///< Collect allocated NvParameterized::Interface objects for profiling
+ WARN_IF_CONVERSION_HAPPENED = 0x1 << 3, ///< Emit warning if conversion happened
+
+
+ DEFAULT_POLICY = CLEAN_FACTORIES | CLEAN_CONVERTES,
+ };
+ };
+
+ protected:
+ struct ConversionInfo
+ {
+ ConversionInfo(::NvParameterized::Conversion* theConv = 0,
+ const char * theClassName = 0,
+ uint32_t theFrom = 0,
+ uint32_t theTo = 0)
+ : conv(theConv)
+ , className(theClassName)
+ , from(theFrom)
+ , to(theTo)
+ {}
+
+ ::NvParameterized::Conversion* conv;
+ const char * className;
+ uint32_t from;
+ uint32_t to;
+
+ bool operator == (const ConversionInfo& rhs)
+ {
+ // ignore "conv" field
+ return from == rhs.from && to == rhs.to && strcmp(className, rhs.className) == 0;
+ }
+ };
+
+ physx::shdfnd::Array<NvParameterized::Factory*> factories;
+ physx::shdfnd::Array<NvParameterized::Interface*> objects;
+ physx::shdfnd::Array<ConversionInfo> converters;
+
+ template <class T>
+ static T removeAndReturn(physx::shdfnd::Array<T>& ctr, uint32_t index)
+ {
+ T res = ctr[index];
+ ctr.remove(index);
+ return res;
+ }
+
+ bool findLastFactoryIndexByClassName(uint32_t& index, const char* className) const {
+ if (!className)
+ return false;
+ index = 0;
+ bool findSomeFactory = false;
+ for (uint32_t i = 0; i < factories.size(); ++i) {
+ if (const char* factoryClassName = factories[i]->getClassName())
+ {
+ if (strcmp(factoryClassName, className) == 0) {
+ if (!findSomeFactory || factories[i]->getVersion() > factories[index]->getVersion())
+ index = i;
+ findSomeFactory = true;
+ }
+ }
+ }
+ return findSomeFactory;
+ }
+
+ bool findFactoryIndexByClassNameAndVersion(uint32_t& index, const char* className, uint32_t version) const
+ {
+ if (!className)
+ return false;
+
+ for (uint32_t i = 0; i < factories.size(); ++i) {
+ if (const char* factoryClassName = factories[i]->getClassName())
+ {
+ if (strcmp(factoryClassName, className) == 0 && factories[i]->getVersion() == version)
+ {
+ index = i;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ void unregisterAllFactories()
+ {
+ if ((behaviourPolicy & BehaviourFlags::CLEAN_FACTORIES) == 0)
+ return;
+
+ for (uint32_t i = 0; i < factories.size(); ++i)
+ {
+ factories[i]->freeParameterDefinitionTable(this);
+ delete factories[i];
+ }
+ factories.clear();
+ }
+
+ void unregisterAllConverters()
+ {
+ if ((behaviourPolicy & BehaviourFlags::CLEAN_CONVERTES) == 0)
+ return;
+
+ for (uint32_t i = 0; i < converters.size(); ++i)
+ {
+ converters[i].conv->release();
+ converters[i].conv = 0;
+ }
+ converters.clear();
+ }
+
+ protected:
+ uint32_t behaviourPolicy;
+
+ public:
+
+ DefaultTraits(uint32_t behaviourFlags)
+ : behaviourPolicy(behaviourFlags)
+ {
+ }
+
+ virtual ~DefaultTraits()
+ {
+ PX_ASSERT(objects.size() == 0);
+ unregisterAllFactories();
+ unregisterAllConverters();
+ }
+
+ virtual void registerFactory(::NvParameterized::Factory& factory)
+ {
+ if (!doesFactoryExist(factory.getClassName(), factory.getVersion()))
+ {
+ factories.pushBack(&factory);
+ }
+ else
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "Factory has already exist");
+ }
+ }
+
+ virtual ::NvParameterized::Factory *removeFactory(const char * className)
+ {
+ uint32_t index = 0;
+ if (!findLastFactoryIndexByClassName(index, className))
+ return NULL;
+
+ ::NvParameterized::Factory* res = removeAndReturn(factories, index);
+ return res;
+ }
+
+ virtual ::NvParameterized::Factory *removeFactory(const char * className, uint32_t version)
+ {
+ uint32_t index = 0;
+ if (!findFactoryIndexByClassNameAndVersion(index, className, version))
+ return NULL;
+
+ ::NvParameterized::Factory* res = removeAndReturn(factories, index);
+ return res;
+ }
+
+ virtual bool doesFactoryExist(const char* className)
+ {
+ uint32_t index = 0;
+ return findLastFactoryIndexByClassName(index, className);
+ }
+
+ virtual bool doesFactoryExist(const char* className, uint32_t version)
+ {
+ uint32_t index = 0;
+ return findFactoryIndexByClassNameAndVersion(index, className, version);
+ }
+
+ virtual ::NvParameterized::Interface* createNvParameterized(const char * name)
+ {
+ uint32_t index = 0;
+ if (findLastFactoryIndexByClassName(index, name))
+ {
+ ::NvParameterized::Interface* result = factories[index]->create(this);
+ if (behaviourPolicy & BehaviourFlags::COLLECT_ALLOCATE_OBJECTS)
+ {
+ objects.pushBack(result);
+ }
+ return result;
+ }
+ return NULL;
+ }
+
+ virtual ::NvParameterized::Interface * createNvParameterized(const char * name, uint32_t ver)
+ {
+ uint32_t index = 0;
+ if (!findFactoryIndexByClassNameAndVersion(index, name, ver))
+ return NULL;
+ ::NvParameterized::Interface* result = factories[index]->create(this);
+
+ if (behaviourPolicy & BehaviourFlags::COLLECT_ALLOCATE_OBJECTS)
+ {
+ objects.pushBack(result);
+ }
+ return result;
+ }
+
+ virtual ::NvParameterized::Interface * finishNvParameterized(const char * name, void *obj, void *buf, int32_t *refCount)
+ {
+ uint32_t index = 0;
+ if (!findLastFactoryIndexByClassName(index, name))
+ return 0;
+ return factories[index]->finish(this, obj, buf, refCount);
+ }
+
+ virtual ::NvParameterized::Interface * finishNvParameterized( const char * name, uint32_t ver, void *obj, void *buf, int32_t *refCount )
+ {
+ uint32_t index = 0;
+ if (!findFactoryIndexByClassNameAndVersion(index, name, ver))
+ return 0;
+ return factories[index]->finish(this, obj, buf, refCount);
+ }
+
+ virtual uint32_t getCurrentVersion(const char *className) const {
+ uint32_t index = 0;
+ if (!findLastFactoryIndexByClassName(index, className))
+ return 0;
+ return factories[index]->getVersion();
+ }
+
+ virtual uint32_t getAlignment(const char *className, uint32_t classVersion) const
+ {
+ uint32_t index = 0;
+ if (!findFactoryIndexByClassNameAndVersion(index, className, classVersion))
+ return uint32_t(1);
+ return factories[index]->getAlignment();
+ }
+
+ virtual bool getNvParameterizedNames( const char ** names, uint32_t &outCount, uint32_t inCount) const
+ {
+ uint32_t currentOutSize = 0;
+ outCount = 0;
+ for (uint32_t i = 0; i < factories.size(); ++i)
+ {
+ const char* curClassName = factories[i]->getClassName();
+ bool foundClassName = false;
+ for (uint32_t j = 0; j < currentOutSize; ++j) {
+ if (strcmp(names[j], curClassName) == 0)
+ {
+ foundClassName = true;
+ break;
+ }
+ }
+
+ if (foundClassName)
+ continue;
+
+ if (outCount < inCount)
+ names[currentOutSize++] = factories[i]->getClassName();
+
+ outCount++;
+ }
+
+ return outCount <= inCount;
+ }
+
+ virtual bool getNvParameterizedVersions(const char* className, uint32_t* versions, uint32_t &outCount, uint32_t inCount) const
+ {
+ outCount = 0;
+ for (uint32_t i = 0; i < factories.size(); ++i) {
+ if (strcmp(factories[i]->getClassName(), className) == 0)
+ {
+ if (outCount < inCount)
+ versions[outCount] = factories[i]->getVersion();
+ outCount++;
+ }
+ }
+ return outCount <= inCount;
+ }
+
+
+ virtual void registerConversion(const char * className, uint32_t from, uint32_t to, ::NvParameterized::Conversion & conv)
+ {
+ ConversionInfo convInfo(&conv, className, from, to);
+ for (uint32_t i = 0; i < converters.size(); ++i)
+ {
+ if (converters[i] == convInfo)
+ {
+ PX_ASSERT_WITH_MESSAGE(false, "Conversion has already been registered");
+ return;
+ }
+ }
+ converters.pushBack(convInfo);
+ }
+
+ virtual ::NvParameterized::Conversion *removeConversion(const char * className, uint32_t from, uint32_t to)
+ {
+ ConversionInfo convInfo(NULL, className, from, to);
+ for (uint32_t i = 0; i < converters.size(); ++i) {
+ if (converters[i] == convInfo)
+ return removeAndReturn(converters, i).conv;
+ }
+ return NULL;
+ }
+
+ virtual bool updateLegacyNvParameterized(::NvParameterized::Interface &legacyObj, ::NvParameterized::Interface &obj)
+ {
+ // updateLegacyNvParameterized should not destroy legacyObj and obj. The code before this stackframe was responsible for it
+ if (legacyObj.version() > obj.version())
+ {
+ PX_ASSERT_WITH_MESSAGE(false, "Downgrade is not permited");
+ return false;
+ }
+
+ if (legacyObj.version() == obj.version())
+ {
+ PX_ASSERT_WITH_MESSAGE(false, "Object to upgrade already up to date version");
+ return false;
+ }
+
+ const char* legacyClassName = legacyObj.className();
+ const char* newClassName = obj.className();
+ if (!legacyClassName || !newClassName)
+ {
+ PX_ASSERT_WITH_MESSAGE(false, "updateLegacyNvParameterized get empty class names");
+ }
+
+ ::NvParameterized::Interface* prevObj = &legacyObj;
+ ::NvParameterized::Interface* nextObj = NULL;
+ bool res = true;
+
+ for (;prevObj->version() != obj.version() && res;)
+ {
+ // TODO: Here is the problem:
+ // We store our version in 32 bits - higher 16 bits store major version, lower 16 bits store minor version.
+ // If we agree on the fact that there are only 10 minor version (0-9) within one 1 major version, then this code should behave correctly
+ // otherwise there will be problems
+ const uint32_t version = prevObj->version();
+ uint32_t nextVersion = 0;
+ if ((version & 0xFFFF) == 9)
+ {
+ nextVersion = (((version & 0xFFFF0000) >> 16) + 1) << 16;
+ }
+ else
+ {
+ nextVersion = version + 1;
+ }
+ bool findConverter = false;
+
+ for (uint32_t i = 0; i < converters.size(); ++i)
+ {
+ if (strcmp(converters[i].className, legacyObj.className()) == 0 && converters[i].from == version)
+ {
+ if (converters[i].to == nextVersion || converters[i].to == version + 1)
+ {
+ if (converters[i].to == version + 1)
+ {
+ nextVersion = version + 1;
+ }
+ findConverter = true;
+
+ if (nextVersion == obj.version())
+ nextObj = &obj;
+ else
+ nextObj = createNvParameterized(legacyObj.className(), nextVersion);
+
+ if (behaviourPolicy & BehaviourFlags::WARN_IF_CONVERSION_HAPPENED)
+ {
+ char buff[512] = {0};
+ sprintf(buff, "Conversion %s,%i=>%i", legacyObj.className(), int(version), int(nextVersion));
+ traitsWarn(buff);
+ }
+
+ if (!(*converters[i].conv)(*prevObj, *nextObj))
+ {
+ res = false;
+ break;;
+ }
+
+ if (prevObj != &legacyObj && prevObj != &obj)
+ {
+ prevObj->destroy();
+ }
+ prevObj = nextObj;
+ nextObj = NULL;
+ }
+ }
+ }
+
+ if (!findConverter)
+ {
+ char buff[512] = {0};
+ sprintf(buff, "Needed conversion routine doesn't exist %s,%i=>%i !", legacyObj.className(), int(version), int(nextVersion));
+ PX_ASSERT_WITH_MESSAGE(false, buff);
+
+ break;
+ }
+ }
+
+ if (prevObj && prevObj != &legacyObj && prevObj != &obj)
+ prevObj->destroy();
+
+ if (nextObj && nextObj != &legacyObj && nextObj != &obj)
+ nextObj->destroy();
+
+ PX_ASSERT_WITH_MESSAGE(res, "Failed to upgrade NvParameterized::Interface");
+
+ return res;
+ }
+
+ virtual int32_t incRefCount(int32_t *refCount)
+ {
+ (*refCount)++;
+ return *refCount;
+ }
+
+ virtual int32_t decRefCount(int32_t *refCount)
+ {
+ (*refCount)--;
+ return *refCount;
+ }
+
+ virtual void *alloc(uint32_t nbytes)
+ {
+ return alloc(nbytes, 16);
+ }
+
+ virtual void *alloc(uint32_t nbytes, uint32_t align)
+ {
+ if (align <= 16)
+ {
+ return physx::shdfnd::AlignedAllocator<16>().allocate(nbytes, __FILE__, __LINE__);
+ }
+ else
+ {
+ switch (align){
+ case 32:
+ return physx::shdfnd::AlignedAllocator<32>().allocate(nbytes, __FILE__, __LINE__);
+ case 64:
+ return physx::shdfnd::AlignedAllocator<64>().allocate(nbytes, __FILE__, __LINE__);
+ case 128:
+ return physx::shdfnd::AlignedAllocator<128>().allocate(nbytes, __FILE__, __LINE__);
+ default:
+ PX_ASSERT_WITH_MESSAGE(false, "Unsupported alignment");
+ return 0;
+ }
+ }
+ }
+
+ virtual void free(void *buf)
+ {
+ physx::shdfnd::AlignedAllocator<16>().deallocate(buf);
+
+ if (behaviourPolicy & BehaviourFlags::COLLECT_ALLOCATE_OBJECTS)
+ {
+ // Try to find in objects
+ for (uint32_t i = 0; i < objects.size(); ++i)
+ {
+ if (objects[i] == reinterpret_cast<NvParameterized::Interface*>(buf))
+ {
+
+ objects.remove(i);
+ break;
+ }
+ }
+ }
+ }
+
+ virtual void traitsWarn(const char * msg) const
+ {
+ PxGetFoundation().getErrorCallback().reportError(physx::PxErrorCode::eDEBUG_WARNING, msg, __FILE__, __LINE__);
+ }
+
+ virtual void release(void)
+ {
+ delete this;
+ }
+ };
+}
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/NvParamConversionTemplate.h b/APEX_1.4/NvParameterized/include/NvParamConversionTemplate.h
new file mode 100644
index 00000000..fa363dfc
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/NvParamConversionTemplate.h
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+
+#ifndef NV_PARAMETERIZED_CONVERSION_TEMPLATE_H
+#define NV_PARAMETERIZED_CONVERSION_TEMPLATE_H
+
+#include <NvTraitsInternal.h>
+#include <nvparameterized/NvParameterizedTraits.h>
+
+namespace NvParameterized
+{
+/**
+\brief Class to handle all the redundant part of version upgrades.
+
+It verifies class names and versions, and it runs the default converter. The user may overload
+convert(), getPreferredVersions() and release() methods.
+*/
+template<typename Told, typename Tnew, uint32_t oldVersion, uint32_t newVersion>
+class ParamConversionTemplate : public NvParameterized::Conversion
+{
+public:
+ typedef Told TOldClass;
+ typedef Tnew TNewClass;
+
+ bool operator()(NvParameterized::Interface& legacyObj, NvParameterized::Interface& obj)
+ {
+ if (!mDefaultConversion)
+ {
+ mDefaultConversion = NvParameterized::internalCreateDefaultConversion(mTraits, getPreferredVersions());
+ }
+
+ // verify class names
+ if (physx::shdfnd::strcmp(legacyObj.className(), Told::staticClassName()) != 0)
+ {
+ return false;
+ }
+ if (physx::shdfnd::strcmp(obj.className(), Tnew::staticClassName()) != 0)
+ {
+ return false;
+ }
+
+ // verify version
+ if (legacyObj.version() != oldVersion)
+ {
+ return false;
+ }
+ if (obj.version() != newVersion)
+ {
+ return false;
+ }
+
+ //Copy unchanged fields
+ if (!(*mDefaultConversion)(legacyObj, obj))
+ {
+ return false;
+ }
+
+ mLegacyData = static_cast<Told*>(&legacyObj);
+ mNewData = static_cast<Tnew*>(&obj);
+
+ if (!convert())
+ {
+ return false;
+ }
+
+ NvParameterized::Handle invalidHandle(mNewData);
+ if (!mNewData->areParamsOK(&invalidHandle, 1))
+ {
+ if (invalidHandle.isValid())
+ {
+ char buf[256];
+ physx::shdfnd::strlcpy(buf, 256, "First invalid item: ");
+ invalidHandle.getLongName(buf + strlen("First invalid item: "), 256UL - static_cast<uint32_t>(strlen("First invalid item: ")));
+ mTraits->traitsWarn(buf);
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ /// User code, frees itself with the traits, and also calls destroy() on the ParamConversionTemplate object
+ virtual void release()
+ {
+ destroy();
+ mTraits->free(this);
+ }
+
+protected:
+ ParamConversionTemplate(NvParameterized::Traits* traits)
+ : mTraits(traits), mDefaultConversion(0), mLegacyData(0), mNewData(0)
+ {
+ // Virtual method getPreferredVersions() can not be called in constructors
+ // so we defer construction of mDefaultConversion
+ }
+
+ ~ParamConversionTemplate()
+ {
+ destroy();
+ }
+
+ /// User code, return list of preferred versions.
+ virtual const NvParameterized::PrefVer* getPreferredVersions() const
+ {
+ return 0;
+ }
+
+ /// User code, return true if conversion is successful.
+ virtual bool convert()
+ {
+ return true;
+ }
+
+ void destroy()
+ {
+ if (mDefaultConversion)
+ {
+ mDefaultConversion->release();
+ }
+ }
+
+
+ NvParameterized::Traits* mTraits;
+ NvParameterized::Conversion* mDefaultConversion;
+
+ Told* mLegacyData;
+ Tnew* mNewData;
+};
+}
+
+// Force inclusion of files with initParamRef before we redefine it below
+#include "nvparameterized/NvParameterized.h"
+#include "nvparameterized/NvParamUtils.h"
+#include "NvParameters.h"
+// Do not call initParamRef in converter - prefer Traits::createNvParameterized with explicit version
+// (see wiki for more details)
+#define initParamRef DO_NOT_USE_ME
+
+#endif // PARAM_CONVERSION_TEMPLATE_H
diff --git a/APEX_1.4/NvParameterized/include/NvParameters.h b/APEX_1.4/NvParameterized/include/NvParameters.h
new file mode 100644
index 00000000..7676cf48
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/NvParameters.h
@@ -0,0 +1,650 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PX_PARAMETERS_H
+#define PX_PARAMETERS_H
+
+#include "PsMutex.h"
+#include "PsAllocator.h"
+#include "PxAssert.h"
+#include "nvparameterized/NvParameterized.h"
+#include "NvParametersTypes.h"
+
+#define NV_PARAM_PLACEMENT_NEW(p, T) new(p) T
+
+namespace NvParameterized
+{
+ typedef physx::shdfnd::MutexT<physx::shdfnd::RawAllocator> MutexType;
+
+ const char *typeToStr(DataType type);
+ DataType strToType(const char *str);
+
+ PX_INLINE static bool IsAligned(const void *p, uint32_t border)
+ {
+ return !(reinterpret_cast<size_t>(p) % border); //size_t == uintptr_t
+ }
+
+ PX_INLINE static bool IsAligned(uint32_t x, uint32_t border)
+ {
+ return !(x % border);
+ }
+
+ // Used for associating useful info with parameters (e.g. min, max, step, etc...)
+ class HintImpl : public Hint
+ {
+ public:
+
+ HintImpl();
+ HintImpl(const char *name, uint64_t value);
+ HintImpl(const char *name, double value);
+ HintImpl(const char *name, const char *value);
+ virtual ~HintImpl();
+
+ void init(const char *name, uint64_t value, bool static_allocation = false);
+ void init(const char *name, double value, bool static_allocation = false);
+ void init(const char *name, const char *value, bool static_allocation = false);
+ void cleanup();
+
+ const char *name(void) const { return(mName); }
+ DataType type(void) const { return(mType); }
+
+ uint64_t asUInt(void) const;
+ double asFloat(void) const;
+ const char *asString(void) const;
+ bool setAsUInt(uint64_t v);
+
+ private:
+
+ bool mStaticAllocation;
+ char *mName;
+ DataType mType;
+
+ union
+ {
+ uint64_t mUIntValue;
+ double mFloatValue;
+ char *mStringValue;
+ };
+ };
+
+
+ class DefinitionImpl : public Definition
+ {
+ public:
+
+ DefinitionImpl(Traits &traits, bool staticAlloc = true);
+ DefinitionImpl(const char *name, DataType t, const char *structName, Traits &traits, bool staticAlloc = true);
+ virtual ~DefinitionImpl();
+
+ // can be used instead of the constructors and destructor
+ void init(const char *name, DataType t, const char *structName, bool static_allocation = false);
+ void cleanup(void);
+ void destroy();
+
+ const char *name(void) const
+ {
+ return(mName);
+ }
+ const char *longName(void) const { return(mLongName); }
+ const char *structName(void) const { return(mStructName); }
+ DataType type(void) const { return(mType); }
+ const char* typeString() const { return typeToStr(mType); }
+
+ int32_t arrayDimension(void) const;
+ int32_t arraySize(int32_t dimension = 0) const;
+ bool arraySizeIsFixed(void) const;
+ bool setArraySize(int32_t size); // -1 if the size is not fixed
+
+ bool isIncludedRef(void) const;
+
+ bool isLeaf(void) const { return(type() != TYPE_STRUCT && type() != TYPE_ARRAY); }
+
+ const Definition *parent(void) const { return(mParent); }
+ const Definition *root(void) const;
+
+ // Only used with parameters of TYPE_STRUCT or TYPE_ARRAY
+ int32_t numChildren(void) const;
+ const Definition *child(int32_t index) const;
+ const Definition *child(const char *name, int32_t &index) const; // only used with TYPE_STRUCT
+ void setChildren(Definition **children, int32_t n);
+ void addChild(Definition *child);
+
+ int32_t numHints(void) const;
+ const Hint *hint(int32_t index) const;
+ const Hint *hint(const char *name) const;
+ void setHints(const Hint **hints, int32_t n);
+ void addHint(Hint *hint);
+
+ int32_t numEnumVals(void) const;
+ int32_t enumValIndex( const char * enum_val ) const;
+
+ // The pointers returned by enumVal() are good for the lifetime of the DefinitionImpl object.
+ const char *enumVal(int32_t index) const;
+ void setEnumVals(const char **enum_vals, int32_t n);
+ void addEnumVal(const char *enum_val);
+
+
+ int32_t numRefVariants(void) const;
+ int32_t refVariantValIndex( const char * ref_val ) const;
+
+ // The pointers returned by refVariantVal() are good for the lifetime of the DefinitionImpl object.
+ const char * refVariantVal(int32_t index) const;
+ void setRefVariantVals(const char **ref_vals, int32_t n);
+ void addRefVariantVal(const char *ref_val);
+
+ uint32_t alignment(void) const;
+ void setAlignment(uint32_t align);
+
+ uint32_t padding(void) const;
+ void setPadding(uint32_t align);
+
+ void setDynamicHandleIndicesMap(const uint8_t *indices, uint32_t numIndices);
+ const uint8_t * getDynamicHandleIndicesMap(uint32_t &outNumIndices) const;
+
+ bool isSimpleType(bool simpleStructs, bool simpleStrings) const;
+
+ private:
+
+ enum { MAX_NAME_LEN = 256 };
+
+ void setDefaults(void);
+
+ bool mStaticAllocation;
+
+ const char * mName;
+ const char * mLongName;
+ const char * mStructName;
+ DataType mType;
+ int32_t mArraySize;
+
+ DefinitionImpl *mParent;
+
+ int32_t mNumChildren;
+ Definition **mChildren;
+
+ int32_t mNumHints;
+ HintImpl **mHints;
+
+ int32_t mNumEnumVals;
+ char **mEnumVals;
+
+ int32_t mNumRefVariants;
+ char **mRefVariantVals;
+
+ Traits *mTraits;
+ bool mLongNameAllocated;
+
+ uint32_t mAlign;
+ uint32_t mPad;
+
+ uint32_t mNumDynamicHandleIndices;
+ const uint8_t *mDynamicHandleIndices;
+ };
+
+ // Used by generated code
+ struct ParamLookupNode
+ {
+ NvParameterized::DataType type;
+ bool isDynamicArrayRoot;
+ size_t offset;
+ const size_t* children;
+ int numChildren;
+ };
+
+ //Constructs temporary object and extract vptr
+ template<typename T, size_t T_align>
+ const char* getVptr()
+ {
+ char buf[T_align + sizeof(T)];
+
+ // We want all isAllocated false
+ memset(buf, false, sizeof(buf));
+
+ // Align
+ char* bufAligned = (char*)((size_t)(buf + T_align) & ~(T_align - 1));
+
+ // Call "fast" constructor (buf and refCount != NULL)
+ // which does not allocate members
+ T* tmp = NV_PARAM_PLACEMENT_NEW(bufAligned, T)(0, reinterpret_cast<void*>(16), reinterpret_cast<int32_t*>(16));
+
+ // vptr is usually stored at the beginning of object...
+ const char* vptr = *reinterpret_cast<const char**>(tmp);
+
+ //Cleanup
+ tmp->~T();
+
+ return vptr;
+ }
+
+class NvParameters : public NvParameterized::Interface
+{
+public:
+
+ NvParameters(Traits *traits, void *buf = 0, int32_t *refCount = 0); //Long form is used for inplace objects
+ virtual ~NvParameters();
+
+ // placement delete
+ virtual void destroy();
+ virtual void initDefaults(void) { }
+ virtual void initRandom(void);
+
+ virtual const char * className(void) const { return mClassName; }
+ virtual void setClassName(const char *name);
+
+ virtual const char * name(void) const { return mName; }
+ virtual void setName(const char *name);
+
+ virtual uint32_t version(void) const { return 0; }
+ virtual uint16_t getMajorVersion(void) const;
+ virtual uint16_t getMinorVersion(void) const;
+
+ virtual const uint32_t * checksum(uint32_t &bits) const
+ {
+ bits = 0;
+ return 0;
+ }
+
+ int32_t numParameters(void);
+ const Definition *parameterDefinition(int32_t index);
+
+ const Definition *rootParameterDefinition(void);
+ const Definition *rootParameterDefinition(void) const;
+
+ // Given a long name like "mystruct.somearray[10].foo", it will return
+ // a handle to that specific parameter. The handle can then be used to
+ // set/get values, as long as it's a handle to a leaf node.
+ virtual ErrorType getParameterHandle(const char *long_name, Handle &handle) const;
+ virtual ErrorType getParameterHandle(const char *long_name, Handle &handle);
+
+ virtual void setSerializationCallback(SerializationCallback *cb, void *userData = NULL);
+ virtual ErrorType callPreSerializeCallback() const;
+
+ ErrorType initParamRef(const Handle &handle, const char *chosenRefStr = 0, bool doDestroyOld = false);
+
+ // These functions wrap the raw(Get|Set)XXXXX() methods. They deal with
+ // error handling and casting.
+ ErrorType getParamBool(const Handle &handle, bool &val) const;
+ ErrorType setParamBool(const Handle &handle, bool val);
+ ErrorType getParamBoolArray(const Handle &handle, bool *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamBoolArray(const Handle &handle, const bool *array, int32_t n, int32_t offset= 0);
+
+ ErrorType getParamString(const Handle &handle, const char *&val) const;
+ ErrorType setParamString(const Handle &handle, const char *val);
+ ErrorType getParamStringArray(const Handle &handle, char **array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamStringArray(const Handle &handle, const char **array, int32_t n, int32_t offset= 0);
+
+ ErrorType getParamEnum(const Handle &handle, const char *&val) const;
+ ErrorType setParamEnum(const Handle &handle, const char *val);
+ ErrorType getParamEnumArray(const Handle &handle, char **array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamEnumArray(const Handle &handle, const char **array, int32_t n, int32_t offset= 0);
+
+ ErrorType getParamRef(const Handle &handle, NvParameterized::Interface *&val) const;
+ ErrorType setParamRef(const Handle &handle, NvParameterized::Interface * val, bool doDestroyOld = false);
+ ErrorType getParamRefArray(const Handle &handle, NvParameterized::Interface **array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamRefArray(const Handle &handle, /*const*/ NvParameterized::Interface **array, int32_t n, int32_t offset = 0, bool doDestroyOld = false);
+
+ ErrorType getParamI8(const Handle &handle, int8_t &val) const;
+ ErrorType setParamI8(const Handle &handle, int8_t val);
+ ErrorType getParamI8Array(const Handle &handle, int8_t *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamI8Array(const Handle &handle, const int8_t *val, int32_t n, int32_t offset= 0);
+
+ ErrorType getParamI16(const Handle &handle, int16_t &val) const;
+ ErrorType setParamI16(const Handle &handle, int16_t val);
+ ErrorType getParamI16Array(const Handle &handle, int16_t *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamI16Array(const Handle &handle, const int16_t *val, int32_t n, int32_t offset= 0);
+
+ ErrorType getParamI32(const Handle &handle, int32_t &val) const;
+ ErrorType setParamI32(const Handle &handle, int32_t val);
+ ErrorType getParamI32Array(const Handle &handle, int32_t *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamI32Array(const Handle &handle, const int32_t *val, int32_t n, int32_t offset= 0);
+
+ ErrorType getParamI64(const Handle &handle, int64_t &val) const;
+ ErrorType setParamI64(const Handle &handle, int64_t val);
+ ErrorType getParamI64Array(const Handle &handle, int64_t *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamI64Array(const Handle &handle, const int64_t *val, int32_t n, int32_t offset= 0);
+
+ ErrorType getParamU8(const Handle &handle, uint8_t &val) const;
+ ErrorType setParamU8(const Handle &handle, uint8_t val);
+ ErrorType getParamU8Array(const Handle &handle, uint8_t *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamU8Array(const Handle &handle, const uint8_t *val, int32_t n, int32_t offset= 0);
+
+ ErrorType getParamU16(const Handle &handle, uint16_t &val) const;
+ ErrorType setParamU16(const Handle &handle, uint16_t val);
+ ErrorType getParamU16Array(const Handle &handle, uint16_t *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamU16Array(const Handle &handle, const uint16_t *array, int32_t n, int32_t offset= 0);
+
+ ErrorType getParamU32(const Handle &handle, uint32_t &val) const;
+ ErrorType setParamU32(const Handle &handle, uint32_t val);
+ ErrorType getParamU32Array(const Handle &handle, uint32_t *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamU32Array(const Handle &handle, const uint32_t *array, int32_t n, int32_t offset= 0);
+
+ ErrorType getParamU64(const Handle &handle, uint64_t &val) const;
+ ErrorType setParamU64(const Handle &handle, uint64_t val);
+ ErrorType getParamU64Array(const Handle &handle, uint64_t *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamU64Array(const Handle &handle, const uint64_t *array, int32_t n, int32_t offset= 0);
+
+ ErrorType getParamF32(const Handle &handle, float &val) const;
+ ErrorType setParamF32(const Handle &handle, float val);
+ ErrorType getParamF32Array(const Handle &handle, float *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamF32Array(const Handle &handle, const float *array, int32_t n, int32_t offset= 0);
+
+ ErrorType getParamF64(const Handle &handle, double &val) const;
+ ErrorType setParamF64(const Handle &handle, double val);
+ ErrorType getParamF64Array(const Handle &handle, double *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamF64Array(const Handle &handle, const double *array, int32_t n, int32_t offset= 0);
+
+ ErrorType setParamVec2(const Handle &handle, const physx::PxVec2 &val);
+ ErrorType getParamVec2(const Handle &handle, physx::PxVec2 &val) const;
+ ErrorType getParamVec2Array(const Handle &handle, physx::PxVec2 *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamVec2Array(const Handle &handle, const physx::PxVec2 *array, int32_t n, int32_t offset= 0);
+
+ ErrorType setParamVec3(const Handle &handle, const physx::PxVec3 &val);
+ ErrorType getParamVec3(const Handle &handle, physx::PxVec3 &val) const;
+ ErrorType getParamVec3Array(const Handle &handle, physx::PxVec3 *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamVec3Array(const Handle &handle, const physx::PxVec3 *array, int32_t n, int32_t offset= 0);
+
+ ErrorType setParamVec4(const Handle &handle, const physx::PxVec4 &val);
+ ErrorType getParamVec4(const Handle &handle, physx::PxVec4 &val) const;
+ ErrorType getParamVec4Array(const Handle &handle, physx::PxVec4 *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamVec4Array(const Handle &handle, const physx::PxVec4 *array, int32_t n, int32_t offset= 0);
+
+ ErrorType setParamQuat(const Handle &handle, const physx::PxQuat &val);
+ ErrorType getParamQuat(const Handle &handle, physx::PxQuat &val) const;
+ ErrorType getParamQuatArray(const Handle &handle, physx::PxQuat *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamQuatArray(const Handle &handle, const physx::PxQuat *array, int32_t n, int32_t offset= 0);
+
+ ErrorType setParamMat33(const Handle &handle, const physx::PxMat33 &val);
+ ErrorType getParamMat33(const Handle &handle, physx::PxMat33 &val) const;
+ ErrorType getParamMat33Array(const Handle &handle, physx::PxMat33 *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamMat33Array(const Handle &handle, const physx::PxMat33 *array, int32_t n, int32_t offset= 0);
+
+ ErrorType setParamMat34Legacy(const Handle &handle, const float (&val)[12]);
+ ErrorType getParamMat34Legacy(const Handle &handle, float (&val)[12]) const;
+ ErrorType getParamMat34LegacyArray(const Handle &handle, float *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamMat34LegacyArray(const Handle &handle, const float *array, int32_t n, int32_t offset = 0);
+
+ ErrorType setParamMat44(const Handle &handle, const physx::PxMat44 &val);
+ ErrorType getParamMat44(const Handle &handle, physx::PxMat44 &val) const;
+ ErrorType getParamMat44Array(const Handle &handle, physx::PxMat44 *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamMat44Array(const Handle &handle, const physx::PxMat44 *array, int32_t n, int32_t offset= 0);
+
+ ErrorType setParamBounds3(const Handle &handle, const physx::PxBounds3 &val);
+ ErrorType getParamBounds3(const Handle &handle, physx::PxBounds3 &val) const;
+ ErrorType getParamBounds3Array(const Handle &handle, physx::PxBounds3 *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamBounds3Array(const Handle &handle, const physx::PxBounds3 *array, int32_t n, int32_t offset= 0);
+
+ ErrorType setParamTransform(const Handle &handle, const physx::PxTransform &val);
+ ErrorType getParamTransform(const Handle &handle, physx::PxTransform &val) const;
+ ErrorType getParamTransformArray(const Handle &handle, physx::PxTransform *array, int32_t n, int32_t offset = 0) const;
+ ErrorType setParamTransformArray(const Handle &handle, const physx::PxTransform *array, int32_t n, int32_t offset= 0);
+
+ ErrorType valueToStr(const Handle &array_handle, char *str, uint32_t n, const char *&ret);
+ ErrorType strToValue(Handle &handle,const char *str,const char **endptr); // assigns this string to the value
+
+ ErrorType resizeArray(const Handle &array_handle, int32_t new_size);
+ ErrorType getArraySize(const Handle &array_handle, int32_t &size, int32_t dimension = 0) const;
+ ErrorType swapArrayElements(const Handle &array_handle, uint32_t firstElement, uint32_t secondElement);
+
+ bool equals(const NvParameterized::Interface &obj, Handle* handleOfInequality, uint32_t numHandlesOfInequality, bool doCompareNotSerialized = true) const;
+
+ bool areParamsOK(Handle *invalidHandles = NULL, uint32_t numInvalidHandles = 0);
+
+ ErrorType copy(const NvParameterized::Interface &other);
+
+ ErrorType clone(NvParameterized::Interface *&obj) const;
+
+ static physx::PxVec2 getVec2(const char *str, const char **endptr);
+ static physx::PxVec3 getVec3(const char *str, const char **endptr);
+ static physx::PxVec4 getVec4(const char *str, const char **endptr);
+ static physx::PxQuat getQuat(const char *str, const char **endptr);
+ static physx::PxMat33 getMat33(const char *str, const char **endptr);
+ static void getMat34Legacy(const char *str, const char **endptr, float (&val)[12]);
+ static physx::PxMat44 getMat44(const char *str, const char **endptr);
+ static physx::PxBounds3 getBounds3(const char *str, const char **endptr);
+ static physx::PxTransform getTransform(const char *str, const char **endptr);
+
+ static physx::PxVec2 init(float x,float y);
+ static physx::PxVec3 init(float x,float y,float z);
+ static physx::PxVec4 initVec4(float x,float y,float z,float w);
+ static physx::PxQuat init(float x,float y,float z,float w);
+ static physx::PxMat33 init(float _11,float _12,float _13,float _21,float _22,float _23,float _31,float _32,float _33);
+ static physx::PxMat44 init(float _11,float _12,float _13,float _14,float _21,float _22,float _23,float _24,float _31,float _32,float _33,float _34,float _41,float _42,float _43,float _44);
+ static physx::PxBounds3 init(float minx,float miny,float minz,float maxx,float maxy,float maxz);
+ static physx::PxTransform init(float x,float y,float z,float qx,float qy,float qz,float qw);
+
+ static int32_t MultIntArray(const int32_t *array, int32_t n);
+ static ErrorType resizeArray(Traits *parameterizedTraits,
+ void *&buf,
+ int32_t *array_sizes,
+ int32_t dimension,
+ int32_t resize_dim,
+ int32_t new_size,
+ bool doFree,
+ int32_t element_size,
+ uint32_t element_align,
+ bool &isMemAllocated);
+ static void recursiveCopy(const void *src,
+ const int32_t *src_sizes,
+ void *dst,
+ const int32_t *dst_sizes,
+ int32_t dimension,
+ int32_t element_size,
+ int32_t *indexes = NULL,
+ int32_t level = 0);
+
+ virtual void getVarPtr(const Handle &, void *&ptr, size_t &offset) const
+ {
+ PX_ALWAYS_ASSERT();
+ ptr = 0;
+ offset = 0;
+ }
+
+ Traits * getTraits(void) const
+ {
+ return mParameterizedTraits;
+ }
+
+ virtual bool checkAlignments() const;
+
+protected:
+
+ void *getVarPtrHelper(const ParamLookupNode *rootNode, void *paramStruct, const Handle &handle, size_t &offset) const;
+
+ static void destroy(NvParameters *obj, NvParameterized::Traits *traits, bool doDeallocateSelf, int32_t *refCount, void *buf);
+
+ // All classes deriving from NvParameterized must overload this function. It
+ // returns the parameter definition tree. The root node must be a struct
+ // with an empty string for its name.
+ virtual const Definition *getParameterDefinitionTree(void) {return NULL;}
+ virtual const Definition *getParameterDefinitionTree(void) const {return NULL;}
+
+ ErrorType releaseDownsizedParameters(const Handle &handle, int newSize, int oldSize);
+ ErrorType initNewResizedParameters(const Handle &handle, int newSize, int oldSize);
+ virtual ErrorType rawResizeArray(const Handle &handle, int new_size);
+ virtual ErrorType rawGetArraySize(const Handle &array_handle, int &size, int dimension) const;
+ virtual ErrorType rawSwapArrayElements(const Handle &array_handle, unsigned int firstElement, unsigned int secondElement);
+
+ // The methods for the types that are supported by the class deriving from
+ // NvParameterized must be overloaded.
+ virtual ErrorType rawSetParamBool(const Handle &handle, bool val);
+ virtual ErrorType rawGetParamBool(const Handle &handle, bool &val) const;
+ virtual ErrorType rawGetParamBoolArray(const Handle &handle, bool *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamBoolArray(const Handle &handle, const bool *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawGetParamString(const Handle &handle, const char *&val) const;
+ virtual ErrorType rawSetParamString(const Handle &handle, const char *val);
+ virtual ErrorType rawGetParamStringArray(const Handle &handle, char **array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamStringArray(const Handle &handle, const char **array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawGetParamEnum(const Handle &handle, const char *&val) const;
+ virtual ErrorType rawSetParamEnum(const Handle &handle, const char *val);
+ virtual ErrorType rawGetParamEnumArray(const Handle &handle, char **array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamEnumArray(const Handle &handle, const char **array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawGetParamRef(const Handle &handle, NvParameterized::Interface *&val) const;
+ virtual ErrorType rawSetParamRef(const Handle &handle, NvParameterized::Interface * val);
+ virtual ErrorType rawGetParamRefArray(const Handle &handle, NvParameterized::Interface **array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamRefArray(const Handle &handle, /*const*/ NvParameterized::Interface **array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawGetParamI8(const Handle &handle, int8_t &val) const;
+ virtual ErrorType rawSetParamI8(const Handle &handle, int8_t val);
+ virtual ErrorType rawGetParamI8Array(const Handle &handle, int8_t *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamI8Array(const Handle &handle, const int8_t *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawGetParamI16(const Handle &handle, int16_t &val) const;
+ virtual ErrorType rawSetParamI16(const Handle &handle, int16_t val);
+ virtual ErrorType rawGetParamI16Array(const Handle &handle, int16_t *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamI16Array(const Handle &handle, const int16_t *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawGetParamI32(const Handle &handle, int32_t &val) const;
+ virtual ErrorType rawSetParamI32(const Handle &handle, int32_t val);
+ virtual ErrorType rawGetParamI32Array(const Handle &handle, int32_t *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamI32Array(const Handle &handle, const int32_t *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawGetParamI64(const Handle &handle, int64_t &val) const;
+ virtual ErrorType rawSetParamI64(const Handle &handle, int64_t val);
+ virtual ErrorType rawGetParamI64Array(const Handle &handle, int64_t *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamI64Array(const Handle &handle, const int64_t *array, int32_t n, int32_t offset);
+
+
+ virtual ErrorType rawGetParamU8(const Handle &handle, uint8_t &val) const;
+ virtual ErrorType rawSetParamU8(const Handle &handle, uint8_t val);
+ virtual ErrorType rawGetParamU8Array(const Handle &handle, uint8_t *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamU8Array(const Handle &handle, const uint8_t *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawGetParamU16(const Handle &handle, uint16_t &val) const;
+ virtual ErrorType rawSetParamU16(const Handle &handle, uint16_t val);
+ virtual ErrorType rawGetParamU16Array(const Handle &handle, uint16_t *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamU16Array(const Handle &handle, const uint16_t *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawGetParamU32(const Handle &handle, uint32_t &val) const;
+ virtual ErrorType rawSetParamU32(const Handle &handle, uint32_t val);
+ virtual ErrorType rawGetParamU32Array(const Handle &handle, uint32_t *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamU32Array(const Handle &handle, const uint32_t *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawSetParamU64(const Handle &handle, uint64_t val);
+ virtual ErrorType rawGetParamU64(const Handle &handle, uint64_t &val) const;
+ virtual ErrorType rawGetParamU64Array(const Handle &handle, uint64_t *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamU64Array(const Handle &handle, const uint64_t *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawGetParamF32(const Handle &handle, float &val) const;
+ virtual ErrorType rawSetParamF32(const Handle &handle, float val);
+ virtual ErrorType rawGetParamF32Array(const Handle &handle, float *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamF32Array(const Handle &handle, const float *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawGetParamF64(const Handle &handle, double &val) const;
+ virtual ErrorType rawSetParamF64(const Handle &handle, double val);
+ virtual ErrorType rawGetParamF64Array(const Handle &handle, double *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamF64Array(const Handle &handle, const double *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawSetParamVec2(const Handle &handle,physx::PxVec2 val);
+ virtual ErrorType rawGetParamVec2(const Handle &handle,physx::PxVec2 &val) const;
+ virtual ErrorType rawGetParamVec2Array(const Handle &handle,physx::PxVec2 *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamVec2Array(const Handle &handle, const physx::PxVec2 *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawSetParamVec3(const Handle &handle,physx::PxVec3 val);
+ virtual ErrorType rawGetParamVec3(const Handle &handle,physx::PxVec3 &val) const;
+ virtual ErrorType rawGetParamVec3Array(const Handle &handle,physx::PxVec3 *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamVec3Array(const Handle &handle, const physx::PxVec3 *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawSetParamVec4(const Handle &handle,physx::PxVec4 val);
+ virtual ErrorType rawGetParamVec4(const Handle &handle,physx::PxVec4 &val) const;
+ virtual ErrorType rawGetParamVec4Array(const Handle &handle,physx::PxVec4 *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamVec4Array(const Handle &handle, const physx::PxVec4 *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawSetParamQuat(const Handle &handle,physx::PxQuat val);
+ virtual ErrorType rawGetParamQuat(const Handle &handle,physx::PxQuat &val) const;
+ virtual ErrorType rawGetParamQuatArray(const Handle &handle,physx::PxQuat *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamQuatArray(const Handle &handle, const physx::PxQuat *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawSetParamMat33(const Handle &handle,physx::PxMat33 val);
+ virtual ErrorType rawGetParamMat33(const Handle &handle,physx::PxMat33 &val) const;
+ virtual ErrorType rawGetParamMat33Array(const Handle &handle,physx::PxMat33 *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamMat33Array(const Handle &handle, const physx::PxMat33 *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawSetParamMat44(const Handle &handle,physx::PxMat44 val);
+ virtual ErrorType rawGetParamMat44(const Handle &handle,physx::PxMat44 &val) const;
+ virtual ErrorType rawGetParamMat44Array(const Handle &handle,physx::PxMat44 *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamMat44Array(const Handle &handle, const physx::PxMat44 *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawSetParamMat34Legacy(const Handle &handle,const float (&val)[12]);
+ virtual ErrorType rawGetParamMat34Legacy(const Handle &handle,float (&val)[12]) const;
+ virtual ErrorType rawGetParamMat34LegacyArray(const Handle &handle, float *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamMat34LegacyArray(const Handle &handle, const float *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawSetParamBounds3(const Handle &handle,physx::PxBounds3 val);
+ virtual ErrorType rawGetParamBounds3(const Handle &handle,physx::PxBounds3 &val) const;
+ virtual ErrorType rawGetParamBounds3Array(const Handle &handle,physx::PxBounds3 *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamBounds3Array(const Handle &handle, const physx::PxBounds3 *array, int32_t n, int32_t offset);
+
+ virtual ErrorType rawSetParamTransform(const Handle &handle,physx::PxTransform val);
+ virtual ErrorType rawGetParamTransform(const Handle &handle,physx::PxTransform &val) const;
+ virtual ErrorType rawGetParamTransformArray(const Handle &handle,physx::PxTransform *array, int32_t n, int32_t offset) const;
+ virtual ErrorType rawSetParamTransformArray(const Handle &handle, const physx::PxTransform *array, int32_t n, int32_t offset);
+
+ // WARNING!
+ // Binary deserializer relies on layout of fields
+ // If you change anything be sure to update it as well
+
+ Traits *mParameterizedTraits;
+ SerializationCallback *mSerializationCb;
+ void *mCbUserData;
+ void *mBuffer;
+ int32_t *mRefCount;
+ const char *mName;
+ const char *mClassName;
+ bool mDoDeallocateSelf; //if true - memory should be deallocated in destroy()
+ bool mDoDeallocateName; //if true - mName is in inplace-buffer and should not be freed
+ bool mDoDeallocateClassName; //see comment for mDoDeallocateName
+
+private:
+
+ void initRandom(NvParameterized::Handle& handle);
+
+ bool equals(const NvParameterized::Interface &obj,
+ Handle &param_handle,
+ Handle *handlesOfInequality,
+ uint32_t numHandlesOfInequality,
+ bool doCompareNotSerialized) const;
+
+ bool checkAlignments(Handle &param_handle) const;
+
+ bool areParamsOK(Handle &handle, Handle *invalidHandles, uint32_t numInvalidHandles, uint32_t &numRemainingHandles);
+
+ ErrorType copy(const NvParameterized::Interface &other,
+ Handle &param_handle);
+
+ // recursively call pre serialization callback
+ ErrorType callPreSerializeCallback(Handle& handle) const;
+
+ ErrorType checkParameterHandle(const Handle &handle) const;
+
+};
+
+} // end of namespace
+
+#endif // PX_PARAMETERS_H
diff --git a/APEX_1.4/NvParameterized/include/NvParametersTypes.h b/APEX_1.4/NvParameterized/include/NvParametersTypes.h
new file mode 100644
index 00000000..aba2b756
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/NvParametersTypes.h
@@ -0,0 +1,58 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PX_PARAMETERS_TYPES_H
+#define PX_PARAMETERS_TYPES_H
+
+namespace NvParameterized
+{
+
+struct DummyDynamicArrayStruct
+{
+ void *buf;
+ bool isAllocated;
+ int elementSize;
+ int arraySizes[1];
+};
+
+struct DummyStringStruct
+{
+ const char *buf;
+ bool isAllocated;
+
+ //This is needed for compatibility with existing code
+ operator const char *() const
+ {
+ return buf;
+ }
+};
+
+class Interface; // necessary for NV_PARAMETERIZED_ONLY_LAYOUTS
+
+}
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/NvRegistrationsForTraitsBase.h b/APEX_1.4/NvParameterized/include/NvRegistrationsForTraitsBase.h
new file mode 100644
index 00000000..2af6ddf2
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/NvRegistrationsForTraitsBase.h
@@ -0,0 +1,29 @@
+#ifndef MODULE_REGISTRATION_FOR_TRAITS_BASE_H
+#define MODULE_REGISTRATION_FOR_TRAITS_BASE_H
+
+#include "nvparameterized/NvParameterizedTraits.h"
+
+namespace NvParameterized
+{
+ class RegistrationsForTraitsBase
+ {
+ public:
+ virtual void registerAvailableFactories(NvParameterized::Traits& parameterizedTraits) = 0;
+ virtual void registerAvailableConverters(NvParameterized::Traits& parameterizedTraits) = 0;
+ virtual void registerAll(NvParameterized::Traits& parameterizedTraits)
+ {
+ registerAvailableFactories(parameterizedTraits);
+ registerAvailableConverters(parameterizedTraits);
+ }
+
+ virtual void unregisterAvailableFactories(NvParameterized::Traits& parameterizedTraits) = 0;
+ virtual void unregisterAvailableConverters(NvParameterized::Traits& parameterizedTraits) = 0;
+ virtual void unregisterAll(NvParameterized::Traits& parameterizedTraits)
+ {
+ unregisterAvailableFactories(parameterizedTraits);
+ unregisterAvailableConverters(parameterizedTraits);
+ }
+ };
+}
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/NvSerializerInternal.h b/APEX_1.4/NvParameterized/include/NvSerializerInternal.h
new file mode 100644
index 00000000..d17d64ff
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/NvSerializerInternal.h
@@ -0,0 +1,63 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PX_SERIALIZER_INTERNAL_H
+#define PX_SERIALIZER_INTERNAL_H
+
+/*!
+\file
+\brief NvParameterized serializer factory
+*/
+
+
+#include "nvparameterized/NvSerializer.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+
+namespace NvParameterized
+{
+
+PX_PUSH_PACK_DEFAULT
+
+/**
+\brief A factory function to create an instance of the Serializer class
+\param [in] type serializer type (binary, xml, etc.)
+\param [in] traits traits-object to do memory allocation, legacy version conversions, callback calls, etc.
+*/
+Serializer *internalCreateSerializer(Serializer::SerializeType type, Traits *traits);
+
+
+// Query the current platform
+const SerializePlatform &GetCurrentPlatform();
+bool GetPlatform(const char *name, SerializePlatform &platform);
+const char *GetPlatformName(const SerializePlatform &platform);
+
+
+PX_POP_PACK
+
+} // end of namespace
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/NvTraitsInternal.h b/APEX_1.4/NvParameterized/include/NvTraitsInternal.h
new file mode 100644
index 00000000..a8d737d8
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/NvTraitsInternal.h
@@ -0,0 +1,85 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PX_TRAITS_INTERNAL_H
+#define PX_TRAITS_INTERNAL_H
+
+#include "nvparameterized/NvParameterizedTraits.h"
+#include "PsString.h"
+
+namespace NvParameterized
+{
+
+PX_PUSH_PACK_DEFAULT
+
+#ifndef WITHOUT_APEX_SERIALIZATION
+#ifdef _MSC_VER
+#pragma warning(disable:4127) // conditional expression is constant
+#endif
+#define NV_PARAM_TRAITS_WARNING(_traits, _format, ...) do { \
+ char _tmp[256]; \
+ physx::shdfnd::snprintf(_tmp, sizeof(_tmp), _format, ##__VA_ARGS__); \
+ _traits->traitsWarn(_tmp); \
+ } while(0)
+
+#else
+#define NV_PARAM_TRAITS_WARNING(...)
+#endif
+
+// Determines how default converter handles included references
+struct RefConversionMode
+{
+ enum Enum
+ {
+ // Simply move it to new object (and remove from old)
+ REF_CONVERT_COPY = 0,
+
+ // Same as REF_CONVERT_COPY but also update legacy references
+ REF_CONVERT_UPDATE,
+
+ // Skip references
+ REF_CONVERT_SKIP,
+
+ REF_CONVERT_LAST
+ };
+};
+
+// Specifies preferred version for element at position specified in longName
+struct PrefVer
+{
+ const char *longName;
+ uint32_t ver;
+};
+
+// A factory function to create an instance of default conversion.
+Conversion *internalCreateDefaultConversion(Traits *traits, const PrefVer *prefVers = 0, RefConversionMode::Enum refMode = RefConversionMode::REF_CONVERT_COPY);
+
+PX_POP_PACK
+
+}
+
+#endif \ No newline at end of file
diff --git a/APEX_1.4/NvParameterized/include/PlatformABI.h b/APEX_1.4/NvParameterized/include/PlatformABI.h
new file mode 100644
index 00000000..58f4f6f8
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/PlatformABI.h
@@ -0,0 +1,135 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PLATFORM_ABI_H_
+#define PLATFORM_ABI_H_
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+#include "BinaryHelper.h"
+#include "nvparameterized/NvSerializer.h"
+
+namespace NvParameterized
+{
+
+//Describes platform ABI (endian, alignment, etc.)
+struct PlatformABI
+{
+ enum Endian
+ {
+ LITTLE,
+ BIG
+ };
+
+ Endian endian;
+
+ //Sizes of basic types
+ struct
+ {
+ uint32_t Char,
+ Bool,
+ pointer,
+ real;
+ } sizes;
+
+ //Alignments of basic types
+ struct
+ {
+ uint32_t Char,
+ Bool,
+ pointer,
+ real,
+ i8,
+ i16,
+ i32,
+ i64,
+ f32,
+ f64;
+ } aligns;
+
+ //Does child class reuse tail padding of parent? (google for "overlaying tail padding")
+ bool doReuseParentPadding;
+
+ //Are empty base classes eliminated? (google for "empty base class optimization")
+ //We may need this in future
+ bool doEbo;
+
+ //Get ABI of platform
+ static Serializer::ErrorType GetPredefinedABI(const SerializePlatform &platform, PlatformABI &params);
+
+ //Get alignment of (complex) NvParameterized data type
+ uint32_t getAlignment(const Definition *pd) const;
+
+ //Get padding of (complex) NvParameterized data type
+ uint32_t getPadding(const Definition *pd) const;
+
+ //Get size of (complex) NvParameterized data type
+ uint32_t getSize(const Definition *pd) const;
+
+ //Helper function which calculates aligned value
+ PX_INLINE static uint32_t align(uint32_t len, uint32_t border);
+
+ //Verifying that platforms are going to work with our serializer
+ PX_INLINE bool isNormal() const;
+ static bool VerifyCurrentPlatform();
+
+ //Alignment of metadata table entry in metadata section
+ //TODO: find better place for this
+ PX_INLINE uint32_t getMetaEntryAlignment() const;
+
+ //Alignment of metadata info in metadata section
+ //TODO: find better place for this
+ PX_INLINE uint32_t getMetaInfoAlignment() const;
+
+ //Alignment of hint in metadata section
+ //TODO: find better place for this
+ PX_INLINE uint32_t getHintAlignment() const;
+
+ //Alignment of hint value (union of uint32_t, uint64_t, const char *) in metadata section
+ //TODO: find better place for this
+ PX_INLINE uint32_t getHintValueAlignment() const;
+
+ //Size of hint value (union of uint32_t, uint64_t, const char *) in metadata section
+ //TODO: find better place for this
+ PX_INLINE uint32_t getHintValueSize() const;
+
+ //Template for getting target alignment of T
+ template <typename T> PX_INLINE uint32_t getAlignment() const;
+
+ //Template for getting target size of T
+ template <typename T> PX_INLINE uint32_t getSize() const;
+
+private:
+ uint32_t getNatAlignment(const Definition *pd) const;
+};
+
+#include "PlatformABI.inl"
+
+}
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/PlatformABI.inl b/APEX_1.4/NvParameterized/include/PlatformABI.inl
new file mode 100644
index 00000000..04fe9ac4
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/PlatformABI.inl
@@ -0,0 +1,267 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+PX_INLINE uint32_t PlatformABI::align(uint32_t len, uint32_t border)
+{
+ uint32_t n = (len + border - 1) / border;
+ return n * border;
+}
+
+PX_INLINE bool PlatformABI::isNormal() const
+{
+ return 1 == sizes.Char && 1 == sizes.Bool //Wide (> 1) bytes not supported
+ && 4 == sizes.real //Some code relies on short float (float)
+ && ( 4 == sizes.pointer || 8 == sizes.pointer ); //Some code relies on pointers being either 32- or 64-bit
+}
+
+PX_INLINE uint32_t PlatformABI::getMetaEntryAlignment() const
+{
+ return physx::PxMax(aligns.i32, aligns.pointer);
+}
+
+PX_INLINE uint32_t PlatformABI::getMetaInfoAlignment() const
+{
+ return NvMax3(getHintAlignment(), aligns.i32, aligns.pointer);
+}
+
+PX_INLINE uint32_t PlatformABI::getHintAlignment() const
+{
+ return physx::PxMax(aligns.i32, getHintValueAlignment());
+}
+
+PX_INLINE uint32_t PlatformABI::getHintValueAlignment() const
+{
+ return NvMax3(aligns.pointer, aligns.i64, aligns.f64);
+}
+
+PX_INLINE uint32_t PlatformABI::getHintValueSize() const
+{
+ return align(8, getHintValueAlignment()); //Size of union = aligned size of maximum element
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<bool>() const
+{
+ return aligns.Bool;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<int8_t>() const
+{
+ return aligns.i8;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<int16_t>() const
+{
+ return aligns.i16;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<int32_t>() const
+{
+ return aligns.i32;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<int64_t>() const
+{
+ return aligns.i64;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<uint8_t>() const
+{
+ return getAlignment<int8_t>();
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<uint16_t>() const
+{
+ return getAlignment<int16_t>();
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<uint32_t>() const
+{
+ return getAlignment<int32_t>();
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<uint64_t>() const
+{
+ return getAlignment<int64_t>();
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<float>() const
+{
+ return aligns.f32;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<double>() const
+{
+ return aligns.f64;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<physx::PxVec2>() const
+{
+ return aligns.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<physx::PxVec3>() const
+{
+ return aligns.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<physx::PxVec4>() const
+{
+ return aligns.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<physx::PxQuat>() const
+{
+ return aligns.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<physx::PxMat33>() const
+{
+ return aligns.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<physx::PxMat44>() const
+{
+ return aligns.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<physx::PxBounds3>() const
+{
+ return aligns.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<void *>() const
+{
+ return aligns.pointer;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getAlignment<physx::PxTransform>() const
+{
+ return aligns.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<bool>() const
+{
+ return sizes.Bool;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<int8_t>() const
+{
+ return 1;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<int16_t>() const
+{
+ return 2;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<int32_t>() const
+{
+ return 4;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<int64_t>() const
+{
+ return 8;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<uint8_t>() const
+{
+ return getSize<int8_t>();
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<uint16_t>() const
+{
+ return getSize<int16_t>();
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<uint32_t>() const
+{
+ return getSize<int32_t>();
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<uint64_t>() const
+{
+ return getSize<int64_t>();
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<float>() const
+{
+ return 4;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<double>() const
+{
+ return 8;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<physx::PxVec2>() const
+{
+ return 2 * sizes.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<physx::PxVec3>() const
+{
+ return 3 * sizes.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<physx::PxVec4>() const
+{
+ return 4 * sizes.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<physx::PxQuat>() const
+{
+ return 4 * sizes.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<physx::PxMat33>() const
+{
+ return 9 * sizes.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<physx::PxMat44>() const
+{
+ return 16 * sizes.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<physx::PxBounds3>() const
+{
+ return 6 * sizes.real;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<void *>() const
+{
+ return sizes.pointer;
+}
+
+template <> PX_INLINE uint32_t PlatformABI::getSize<physx::PxTransform>() const
+{
+ return 7 * sizes.real;
+}
diff --git a/APEX_1.4/NvParameterized/include/PlatformInputStream.h b/APEX_1.4/NvParameterized/include/PlatformInputStream.h
new file mode 100644
index 00000000..45af2a3a
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/PlatformInputStream.h
@@ -0,0 +1,115 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PLATFORM_INPUT_STREAM_H_
+#define PLATFORM_INPUT_STREAM_H_
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+#include "PlatformStream.h"
+#include "ApbDefinitions.h"
+
+namespace NvParameterized
+{
+
+//ABI-aware input stream
+class PlatformInputStream: public PlatformStream
+{
+ physx::PxFileBuf &mStream;
+ physx::shdfnd::Array<uint32_t, Traits::Allocator> mPos;
+ uint32_t mStartPos; //This is necessary to handle NvParameterized streams starting in the middle of other files
+
+ PlatformInputStream(const PlatformInputStream &); //Don't
+ void operator =(const PlatformInputStream &); //Don't
+
+public:
+ PlatformInputStream(physx::PxFileBuf &stream, const PlatformABI &targetParams, Traits *traits);
+
+ Serializer::ErrorType skipBytes(uint32_t nbytes);
+
+ Serializer::ErrorType pushPos(uint32_t newPos);
+
+ void popPos();
+
+ uint32_t getPos() const;
+
+ //Read string stored at given offset
+ //TODO: this could much faster if we loaded whole dictionary in the beginning
+ Serializer::ErrorType readString(uint32_t off, const char *&s);
+
+ //Deserialize header of NvParameterized object (see wiki for details)
+ Serializer::ErrorType readObjHeader(ObjHeader &hdr);
+
+ //Deserialize primitive type
+ template<typename T> PX_INLINE Serializer::ErrorType read(T &x, bool doAlign = true);
+
+ //Deserialize array of primitive type (slow path)
+ template<typename T> PX_INLINE Serializer::ErrorType readSimpleArraySlow(Handle &handle);
+
+ //Deserialize array of structs of primitive type
+ Serializer::ErrorType readSimpleStructArray(Handle &handle);
+
+ //Deserialize array of primitive type
+ template<typename T> PX_INLINE Serializer::ErrorType readSimpleArray(Handle &handle);
+
+ //Align current offset according to supplied alignment and padding
+ void beginStruct(uint32_t align_, uint32_t pad_);
+
+ //Align current offset according to supplied alignment (padding = alignment)
+ void beginStruct(uint32_t align_);
+
+ //Align current offset according to supplied DataType
+ void beginStruct(const Definition *pd);
+
+ //Insert tail padding
+ void closeStruct();
+
+ //beginStruct for DummyStringStruct
+ void beginString();
+
+ //closeStruct for DummyStringStruct
+ void closeString();
+
+ //beginStruct for arrays
+ void beginArray(const Definition *pd);
+
+ //closeStruct for arrays
+ void closeArray();
+
+ //Align offset to be n*border
+ void align(uint32_t border);
+
+ //Read value of pointer (offset from start of file)
+ Serializer::ErrorType readPtr(uint32_t &val);
+};
+
+#include "PlatformInputStream.inl"
+
+}
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/PlatformInputStream.inl b/APEX_1.4/NvParameterized/include/PlatformInputStream.inl
new file mode 100644
index 00000000..8c3605ab
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/PlatformInputStream.inl
@@ -0,0 +1,117 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+template<typename T> PX_INLINE Serializer::ErrorType PlatformInputStream::read(T &x, bool doAlign)
+{
+ if( doAlign )
+ align(mTargetParams.getAlignment<T>());
+
+ if( mCurParams.getSize<T>() != mTargetParams.getSize<T>() )
+ {
+ PX_ALWAYS_ASSERT();
+ return Serializer::ERROR_INVALID_PLATFORM;
+ }
+
+ mStream.read(&x, sizeof(T));
+
+ if( mCurParams.endian != mTargetParams.endian )
+ SwapBytes((char *)&x, sizeof(T), GetDataType<T>::value);
+
+ return Serializer::ERROR_NONE;
+}
+
+//Deserialize array of primitive type (slow path)
+template<typename T> PX_INLINE Serializer::ErrorType PlatformInputStream::readSimpleArraySlow(Handle &handle)
+{
+ int32_t n;
+ handle.getArraySize(n);
+
+ align(mTargetParams.getAlignment<T>());
+
+ for(int32_t i = 0; i < n; ++i)
+ {
+ handle.set(i);
+ T val;
+ NV_ERR_CHECK_RETURN( read(val) );
+ handle.setParam<T>(val);
+
+ handle.popIndex();
+ }
+
+ return Serializer::ERROR_NONE;
+}
+
+template<typename T> PX_INLINE Serializer::ErrorType PlatformInputStream::readSimpleArray(Handle &handle)
+{
+ if( mTargetParams.getSize<T>() == mCurParams.getSize<T>()
+ && mTargetParams.getSize<T>() >= mTargetParams.getAlignment<T>()
+ && mCurParams.getSize<T>() >= mCurParams.getAlignment<T>() ) //No gaps between array elements on both platforms
+ {
+ //Fast path
+
+ int32_t n;
+ handle.getArraySize(n);
+
+ align(mTargetParams.getAlignment<T>());
+
+ const int32_t elemSize = (int32_t)sizeof(T);
+
+ if( mStream.tellRead() + elemSize * n >= mStream.getFileLength() )
+ {
+ DEBUG_ALWAYS_ASSERT();
+ return Serializer::ERROR_INVALID_INTERNAL_PTR;
+ }
+
+ PX_ASSERT(elemSize * n >= 0);
+ char *p = (char *)mTraits->alloc(static_cast<uint32_t>(elemSize * n));
+ mStream.read(p, static_cast<uint32_t>(elemSize * n));
+
+ if( mCurParams.endian != mTargetParams.endian )
+ {
+ char *elem = p;
+ for(int32_t i = 0; i < n; ++i)
+ {
+ SwapBytes(elem, elemSize, GetDataType<T>::value);
+ elem += elemSize;
+ }
+ }
+
+ handle.setParamArray<T>((const T *)p, n);
+
+ mTraits->free(p);
+ }
+ else
+ {
+ return readSimpleArraySlow<T>(handle);
+ }
+
+ return Serializer::ERROR_NONE;
+}
+
diff --git a/APEX_1.4/NvParameterized/include/PlatformOutputStream.h b/APEX_1.4/NvParameterized/include/PlatformOutputStream.h
new file mode 100644
index 00000000..821d7a10
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/PlatformOutputStream.h
@@ -0,0 +1,212 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PLATFORM_OUTPUT_STREAM_H_
+#define PLATFORM_OUTPUT_STREAM_H_
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+#include "PlatformStream.h"
+#include "ApbDefinitions.h"
+
+#ifndef WITHOUT_APEX_SERIALIZATION
+
+namespace NvParameterized
+{
+
+class PlatformOutputStream;
+
+//Info about pointed data (and its subdata)
+struct Reloc
+{
+ RelocType type;
+ uint32_t ptrPos;
+ PlatformOutputStream *ptrData;
+ Traits *traits;
+
+ Reloc(RelocType type_, uint32_t ptrPos_, const PlatformOutputStream &parent);
+
+ Reloc(const Reloc &cinfo);
+
+ ~Reloc();
+};
+
+//Info about pointed string
+struct StringReloc
+{
+ uint32_t ptrPos;
+ const char *s;
+
+ StringReloc(uint32_t ptrPos_, const char *s_): ptrPos(ptrPos_), s(s_) {}
+};
+
+//Info about reloc which was already merged
+struct MergedReloc
+{
+ uint32_t ptrPos;
+ uint32_t targetPos;
+ RelocType type;
+ bool isExtern;
+};
+
+//ABI-aware output stream
+class PlatformOutputStream: public PlatformStream
+{
+ void operator = (const PlatformOutputStream &); //Don't
+
+ friend struct Reloc;
+public:
+ PlatformOutputStream(const PlatformABI &targetParams, Traits *traits, Dictionary &dict_);
+
+ //Array's copy constructor is broken so we implement it by hand
+ PlatformOutputStream(const PlatformOutputStream &s);
+
+#ifndef NDEBUG
+ void dump() const;
+#endif
+
+ PX_INLINE StringBuf &getData() { return data; }
+
+ uint32_t size() const { return data.size(); }
+
+ //Update uint32_t at given position
+ void storeU32At(uint32_t x, uint32_t i);
+
+ uint32_t storeString(const char *s);
+
+ //Serialize raw bytes
+ uint32_t storeBytes(const char *s, uint32_t n);
+
+ //Serialize value of primitive type with proper alignment
+ //(this is overriden for bools below)
+ template <typename T> PX_INLINE uint32_t storeSimple(T x);
+
+ PX_INLINE uint32_t storeSimple(float* x, uint32_t size);
+
+ //Serialize array of primitive type with proper alignment (slow path)
+ template <typename T> PX_INLINE int32_t storeSimpleArraySlow(Handle &handle);
+
+ //Serialize array of structs of primitive types with proper alignment
+ uint32_t storeSimpleStructArray(Handle &handle);
+
+ //Serialize array of primitive type with proper alignment
+ template <typename T> PX_INLINE uint32_t storeSimpleArray(Handle &handle);
+
+ //Serialize header of NvParameterized object (see wiki for details)
+ uint32_t storeObjHeader(const NvParameterized::Interface &obj, bool isIncluded = true);
+
+ //Serialize NvParameters-part of NvParameterized object
+ uint32_t beginObject(const NvParameterized::Interface &obj, bool /*isRoot*/, const Definition *pd);
+
+ //Insert tail padding bytes for NvParameterized object
+ void closeObject() { closeStruct(); }
+
+ //Align current offset according to supplied alignment and padding
+ uint32_t beginStruct(uint32_t align_, uint32_t pad_);
+
+ //Align current offset according to supplied alignment (padding = alignment)
+ uint32_t beginStruct(uint32_t align_);
+
+ //Align current offset according to supplied DataType
+ uint32_t beginStruct(const Definition *pd);
+
+ //Insert tail padding
+ void closeStruct();
+
+ //beginStruct for DummyStringStruct
+ uint32_t beginString();
+
+ //closeStruct for DummyStringStruct
+ void closeString();
+
+ //beginStruct for arrays
+ uint32_t beginArray(const Definition *pd);
+
+ //beginStruct for arrays
+ uint32_t beginArray(uint32_t align_);
+
+ //closeStruct for arrays
+ void closeArray();
+
+ void skipBytes(uint32_t nbytes);
+
+ //Align offset to be n*border
+ void align(uint32_t border);
+
+ //Align offset to be n * alignment of T
+ template <typename T> PX_INLINE void align();
+
+ //Add data (including relocations) from another stream
+ uint32_t merge(const PlatformOutputStream &mergee);
+
+ //Merge pointed data (including strings) thus flattening the stream
+ void flatten();
+
+ //Create relocation table
+ uint32_t writeRelocs();
+
+ //Serialize dictionary data
+ void mergeDict();
+
+ uint32_t storeNullPtr();
+
+ Reloc &storePtr(RelocType type, const Definition *pd);
+
+ Reloc &storePtr(RelocType type, uint32_t align);
+
+ void storeStringPtr(const char *s);
+
+ PX_INLINE uint32_t alignment() const { return mTotalAlign; }
+
+ PX_INLINE void setAlignment(uint32_t newAlign) { mTotalAlign = newAlign; }
+
+private:
+
+ //Byte stream
+ StringBuf data;
+
+ //Generic relocations
+ physx::shdfnd::Array<Reloc, Traits::Allocator> mRelocs;
+
+ //String relocations
+ physx::shdfnd::Array<StringReloc, Traits::Allocator> mStrings;
+
+ //Keep info about relocations after flattening
+ physx::shdfnd::Array<MergedReloc, Traits::Allocator> mMerges;
+
+ Dictionary &dict;
+
+ uint32_t mTotalAlign;
+};
+
+#include "PlatformOutputStream.inl"
+
+}
+
+#endif
+#endif
diff --git a/APEX_1.4/NvParameterized/include/PlatformOutputStream.inl b/APEX_1.4/NvParameterized/include/PlatformOutputStream.inl
new file mode 100644
index 00000000..bdbe88eb
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/PlatformOutputStream.inl
@@ -0,0 +1,138 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+template <typename T> PX_INLINE void PlatformOutputStream::align()
+{
+ align(mTargetParams.getAlignment<T>());
+}
+
+template <typename T> PX_INLINE uint32_t PlatformOutputStream::storeSimple(T x)
+{
+ align(mTargetParams.getAlignment<T>());
+
+ uint32_t off = size();
+
+ data.append(x);
+
+ char *p = getData() + off;
+
+ //It is unsafe to call SwapBytes directly on floats (doubles, vectors, etc.)
+ //because values may become NaNs which will lead to all sorts of errors
+ if( mCurParams.endian != mTargetParams.endian )
+ SwapBytes(p, sizeof(T), GetDataType<T>::value);
+
+ return off;
+}
+
+PX_INLINE uint32_t PlatformOutputStream::storeSimple(float* x, uint32_t num)
+{
+ align(mTargetParams.getAlignment<float>());
+
+ uint32_t off = size();
+
+ for (uint32_t k = 0; k < num; ++k)
+ {
+ data.append(x[k]);
+ }
+
+ char *p = getData() + off;
+
+ //It is unsafe to call SwapBytes directly on floats (doubles, vectors, etc.)
+ //because values may become NaNs which will lead to all sorts of errors
+ if( mCurParams.endian != mTargetParams.endian )
+ SwapBytes(p, sizeof(float) * num, GetDataType<float>::value);
+
+ return off;
+}
+
+template <typename T> PX_INLINE int32_t PlatformOutputStream::storeSimpleArraySlow(Handle &handle)
+{
+ int32_t n;
+ handle.getArraySize(n);
+
+ align<T>();
+ uint32_t off = size();
+
+ data.reserve(size() + n * physx::PxMax(mTargetParams.getAlignment<T>(), mTargetParams.getSize<T>()));
+
+ for(int32_t i = 0; i < n; ++i)
+ {
+ handle.set(i);
+
+ T val;
+ handle.getParam<T>(val);
+ storeSimple<T>(val);
+
+ handle.popIndex();
+ }
+
+ int32_t offsetAsInt = static_cast<int32_t>(off);
+ PX_ASSERT(offsetAsInt >= 0);
+ return offsetAsInt;
+}
+
+template <typename T> PX_INLINE uint32_t PlatformOutputStream::storeSimpleArray(Handle &handle)
+{
+ if( TYPE_BOOL != handle.parameterDefinition()->child(0)->type() //Bools are special (see custom version of storeSimple)
+ && mTargetParams.getSize<T>() == mCurParams.getSize<T>()
+ && mTargetParams.getSize<T>() >= mTargetParams.getAlignment<T>()
+ && mCurParams.getSize<T>() >= mCurParams.getAlignment<T>() ) //No gaps between array elements on both platforms
+ {
+ //Fast path
+
+ int32_t n;
+ handle.getArraySize(n);
+
+ align<T>();
+ uint32_t off = size();
+
+ const int32_t elemSize = (int32_t)sizeof(T);
+
+ skipBytes((uint32_t)(elemSize * n));
+
+ char *p = getData() + off;
+ handle.getParamArray<T>((T *)p, n);
+
+ if( mCurParams.endian != mTargetParams.endian )
+ {
+ for(int32_t i = 0; i < n; ++i)
+ {
+ SwapBytes(p, elemSize, GetDataType<T>::value);
+ p += elemSize;
+ }
+ }
+
+ return off;
+ }
+ else
+ {
+ return static_cast<uint32_t>(storeSimpleArraySlow<T>(handle));
+ }
+}
diff --git a/APEX_1.4/NvParameterized/include/PlatformStream.h b/APEX_1.4/NvParameterized/include/PlatformStream.h
new file mode 100644
index 00000000..c17bda66
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/PlatformStream.h
@@ -0,0 +1,151 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PLATFORM_STREAM_H_
+#define PLATFORM_STREAM_H_
+
+#include <stdio.h>
+
+#include "nvparameterized/NvParameterized.h"
+#include "nvparameterized/NvSerializer.h"
+#include "NvSerializerInternal.h"
+#include "PlatformABI.h"
+
+namespace NvParameterized
+{
+
+// Base class for ABI-aware streams
+
+// TODO:
+// PlatformInput/OutputStream should probably be visitors
+
+class PlatformStream
+{
+ void operator =(const PlatformStream &); //Don't
+
+protected:
+ Traits *mTraits;
+
+ PlatformABI mTargetParams, mCurParams;
+
+ struct Agregate
+ {
+ enum Type
+ {
+ STRUCT,
+ ARRAY
+ };
+
+ Type type;
+ uint32_t align;
+
+ Agregate(Type t, uint32_t a): type(t), align(a) {}
+ };
+
+ //Agregate stack holds information about structs and their nesting (for automatic insertion of tail pad)
+ physx::shdfnd::Array<Agregate, Traits::Allocator> mStack;
+
+public:
+ PlatformStream(const PlatformABI &targetParams, Traits *traits)
+ : mTraits(traits),
+ mTargetParams(targetParams),
+ mStack(Traits::Allocator(traits))
+ {
+ // TODO: constructors should not fail...
+ if( Serializer::ERROR_NONE != PlatformABI::GetPredefinedABI(GetCurrentPlatform(), mCurParams) )
+ {
+ PX_ALWAYS_ASSERT();
+ return;
+ }
+ }
+
+ //Array's copy constructor is broken so we implement it by hand
+ PlatformStream(const PlatformStream &s)
+ : mTraits(s.mTraits),
+ mTargetParams(s.mTargetParams),
+ mCurParams(s.mCurParams),
+ mStack(Traits::Allocator(s.mTraits))
+ {
+ mStack.reserve(s.mStack.size());
+ for(uint32_t i = 0; i < s.mStack.size(); ++i)
+ mStack.pushBack(s.mStack[i]);
+ }
+
+ void dump() const
+ {
+ printf("Dumping PlatformStream at %p:\n", this);
+ }
+
+ const PlatformABI &getTargetABI() const
+ {
+ return mTargetParams;
+ }
+
+ uint32_t getTargetSize(const Definition *pd) const
+ {
+ return mTargetParams.getSize(pd);
+ }
+
+ uint32_t getTargetAlignment(const Definition *pd) const
+ {
+ return mTargetParams.getAlignment(pd);
+ }
+
+ uint32_t getTargetPadding(const Definition *pd) const
+ {
+ return mTargetParams.getPadding(pd);
+ }
+
+ //Align offset to be n*border
+ PX_INLINE uint32_t getAlign(uint32_t off, uint32_t border, bool &isAligned) const
+ {
+ PX_ASSERT(border <= 128);
+
+ //Array members are not aligned
+ //See http://www.gamasutra.com/view/feature/3975/data_alignment_part_2_objects_on_.php
+ if( !mStack.empty() && Agregate::ARRAY == mStack.back().type )
+ {
+ isAligned = false;
+ return off;
+ }
+
+ isAligned = true;
+ const uint32_t mask = border - 1;
+ return (off + mask) & ~mask;
+ }
+
+ //Align offset to be n*border
+ PX_INLINE uint32_t getAlign(uint32_t off, uint32_t border) const
+ {
+ bool tmp;
+ return getAlign(off, border, tmp);
+ }
+};
+
+}
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/SerializerCommon.h b/APEX_1.4/NvParameterized/include/SerializerCommon.h
new file mode 100644
index 00000000..59f4f98e
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/SerializerCommon.h
@@ -0,0 +1,172 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef SERIALIZER_COMMON_H
+#define SERIALIZER_COMMON_H
+
+#include <stdio.h> // FILE
+
+#include "PxAssert.h"
+
+#include "PsArray.h"
+#include "PsHashMap.h"
+
+#include "nvparameterized/NvParameterized.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+#include "nvparameterized/NvSerializer.h"
+
+#define ENABLE_DEBUG_ASSERTS 1
+
+#if ENABLE_DEBUG_ASSERTS
+# define DEBUG_ASSERT(x) PX_ASSERT(x)
+#else
+# define DEBUG_ASSERT(x)
+#endif
+#define DEBUG_ALWAYS_ASSERT() DEBUG_ASSERT(0)
+
+#define NV_ERR_CHECK_RETURN(x) { Serializer::ErrorType err = x; if( Serializer::ERROR_NONE != err ) { DEBUG_ALWAYS_ASSERT(); return err; } }
+#define NV_BOOL_ERR_CHECK_RETURN(x, err) { if( !(x) ) { DEBUG_ALWAYS_ASSERT(); return err; } }
+#define NV_PARAM_ERR_CHECK_RETURN(x, err) { if( NvParameterized::ERROR_NONE != (NvParameterized::ErrorType)(x) ) { DEBUG_ALWAYS_ASSERT(); return err; } }
+
+#define NV_ERR_CHECK_WARN_RETURN(x, ...) { \
+ Serializer::ErrorType err = x; \
+ if( Serializer::ERROR_NONE != err ) { \
+ NV_PARAM_TRAITS_WARNING(mTraits, ##__VA_ARGS__); \
+ DEBUG_ALWAYS_ASSERT(); \
+ return err; \
+ } \
+}
+
+#define NV_BOOL_ERR_CHECK_WARN_RETURN(x, err, ...) { \
+ if( !(x) ) { \
+ NV_PARAM_TRAITS_WARNING(mTraits, ##__VA_ARGS__); \
+ DEBUG_ALWAYS_ASSERT(); \
+ return err; \
+ } \
+}
+
+#define NV_PARAM_ERR_CHECK_WARN_RETURN(x, err, ...) { \
+ if( NvParameterized::ERROR_NONE != (NvParameterized::ErrorType)(x) ) \
+ { \
+ NV_PARAM_TRAITS_WARNING(mTraits, ##__VA_ARGS__); \
+ DEBUG_ALWAYS_ASSERT(); \
+ return err; \
+ } \
+}
+
+namespace NvParameterized
+{
+
+bool UpgradeLegacyObjects(Serializer::DeserializedData &data, bool &isUpdated, Traits *t);
+Interface *UpgradeObject(Interface &obj, bool &isUpdated, Traits *t);
+
+//This is used for releasing resources (I wish we had generic smart ptrs...)
+class Releaser
+{
+ FILE *mFile;
+
+ void *mBuf;
+ Traits *mTraits;
+
+ Interface *mObj;
+
+ Releaser(const Releaser &) {}
+
+public:
+
+ Releaser()
+ {
+ reset();
+ }
+
+ Releaser(void *buf, Traits *traits)
+ {
+ reset(buf, traits);
+ }
+
+ Releaser(FILE *file)
+ {
+ reset(file);
+ }
+
+ Releaser(Interface *obj)
+ {
+ reset(obj);
+ }
+
+ void reset()
+ {
+ mFile = 0;
+ mBuf = 0;
+ mTraits = 0;
+ mObj = 0;
+ }
+
+ void reset(Interface *obj)
+ {
+ reset();
+
+ mObj = obj;
+ }
+
+ void reset(FILE *file)
+ {
+ reset();
+
+ mFile = file;
+ }
+
+ void reset(void *buf, Traits *traits)
+ {
+ reset();
+
+ mBuf = buf;
+ mTraits = traits;
+ }
+
+ ~Releaser()
+ {
+ if( mBuf )
+ mTraits->free(mBuf);
+
+ if( mFile )
+ fclose(mFile);
+
+ if( mObj )
+ mObj->destroy();
+ }
+};
+
+void *serializerMemAlloc(uint32_t size, Traits *traits);
+void serializerMemFree(void *mem, Traits *traits);
+
+// Checksum for some classes is invalid
+bool DoIgnoreChecksum(const Interface &obj);
+
+} // namespace NvParameterized
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/XmlDeserializer.h b/APEX_1.4/NvParameterized/include/XmlDeserializer.h
new file mode 100644
index 00000000..ac6075fa
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/XmlDeserializer.h
@@ -0,0 +1,307 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef XML_DESERIALIZER_H_
+#define XML_DESERIALIZER_H_
+
+//XML deserialization (by John Ratcliff)
+
+#include "PsFastXml.h"
+
+#include "nvparameterized/NvSerializer.h"
+#include "nvparameterized/NvParameterized.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+
+#include "SerializerCommon.h"
+
+namespace NvParameterized
+{
+
+typedef enum
+{
+ ARRAY,
+ STRUCT,
+ VALUE,
+ SKIP
+} FieldType;
+
+struct FieldInfo
+{
+ PX_INLINE void init(const char *name_, FieldType type_)
+ {
+ name = name_;
+ type = type_;
+ idx = 0;
+ }
+
+ const char *name;
+ FieldType type;
+ uint32_t idx; //For arrays
+};
+
+class ObjectInfo
+{
+ static const uint32_t MAX_STRUCT_FIELD_STACK = 256;
+
+ Interface *mObj;
+
+ //Field stack
+ uint32_t mIndex;
+ FieldInfo mFields[MAX_STRUCT_FIELD_STACK];
+
+public:
+
+ PX_INLINE ObjectInfo(): mObj(0), mIndex(0) {}
+
+ PX_INLINE void init(Interface *obj)
+ {
+ mObj = obj;
+ }
+
+ PX_INLINE Interface *getObject()
+ {
+ return mObj;
+ }
+
+ PX_INLINE bool popField(const char *&name, FieldType &type)
+ {
+ if( !mIndex )
+ {
+ DEBUG_ALWAYS_ASSERT();
+ return false;
+ }
+
+ FieldInfo &field = mFields[--mIndex];
+ name = field.name;
+ type = field.type;
+
+# ifndef NDEBUG
+ field.name = 0;
+# endif
+
+ if( mIndex )
+ {
+ FieldInfo &lastField = mFields[mIndex-1];
+ if( ARRAY == lastField.type )
+ ++lastField.idx;
+ }
+
+ return true;
+ }
+
+ PX_INLINE void pushField(const char *name, FieldType type)
+ {
+ PX_ASSERT( mIndex < MAX_STRUCT_FIELD_STACK );
+
+ if( mIndex < MAX_STRUCT_FIELD_STACK )
+ mFields[mIndex++].init(name, type);
+ }
+
+ PX_INLINE uint32_t getIndex() const { return mIndex; };
+
+ PX_INLINE FieldInfo &getFieldInfo(uint32_t i)
+ {
+ PX_ASSERT( i < mIndex );
+ return mFields[i];
+ }
+};
+
+class XmlDeserializer: public physx::shdfnd::FastXml::Callback
+{
+ static const uint32_t MAX_REF_STACK = 8,
+ MAX_ROOT_OBJ = 64;
+
+ Serializer::ErrorType mError;
+
+ Traits *mTraits;
+
+ //Object stack
+ uint32_t mObjIndex;
+ ObjectInfo mObjects[MAX_REF_STACK];
+
+ //Array of root objects
+ uint32_t mRootIndex;
+ Interface *mRootObjs[MAX_ROOT_OBJ];
+
+ //Check errors in <NvParameters>
+ uint32_t mRootTags;
+ bool mInRootElement;
+
+ //Check DOCTYPE
+ bool mHasDoctype;
+
+ uint32_t mVer;
+
+ // read simple structs in array
+ int32_t* mSimpleStructRedirect;
+ uint32_t mSimpleStructRedirectSize;
+
+ //Top Of Stack
+ PX_INLINE ObjectInfo &tos()
+ {
+ PX_ASSERT( mObjIndex >= 1 && mObjIndex <= MAX_REF_STACK );
+ return mObjIndex > 0 ? mObjects[mObjIndex - 1] : mObjects[0];
+ }
+
+ PX_INLINE void pushObj(Interface *obj)
+ {
+ if( mObjIndex >= MAX_REF_STACK )
+ {
+ PX_ALWAYS_ASSERT(); //included references nested too deeply
+ return;
+ }
+
+ ++mObjIndex;
+ tos().init(obj);
+ }
+
+ PX_INLINE bool popObj()
+ {
+ if( mObjIndex <= 0 )
+ return false;
+
+ --mObjIndex;
+
+ return true;
+ }
+
+ PX_INLINE void pushField(const char *name, FieldType type)
+ {
+ tos().pushField(mTraits->strdup(name), type);
+ }
+
+ PX_INLINE bool popField()
+ {
+ const char *name = 0;
+ FieldType type;
+ if( !tos().popField(name, type) )
+ return false;
+
+ mTraits->strfree(const_cast<char *>(name));
+
+ return true;
+ }
+
+ bool verifyObject(Interface *obj, const physx::shdfnd::FastXml::AttributePairs& attr);
+
+ bool initAddressString(char *dest, uint32_t len, const char *name);
+
+public:
+
+ PX_INLINE XmlDeserializer(Traits *traits, uint32_t ver):
+ mError(Serializer::ERROR_NONE),
+ mTraits(traits),
+ mObjIndex(0),
+ mRootIndex(0),
+ mRootTags(0),
+ mInRootElement(false),
+ mHasDoctype(false),
+ mVer(ver),
+ mSimpleStructRedirect(NULL),
+ mSimpleStructRedirectSize(0) {}
+
+ PX_INLINE virtual ~XmlDeserializer()
+ {
+ if (mSimpleStructRedirect != NULL)
+ {
+ mTraits->free(mSimpleStructRedirect);
+ }
+ mSimpleStructRedirect = NULL;
+ mSimpleStructRedirectSize = 0;
+ }
+
+ static PX_INLINE XmlDeserializer *Create(Traits *traits, uint32_t ver)
+ {
+ char *buf = (char *)serializerMemAlloc(sizeof(XmlDeserializer), traits);
+ return PX_PLACEMENT_NEW(buf, XmlDeserializer)(traits, ver);
+ }
+
+ PX_INLINE void destroy()
+ {
+ Traits *traits = mTraits;
+ this->~XmlDeserializer();
+ serializerMemFree(this, traits);
+ }
+
+ PX_INLINE Serializer::ErrorType getLastError() const
+ {
+ return mError;
+ }
+
+ PX_INLINE Interface **getObjs()
+ {
+ return mRootObjs;
+ }
+
+ PX_INLINE uint32_t getNobjs() const
+ {
+ return physx::PxMin(mRootIndex, MAX_ROOT_OBJ);
+ }
+
+ //Release all created objects (in case of error)
+ PX_INLINE void releaseAll()
+ {
+ for(uint32_t i = 0; i < getNobjs(); ++i)
+ mRootObjs[i]->destroy();
+ }
+
+ virtual bool processComment(const char *)
+ {
+ return true;
+ }
+
+ virtual bool processDoctype(const char * rootElement, const char *, const char *, const char *)
+ {
+ mHasDoctype = true;
+ return 0 == ::strcmp(rootElement, "NvParameters") || 0 == ::strcmp(rootElement, "NxParameters");
+ }
+
+ virtual void *allocate(uint32_t size)
+ {
+ return mTraits->alloc(size);
+ }
+
+ virtual void deallocate(void *ptr)
+ {
+ mTraits->free(ptr);
+ }
+
+ virtual bool processClose(const char *tag,uint32_t depth,bool &isError);
+
+ virtual bool processElement(
+ const char *elementName,
+ const char *elementData,
+ const physx::shdfnd::FastXml::AttributePairs& attr,
+ int32_t /*lineno*/
+ );
+
+ int32_t* getSimpleStructRedirect(uint32_t size);
+};
+
+}
+
+#endif
diff --git a/APEX_1.4/NvParameterized/include/XmlSerializer.h b/APEX_1.4/NvParameterized/include/XmlSerializer.h
new file mode 100644
index 00000000..47ae4984
--- /dev/null
+++ b/APEX_1.4/NvParameterized/include/XmlSerializer.h
@@ -0,0 +1,114 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PX_XML_SERIALIZER_H
+#define PX_XML_SERIALIZER_H
+
+//XML serialization (by John Ratcliff)
+
+#include "nvparameterized/NvSerializer.h"
+#include "AbstractSerializer.h"
+
+#include "PsIOStream.h"
+
+namespace NvParameterized
+{
+
+struct traversalState;
+
+bool isXmlFormat(physx::PxFileBuf &stream);
+
+// XML serializer implementation
+class XmlSerializer : public AbstractSerializer
+{
+ ErrorType peekNumObjects(char *data, uint32_t len, uint32_t &numObjects);
+
+ Serializer::ErrorType peekClassNames(physx::PxFileBuf &stream, char **classNames, uint32_t &numClassNames);
+
+#ifndef WITHOUT_APEX_SERIALIZATION
+ Serializer::ErrorType traverseParamDefTree(
+ const Interface &obj,
+ physx::PsIOStream &stream,
+ traversalState &state,
+ Handle &handle,
+ bool printValues = true);
+
+ Serializer::ErrorType emitElementNxHints(
+ physx::PsIOStream &stream,
+ Handle &handle,
+ traversalState &state,
+ bool &includedRef);
+
+ Serializer::ErrorType emitElement(
+ const Interface &obj,
+ physx::PsIOStream &stream,
+ const char *elementName,
+ Handle &handle,
+ bool includedRef,
+ bool printValues,
+ bool isRoot = false);
+#endif
+
+protected:
+
+#ifndef WITHOUT_APEX_SERIALIZATION
+ Serializer::ErrorType internalSerialize(physx::PxFileBuf &fbuf,const Interface **objs, uint32_t n, bool doMetadata);
+#endif
+
+ Serializer::ErrorType internalDeserialize(physx::PxFileBuf &stream, DeserializedData &res, bool &doesNeedUpdate);
+
+public:
+
+ XmlSerializer(Traits *traits): AbstractSerializer(traits) {}
+
+ ~XmlSerializer() {}
+
+ virtual void release(void)
+ {
+ this->~XmlSerializer();
+ serializerMemFree(this,mTraits);
+ }
+
+ PX_INLINE static uint32_t version()
+ {
+ return 0x00010000;
+ }
+
+ ErrorType peekNumObjectsInplace(const void * data, uint32_t dataLen, uint32_t & numObjects);
+
+ ErrorType peekNumObjects(physx::PxFileBuf &stream, uint32_t &numObjects);
+
+ using Serializer::deserializeMetadata;
+ ErrorType deserializeMetadata(physx::PxFileBuf & /*stream*/, Definition ** /*defs*/, uint32_t & /*ndefs*/)
+ {
+ return Serializer::ERROR_NOT_IMPLEMENTED;
+ }
+};
+
+} // namespace NvParameterized
+
+#endif
diff --git a/APEX_1.4/NvParameterized/src/BinSerializer.cpp b/APEX_1.4/NvParameterized/src/BinSerializer.cpp
new file mode 100644
index 00000000..623c0203
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/BinSerializer.cpp
@@ -0,0 +1,1828 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+/*
+ Binary serialization is very complex and error-prone
+ process. Ensuring that it works properly is _critically_
+ important for the engine.
+
+ Before you do any significant changes to this code
+ please get familiar with C/C++ object layouts.
+ You may find these links helpful:
+
+ * APEX binary file format
+ https://wiki.nvidia.com/engwiki/index.php/PhysX/APEX/architecture/design/File_Formats
+ (may not be up-to-date)
+
+ * C++ data alignment and portability
+ http://www.codesynthesis.com/~boris/blog/2009/04/06/cxx-data-alignment-portability/
+
+ * Data structure alignment
+ http://en.wikipedia.org/wiki/Data_structure_alignment
+
+ * About Data Alignment
+ http://msdn.microsoft.com/en-us/library/ms253949%28v=VS.80%29.aspx
+
+ * Types and Storage
+ http://msdn.microsoft.com/en-us/library/02c56cw3.aspx
+
+ * Jan Gray's article in "C++: Under the Hood"
+ http://www.openrce.org/articles/files/jangrayhood.pdf
+
+ * Windows Data Alignment on IPF, x86, and x64
+ http://msdn.microsoft.com/en-us/library/aa290049%28VS.71%29.aspx
+
+ * GCC alignment in classes gotcha
+ https://ps3.scedev.net/forums/thread/41593/
+
+ * all messages in thread http://compilers.iecc.com/comparch/article/94-08-119
+
+ * Memory Layout for Multiple and Virtual Inheritance
+ http://www.phpcompiler.org/articles/virtualinheritance.html
+
+ * The "Empty Member" C++ Optimization
+ http://www.cantrip.org/emptyopt.html
+
+ You may also want to see examples of existing ABI
+ for various platforms:
+
+ * Agner Fog's Calling conventions for different C++ compilers
+ and operating systems,
+ http://www.agner.org/optimize/calling_conventions.pdf
+
+ * Itanium C++ ABI Data Layout
+ http://www.codesourcery.com/public/cxx-abi/abi.html#layout
+
+ * Introduction to Mac OS X ABI Function Call Guide
+ http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/LowLevelABI/000-Introduction/introduction.html
+
+ After you implement you changes be sure to check that ALL
+ NvParameterized unit tests
+ * Test/MediaTest
+ * Test/RandomClasses
+ * Test/ParamRandomTest
+ run without errors on ALL supported platforms:
+ * Win32
+ * Win64
+ * PS3
+ * XBOX 360
+ (in future we may also have Mac, Tegra, Linux on PC, etc.).
+
+ If you need to add new platform to this list, be sure to
+ analyze it's ABI with ABIDumper
+ (//sw/nvidia/shared/general/ABIDumper) and check whether
+ it requires special changes in current serialization code
+ (Mac does).
+
+ If you ever implement new features be sure to cover them
+ in random schema generator
+ NvParameterized/scripts/RandomSchema.pl, generate a bunch
+ (10 at least) of new random schemas for Test/RandomClasses
+ and add them to p4 (and verify that they work on all
+ platforms!).
+*/
+
+#include <PxSimpleTypes.h>
+
+#include "PsArray.h"
+#include "PsHash.h"
+#include "PsHashMap.h"
+
+#include "NvParameters.h"
+#include "nvparameterized/NvParamUtils.h"
+#include "NvTraitsInternal.h"
+
+#include "BinaryHelper.h"
+
+#include "PlatformABI.h"
+#include "PlatformInputStream.h"
+#include "PlatformOutputStream.h"
+
+#include "BinSerializer.h"
+
+namespace NvParameterized
+{
+
+// Verify that file header is ok
+Serializer::ErrorType BinSerializer::verifyFileHeader(
+ const BinaryHeader &hdr,
+ const BinaryHeaderExt *ext,
+ uint32_t dataLen ) const
+{
+ NV_BOOL_ERR_CHECK_WARN_RETURN( BinSerializer::Magic == hdr.magic, Serializer::ERROR_INVALID_MAGIC, "Invalid APB file: magic number does not match: %x", hdr.magic );
+ NV_BOOL_ERR_CHECK_WARN_RETURN( (uint32_t)BINARY_TYPE_PLAIN == hdr.type, Serializer::ERROR_INVALID_FILE_FORMAT, "Invalid APB file: unknown file format: %d", hdr.type );
+
+ NV_BOOL_ERR_CHECK_WARN_RETURN(
+ BinVersions::WithExtendedHeader == hdr.version || BinVersions::WithAlignment == hdr.version,
+ Serializer::ERROR_INVALID_FILE_VERSION, "Invalid APB header: unexpected version: %x", hdr.version );
+
+ // Verify offsets
+ NV_BOOL_ERR_CHECK_WARN_RETURN( hdr.fileLength <= dataLen
+ && hdr.dataOffset < hdr.fileLength
+ && hdr.relocOffset < hdr.fileLength
+ && hdr.dictOffset < hdr.fileLength
+ && hdr.metadataOffset < hdr.fileLength,
+ Serializer::ERROR_INVALID_INTERNAL_PTR,
+ "Invalid APB file: section offsets do not match file length" );
+
+ if( ext )
+ {
+ NV_BOOL_ERR_CHECK_WARN_RETURN(
+ 0 == memcmp((const char *)&ext->vcsSafetyFlags, VCS_SAFETY_FLAGS, 4),
+ Serializer::ERROR_INVALID_CHAR,
+ "Invalid APB file: perhaps your editor inserts redundant carriage returns?"
+ );
+ }
+
+ return Serializer::ERROR_NONE;
+}
+
+// Peeks APB header from stream
+static Serializer::ErrorType peekFileHeader(physx::PxFileBuf &stream, BinaryHeader &hdr, BinaryHeaderExt &ext, bool doDecanonize = true)
+{
+ NV_BOOL_ERR_CHECK_RETURN(
+ sizeof(BinaryHeader) == stream.peek(&hdr, sizeof(BinaryHeader)),
+ Serializer::ERROR_INVALID_FILE_FORMAT );
+
+ if( hdr.version >= BinVersions::WithExtendedHeader )
+ {
+ uint32_t fileOff = stream.tellRead();
+
+ stream.seekRead(fileOff + sizeof(BinaryHeader));
+ NV_BOOL_ERR_CHECK_RETURN(
+ sizeof(BinaryHeaderExt) == stream.peek(&ext, sizeof(BinaryHeaderExt)),
+ Serializer::ERROR_INVALID_FILE_FORMAT );
+
+ stream.seekRead(fileOff);
+ }
+
+ if( doDecanonize )
+ hdr.decanonize();
+
+ return Serializer::ERROR_NONE;
+}
+
+// Extract platform ABI from file header
+Serializer::ErrorType BinSerializer::getPlatformInfo(
+ BinaryHeader &hdr,
+ BinaryHeaderExt *ext,
+ PlatformABI &abi ) const
+{
+ //Difference between these versions is not important for non-inplace serializer
+ if( hdr.version == BinVersions::Initial || hdr.version == BinVersions::AllRefsCounted )
+ hdr.version = BinVersions::WithAlignment;
+
+ NV_ERR_CHECK_RETURN( verifyFileHeader(hdr, ext, hdr.fileLength) );
+
+ SerializePlatform platform;
+ NV_ERR_CHECK_WARN_RETURN(hdr.getPlatform(platform), "Invalid platform");
+
+ NV_ERR_CHECK_WARN_RETURN( PlatformABI::GetPredefinedABI(platform, abi), "Unknown platform" );
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType BinSerializer::peekInplaceAlignment(physx::PxFileBuf& stream, uint32_t& align)
+{
+ BinaryHeader hdr;
+ BinaryHeaderExt ext;
+ NV_ERR_CHECK_RETURN( peekFileHeader(stream, hdr, ext, false) );
+ align = Canonize(hdr.alignment);
+ return Serializer::ERROR_NONE;
+}
+
+// Verify that object matches its header
+Serializer::ErrorType BinSerializer::verifyObjectHeader(const ObjHeader &hdr, const Interface *obj, Traits *traits) const
+{
+ DEBUG_ASSERT(obj);
+ NV_BOOL_ERR_CHECK_WARN_RETURN(
+ obj->version() == hdr.version,
+ Serializer::ERROR_UNKNOWN,
+ "Invalid object: version does not match object header" );
+
+ PX_UNUSED(traits);
+
+ uint32_t bits = UINT32_MAX;
+ const uint32_t *checksum = obj->checksum(bits);
+
+ if( !DoIgnoreChecksum(*obj) || hdr.version != obj->version() )
+ {
+ if( bits != 32 * hdr.checksumSize )
+ NV_PARAM_TRAITS_WARNING(
+ traits,
+ "Schema checksum is different for object of class %s and version %u, asset may be corrupted",
+ hdr.className, (unsigned)hdr.version
+ );
+ else
+ {
+ for(uint32_t i = 0; i < hdr.checksumSize; ++i)
+ if( checksum[i] != hdr.checksum[i] )
+ {
+ NV_PARAM_TRAITS_WARNING(
+ traits,
+ "Schema checksum is different for object of class %s and version %u, asset may be corrupted",
+ hdr.className, (unsigned)hdr.version
+ );
+ break;
+ }
+ }
+ }
+
+ return Serializer::ERROR_NONE;
+}
+
+#if 0
+//TODO: this is just for tests, remove it after metadata works
+static void DumpDefinition(const Definition *def, const char *className, uint32_t version, uint32_t off = 0)
+{
+ char *tab = (char *)::malloc(off + 1);
+ memset(tab, ' ', off);
+ tab[off] = 0;
+
+ if( className )
+ printf("%sClass %s:%d\n", tab, className, version);
+
+ printf("%sDefinition at 0x%p:\n", tab, def);
+ printf("%s name = %s\n", tab, def->name());
+ printf("%s type = %s\n", tab, typeToStr(def->type()));
+ printf("%s align = %d\n", tab, def->alignment());
+ printf("%s pad = %d\n", tab, def->padding());
+
+ printf("%s %d hints:\n", tab, def->numHints());
+ for(uint32_t i = 0; i < def->numHints(); ++i)
+ {
+ const Hint *hint = def->hint(i);
+
+ printf("%s %s => ", tab, hint->name());
+ switch( hint->type() )
+ {
+ case TYPE_U64:
+ printf("%llu", hint->asUInt());
+ break;
+ case TYPE_F64:
+ printf("%f", hint->asFloat());
+ break;
+ case TYPE_STRING:
+ printf("\"%s\"", hint->asString());
+ break;
+ default:
+ DEBUG_ALWAYS_ASSERT();
+ }
+ printf("\n");
+ }
+
+ printf("%s %d enums: ", tab, def->numEnumVals());
+ for(uint32_t i = 0; i < def->numEnumVals(); ++i)
+ printf("\"%s\", ", def->enumVal(i));
+ printf("\n");
+
+ printf("%s %d refVariants: ", tab, def->numRefVariants());
+ for(uint32_t i = 0; i < def->numRefVariants(); ++i)
+ printf("\"%s\", ", def->refVariantVal(i));
+ printf("\n");
+
+ printf("%s %d children:\n", tab, def->numChildren());
+ for(uint32_t i = 0; i < def->numChildren(); ++i)
+ {
+ printf("%sChild %d:\n", tab, i);
+ DumpDefinition(def->child(i), 0, 0, off + 1);
+ }
+
+ ::free(tab);
+
+ fflush(stdout);
+}
+#endif
+
+Serializer::ErrorType BinSerializer::peekNumObjects(physx::PxFileBuf &stream, uint32_t &numObjects)
+{
+ BinaryHeader hdr;
+ BinaryHeaderExt ext;
+ NV_ERR_CHECK_RETURN( peekFileHeader(stream, hdr, ext, false) );
+
+ return peekNumObjectsInplace((const void *)&hdr, sizeof(hdr), numObjects);
+}
+
+Serializer::ErrorType BinSerializer::peekNumObjectsInplace(const void *data, uint32_t dataLen, uint32_t &numObjects)
+{
+ NV_BOOL_ERR_CHECK_RETURN( dataLen >= sizeof(BinaryHeader), Serializer::ERROR_INVALID_FILE_FORMAT );
+ numObjects = static_cast<uint32_t>(Canonize( ((const BinaryHeader *)data)->numObjects));
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType BinSerializer::peekClassNames(physx::PxFileBuf &stream, char **classNames, uint32_t &numClassNames)
+{
+ BinaryHeader hdr;
+ BinaryHeaderExt ext;
+ NV_ERR_CHECK_RETURN( peekFileHeader(stream, hdr, ext) );
+
+ PlatformABI targetParams;
+ NV_ERR_CHECK_RETURN(getPlatformInfo(
+ hdr,
+ hdr.version >= BinVersions::WithExtendedHeader ? &ext : 0,
+ targetParams
+ ));
+
+ PlatformInputStream objectTable(stream, targetParams, mTraits);
+ objectTable.skipBytes(hdr.dataOffset);
+
+ numClassNames = physx::PxMin(numClassNames, (uint32_t)hdr.numObjects);
+ for(uint32_t i = 0; i < numClassNames; ++i)
+ {
+ uint32_t tmp;
+ NV_ERR_CHECK_RETURN( objectTable.readPtr(tmp) ); // Pointer to object data
+
+ uint32_t classNameOff;
+ NV_ERR_CHECK_RETURN( objectTable.readPtr(classNameOff) ); // Pointer to className
+
+ const char *className;
+ NV_ERR_CHECK_RETURN( objectTable.readString(classNameOff, className) );
+ classNames[i] = mTraits->strdup(className); //User will call Traits::strfree
+ mTraits->free((void *)className);
+
+ NV_ERR_CHECK_RETURN( objectTable.readPtr(tmp) ); // Pointer to name
+ NV_ERR_CHECK_RETURN( objectTable.readPtr(tmp) ); // Pointer to filename
+ }
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType BinSerializer::readMetadataInfo(const BinaryHeader &hdr, PlatformInputStream &s, DefinitionImpl *def)
+{
+ PX_PLACEMENT_NEW(def, DefinitionImpl)(*mTraits, false);
+
+ s.beginStruct(s.getTargetABI().getMetaInfoAlignment());
+
+ //type
+ uint32_t type;
+ NV_ERR_CHECK_RETURN( s.read(type) );
+ NV_BOOL_ERR_CHECK_WARN_RETURN( type < TYPE_LAST, Serializer::ERROR_INVALID_DATA_TYPE, "Unknown data type: %d", (int)type);
+
+ //arraySize
+ int32_t arraySize;
+ NV_ERR_CHECK_RETURN( s.read(arraySize) );
+
+ //shortName
+ uint32_t nameOff;
+ NV_ERR_CHECK_RETURN( s.readPtr(nameOff) );
+
+ const char *name;
+ NV_ERR_CHECK_RETURN( s.readString(nameOff, name) ); //NOTE: we do not release name because DefinitionImpl does not copy it
+
+ //structName
+ uint32_t structNameOff;
+ NV_ERR_CHECK_RETURN( s.readPtr(structNameOff) );
+
+ const char *structName;
+ NV_ERR_CHECK_RETURN( s.readString(structNameOff, structName) ); //NOTE: we do not release name because DefinitionImpl does not copy it
+
+ // We do not have metadata for older formats without alignment
+ NV_BOOL_ERR_CHECK_WARN_RETURN( hdr.version >= BinVersions::WithAlignment, Serializer::ERROR_INVALID_FILE_VERSION, "Unable to deserialize metadata: file format does not support it" );
+
+ //alignment
+ uint32_t alignment;
+ NV_ERR_CHECK_RETURN( s.read(alignment) );
+
+ //padding
+ uint32_t padding;
+ NV_ERR_CHECK_RETURN( s.read(padding) );
+
+ def->init(name, (DataType)type, structName);
+ def->setArraySize(arraySize);
+ if( alignment ) def->setAlignment(alignment);
+ if( padding ) def->setPadding(padding);
+
+ //numChildren
+ uint32_t numChildren;
+ NV_ERR_CHECK_RETURN( s.read(numChildren) );
+
+ //children
+ for(uint32_t i = 0; i < numChildren; ++i)
+ {
+ DefinitionImpl *childDef = (DefinitionImpl *)mTraits->alloc(sizeof(DefinitionImpl));
+
+ uint32_t off;
+ NV_ERR_CHECK_RETURN( s.readPtr(off) );
+
+ NV_ERR_CHECK_RETURN( s.pushPos(off) );
+ NV_ERR_CHECK_RETURN( readMetadataInfo(hdr, s, childDef) );
+ s.popPos();
+
+ def->addChild(childDef);
+ }
+
+ //numHints
+ uint32_t numHints;
+ NV_ERR_CHECK_RETURN( s.read(numHints) );
+
+ //hints
+ for(uint32_t i = 0; i < numHints; ++i)
+ {
+ HintImpl *hint = (HintImpl *)mTraits->alloc(sizeof(HintImpl));
+ PX_PLACEMENT_NEW(hint, HintImpl)();
+
+ s.beginStruct(s.getTargetABI().getHintAlignment());
+
+ //type
+ uint32_t hintType;
+ NV_ERR_CHECK_RETURN( s.read(hintType) );
+
+ //name
+ uint32_t hintNameOff;
+ NV_ERR_CHECK_RETURN( s.readPtr(hintNameOff) );
+
+ const char *hintName;
+ NV_ERR_CHECK_RETURN( s.readString(hintNameOff, hintName) );
+ Releaser releaseName((void *)hintName, mTraits);
+
+ //val
+ s.beginStruct(s.getTargetABI().getHintValueAlignment());
+ switch( hintType )
+ {
+ case TYPE_U64:
+ {
+ uint64_t val;
+ NV_ERR_CHECK_RETURN( s.read(val) );
+ hint->init(hintName, val, false);
+
+ break;
+ }
+ case TYPE_F64:
+ {
+ double val;
+ NV_ERR_CHECK_RETURN( s.read(val) );
+ hint->init(hintName, val, false);
+
+ break;
+ }
+ case TYPE_STRING:
+ {
+ uint32_t off;
+ NV_ERR_CHECK_RETURN( s.readPtr(off) );
+
+ const char *val;
+ NV_ERR_CHECK_RETURN( s.readString(off, val) );
+ Releaser releaseVal((void *)val, mTraits);
+
+ hint->init(hintName, val, false);
+
+ break;
+ }
+ default:
+ DEBUG_ALWAYS_ASSERT();
+ return Serializer::ERROR_INVALID_DATA_TYPE;
+ }
+ s.align(s.getTargetABI().getHintValueSize());
+ s.closeStruct();
+
+ s.closeStruct();
+
+ def->addHint(hint);
+ } //i
+
+ //numEnumVals
+ uint32_t numEnumVals;
+ NV_ERR_CHECK_RETURN( s.read(numEnumVals) );
+
+ //enumVals
+ for(uint32_t i = 0; i < numEnumVals; ++i)
+ {
+ uint32_t off;
+ NV_ERR_CHECK_RETURN( s.readPtr(off) );
+
+ const char *val;
+ NV_ERR_CHECK_RETURN( s.readString(off, val) );
+ Releaser releaseVal((void *)val, mTraits);
+
+ def->addEnumVal(val);
+ }
+
+ //numRefVariants
+ uint32_t numRefVariants;
+ NV_ERR_CHECK_RETURN( s.read(numRefVariants) );
+
+ //refVariants
+ for(uint32_t i = 0; i < numRefVariants; ++i)
+ {
+ uint32_t off;
+ NV_ERR_CHECK_RETURN( s.readPtr(off) );
+
+ const char *val;
+ NV_ERR_CHECK_RETURN( s.readString(off, val) );
+ Releaser releaseVal((void *)val, mTraits);
+
+ def->addRefVariantVal(val);
+ }
+
+ s.closeStruct();
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType BinSerializer::deserializeMetadata(physx::PxFileBuf &stream, DeserializedMetadata &desData)
+{
+ BinaryHeader hdr;
+ BinaryHeaderExt ext;
+ NV_ERR_CHECK_RETURN( peekFileHeader(stream, hdr, ext) );
+ NV_ERR_CHECK_RETURN(verifyFileHeader(
+ hdr,
+ hdr.version >= BinVersions::WithExtendedHeader ? &ext : 0,
+ hdr.fileLength
+ ));
+
+ PlatformABI targetParams;
+ NV_ERR_CHECK_RETURN(getPlatformInfo(
+ hdr,
+ hdr.version >= BinVersions::WithExtendedHeader ? &ext : 0,
+ targetParams
+ ));
+
+ PlatformInputStream s(stream, targetParams, mTraits);
+ s.skipBytes(hdr.metadataOffset);
+
+ uint32_t numMetadata = hdr.numMetadata;
+
+ desData.init(mTraits, numMetadata);
+
+ for(uint32_t i = 0; i < numMetadata; ++i)
+ {
+ uint32_t classNameOff;
+ NV_ERR_CHECK_RETURN( s.readPtr(classNameOff) );
+
+ const char *className;
+ NV_ERR_CHECK_RETURN( s.readString(classNameOff, className) );
+
+ uint32_t version;
+ NV_ERR_CHECK_RETURN( s.read(version) );
+
+ uint32_t entryOff;
+ NV_ERR_CHECK_RETURN( s.readPtr(entryOff) );
+
+ s.pushPos(entryOff);
+
+ DefinitionImpl *def = (DefinitionImpl *)mTraits->alloc(sizeof(DefinitionImpl));
+ NV_ERR_CHECK_WARN_RETURN( readMetadataInfo(hdr, s, def), "Failed to read metadata info" );
+
+// DumpDefinition(def, className, version);
+
+ desData[i].def = def;
+ desData[i].version = version;
+ desData[i].className = className;
+
+ s.popPos();
+ }
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType BinSerializer::internalDeserialize(physx::PxFileBuf &stream, Serializer::DeserializedData &res, bool & /*doesNeedUpdate*/)
+{
+ NV_BOOL_ERR_CHECK_WARN_RETURN(
+ PlatformABI::VerifyCurrentPlatform(),
+ Serializer::ERROR_INVALID_PLATFORM,
+ "Current platform is not supported, aborting" );
+
+ NV_BOOL_ERR_CHECK_RETURN( BinaryHeader::CheckAlignment(), Serializer::ERROR_INVALID_PLATFORM );
+
+ BinaryHeader hdr;
+ BinaryHeaderExt ext;
+ NV_ERR_CHECK_RETURN( peekFileHeader(stream, hdr, ext) );
+
+ PlatformABI abi;
+ NV_ERR_CHECK_RETURN(getPlatformInfo(
+ hdr,
+ hdr.version >= BinVersions::WithExtendedHeader ? &ext : 0,
+ abi
+ ));
+
+ uint32_t fileOff = stream.tellRead();
+
+ PlatformInputStream data(stream, abi, mTraits);
+ NV_ERR_CHECK_RETURN( data.skipBytes(hdr.dataOffset) );
+
+ res.init(mTraits, static_cast<uint32_t>(hdr.numObjects));
+ for(uint32_t i = 0; i < static_cast<uint32_t>(hdr.numObjects); ++i)
+ {
+ uint32_t objOff;
+ NV_ERR_CHECK_RETURN( data.readPtr(objOff) );
+
+ if( !objOff )
+ res[i] = 0;
+ else
+ {
+ NV_ERR_CHECK_RETURN( data.pushPos(objOff) );
+
+ Serializer::ErrorType error = readObject(res[i], data);
+ if( Serializer::ERROR_NONE != error )
+ {
+ for(uint32_t j = 0; j < i; ++j) //Last object was destroyed in readObject
+ res[j]->destroy();
+
+ res.init(0, 0);
+
+ return error;
+ }
+
+ data.popPos();
+ }
+
+ uint32_t tmp;
+ NV_ERR_CHECK_RETURN( data.readPtr(tmp) ); // className
+ NV_ERR_CHECK_RETURN( data.readPtr(tmp) ); // name
+ NV_ERR_CHECK_RETURN( data.readPtr(tmp) ); // filename
+ } //i
+
+ stream.seekRead(fileOff + hdr.fileLength); //Goto end of stream
+
+ return Serializer::ERROR_NONE;
+}
+
+static BinaryReloc *getRelocationTable(const BinaryHeader &hdr, char *start, uint32_t &nrelocs)
+{
+ char *ptrTable = start + hdr.relocOffset;
+ nrelocs = *reinterpret_cast<uint32_t *>(ptrTable);
+
+ ptrTable += PlatformABI::align(4, GetAlignment<BinaryReloc>::value);
+
+ return reinterpret_cast<BinaryReloc *>(ptrTable); //Alignment is ok
+}
+
+Serializer::ErrorType BinSerializer::internalDeserializeInplace(void *mdata, uint32_t dataLen, Serializer::DeserializedData &res, bool & doesNeedUpdate)
+{
+ doesNeedUpdate = false;
+
+ NV_BOOL_ERR_CHECK_WARN_RETURN(
+ PlatformABI::VerifyCurrentPlatform(),
+ Serializer::ERROR_INVALID_PLATFORM,
+ "Current platform is not supported, aborting" );
+
+ char *start = (char *)mdata;
+
+ //Header
+ BinaryHeader &hdr = *reinterpret_cast<BinaryHeader *>(start);
+ hdr.decanonize(); //Make platform-dependent
+
+ //Extended header
+ BinaryHeaderExt *ext = hdr.version >= BinVersions::WithExtendedHeader
+ ? reinterpret_cast<BinaryHeaderExt *>(start + sizeof(BinaryHeader))
+ : 0;
+ if( ext ) ext->decanonize();
+
+ //This particular updates can be done on the fly
+ //Probably there is no need to set isUpdated because updates can be done on the fly
+
+ if( hdr.version == BinVersions::Initial )
+ NV_ERR_CHECK_WARN_RETURN( updateInitial2AllCounted(hdr, start), "Failed to update binary asset from 1.0 to 1.1" );
+
+ if( hdr.version == BinVersions::AllRefsCounted )
+ NV_ERR_CHECK_WARN_RETURN( updateAllCounted2WithAlignment(hdr, start), "Failed to update binary asset from 1.1 to 1.2" );
+
+ NV_ERR_CHECK_RETURN( verifyFileHeader(hdr, ext, dataLen) );
+
+ NV_BOOL_ERR_CHECK_RETURN( IsAligned(mdata, hdr.alignment), Serializer::ERROR_UNALIGNED_MEMORY);
+
+ //Verify platform
+ SerializePlatform filePlatform;
+ NV_ERR_CHECK_WARN_RETURN( hdr.getPlatform(filePlatform), "Unknown platform" );
+ NV_BOOL_ERR_CHECK_WARN_RETURN(
+ GetCurrentPlatform() == filePlatform,
+ Serializer::ERROR_INVALID_PLATFORM,
+ "Failed to inplace deserialize: platforms do not match" );
+
+ //Fix pointers
+
+ uint32_t nrelocs;
+ BinaryReloc *relocs = getRelocationTable(hdr, start, nrelocs);
+
+ //Using refOffs-array causes a memory allocation hence it's bad.
+ //But we have to fix all pointers prior to calling finishNvParameterized().
+ //Basically we have 3 opportunities:
+ // - reorder relocs s.t. NvParameterized-objects go after all other relocs (strings, etc.)
+ // (but this limits our binary file format + it turns out to be tricky to implement)
+ // - walk through array once again
+ // (but this may have a significant time penalty)
+ // - reuse space in relocation table to store offsets of references
+ // (this sounds nice and easy enough!)
+ // - or maybe just process relocations in reverse order
+ // (this one should be the fastest but once again this limits our format)
+ //For now we just keep the dynamic array as it seems to be pretty fast.
+
+ physx::shdfnd::Array<uint32_t, Traits::Allocator> refOffs((Traits::Allocator(mTraits)));
+ refOffs.reserve(nrelocs / 10);
+
+ for(uint32_t i = 0; i < nrelocs; ++i)
+ {
+ BinaryReloc &reloc = relocs[i];
+
+ NV_BOOL_ERR_CHECK_RETURN(
+ reloc.type < static_cast<uint32_t>(RELOC_LAST),
+ Serializer::ERROR_INVALID_RELOC_TYPE );
+
+ switch( reloc.type )
+ {
+ case uint32_t(RELOC_ABS_RAW):
+ //Raw data, do nothing
+ break;
+ case uint32_t(RELOC_ABS_REF):
+ //Reference, init later
+ refOffs.pushBack(reloc.off);
+ break;
+ default:
+ DEBUG_ALWAYS_ASSERT();
+ return Serializer::ERROR_INVALID_INTERNAL_PTR;
+ }
+
+ char *&ptr = *reinterpret_cast<char **>(start + reloc.off);
+
+ size_t off = reinterpret_cast<size_t>(ptr); //size_t == uintptr_t
+ NV_BOOL_ERR_CHECK_RETURN( off < dataLen, Serializer::ERROR_INVALID_INTERNAL_PTR );
+
+ ptr = start + off;
+ }
+
+ uint32_t *refCount = reinterpret_cast<uint32_t*>(&hdr.numObjects);
+
+ //Init references (vtables and stuff)
+ for(uint32_t i = 0; i < refOffs.size(); ++i)
+ {
+ char *&p = *reinterpret_cast<char **>(start + refOffs[i]);
+
+ const ObjHeader &objHdr = *reinterpret_cast<const ObjHeader *>(p);
+
+ const char *className = objHdr.className;
+ NV_BOOL_ERR_CHECK_RETURN( className, Serializer::ERROR_INVALID_INTERNAL_PTR );
+
+ p += objHdr.dataOffset;
+
+ if( !objHdr.isIncluded )
+ {
+ Interface *obj = PX_PLACEMENT_NEW(p, NvParameters)(mTraits, start, reinterpret_cast<int32_t*>(refCount));
+ PX_UNUSED(obj);
+
+ //We do not want objHdr.verify() here
+ }
+ else
+ {
+ Interface *obj = mTraits->finishNvParameterized(className, objHdr.version, p, start, reinterpret_cast<int32_t*>(refCount));
+ NV_BOOL_ERR_CHECK_RETURN( obj, Serializer::ERROR_OBJECT_CREATION_FAILED );
+ NV_ERR_CHECK_RETURN( verifyObjectHeader(objHdr, obj, mTraits) );
+
+ if( objHdr.version != mTraits->getCurrentVersion(className) )
+ doesNeedUpdate = true;
+ } //if( !objHdr.isIncluded )
+ } //i
+
+ // Table of root references
+ ObjectTableEntry *objectTable = reinterpret_cast<ObjectTableEntry *>(start + hdr.dataOffset); //At start of data section
+
+ //Init results
+ res.init(mTraits, static_cast<uint32_t>(hdr.numObjects));
+ for(uint32_t i = 0; i < static_cast<uint32_t>(hdr.numObjects); ++i)
+ res[i] = objectTable[i].obj;
+
+ *refCount = refOffs.size(); //Release after all inplace references are destroyed
+
+ // Conversion will be done after deserialization to avoid releasing inplace memory if all objects are destroyed
+ //(otherwise we may have data corruption)
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType BinSerializer::updateAllCounted2WithAlignment(BinaryHeader &hdr, char * /*start*/)
+{
+ hdr.version = BinVersions::WithAlignment;
+ hdr.alignment = 8;
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType BinSerializer::updateInitial2AllCounted(BinaryHeader &hdr, char *start)
+{
+ // versionAllRefsCounted counts all references instead of just top-level references;
+ // to achieve this we simply set mDoDeallocateSelf to true in all references
+
+ uint32_t nrelocs;
+ BinaryReloc *relocs = getRelocationTable(hdr, start, nrelocs);
+
+ for(uint32_t i = 0; i < nrelocs; ++i)
+ {
+ BinaryReloc &reloc = relocs[i];
+
+ if( reloc.type != static_cast<uint32_t>(RELOC_ABS_REF) )
+ continue;
+
+ size_t targetOff = *reinterpret_cast<size_t *>(start + reloc.off); //size_t == uintptr_t
+
+ const ObjHeader &objHdr = *reinterpret_cast<const ObjHeader *>(start + targetOff);
+
+ targetOff += objHdr.dataOffset; //Points to start of NvParameters
+
+#if PX_PS4 == 1
+#pragma GCC diagnostic ignored "-Wunused-private-field"
+#endif
+ // MyNvParameters has the same layout as NvParameters
+ class MyNvParameters
+ {
+ void *vtable;
+ void *mParameterizedTraits;
+ void *mSerializationCb;
+ void *mCbUserData;
+ void *mBuffer;
+ void *mRefCount;
+ void *mName;
+ void *mClassName;
+ bool mDoDeallocateSelf;
+ bool mDoDeallocateName;
+ bool mDoDeallocateClassName;
+
+ public:
+ void setDoDeallocateSelf() { mDoDeallocateSelf = true; }
+ };
+#if PX_PS4 == 1
+#pragma GCC diagnostic warning "-Wunused-private-field"
+#endif
+ MyNvParameters *pAsNvParameters = reinterpret_cast<MyNvParameters *>(start + targetOff);
+ pAsNvParameters->setDoDeallocateSelf();
+ }
+
+ hdr.version = BinVersions::AllRefsCounted;
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType BinSerializer::readArraySlow(Handle &handle, PlatformInputStream &s)
+{
+ int32_t n;
+ NV_PARAM_ERR_CHECK_RETURN( handle.getArraySize(n), Serializer::ERROR_INVALID_ARRAY );
+
+ for(int32_t i = 0; i < n; ++i)
+ {
+ handle.set(i);
+ NV_ERR_CHECK_RETURN( readBinaryData(handle, s) );
+ handle.popIndex();
+ }
+
+ return Serializer::ERROR_NONE;
+}
+
+static bool IsSimpleStruct(const Definition *pd)
+{
+ // Empty structs are special
+ if( 0 == pd->numChildren() )
+ return false;
+
+ for(int32_t i = 0; i < pd->numChildren(); ++i)
+ {
+ if (pd->child(i)->type() == TYPE_STRING || pd->child(i)->type() == TYPE_ENUM || pd->child(i)->type() == TYPE_ARRAY ||
+ pd->child(i)->type() == TYPE_REF || pd->child(i)->type() == TYPE_STRUCT
+ )
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+#ifndef WITHOUT_APEX_SERIALIZATION
+
+Serializer::ErrorType BinSerializer::internalSerialize(physx::PxFileBuf &stream, const Interface **objs, uint32_t nobjs, bool doMetadata)
+{
+ NV_BOOL_ERR_CHECK_WARN_RETURN(
+ PlatformABI::VerifyCurrentPlatform(),
+ Serializer::ERROR_INVALID_PLATFORM ,
+ "Current platform is not supported, aborting" );
+
+ NV_BOOL_ERR_CHECK_RETURN( BinaryHeader::CheckAlignment(), Serializer::ERROR_INVALID_PLATFORM );
+
+ PlatformABI targetParams;
+ NV_ERR_CHECK_WARN_RETURN( PlatformABI::GetPredefinedABI(mPlatform, targetParams), "Unknown platform" );
+ NV_BOOL_ERR_CHECK_WARN_RETURN(
+ targetParams.isNormal(),
+ Serializer::ERROR_INVALID_PLATFORM,
+ "Target platform is not supported, aborting" );
+
+ PlatformABI curParams;
+ NV_ERR_CHECK_WARN_RETURN( PlatformABI::GetPredefinedABI(GetCurrentPlatform(), curParams), "Unknown platform" );
+ NV_BOOL_ERR_CHECK_RETURN( curParams.isNormal(), Serializer::ERROR_INVALID_PLATFORM );
+
+ Dictionary dict(mTraits); //Dictionary is updated in other routines
+
+ // Compute object data
+
+ typedef physx::shdfnd::Array<PlatformOutputStream, Traits::Allocator> StreamArray;
+ StreamArray dataStreams((Traits::Allocator(mTraits)));
+ dataStreams.reserve(nobjs);
+ for(uint32_t i = 0; i < nobjs; ++i)
+ {
+ Handle handle(*objs[i], "");
+ NV_BOOL_ERR_CHECK_RETURN( handle.isValid(), Serializer::ERROR_UNKNOWN );
+
+ dataStreams.pushBack(PlatformOutputStream(targetParams, mTraits, dict));
+ dataStreams.back().setAlignment(16); // 16 for safety
+
+ NV_ERR_CHECK_WARN_RETURN( storeBinaryData(*objs[i], handle, dataStreams.back()), "Failed to serialize data for object %d", i );
+ }
+
+ // Compute metadata
+
+ PlatformOutputStream metadataStream(targetParams, mTraits, dict);
+ metadataStream.setAlignment(16); // 16 for safety
+ uint32_t numMetadata = 0;
+ if( doMetadata )
+ {
+ typedef physx::shdfnd::Pair<const char *, uint32_t> VersionedClass;
+ typedef physx::shdfnd::HashMap<VersionedClass, const Definition *, physx::shdfnd::Hash<VersionedClass>, Traits::Allocator> MapClass2Def;
+ MapClass2Def mapClass2Def((Traits::Allocator(mTraits)));
+
+ //We track all classes that were saved to avoid duplicate metadata info
+ class MyRefCallback: public ReferenceInterface
+ {
+ MapClass2Def &mapClass2Def;
+
+ //Silence warnings on unable to generate assignment operator
+ void operator =(MyRefCallback) {}
+ public:
+ MyRefCallback(MapClass2Def &mapClass2Def_): mapClass2Def(mapClass2Def_) {}
+
+ void referenceCallback(Handle &handle)
+ {
+ Interface *iface;
+ handle.getParamRef(iface);
+ if( iface )
+ mapClass2Def[ VersionedClass(iface->className(), iface->version()) ] = iface->rootParameterDefinition();
+ }
+ } cb(mapClass2Def);
+
+ for(uint32_t i = 0; i < nobjs; ++i)
+ {
+ if( !objs[i] )
+ continue;
+
+ mapClass2Def[ VersionedClass(objs[i]->className(), objs[i]->version()) ] = objs[i]->rootParameterDefinition();
+ getReferences(*objs[i], cb, false, true, true);
+ }
+
+ numMetadata = mapClass2Def.size();
+
+ for(MapClass2Def::Iterator i = mapClass2Def.getIterator(); !i.done(); ++i)
+ {
+ metadataStream.beginStruct(targetParams.getMetaEntryAlignment());
+
+ metadataStream.storeStringPtr(i->first.first); //className
+ metadataStream.storeSimple<uint32_t>(i->first.second); //classVersion
+
+ //info
+ Reloc &reloc = metadataStream.storePtr(RELOC_ABS_RAW, targetParams.getMetaInfoAlignment());
+ NV_ERR_CHECK_RETURN( storeMetadataInfo(i->second, *reloc.ptrData) );
+
+ metadataStream.closeStruct();
+ } //i
+ }
+
+ // Init header
+
+ BinaryHeader hdr;
+
+ hdr.magic = Magic;
+ hdr.type = BINARY_TYPE_PLAIN;
+ hdr.version = Version;
+ hdr.numObjects = static_cast<int32_t>(nobjs);
+ hdr.fileLength = 0;
+ hdr.dictOffset = 0;
+ hdr.dataOffset = 0;
+ hdr.relocOffset = 0;
+ hdr.metadataOffset = 0;
+
+ hdr.archType = static_cast<uint32_t>(mPlatform.archType);
+ hdr.compilerType = static_cast<uint32_t>(mPlatform.compilerType);
+ hdr.compilerVer = mPlatform.compilerVer;
+ hdr.osType = static_cast<uint32_t>(mPlatform.osType);
+ hdr.osVer = mPlatform.osVer;
+
+ hdr.numMetadata = numMetadata;
+ hdr.alignment = 0;
+
+ BinaryHeaderExt ext;
+ memset(&ext, 0, sizeof(ext));
+ memcpy(&ext.vcsSafetyFlags, VCS_SAFETY_FLAGS, 4);
+
+ // Resulting stream
+
+ PlatformOutputStream joinStream(targetParams, mTraits, dict);
+
+ // Merge header
+
+ joinStream.storeBytes(reinterpret_cast<const char *>(&hdr), sizeof(hdr));
+ joinStream.storeBytes(reinterpret_cast<const char *>(&ext), sizeof(ext));
+ joinStream.align(16);
+
+ // Merge dictionary
+
+ uint32_t dictOffset = joinStream.size();
+ joinStream.mergeDict();
+
+ // Merge data
+
+ uint32_t dataOffset = 0;
+ {
+ joinStream.align(joinStream.getTargetABI().aligns.pointer);
+ dataOffset = joinStream.size();
+
+ //Create object table
+ for(uint32_t i = 0; i < nobjs; ++i)
+ {
+ dataStreams[i].flatten();
+
+ Reloc &reloc = joinStream.storePtr(RELOC_ABS_REF, dataStreams[i].alignment());
+ reloc.ptrData->merge(dataStreams[i]);
+
+ //This was requested for faster peeking of contained assets
+ joinStream.storeStringPtr(objs[i]->className());
+ joinStream.storeStringPtr(objs[i]->name());
+
+ //UE3 was once using this
+ joinStream.storeNullPtr();
+ }
+
+ joinStream.flatten(); //Merge all data-related pointers
+ }
+
+ // Merge metadata
+
+ uint32_t metadataOffset = 0;
+ if( doMetadata )
+ {
+ metadataOffset = joinStream.merge(metadataStream);
+ joinStream.flatten(); //Merge all metadata-related pointers
+ }
+
+ // Merge relocation data
+
+ uint32_t relocOffset = joinStream.writeRelocs();
+
+ // Update offsets in header
+
+ void *data = joinStream.getData();
+
+ BinaryHeader &hdrFinal = *reinterpret_cast<BinaryHeader *>(data);
+ hdrFinal.fileLength = joinStream.size();
+ hdrFinal.dictOffset = dictOffset;
+ hdrFinal.dataOffset = dataOffset;
+ hdrFinal.metadataOffset = metadataOffset;
+ hdrFinal.relocOffset = relocOffset;
+ hdrFinal.alignment = joinStream.alignment();
+
+ BinaryHeaderExt &extFinal = *reinterpret_cast<BinaryHeaderExt *>((char *)data + sizeof(BinaryHeader));
+
+ //Make platform-independent
+ hdrFinal.canonize();
+ extFinal.canonize();
+
+ // Write data to stream
+
+ if( stream.tellWrite() % joinStream.alignment() )
+ {
+ NV_PARAM_TRAITS_WARNING(
+ mTraits,
+ "Input stream is unaligned, "
+ "you will not be able to inplace deserialize it "
+ "without copying to intermediate buffer"
+ );
+ }
+
+ NV_BOOL_ERR_CHECK_RETURN(
+ joinStream.size() == stream.write(data, joinStream.size()),
+ Serializer::ERROR_STREAM_ERROR );
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType BinSerializer::storeMetadataInfo(const Definition *def, PlatformOutputStream &s)
+{
+ s.beginStruct(s.getTargetABI().getMetaInfoAlignment());
+
+ //type
+ s.storeSimple((uint32_t)def->type());
+
+ //arraySize
+ s.storeSimple(TYPE_ARRAY == def->type() ? (int32_t)def->arraySize() : -1);
+
+ //shortName
+ s.storeStringPtr(def->name());
+
+ //structName
+ s.storeStringPtr(def->structName());
+
+ //alignment
+ s.storeSimple(def->alignment());
+
+ //padding
+ s.storeSimple(def->padding());
+
+ //numChildren
+ s.storeSimple(def->numChildren());
+
+ //children
+ for(int32_t i = 0; i < def->numChildren(); ++i)
+ {
+ Reloc &childrenReloc = s.storePtr(RELOC_ABS_RAW, s.getTargetABI().getMetaInfoAlignment());
+ NV_ERR_CHECK_RETURN( storeMetadataInfo(def->child(i), *childrenReloc.ptrData) );
+ }
+
+ //numHints
+ s.storeSimple(def->numHints());
+
+ //hints
+ for(int32_t i = 0; i < def->numHints(); ++i)
+ {
+ const Hint *hint = def->hint(i);
+
+ s.beginStruct(s.getTargetABI().getHintAlignment());
+
+ s.storeSimple((uint32_t)hint->type());
+ s.storeStringPtr(hint->name());
+
+ s.beginStruct(s.getTargetABI().getHintValueAlignment());
+ switch( hint->type() )
+ {
+ case TYPE_U64:
+ s.storeSimple(hint->asUInt());
+ break;
+ case TYPE_F64:
+ s.storeSimple(hint->asFloat());
+ break;
+ case TYPE_STRING:
+ s.storeStringPtr(hint->asString());
+ break;
+
+NV_PARAMETRIZED_LINAL_DATATYPE_LABELS
+NV_PARAMETRIZED_REF_DATATYPE_LABELS
+NV_PARAMETRIZED_ENUM_DATATYPE_LABELS
+NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS
+ case TYPE_F32:
+ case TYPE_U32: case TYPE_U16: case TYPE_U8:
+ case TYPE_I64: case TYPE_I32: case TYPE_I16: case TYPE_I8: case TYPE_BOOL:
+ default:
+ DEBUG_ALWAYS_ASSERT();
+ return Serializer::ERROR_INVALID_DATA_TYPE;
+ }
+ s.align(s.getTargetABI().getHintValueSize());
+ s.closeStruct();
+
+ s.closeStruct();
+ }
+
+ //numEnumVals
+ s.storeSimple(def->numEnumVals());
+
+ //enumVals
+ for(int32_t i = 0; i < def->numEnumVals(); ++i)
+ s.storeStringPtr(def->enumVal(i));
+
+ //numRefVariantVals
+ s.storeSimple(def->numRefVariants());
+
+ //refVariants
+ for(int32_t i = 0; i < def->numRefVariants(); ++i)
+ s.storeStringPtr(def->refVariantVal(i));
+
+ s.closeStruct();
+
+ return Serializer::ERROR_NONE;
+}
+
+//Store array of arbitrary type (slow version)
+Serializer::ErrorType BinSerializer::storeArraySlow(Handle &handle, PlatformOutputStream &s)
+{
+ int32_t size;
+ NV_PARAM_ERR_CHECK_RETURN( handle.getArraySize(size), Serializer::ERROR_INVALID_ARRAY );
+
+ const Interface &obj = *handle.getConstInterface();
+ for(int32_t i = 0; i < size; ++i)
+ {
+ handle.set(i);
+ NV_ERR_CHECK_RETURN( storeBinaryData(obj, handle, s) );
+ handle.popIndex();
+ }
+
+ return Serializer::ERROR_NONE;
+}
+
+//Print binary data for part of NvParameterized object addressed by handle
+Serializer::ErrorType BinSerializer::storeBinaryData(const Interface &obj, Handle &handle, PlatformOutputStream &res, bool isRootObject)
+{
+ bool isObject = !handle.numIndexes();
+
+ if( isObject )
+ res.storeObjHeader(obj);
+
+ const Definition *pd = handle.parameterDefinition();
+
+ bool doNotSerialize = 0 != pd->hint("DONOTSERIALIZE"),
+ isDynamicArray = pd->type() == TYPE_ARRAY && !pd->arraySizeIsFixed();
+
+ // Alignment in dynamic array means alignment of dynamic memory
+ // so we do not insert it here
+ if( pd->alignment() && !isDynamicArray )
+ res.align(pd->alignment());
+
+ //Dynamic arrays are special because we need some of their fields for correct inplace deserialization
+ if( doNotSerialize && !isDynamicArray )
+ {
+ //Simply skip bytes
+ res.align(res.getTargetAlignment(pd));
+ res.skipBytes(res.getTargetSize(pd));
+
+ return Serializer::ERROR_NONE;
+ }
+
+ switch( pd->type() )
+ {
+ case TYPE_ARRAY:
+ {
+ if( pd->arraySizeIsFixed() )
+ {
+ res.beginArray(pd);
+ storeArraySlow(handle, res);
+ res.closeArray();
+ }
+ else
+ {
+ res.beginStruct(pd); //Dynamic arrays are implemented as structs
+
+ bool isEmpty = false;
+ if( doNotSerialize )
+ isEmpty = true;
+ else
+ {
+ for(int32_t i = 0; i < pd->arrayDimension(); ++i)
+ {
+ int32_t size = 0;
+ NV_PARAM_ERR_CHECK_RETURN( handle.getArraySize(size, i), Serializer::ERROR_INVALID_ARRAY );
+
+ if( 0 == size )
+ {
+ isEmpty = true;
+ break;
+ }
+ }
+ }
+
+ const Definition *elemPd = pd;
+ for(int32_t i = 0; i < pd->arrayDimension(); ++i)
+ elemPd = elemPd->child(0);
+
+ //Pointer-to-data
+ Reloc *reloc = 0;
+ if( isEmpty )
+ res.storeNullPtr();
+ else
+ {
+ reloc = &res.storePtr(RELOC_ABS_RAW, elemPd);
+ if( pd->alignment() )
+ reloc->ptrData->setAlignment(physx::PxMax(reloc->ptrData->alignment(), pd->alignment()));
+ }
+
+ //isAllocated
+ res.storeSimple(false);
+
+ //elementSize
+ res.storeSimple<uint32_t>(res.getTargetSize(elemPd));
+
+ //arraySizes
+ const Definition *subArrayPd = pd;
+ res.beginArray(res.getTargetABI().getAlignment<int32_t>());
+ for(int32_t dim = 0; dim < pd->arrayDimension(); ++dim)
+ {
+ // Store size of static dimensions even if doNotSerialize is on
+ int32_t size = 0;
+ if( !doNotSerialize || subArrayPd->arraySizeIsFixed() )
+ NV_PARAM_ERR_CHECK_RETURN( handle.getArraySize(size, dim), Serializer::ERROR_INVALID_ARRAY );
+
+ res.storeSimple(size);
+
+ NV_BOOL_ERR_CHECK_RETURN( 1 == subArrayPd->numChildren(), Serializer::ERROR_UNKNOWN );
+ subArrayPd = subArrayPd->child(0);
+ }
+ res.closeArray();
+
+ //Data
+ if( !isEmpty )
+ {
+ reloc->ptrData->beginArray(elemPd);
+
+ int32_t size = -1;
+ NV_PARAM_ERR_CHECK_RETURN( handle.getArraySize(size), Serializer::ERROR_INVALID_ARRAY );
+
+ const Definition *child = pd->child(0);
+ switch( child->type() )
+ {
+# define NV_PARAMETERIZED_TYPES_NO_LEGACY_TYPES
+# define NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+# define NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+# define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ case TYPE_##enum_name: \
+ { \
+ reloc->ptrData->storeSimpleArray<c_type>(handle); \
+ break; \
+ }
+# include "nvparameterized/NvParameterized_types.h"
+
+ case TYPE_STRUCT:
+ if( IsSimpleStruct(child) )
+ {
+ //Fast path for simple structs
+ reloc->ptrData->storeSimpleStructArray(handle);
+ break;
+ }
+
+ //Else fall through to default, includes TYPE_MAT34 case
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+NV_PARAMETRIZED_LEGACY_DATATYPE_LABELS
+NV_PARAMETRIZED_STRING_DATATYPE_LABELS
+NV_PARAMETRIZED_REF_DATATYPE_LABELS
+NV_PARAMETRIZED_ENUM_DATATYPE_LABELS
+NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS
+ case TYPE_ARRAY:
+ default:
+ storeArraySlow(handle, *reloc->ptrData);
+ break;
+ }
+
+ reloc->ptrData->closeArray();
+ }
+
+ res.closeStruct();
+ }
+ break;
+ }
+
+ case TYPE_STRUCT:
+ {
+ uint32_t oldSize = isObject ? res.beginObject(obj, isRootObject, pd) : res.beginStruct(pd);
+
+ for(int32_t i = 0; i < pd->numChildren(); ++i)
+ {
+ handle.set(i);
+ NV_ERR_CHECK_RETURN( storeBinaryData(obj, handle, res) );
+ handle.popIndex();
+ }
+
+ //Empty structs are at least 1 char long
+ if( res.size() == oldSize )
+ res.storeSimple((uint8_t)0);
+
+ if( isObject )
+ res.closeObject();
+ else
+ res.closeStruct();
+
+ break;
+ }
+
+ case TYPE_STRING:
+ {
+ const char *s = 0;
+ handle.getParamString(s);
+
+ res.beginString();
+
+ //buf
+ res.storeStringPtr(s);
+
+ //isAllocated
+ res.storeSimple(false);
+
+ res.closeString();
+
+ break;
+ }
+
+ case TYPE_ENUM:
+ {
+ const char *s = 0;
+ handle.getParamEnum(s);
+
+ res.storeStringPtr(s);
+
+ break;
+ }
+
+ case TYPE_REF:
+ {
+ Interface *refObj = 0;
+ handle.getParamRef(refObj);
+
+ if( !refObj )
+ res.storeNullPtr();
+ else if( pd->isIncludedRef() )
+ {
+ Handle refHandle(*refObj, "");
+ NV_BOOL_ERR_CHECK_RETURN( refHandle.isValid(), Serializer::ERROR_UNKNOWN );
+
+ Reloc &reloc = res.storePtr(RELOC_ABS_REF, 16); //16 for safety
+ NV_ERR_CHECK_RETURN( storeBinaryData(*refObj, refHandle, *reloc.ptrData, false) );
+ }
+ else //Named reference
+ {
+ Reloc &reloc = res.storePtr(RELOC_ABS_REF, 16); //16 for safety
+ reloc.ptrData->storeObjHeader(*refObj, false);
+ reloc.ptrData->beginObject(*refObj, false, 0);
+ reloc.ptrData->closeObject(); //Named references are instances of NvParameters => no additional fields
+ }
+
+ break;
+ }
+
+ case TYPE_POINTER:
+ {
+ res.storeNullPtr();
+ break;
+ }
+
+
+# define NV_PARAMETERIZED_TYPES_NO_LEGACY_TYPES
+# define NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+# define NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+# define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ case TYPE_##enum_name: \
+ { \
+ c_type val; \
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParam##type_name(val), Serializer::ERROR_INVALID_VALUE ); \
+ res.storeSimple<c_type>(val); \
+ break; \
+ }
+# include "nvparameterized/NvParameterized_types.h"
+
+ case TYPE_MAT34:
+ {
+ float val[12];
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamMat34Legacy(val), Serializer::ERROR_INVALID_VALUE );
+ res.storeSimple(val, 12);
+ break;
+ }
+
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+ default:
+ DEBUG_ASSERT(0 && "Unknown type");
+ return Serializer::ERROR_INVALID_DATA_TYPE;
+ }
+
+ return Serializer::ERROR_NONE;
+}
+
+#endif
+
+//Read NvParameterized object data
+Serializer::ErrorType BinSerializer::readObject(Interface *&obj, PlatformInputStream &data)
+{
+ ObjHeader objHdr;
+ NV_ERR_CHECK_WARN_RETURN( data.readObjHeader(objHdr), "Failed to deserialize object header" );
+ Releaser releaseClassName((void *)objHdr.className, mTraits),
+ releaseName((void *)objHdr.name, mTraits),
+ releaseChecksum((void *)objHdr.checksum, mTraits);
+
+ if( !objHdr.isIncluded )
+ {
+ void *buf = mTraits->alloc(sizeof(NvParameters));
+ NV_BOOL_ERR_CHECK_RETURN( buf, Serializer::ERROR_MEMORY_ALLOCATION_FAILURE );
+
+ obj = PX_PLACEMENT_NEW(buf, NvParameters)(mTraits);
+ obj->setClassName(objHdr.className);
+
+ if( objHdr.name )
+ obj->setName(objHdr.name);
+
+ //We do not want objHdr.verify() here
+ }
+ else
+ {
+ NV_BOOL_ERR_CHECK_RETURN( objHdr.className, Serializer::ERROR_OBJECT_CREATION_FAILED );
+
+ obj = mTraits->createNvParameterized(objHdr.className, objHdr.version);
+ NV_BOOL_ERR_CHECK_RETURN( obj, Serializer::ERROR_OBJECT_CREATION_FAILED );
+
+ if( objHdr.name )
+ obj->setName(objHdr.name);
+
+ NV_ERR_CHECK_RETURN( verifyObjectHeader(objHdr, obj, mTraits) );
+
+ Handle handle(*obj, "");
+ NV_BOOL_ERR_CHECK_RETURN( handle.isValid(), Serializer::ERROR_UNKNOWN );
+
+ NV_ERR_CHECK_RETURN( data.pushPos(objHdr.dataOffset) );
+ NV_ERR_CHECK_RETURN( readBinaryData(handle, data) );
+ data.popPos();
+ }
+
+ return Serializer::ERROR_NONE;
+}
+
+//Read binary data of NvParameterized object addressed by handle
+Serializer::ErrorType BinSerializer::readBinaryData(Handle &handle, PlatformInputStream &data)
+{
+ const Definition *pd = handle.parameterDefinition();
+
+ bool isDynamicArray = TYPE_ARRAY == pd->type() && !pd->arraySizeIsFixed();
+
+ // See comment in storeBinaryData
+ if( pd->alignment() && !isDynamicArray )
+ data.align(pd->alignment());
+
+ if( pd->hint("DONOTSERIALIZE") )
+ {
+ //Simply skip DONOTSERIALIZE
+ data.align(data.getTargetAlignment(pd));
+ NV_ERR_CHECK_RETURN( data.skipBytes(data.getTargetSize(pd)) );
+ return Serializer::ERROR_NONE;
+ }
+
+ switch( pd->type() )
+ {
+ case TYPE_ARRAY:
+ {
+ if( pd->arraySizeIsFixed() )
+ {
+ data.beginArray(pd);
+ for(int32_t i = 0; i < pd->arraySize(); ++i)
+ {
+ handle.set(i);
+ NV_ERR_CHECK_RETURN( readBinaryData(handle, data) );
+ handle.popIndex();
+ }
+ data.closeArray();
+ }
+ else
+ {
+ data.beginStruct(pd); //Dynamic arrays are implemented as structs
+
+ uint32_t elemOff;
+ NV_ERR_CHECK_RETURN( data.readPtr(elemOff) );
+
+ bool isAllocated;
+ NV_ERR_CHECK_RETURN( data.read(isAllocated) );
+
+ int32_t elementSize;
+ NV_ERR_CHECK_RETURN( data.read(elementSize) ); //elementSize
+
+ data.beginStruct(data.getTargetABI().aligns.i32); //Start array of sizes
+
+ int32_t arraySize;
+ NV_ERR_CHECK_RETURN( data.read(arraySize) ); //We need only the first size
+
+ const Definition *subArrayPd = pd->child(0);
+ for(int32_t dim = 1; dim < pd->arrayDimension(); ++dim)
+ {
+ int32_t size;
+ NV_ERR_CHECK_RETURN( data.read(size) );
+
+ // We do not support nested dynamic arrays
+ if( subArrayPd->arraySizeIsFixed() )
+ NV_BOOL_ERR_CHECK_RETURN( size == subArrayPd->arraySize(), Serializer::ERROR_INVALID_ARRAY );
+
+ subArrayPd = subArrayPd->child(0);
+ }
+ data.closeStruct(); //End array of sizes
+
+ NV_PARAM_ERR_CHECK_RETURN( handle.resizeArray(arraySize), Serializer::ERROR_INVALID_ARRAY );
+
+ if( elemOff )
+ {
+ // Check alignment
+ uint32_t align = pd->alignment();
+ if( align && elemOff % align ) {
+ char longName[256];
+ handle.getLongName(longName, sizeof(longName));
+ NV_PARAM_TRAITS_WARNING(
+ mTraits,
+ "%s: array is unaligned, "
+ "you will not be able to inplace deserialize it "
+ "without copying to intermediate buffer.",
+ longName
+ );
+ }
+
+ NV_ERR_CHECK_RETURN( data.pushPos(elemOff) );
+
+ switch( pd->child(0)->type() )
+ {
+# define NV_PARAMETERIZED_TYPES_NO_LEGACY_TYPES
+# define NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+# define NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+# define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ case TYPE_##enum_name: \
+ { \
+ NV_ERR_CHECK_RETURN( data.readSimpleArray<c_type>(handle) ); \
+ break; \
+ }
+# include "nvparameterized/NvParameterized_types.h"
+
+ case TYPE_STRUCT:
+ {
+ const Definition *child = pd->child(0);
+ if( IsSimpleStruct(child) )
+ {
+ //Fast path for simple structs
+ NV_ERR_CHECK_RETURN( data.readSimpleStructArray(handle) );
+ break;
+ }
+
+ //Else fall through to default, including TYPE_MAT34 case
+ }
+
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+NV_PARAMETRIZED_LEGACY_DATATYPE_LABELS
+NV_PARAMETRIZED_STRING_DATATYPE_LABELS
+NV_PARAMETRIZED_REF_DATATYPE_LABELS
+NV_PARAMETRIZED_ENUM_DATATYPE_LABELS
+NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS
+case TYPE_ARRAY:
+ default:
+ NV_ERR_CHECK_RETURN( readArraySlow(handle, data) );
+ break;
+ }
+
+ data.popPos();
+ }
+
+ data.closeStruct();
+ }
+ break;
+ }
+
+ case TYPE_STRUCT:
+ {
+ uint32_t oldPos = data.getPos();
+
+ data.beginStruct(pd);
+ for(int32_t i = 0; i < pd->numChildren(); ++i)
+ {
+ handle.set(i);
+ NV_ERR_CHECK_RETURN( readBinaryData(handle, data) );
+ handle.popIndex();
+ }
+
+ //Empty structs are at least 1 char long
+ if( data.getPos() == oldPos )
+ {
+ uint8_t tmp;
+ NV_ERR_CHECK_RETURN( data.read(tmp) );
+ }
+
+ data.closeStruct();
+
+ break;
+ }
+
+ case TYPE_STRING:
+ {
+ data.beginString();
+
+ uint32_t off;
+ NV_ERR_CHECK_RETURN( data.readPtr(off) );
+
+ const char *s;
+ NV_ERR_CHECK_RETURN( data.readString(off, s) );
+
+ NV_PARAM_ERR_CHECK_RETURN( handle.setParamString(s), Serializer::ERROR_INVALID_VALUE );
+ mTraits->free((char *)s);
+
+ bool isAllocated;
+ NV_ERR_CHECK_RETURN( data.read(isAllocated) );
+
+ data.closeString();
+
+ break;
+ }
+
+ case TYPE_ENUM:
+ {
+ uint32_t off;
+ NV_ERR_CHECK_RETURN( data.readPtr(off) );
+
+ const char *s;
+ NV_ERR_CHECK_RETURN( data.readString(off, s) );
+
+ NV_BOOL_ERR_CHECK_RETURN( s, Serializer::ERROR_INVALID_VALUE );
+ NV_PARAM_ERR_CHECK_RETURN( handle.setParamEnum(s), Serializer::ERROR_INVALID_VALUE );
+
+ mTraits->free((char *)s);
+
+ break;
+ }
+
+ case TYPE_REF:
+ {
+ uint32_t objPos;
+ NV_ERR_CHECK_RETURN( data.readPtr(objPos) );
+
+ Interface *refObj = 0;
+
+ if( objPos )
+ {
+ NV_ERR_CHECK_RETURN( data.pushPos(objPos) );
+ NV_ERR_CHECK_RETURN( readObject(refObj, data) );
+ data.popPos();
+ }
+
+ if( refObj && (-1 == handle.parameterDefinition()->refVariantValIndex(refObj->className())) )
+ {
+ char longName[256];
+ handle.getLongName(longName, sizeof(longName));
+ NV_PARAM_TRAITS_WARNING(
+ mTraits,
+ "%s: setting reference of invalid class %s",
+ longName,
+ refObj->className()
+ );
+ }
+
+ NV_PARAM_ERR_CHECK_RETURN( handle.setParamRef(refObj), Serializer::ERROR_INVALID_REFERENCE );
+
+ break;
+ }
+
+ case TYPE_POINTER:
+ {
+ void *tmp;
+ NV_ERR_CHECK_RETURN( data.read(tmp) );
+ break;
+ }
+
+
+# define NV_PARAMETERIZED_TYPES_NO_LEGACY_TYPES
+# define NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+# define NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+# define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ case TYPE_##enum_name: \
+ { \
+ c_type val; \
+ NV_ERR_CHECK_RETURN(data.read(val)); \
+ NV_PARAM_ERR_CHECK_RETURN( handle.setParam##type_name(val), Serializer::ERROR_INVALID_VALUE ); \
+ break; \
+ }
+# include "nvparameterized/NvParameterized_types.h"
+
+ case TYPE_MAT34:
+ {
+ float val[12];
+ for (int k = 0; k < 12; ++k)
+ {
+ NV_ERR_CHECK_RETURN(data.read(val[k]));
+ }
+ NV_PARAM_ERR_CHECK_RETURN( handle.setParamMat34Legacy(val), Serializer::ERROR_INVALID_VALUE );
+ break;
+ }
+
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+ default:
+ DEBUG_ASSERT(0 && "Unknown type");
+ return Serializer::ERROR_INVALID_DATA_TYPE;
+ }
+
+ return Serializer::ERROR_NONE;
+}
+
+bool isBinaryFormat(physx::PxFileBuf &stream)
+{
+ uint32_t magic;
+ stream.peek(&magic, 4);
+ return Canonize(magic) == BinSerializer::Magic;
+}
+
+Serializer::ErrorType peekBinaryPlatform(physx::PxFileBuf &stream, SerializePlatform &platform)
+{
+ BinaryHeader hdr;
+ BinaryHeaderExt ext;
+ NV_ERR_CHECK_RETURN( peekFileHeader(stream, hdr, ext) );
+ NV_ERR_CHECK_RETURN( hdr.getPlatform(platform) );
+ return Serializer::ERROR_NONE;
+}
+
+} // namespace NvParameterized
diff --git a/APEX_1.4/NvParameterized/src/BinaryHelper.cpp b/APEX_1.4/NvParameterized/src/BinaryHelper.cpp
new file mode 100644
index 00000000..e3fff8e7
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/BinaryHelper.cpp
@@ -0,0 +1,123 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+#include <ctype.h>
+#include <stdio.h>
+
+#include "BinaryHelper.h"
+
+namespace NvParameterized
+{
+
+void dumpBytes(const char *data, uint32_t nbytes)
+{
+ printf("Total = %d bytes\n", nbytes);
+
+ for(uint32_t i = 0; i < nbytes; i += 16)
+ {
+ printf("%08x: ", i);
+
+ //Print bytes
+ for(uint32_t j = i; j < i + 16; ++j)
+ {
+ if( nbytes < j )
+ {
+ //Pad with whites
+ for(; j < i + 16; ++j)
+ printf(" ");
+
+ break;
+ }
+
+ unsigned char c = static_cast<unsigned char>(data[j]);
+ printf("%02x ", c);
+ }
+
+ //Print chars
+ for(uint32_t j = i; j < i + 16; ++j)
+ {
+ if( nbytes < j )
+ break;
+
+ unsigned char c = static_cast<unsigned char>(data[j]);
+ printf("%c", isprint(c) ? c : '.');
+ }
+
+ printf("\n");
+ }
+}
+
+void Dictionary::setOffset(const char *s, uint32_t off)
+{
+ for(uint32_t i = 0; i < entries.size(); ++i)
+ if( 0 == strcmp(s, entries[i].s) )
+ {
+ entries[i].offset = off;
+ return;
+ }
+
+ PX_ASSERT(0 && "String not found");
+}
+
+uint32_t Dictionary::getOffset(const char *s) const
+{
+ for(uint32_t i = 0; i < entries.size(); ++i)
+ if( 0 == strcmp(s, entries[i].s) )
+ return entries[i].offset;
+
+ PX_ASSERT(0 && "String not found");
+ return (uint32_t)-1;
+}
+
+void Dictionary::serialize(StringBuf &res) const
+{
+ res.append(Canonize(entries.size()));
+
+ for(uint32_t i = 0; i < entries.size(); ++i)
+ {
+ const char *s = entries[i].s;
+ res.appendBytes(s, 1 + (uint32_t)strlen(s));
+ }
+}
+
+uint32_t Dictionary::put(const char *s)
+{
+ PX_ASSERT(s && "NULL in dictionary");
+
+ for(uint32_t i = 0; i < entries.size(); ++i)
+ if( 0 == strcmp(s, entries[i].s) )
+ return i;
+
+ Entry e = {s, 0};
+ entries.pushBack(e);
+ return entries.size() - 1;
+}
+
+} \ No newline at end of file
diff --git a/APEX_1.4/NvParameterized/src/NvParameterized.cpp b/APEX_1.4/NvParameterized/src/NvParameterized.cpp
new file mode 100644
index 00000000..64ed67c5
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/NvParameterized.cpp
@@ -0,0 +1,5957 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <PxSimpleTypes.h>
+#include <PsIntrinsics.h>
+
+#if PX_VC && !PX_PS4
+#pragma warning(disable:4996 4310)
+#endif
+
+#include "PsAsciiConversion.h"
+
+#include "nvparameterized/NvParameterized.h"
+
+#include "NvParameters.h"
+#include "NvTraitsInternal.h"
+#include "PsString.h"
+
+
+namespace NvParameterized
+{
+
+#define NV_ERR_CHECK_RETURN(x) if(x!=ERROR_NONE) return(x);
+#define NV_BOOL_RETURN(x) if((x)!=ERROR_NONE) return(false);
+
+#define DEBUG_ASSERT(x)
+//#define DEBUG_ASSERT(x) PX_ASSERT(x)
+
+char Spog[] = "test";
+
+template <typename T>
+void swap(T& a, T&b)
+{
+ T tmp = b;
+ b = a;
+ a = tmp;
+}
+
+#define COND_DUP(str) (mStaticAllocation) ? (char *)(str) : local_strdup(str)
+
+int32_t local_strcmp(const char* s1, const char* s2)
+{
+ return physx::shdfnd::strcmp(s1, s2);
+}
+
+int32_t local_stricmp(const char* s1, const char* s2)
+{
+ return physx::shdfnd::stricmp(s1, s2);
+}
+
+int32_t local_sprintf_s( char * _DstBuf, size_t _DstSize, const char * _Format, ...)
+{
+ if ( _DstBuf == NULL || _Format == NULL )
+ {
+ return -1;
+ }
+
+ va_list arg;
+ va_start( arg, _Format );
+ int32_t r = physx::shdfnd::vsnprintf( _DstBuf, _DstSize, _Format, arg );
+ va_end(arg);
+
+ return r;
+}
+
+
+static PX_INLINE void* allocAligned(NvParameterized::Traits* t, uint32_t size, uint32_t align)
+{
+ void* buf = t->alloc(size, align);
+ if( (size_t)buf & (align - 1) )
+ {
+ t->free(buf);
+ return 0;
+ }
+
+ return buf;
+}
+
+static PX_INLINE double RandomF64()
+{
+ return (double)rand() / RAND_MAX;
+}
+
+static PX_INLINE float RandomF32()
+{
+ return (float)RandomF64();
+}
+
+static PX_INLINE uint32_t RandomIdx(uint32_t m, uint32_t M)
+{
+ return uint32_t(m + RandomF64() * (M - m) + 0.99); // FIXME: round
+}
+
+static PX_INLINE physx::PxVec2 RandomVec2()
+{
+ return physx::PxVec2(RandomF32(), RandomF32());
+}
+
+static PX_INLINE physx::PxVec3 RandomVec3()
+{
+ return physx::PxVec3(RandomF32(), RandomF32(), RandomF32());
+}
+
+static PX_INLINE physx::PxVec4 RandomVec4()
+{
+ return physx::PxVec4(RandomF32(), RandomF32(), RandomF32(), RandomF32());
+}
+
+static PX_INLINE physx::PxQuat RandomQuat()
+{
+ return physx::PxQuat(RandomF32(), RandomF32(), RandomF32(), RandomF32());
+}
+
+static PX_INLINE uint32_t RandomU32()
+{
+ return (uint32_t)rand();
+}
+
+static PX_INLINE uint64_t RandomU64()
+{
+ uint32_t u32s[2];
+ u32s[0] = RandomU32();
+ u32s[1] = RandomU32();
+
+ return *(uint64_t*)&u32s[0];
+}
+
+static PX_INLINE bool notEqual(const char *a, const char *b)
+{
+ if(a == NULL && b == NULL)
+ return(false);
+
+ return (a == NULL && b != NULL)
+ || (a != NULL && b == NULL)
+ || 0 != strcmp(a, b);
+}
+
+static PX_INLINE bool notEqual(uint8_t a,uint8_t b)
+{
+ return a!=b;
+}
+static PX_INLINE bool notEqual(uint16_t a,uint16_t b)
+{
+ return a!=b;
+}
+
+static PX_INLINE bool notEqual(uint32_t a,uint32_t b)
+{
+ return a!=b;
+}
+
+static PX_INLINE bool notEqual(uint64_t a,uint64_t b)
+{
+ return a!=b;
+}
+
+static PX_INLINE bool notEqual(int8_t a,int8_t b)
+{
+ return a!=b;
+}
+static PX_INLINE bool notEqual(int16_t a,int16_t b)
+{
+ return a!=b;
+}
+
+static PX_INLINE bool notEqual(int32_t a,int32_t b)
+{
+ return a!=b;
+}
+
+static PX_INLINE bool notEqual(int64_t a,int64_t b)
+{
+ return a!=b;
+}
+
+static PX_INLINE bool notEqual(float a,float b)
+{
+ return a!=b;
+}
+
+static PX_INLINE bool notEqual(float (&a)[12],float (&b)[12])
+{
+ return a[0] != b[0] || a[1] != b[1] || a[2] != b[2] ||
+ a[3] != b[3] || a[4] != b[4] || a[5] != b[5] ||
+ a[6] != b[6] || a[7] != b[7] || a[8] != b[8] ||
+ a[9] != b[9] || a[10] != b[10] || a[11] != b[11];
+}
+
+static PX_INLINE bool notEqual(double a,double b)
+{
+ return a!=b;
+}
+
+static PX_INLINE bool notEqual(bool a,bool b)
+{
+ return a!=b;
+}
+
+static PX_INLINE bool notEqual(const physx::PxVec2 &a,const physx::PxVec2 &b)
+{
+ return a!=b;
+}
+
+static PX_INLINE bool notEqual(const physx::PxVec3 &a,const physx::PxVec3 &b)
+{
+ return a!=b;
+}
+
+static PX_INLINE bool notEqual(const physx::PxVec4 &a,const physx::PxVec4 &b)
+{
+ return a!=b;
+}
+
+// This was formerly in the NvQuat.h file but was removed due to other code bases requiring it to be gone
+static PX_INLINE bool operator!=( const physx::PxQuat& a, const physx::PxQuat& b )
+{
+ return a.x != b.x
+ || a.y != b.y
+ || a.z != b.z
+ || a.w != b.w;
+}
+
+static PX_INLINE bool notEqual(const physx::PxQuat &a,physx::PxQuat &b)
+{
+ return a != b;
+}
+
+static PX_INLINE bool notEqual(const physx::PxMat33 &a,physx::PxMat33 &b)
+{
+ const float *qa = a.front();
+ const float *qb = b.front();
+ return qa[0] != qb[0] || qa[1] != qb[1] || qa[2] != qb[2] || qa[3] != qb[3] ||
+ qa[4] != qb[4] || qa[5] != qb[5] || qa[6] != qb[6] || qa[7] != qb[7] ||
+ qa[8] != qb[8];
+}
+
+static PX_INLINE bool notEqual(const physx::PxMat44 &a,physx::PxMat44 &b)
+{
+ return a.column0.w != b.column0.w || a.column0.x != b.column0.x || a.column0.y != b.column0.y || a.column0.z != b.column0.z ||
+ a.column1.w != b.column1.w || a.column1.x != b.column1.x || a.column1.y != b.column1.y || a.column1.z != b.column1.z ||
+ a.column2.w != b.column2.w || a.column2.x != b.column2.x || a.column2.y != b.column2.y || a.column2.z != b.column2.z ||
+ a.column3.w != b.column3.w || a.column3.x != b.column3.x || a.column3.y != b.column3.y || a.column3.z != b.column3.z;
+}
+
+static PX_INLINE bool notEqual(const physx::PxBounds3 &a,const physx::PxBounds3 &b)
+{
+ return a.minimum != b.minimum || a.maximum != b.maximum;
+}
+
+static PX_INLINE bool notEqual(const physx::PxTransform &a,const physx::PxTransform &b)
+{
+ return a.p != b.p || a.q != b.q;
+}
+
+#define CHECK_FINITE(t) { \
+ const t* _fs = (const t*)&val; \
+ for(size_t _j = 0; _j < sizeof(val) / sizeof(t); ++_j) \
+ { \
+ if( physx::PxIsFinite(_fs[_j]) ) continue; \
+ char _longName[256]; \
+ handle.getLongName(_longName, sizeof(_longName)); \
+ NV_PARAM_TRAITS_WARNING(mParameterizedTraits, "%s: setting non-finite floating point value", _longName); \
+ break; \
+ } \
+}
+
+#define CHECK_FINITE_ARRAY(t) { \
+ for(int32_t _i = 0; _i < int32_t(n); ++_i) \
+ { \
+ const t* _fs = (const t*)(&array[_i]); \
+ for(size_t _j = 0; _j < sizeof(array[0]) / sizeof(t); ++_j) \
+ { \
+ if( physx::PxIsFinite(_fs[_j]) ) continue; \
+ char _longName[256]; \
+ handle.getLongName(_longName, sizeof(_longName)); \
+ NV_PARAM_TRAITS_WARNING(mParameterizedTraits, "%s[%d]: setting non-finite floating point value", _longName, (int)_i); \
+ break; \
+ } \
+ } \
+}
+
+#define CHECK_F32_FINITE \
+ CHECK_FINITE(float)
+
+#define CHECK_F32_FINITE_ARRAY \
+ CHECK_FINITE_ARRAY(float)
+
+#define CHECK_F64_FINITE \
+ CHECK_FINITE(double)
+
+#define CHECK_F64_FINITE_ARRAY \
+ CHECK_FINITE_ARRAY(double)
+
+//******************************************************************************
+//*** Local functions
+//******************************************************************************
+
+#if 0
+static void *local_malloc(uint32_t bytes)
+{
+ return(NV_ALLOC(bytes, NV_DEBUG_EXP("NvParameterized::local_malloc")));
+}
+
+static void *local_realloc(void *buf, uint32_t bytes)
+{
+ return(GetApexAllocator()->realloc(buf, bytes));
+}
+
+static void local_free(void *buf)
+{
+ NV_FREE(buf);
+}
+#else
+
+static void *local_malloc(uint32_t bytes)
+{
+ return(malloc(bytes));
+}
+
+static void *local_realloc(void *buf, uint32_t bytes)
+{
+ return(realloc(buf, bytes));
+}
+
+static void local_free(void *buf)
+{
+ free(buf);
+}
+
+#endif
+
+static char *local_strdup(const char *str)
+{
+ if(str == NULL)
+ return NULL;
+
+ uint32_t len = (uint32_t)strlen(str);
+
+ char *result = (char *)local_malloc(sizeof(char) * (len + 1));
+ physx::shdfnd::strlcpy(result, len+1, str);
+ return result;
+}
+
+static void local_strncpy(char *dst, const char *src, uint32_t n)
+{
+ physx::shdfnd::strlcpy(dst, n, src);
+}
+
+
+static void local_strncat(char *dst, const char *src, uint32_t n)
+{
+ PX_UNUSED(n);
+ physx::shdfnd::strlcat(dst, strlen(dst) + strlen(src) + 1,src);
+}
+
+static int32_t safe_strcmp(const char *str1, const char *str2)
+{
+ if( str1 != NULL && str2 != NULL )
+ return strcmp(str1, str2);
+ else if( str1 == NULL && str2 == NULL )
+ return 0;
+ else
+ return -1;
+}
+
+void *dupBuf(void *buf, uint32_t n)
+{
+ PX_ASSERT(buf != NULL);
+ PX_ASSERT(n > 0);
+
+ void *Ret = local_malloc(n);
+ physx::intrinsics::memCopy(Ret, buf, n);
+
+ return(Ret);
+}
+
+DataType strToType(const char *str)
+{
+# define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ if(!strcmp(str, #type_name)) \
+ return(TYPE_##enum_name);
+
+# include "nvparameterized/NvParameterized_types.h"
+
+ if(!strcmp(str, "Pointer"))
+ return(TYPE_POINTER);
+
+ if(!strcmp(str, "Mat34"))
+ return(TYPE_MAT34);
+
+ return(TYPE_UNDEFINED);
+}
+
+const char *typeToStr(DataType type)
+{
+ switch(type)
+ {
+
+# define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ case TYPE_##enum_name : \
+ return(#type_name);
+# include "nvparameterized/NvParameterized_types.h"
+
+ case TYPE_MAT34:
+ return "Mat34";
+
+ case TYPE_POINTER:
+ return "Pointer";
+
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+ default:
+ return NULL;
+ }
+}
+
+//******************************************************************************
+//*** class HintImpl
+//******************************************************************************
+
+HintImpl::HintImpl()
+{
+ mStaticAllocation = true;
+}
+
+HintImpl::HintImpl(const char *name, uint64_t value)
+{
+ PX_ASSERT(name != NULL);
+
+ init(name, value);
+}
+
+HintImpl::HintImpl(const char *name, double value)
+{
+ PX_ASSERT(name != NULL);
+
+ init(name, value);
+}
+
+HintImpl::HintImpl(const char *name, const char *value)
+{
+ PX_ASSERT(name != NULL);
+ PX_ASSERT(value != NULL);
+
+ init(name, value);
+}
+
+HintImpl::~HintImpl()
+{
+ cleanup();
+}
+
+void HintImpl::init(const char *name, uint64_t value, bool static_allocation)
+{
+ PX_ASSERT(name != NULL);
+
+ mStaticAllocation = static_allocation;
+ mType = TYPE_U64;
+ mName = COND_DUP(name);
+ mUIntValue = value;
+}
+
+void HintImpl::init(const char *name, double value, bool static_allocation)
+{
+ PX_ASSERT(name != NULL);
+
+ mStaticAllocation = static_allocation;
+ mType = TYPE_F64;
+ mName = COND_DUP(name);
+ mFloatValue = value;
+}
+
+void HintImpl::init(const char *name, const char *value, bool static_allocation)
+{
+ PX_ASSERT(name != NULL);
+ PX_ASSERT(value != NULL);
+
+ mStaticAllocation = static_allocation;
+ mType = TYPE_STRING;
+ mName = COND_DUP(name);
+ mStringValue = COND_DUP(value);
+}
+
+void HintImpl::cleanup(void)
+{
+ PX_ASSERT(mName != NULL);
+
+ if(!mStaticAllocation)
+ {
+ local_free(mName);
+
+ if(type() == TYPE_STRING)
+ {
+ PX_ASSERT(mStringValue != NULL);
+ local_free(mStringValue);
+ }
+ }
+}
+
+bool HintImpl::setAsUInt(uint64_t v)
+{
+ bool ret = false;
+ PX_ASSERT(type() == TYPE_U64);
+ if ( type() == TYPE_U64 )
+ {
+ mUIntValue = v;
+ ret = true;
+ }
+ return ret;
+}
+
+uint64_t HintImpl::asUInt(void) const
+{
+ PX_ASSERT(type() == TYPE_U64);
+ return(mUIntValue);
+}
+
+double HintImpl::asFloat(void) const
+{
+ PX_ASSERT(type() == TYPE_U64 || type() == TYPE_F64);
+ return(type() == TYPE_U64 ? static_cast<int64_t>(mUIntValue) : mFloatValue);
+}
+
+const char *HintImpl::asString(void)const
+{
+ PX_ASSERT(type() == TYPE_STRING);
+ return(mStringValue);
+}
+
+
+//******************************************************************************
+//*** class Handle
+//******************************************************************************
+
+
+
+//******************************************************************************
+//*** class DefinitionImpl
+//******************************************************************************
+
+void DefinitionImpl::setDefaults(void)
+{
+ mName = NULL;
+
+ mLongName = NULL;
+ mLongNameAllocated = false;
+
+ mStructName = NULL;
+
+ mType = TYPE_UNDEFINED;
+
+ mArraySize = 0;
+
+ mParent = NULL;
+
+ mNumChildren = 0;
+ mChildren = NULL;
+
+ mNumHints = 0;
+ mHints = NULL;
+
+ mEnumVals = NULL;
+ mNumEnumVals = 0;
+
+ mNumRefVariants = 0;
+ mRefVariantVals = NULL;
+
+ mNumDynamicHandleIndices = 0;
+ mDynamicHandleIndices = NULL;
+
+ mAlign = mPad = 0;
+}
+
+DefinitionImpl::DefinitionImpl(Traits &traits, bool staticAlloc)
+{
+ mStaticAllocation = staticAlloc;
+ mTraits = &traits;
+ setDefaults();
+}
+
+DefinitionImpl::DefinitionImpl(const char *name, DataType t, const char *structName, Traits &traits, bool staticAlloc)
+{
+ mStaticAllocation = staticAlloc;
+ mTraits = &traits;
+ mLongNameAllocated = false;
+ init(name, t, structName, false);
+}
+
+
+DefinitionImpl::~DefinitionImpl()
+{
+ cleanup();
+}
+
+void DefinitionImpl::setAlignment(uint32_t align)
+{
+ mAlign = align;
+}
+
+uint32_t DefinitionImpl::alignment(void) const
+{
+ return mAlign;
+}
+
+void DefinitionImpl::setPadding(uint32_t pad)
+{
+ mPad = pad;
+}
+
+uint32_t DefinitionImpl::padding(void) const
+{
+ return mPad;
+}
+
+void DefinitionImpl::init(const char *name, DataType t, const char *structName, bool static_allocation)
+{
+ PX_UNUSED( static_allocation );
+
+ cleanup();
+
+ mName = name;
+ mLongName = name;
+ mStructName = structName;
+
+ PX_ASSERT(t != TYPE_UNDEFINED);
+ mType = t;
+}
+
+void DefinitionImpl::destroy(void)
+{
+ PX_ASSERT( !mStaticAllocation );
+
+ if( !mStaticAllocation )
+ {
+ this->~DefinitionImpl();
+ mTraits->free(this);
+ }
+}
+
+void DefinitionImpl::cleanup(void)
+{
+ if(!mStaticAllocation)
+ {
+ if( mStructName )
+ mTraits->free((void *)mStructName);
+
+ mTraits->free((void *)mName);
+
+ if(mChildren != NULL)
+ {
+ for(int32_t i=0; i < mNumChildren; ++i)
+ mChildren[i]->destroy();
+
+ local_free(mChildren);
+ }
+
+ if(mHints != NULL)
+ {
+ for(int32_t i=0; i < mNumHints; ++i)
+ {
+ mHints[i]->cleanup();
+ mTraits->free(mHints[i]);
+ }
+
+ local_free(mHints);
+ }
+
+ if(mEnumVals != NULL)
+ {
+ for(int32_t i = 0; i < mNumEnumVals; ++i)
+ local_free(mEnumVals[i]);
+
+ local_free(mEnumVals);
+ }
+
+ if(mRefVariantVals != NULL)
+ {
+ for(int32_t i = 0; i < mNumRefVariants; ++i)
+ local_free(mRefVariantVals[i]);
+
+ local_free(mRefVariantVals);
+ }
+ }
+
+ if(mLongNameAllocated && mLongName)
+ {
+ mTraits->strfree( (char *)mLongName );
+ mLongName = NULL;
+ mLongNameAllocated = false;
+ }
+
+ setDefaults();
+}
+
+const Definition *DefinitionImpl::root(void) const
+{
+ const Definition *root = this;
+ while(root->parent() != NULL)
+ root = root->parent();
+
+ return(root);
+}
+
+int32_t DefinitionImpl::arrayDimension(void) const
+{
+ PX_ASSERT(type() == TYPE_ARRAY);
+
+ int32_t Dim = 0;
+ const Definition *Cur = this;
+ for(;Cur->type() == TYPE_ARRAY; Cur = Cur->child(0))
+ {
+ PX_ASSERT(Cur != NULL);
+ Dim++;
+ }
+
+ return(Dim);
+}
+
+int32_t DefinitionImpl::arraySize(int32_t dimension) const
+{
+ PX_ASSERT(type() == TYPE_ARRAY);
+ PX_ASSERT(dimension >= 0);
+ PX_ASSERT(dimension < arrayDimension());
+
+ const Definition *Cur = this;
+ for(int32_t i=0; i < dimension; ++i)
+ Cur = Cur->child(0);
+
+ if(Cur->type() != TYPE_ARRAY)
+ return(-1);
+
+ const DefinitionImpl *pd = static_cast<const DefinitionImpl *>(Cur);
+
+ return( pd->mArraySize);
+}
+
+bool DefinitionImpl::arraySizeIsFixed(void) const
+{
+ PX_ASSERT(type() == TYPE_ARRAY);
+ return(mArraySize > 0);
+}
+
+bool DefinitionImpl::setArraySize(int32_t size)
+{
+ PX_ASSERT(size >= -1);
+
+ if(size < 0)
+ return(false);
+
+ mArraySize = size;
+
+ return(true);
+}
+
+bool DefinitionImpl::isIncludedRef(void) const
+{
+ const Hint *h = hint("INCLUDED");
+ return h && h->type() == TYPE_U64 && h->asUInt();
+}
+
+int32_t DefinitionImpl::numChildren(void) const
+{
+ return(mNumChildren);
+}
+
+const Definition * DefinitionImpl::child(int32_t index) const
+{
+ PX_ASSERT(index >= 0);
+ PX_ASSERT(index < numChildren());
+ PX_ASSERT(type() == TYPE_STRUCT || type() == TYPE_ARRAY);
+
+ if(index < 0 || index >= numChildren())
+ return(NULL);
+
+ return(mChildren[index]);
+}
+
+const Definition * DefinitionImpl::child(const char *name, int32_t &index) const
+{
+ PX_ASSERT(name);
+ PX_ASSERT(type() == TYPE_STRUCT);
+
+ int32_t i;
+ for(i=0; i < numChildren(); ++i)
+ if(!strcmp(mChildren[i]->name(), name))
+ {
+ index = i;
+ return(mChildren[i]);
+ }
+
+ return(NULL);
+}
+
+
+#define PUSH_TO_ARRAY(val, array, obj_type, num_var) \
+ num_var++; \
+ if(array == NULL) \
+ array = (obj_type *)local_malloc(sizeof(obj_type)); \
+ else \
+ array = (obj_type *)local_realloc(array, num_var * sizeof(obj_type)); \
+ PX_ASSERT(array != NULL); \
+ array[num_var-1] = val;
+
+
+static char *GenLongName(char *dst,
+ uint32_t n,
+ const char *parent_long_name,
+ DataType parent_type,
+ const char *child_name)
+{
+ local_strncpy(dst, parent_long_name, n);
+
+ switch(parent_type)
+ {
+ case TYPE_STRUCT:
+ if(parent_long_name[0])
+ local_strncat(dst, ".", n);
+ local_strncat(dst, child_name, n);
+ break;
+
+ case TYPE_ARRAY:
+ local_strncat(dst, "[]", n);
+ break;
+
+ NV_PARAMETRIZED_NO_AGGREGATE_DATATYPE_LABELS
+ default:
+ PX_ASSERT((void *)"Shouldn't be here!" == NULL);
+ break;
+ }
+
+ return(dst);
+}
+
+#define SET_ARRAY(type, src_array_var, dst_array_var, num_var) \
+ PX_ASSERT(src_array_var != NULL); \
+ PX_ASSERT(n > 0); \
+ if(mStaticAllocation) \
+ { \
+ dst_array_var = (type *)src_array_var; \
+ num_var = n; \
+ } \
+ else \
+ { \
+ PX_ASSERT(dst_array_var == NULL); \
+ dst_array_var = (type *)dupBuf(src_array_var, sizeof(type) * n); \
+ num_var = n; \
+ }
+
+void DefinitionImpl::setChildren(Definition **children, int32_t n)
+{
+ SET_ARRAY(Definition *, children, mChildren, mNumChildren);
+
+ char tmpStr[MAX_NAME_LEN];
+
+ for(int32_t i=0; i < n; ++i)
+ {
+ Definition *_child = children[i];
+ DefinitionImpl *child = static_cast< DefinitionImpl *>(_child);
+
+ PX_ASSERT(child->parent() == NULL); // Only one parent allowed
+
+ GenLongName(tmpStr,
+ MAX_NAME_LEN,
+ mLongName,
+ type(),
+ child->mName);
+
+ child->mLongName = mTraits->strdup( tmpStr );
+ child->mLongNameAllocated = true;
+
+ PX_ASSERT( child != this );
+ child->mParent = this;
+ }
+}
+
+void DefinitionImpl::addChild(Definition *_child)
+{
+ PX_ASSERT(_child != NULL);
+ PX_ASSERT(!mStaticAllocation);
+
+ DefinitionImpl *child = static_cast< DefinitionImpl *>(_child);
+ PX_ASSERT(child->mParent == NULL); // Only one parent allowed
+
+ char tmpStr[MAX_NAME_LEN];
+
+ GenLongName(tmpStr,
+ MAX_NAME_LEN,
+ mLongName,
+ type(),
+ child->mName);
+
+ child->mLongName = mTraits->strdup( tmpStr );
+ child->mLongNameAllocated = true;
+
+ PX_ASSERT( child != this );
+ child->mParent = this;
+ PUSH_TO_ARRAY(_child, mChildren, Definition *, mNumChildren)
+}
+
+
+int32_t DefinitionImpl::numHints(void) const
+{
+ return(mNumHints);
+}
+
+const Hint *DefinitionImpl::hint(int32_t index) const
+{
+ PX_ASSERT(index >= 0);
+ PX_ASSERT(index < numHints());
+
+ if( index >= numHints() )
+ {
+ return(NULL);
+ }
+
+ return(mHints[index]);
+}
+
+const Hint *DefinitionImpl::hint(const char *name) const
+{
+ PX_ASSERT(name != NULL);
+
+ for(int32_t i=0; i < numHints(); ++i)
+ if(!strcmp(mHints[i]->name(), name))
+ return(mHints[i]);
+
+ return(NULL);
+}
+
+void DefinitionImpl::setHints(const Hint **hints, int32_t n)
+{
+ SET_ARRAY(HintImpl *, hints, mHints, mNumHints);
+}
+
+void DefinitionImpl::addHint(Hint *_hint)
+{
+ PX_ASSERT(_hint != NULL);
+ HintImpl *hint = static_cast< HintImpl *>(_hint);
+ PUSH_TO_ARRAY(hint, mHints, HintImpl *, mNumHints)
+}
+
+int32_t DefinitionImpl::numEnumVals(void) const
+{
+ return(mNumEnumVals);
+}
+
+int32_t DefinitionImpl::enumValIndex( const char * enum_val ) const
+{
+ if(!enum_val)
+ return(-1);
+
+ for(int32_t i=0; i < numEnumVals(); ++i)
+ {
+ if( !strcmp( enumVal(i), enum_val ) )
+ {
+ return(i);
+ }
+ }
+
+ return(-1);
+}
+
+const char *DefinitionImpl::enumVal(int32_t index) const
+{
+ PX_ASSERT(index >= 0);
+ PX_ASSERT(index < numEnumVals());
+
+ return(mEnumVals[index]);
+}
+
+void DefinitionImpl::setEnumVals(const char **enum_vals, int32_t n)
+{
+ SET_ARRAY(char *, enum_vals, mEnumVals, mNumEnumVals);
+}
+
+void DefinitionImpl::addEnumVal(const char *enum_val)
+{
+ PX_ASSERT(enum_val != NULL);
+
+ char *NewEnumVal = COND_DUP(enum_val);
+ PUSH_TO_ARRAY(NewEnumVal, mEnumVals, char *, mNumEnumVals)
+}
+
+int32_t DefinitionImpl::refVariantValIndex( const char * ref_val ) const
+{
+ if(!ref_val)
+ return(-1);
+
+ for(int32_t i=0; i < numRefVariants(); ++i)
+ {
+ if( !strcmp( refVariantVal(i), ref_val ) )
+ {
+ return(i);
+ }
+ }
+
+ return(-1);
+}
+
+int32_t DefinitionImpl::numRefVariants(void) const
+{
+ return(mNumRefVariants);
+}
+
+const char *DefinitionImpl::refVariantVal(int32_t index) const
+{
+ PX_ASSERT(index >= 0);
+ PX_ASSERT(index < numRefVariants());
+
+ return(mRefVariantVals[index]);
+}
+
+void DefinitionImpl::setRefVariantVals(const char **ref_vals, int32_t n)
+{
+ SET_ARRAY(char *, ref_vals, mRefVariantVals, mNumRefVariants);
+}
+
+void DefinitionImpl::addRefVariantVal(const char *ref_val)
+{
+ PX_ASSERT(ref_val != NULL);
+
+ char *NewEnumVal = COND_DUP(ref_val);
+ PUSH_TO_ARRAY(NewEnumVal, mRefVariantVals, char *, mNumRefVariants)
+}
+
+void DefinitionImpl::setDynamicHandleIndicesMap(const uint8_t *indices, uint32_t numIndices)
+{
+ mNumDynamicHandleIndices = numIndices;
+ mDynamicHandleIndices = indices;
+}
+
+const uint8_t * DefinitionImpl::getDynamicHandleIndicesMap(uint32_t &outNumIndices) const
+{
+ outNumIndices = mNumDynamicHandleIndices;
+ return mDynamicHandleIndices;
+}
+
+bool DefinitionImpl::isSimpleType(bool simpleStructs, bool simpleStrings) const
+{
+ switch(mType)
+ {
+ case TYPE_STRUCT:
+ if( !simpleStructs )
+ return false;
+
+ for(int32_t i = 0; i < mNumChildren; ++i)
+ {
+ if( !mChildren[i]->isSimpleType(simpleStructs, simpleStrings) )
+ return false;
+ }
+
+ return true;
+
+ case TYPE_ARRAY:
+ case TYPE_REF:
+ return false;
+
+ NV_PARAMETRIZED_NO_AGGREGATE_AND_REF_DATATYPE_LABELS
+ default:
+ PX_ASSERT( mNumChildren == 0 );
+ return true;
+ }
+}
+
+//******************************************************************************
+//*** class NvParameterized
+//******************************************************************************
+
+NvParameters::NvParameters(Traits *traits, void *buf, int32_t *refCount)
+{
+ mParameterizedTraits = traits;
+
+ if( buf )
+ {
+ mBuffer = buf;
+ mRefCount = refCount;
+
+ //Values of other fields are already deserialized
+ }
+ else
+ {
+ mName = mClassName = NULL;
+ mDoDeallocateName = mDoDeallocateClassName = mDoDeallocateSelf = true;
+
+ mSerializationCb = NULL;
+ mCbUserData = NULL;
+
+ mBuffer = NULL;
+ mRefCount = NULL;
+
+ //Other fields are used only for inplace objects => skip them
+ }
+}
+
+NvParameters::~NvParameters()
+{
+ if( mClassName && mDoDeallocateClassName )
+ {
+ mParameterizedTraits->strfree( const_cast<char*>(mClassName) );
+ mClassName = NULL;
+ }
+
+ if( mName && mDoDeallocateName )
+ {
+ mParameterizedTraits->strfree( const_cast<char*>(mName) );
+ mName = NULL;
+ }
+}
+
+// placement delete
+void NvParameters::destroy()
+{
+ // We cache these fields here to avoid overwrite in destructor
+ bool doDeallocateSelf = mDoDeallocateSelf;
+ void *buf = mBuffer;
+ int32_t *refCount = mRefCount;
+ NvParameterized::Traits *traits = mParameterizedTraits;
+
+ this->~NvParameters();
+
+ destroy(this, traits, doDeallocateSelf, refCount, buf);
+}
+
+void NvParameters::destroy(NvParameters *obj, NvParameterized::Traits *traits, bool doDeallocateSelf, int32_t *refCount, void *buf)
+{
+ if( !doDeallocateSelf )
+ return;
+
+ if( !refCount ) //Ordinary object?
+ {
+ traits->free(obj);
+ return;
+ }
+
+ //Inplace object => callback client
+
+ traits->onInplaceObjectDestroyed(buf, obj);
+ if( !traits->decRefCount(refCount) )
+ traits->onAllInplaceObjectsDestroyed(buf);
+}
+
+
+uint16_t NvParameters::getMajorVersion(void) const
+{
+ uint16_t major = version() >> 16;
+ return major;
+}
+
+uint16_t NvParameters::getMinorVersion(void) const
+{
+ uint16_t minor = version() & 0xffff;
+ return minor;
+}
+
+void NvParameters::initRandom(void)
+{
+ Handle handle(*this, "");
+ initRandom(handle);
+}
+
+void NvParameters::initRandom(NvParameterized::Handle& handle)
+{
+ NvParameterized::ErrorType error;
+
+ const Definition* pd = handle.parameterDefinition();
+ switch( pd->type() )
+ {
+ case TYPE_STRUCT:
+ {
+ for(int32_t i = 0; i < pd->numChildren(); ++i)
+ {
+ handle.set(i);
+ initRandom(handle);
+ handle.popIndex();
+ }
+
+ break;
+ }
+
+ case TYPE_ARRAY:
+ {
+ if (!pd->arraySizeIsFixed())
+ {
+ error = handle.resizeArray(int32_t(10 * (double)rand() / RAND_MAX));
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ }
+
+ int32_t size;
+ error = handle.getArraySize(size);
+ PX_ASSERT(error == ERROR_NONE);
+
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+
+ for(int32_t i = 0; i < size; ++i)
+ {
+ handle.set(i);
+ initRandom(handle);
+ handle.popIndex();
+ }
+
+ break;
+ }
+
+ case TYPE_REF:
+ {
+ if (!pd->numRefVariants())
+ break; // Can't do anything without refVariants-hint
+
+ PX_ASSERT(pd->numRefVariants() > 0);
+ uint32_t refIdx = RandomIdx(0U, pd->numRefVariants() - 1U);
+ const char* className = pd->refVariantVal(static_cast<int32_t>(refIdx));
+ if( mParameterizedTraits->doesFactoryExist(className) ) {
+ error = initParamRef(handle, className, true);
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+
+ NvParameterized::Interface* obj = NULL;
+ error = handle.getParamRef(obj);
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ }
+
+ break;
+ }
+
+ case TYPE_BOOL:
+ error = handle.setParamBool( 0 == RandomU32() % 2 );
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_STRING:
+ {
+ char s[10];
+ int32_t len = (int32_t)( (size_t)rand() % sizeof(s) );
+ for(int32_t i = 0; i < len; ++i)
+ s[i] = 'a' + rand() % ('z' - 'a');
+ s[len] = 0;
+
+ error = handle.setParamString(s);
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+ }
+
+ case TYPE_ENUM:
+ {
+ uint32_t enumIdx = RandomIdx(0U, static_cast<uint32_t>(pd->numEnumVals()-1));
+ error = handle.setParamEnum(pd->enumVal(static_cast<int32_t>(enumIdx)));
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+ }
+
+ case TYPE_I8:
+ error = handle.setParamI8((int8_t)(RandomU32() & 0xff));
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_U8:
+ error = handle.setParamU8((uint8_t)(RandomU32() & 0xff));
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_I16:
+ error = handle.setParamI16((int16_t)(RandomU32() & 0xffff));
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_U16:
+ error = handle.setParamU16((uint16_t)(RandomU32() & 0xffff));
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_I32:
+ error = handle.setParamI32((int32_t)RandomU32());
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_U32:
+ error = handle.setParamU32((uint32_t)RandomU32());
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_I64:
+ error = handle.setParamI64((int64_t)RandomU64());
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_U64:
+ error = handle.setParamU64(RandomU64());
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_F32:
+ error = handle.setParamF32(RandomF32());
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_F64:
+ error = handle.setParamF64(RandomF64());
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_VEC2:
+ error = handle.setParamVec2(RandomVec2());
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_VEC3:
+ error = handle.setParamVec3(RandomVec3());
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_VEC4:
+ error = handle.setParamVec4(RandomVec4());
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_QUAT:
+ error = handle.setParamQuat(RandomQuat());
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_MAT33:
+ error = handle.setParamMat33(physx::PxMat33(RandomVec3(), RandomVec3(), RandomVec3()));
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_BOUNDS3:
+ error = handle.setParamBounds3(physx::PxBounds3(RandomVec3(), RandomVec3()));
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_MAT44:
+ error = handle.setParamMat44(physx::PxMat44(RandomVec4(), RandomVec4(), RandomVec4(), RandomVec4()));
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+
+ case TYPE_MAT34:
+ {
+ float f[12] = { RandomF32(), RandomF32(), RandomF32(), RandomF32(),
+ RandomF32(), RandomF32(), RandomF32(), RandomF32(),
+ RandomF32(), RandomF32(), RandomF32(), RandomF32() };
+ error = handle.setParamMat34Legacy(f);
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+ }
+
+ case TYPE_POINTER:
+ // We can't init pointers :(
+ break;
+
+ case TYPE_TRANSFORM:
+ {
+ // PxTransform asserts if the quat isn't "sane"
+ physx::PxQuat q;
+ do {
+ q = RandomQuat();
+ } while (!q.isSane());
+
+ error = handle.setParamTransform(physx::PxTransform(RandomVec3(),q));
+ DEBUG_ASSERT( NvParameterized::ERROR_NONE == error );
+ break;
+ }
+ NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+ default:
+ PX_ALWAYS_ASSERT();
+ }
+
+ PX_UNUSED(error); // Make compiler happy
+}
+
+void NvParameters::setClassName(const char *name)
+{
+ if(mParameterizedTraits)
+ {
+ if( mClassName )
+ {
+ if( !strcmp( mClassName, name ) )
+ return;
+
+ if( mDoDeallocateClassName )
+ mParameterizedTraits->strfree( const_cast<char*>(mClassName) );
+ }
+
+ mClassName = mParameterizedTraits->strdup(name);
+ }
+ else
+ {
+ mClassName = name;
+ }
+
+ mDoDeallocateClassName = true;
+}
+
+void NvParameters::setName(const char *name)
+{
+ if(mParameterizedTraits)
+ {
+ if( mName )
+ {
+ if( !strcmp( mName, name ) )
+ return;
+
+ if( mDoDeallocateName )
+ mParameterizedTraits->strfree( const_cast<char*>(mName) );
+ }
+
+ mName = mParameterizedTraits->strdup(name);
+ }
+ else
+ {
+ mName = name;
+ }
+
+ mDoDeallocateName = true;
+}
+
+void NvParameters::setSerializationCallback(SerializationCallback *cb, void *userData)
+{
+ mSerializationCb = cb;
+ mCbUserData = userData;
+}
+
+ErrorType NvParameters::callPreSerializeCallback() const
+{
+ if(mSerializationCb)
+ {
+ mSerializationCb->preSerialize(mCbUserData);
+ }
+
+ Handle handle(*this);
+
+ NV_ERR_CHECK_RETURN( getParameterHandle("", handle) );
+
+ return callPreSerializeCallback(handle);
+}
+
+int32_t NvParameters::numParameters(void)
+{
+ return(rootParameterDefinition()->numChildren());
+}
+
+const Definition *NvParameters::parameterDefinition(int32_t index)
+{
+ return(rootParameterDefinition()->child(index));
+}
+
+const Definition *NvParameters::rootParameterDefinition(void)
+{
+ return(getParameterDefinitionTree());
+}
+
+const Definition *NvParameters::rootParameterDefinition(void) const
+{
+ return(getParameterDefinitionTree());
+}
+
+ErrorType NvParameters::getParameterHandle(const char *long_name, Handle &handle) const
+{
+ ErrorType result = ERROR_NONE;
+
+ PX_ASSERT( handle.getConstInterface() == this );
+
+ if( rootParameterDefinition() == NULL )
+ {
+ handle.reset();
+ result = (ERROR_INVALID_CALL_ON_NAMED_REFERENCE);
+ }
+ else
+ {
+ result = handle.set(this,rootParameterDefinition(), long_name);
+ }
+
+ PX_ASSERT(result == ERROR_NONE);
+
+ return result;
+}
+
+ErrorType NvParameters::getParameterHandle(const char *long_name, Handle &handle)
+{
+ ErrorType result = ERROR_NONE;
+
+ PX_ASSERT( handle.getConstInterface() == this );
+
+ if( rootParameterDefinition() == NULL )
+ {
+ handle.reset();
+ result = (ERROR_INVALID_CALL_ON_NAMED_REFERENCE);
+ }
+ else
+ {
+ result = handle.set(this,rootParameterDefinition(), long_name);
+ }
+
+ PX_ASSERT(result == ERROR_NONE);
+
+ return result;
+}
+
+#ifndef NV_CHECKED
+# define CHECK_HANDLE
+# define CHECK_IS_SIMPLE_ARRAY(type_enum_name)
+#else
+# define CHECK_HANDLE \
+ { \
+ ErrorType result = checkParameterHandle(handle); \
+ PX_ASSERT(result == ERROR_NONE); \
+ if(result != ERROR_NONE) \
+ return(result); \
+ }
+# define CHECK_IS_SIMPLE_ARRAY(type_enum_name) \
+ { \
+ PX_ASSERT(offset >= 0);\
+ PX_ASSERT(n >= 0);\
+ if(handle.parameterDefinition()->type() != TYPE_ARRAY) \
+ {\
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_NOT_AN_ARRAY");\
+ return(ERROR_NOT_AN_ARRAY); \
+ }\
+ if(handle.parameterDefinition()->child(0)->type() != TYPE_##type_enum_name) \
+ {\
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");\
+ return(ERROR_CAST_FAILED); \
+ }\
+ int32_t arraySize; \
+ ErrorType error; \
+ if((error = getArraySize(handle, arraySize)) != ERROR_NONE) \
+ {\
+ PX_ASSERT(error == ERROR_NONE); \
+ return(error); \
+ }\
+ if( offset + n > arraySize) \
+ {\
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_ARRAY_IS_TOO_SMALL");\
+ return(ERROR_ARRAY_IS_TOO_SMALL); \
+ }\
+ }
+#endif
+
+template <class Type > ErrorType rawGetParam(const Handle &handle,Type &val,const NvParameters *parent)
+{
+ size_t offset;
+ void *ptr=NULL;
+ parent->getVarPtr(handle, ptr, offset);
+ if ( ptr == NULL )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_TYPE_NOT_SUPPORTED");
+ return ERROR_TYPE_NOT_SUPPORTED;
+ }
+ Type *var = (Type *)((char *)ptr);
+ val = *var;
+ return(ERROR_NONE);
+}
+
+template <class Type > ErrorType rawSetParam(const Handle &handle,const Type &val,NvParameters *parent)
+{
+ size_t offset;
+ void *ptr=NULL;
+ parent->getVarPtr(handle, ptr, offset);
+ if(ptr == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+ Type *Var = (Type *)((char *)ptr);
+ *Var = val;
+ return(ERROR_NONE);
+}
+
+template <class Type >ErrorType rawGetParamArray(const Handle &handle,Type *array, int32_t n, int32_t offset,const NvParameters *parent)
+{
+ int32_t size;
+ NV_ERR_CHECK_RETURN(handle.getArraySize(size));
+ if( size < offset + n )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ if( n )
+ {
+ Handle memberHandle(handle);
+ NV_ERR_CHECK_RETURN(memberHandle.set(offset));
+
+ size_t tmp;
+ void *ptr=NULL;
+ parent->getVarPtr(memberHandle, ptr, tmp);
+ if(ptr == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ physx::intrinsics::memCopy(array, ptr, n * sizeof(Type));
+ }
+
+ return(ERROR_NONE);
+}
+
+template <class Type> ErrorType rawSetParamArray(const Handle &handle, const Type *array, int32_t n, int32_t offset,NvParameters *parent)
+{
+ int32_t size;
+ NV_ERR_CHECK_RETURN(handle.getArraySize(size));
+ if( size < offset + n )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ if( n )
+ {
+ Handle memberHandle(handle);
+ NV_ERR_CHECK_RETURN(memberHandle.set(offset));
+
+ size_t tmp;
+ void *ptr=NULL;
+ parent->getVarPtr(memberHandle, ptr, tmp);
+ if(ptr == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ physx::intrinsics::memCopy(ptr, array, n * sizeof(Type));
+ }
+
+ return(ERROR_NONE);
+}
+
+//******************************************************************************
+//*** Bool
+//******************************************************************************
+
+ErrorType NvParameters::getParamBool(const Handle &handle, bool &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_BOOL)
+ {
+ return rawGetParamBool(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamBool(const Handle &handle, bool val)
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_BOOL)
+ {
+ return rawSetParamBool(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamBoolArray(const Handle &handle, bool *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(BOOL)
+ return(rawGetParamBoolArray(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamBoolArray(const Handle &handle, const bool *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(BOOL)
+ return(rawSetParamBoolArray(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** String
+//******************************************************************************
+
+ErrorType NvParameters::getParamString(const Handle &handle, const char *&val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_ENUM)
+ {
+ return rawGetParamEnum(handle, val);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_STRING)
+ {
+ return rawGetParamString(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamString(const Handle &handle, const char *val)
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_STRING)
+ {
+ return rawSetParamString(handle, val);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_ENUM)
+ {
+ return rawSetParamEnum(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::rawGetParamStringArray(const Handle &handle, char **array, int32_t n, int32_t offset) const
+{
+ Handle memberHandle(handle);
+ for(int32_t i=0; i < n; ++i)
+ {
+ ErrorType error;
+ if((error = memberHandle.set(i + offset)) != ERROR_NONE)
+ {
+ PX_ASSERT(error == ERROR_NONE);
+ return(error);
+ }
+
+ const char * tmp;
+ if((error = rawGetParamString(memberHandle, tmp)) != ERROR_NONE)
+ {
+ PX_ASSERT(error == ERROR_NONE);
+ return(error);
+ }
+
+ array[i] = const_cast<char*>(tmp);
+ memberHandle.popIndex();
+ }
+ return(ERROR_NONE);
+}
+
+
+ErrorType NvParameters::getParamStringArray(const Handle &handle, char **array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(STRING)
+ return(rawGetParamStringArray(handle, array, n, offset));
+}
+
+ErrorType NvParameters::rawSetParamStringArray(const Handle &handle, const char **array, int32_t n, int32_t offset)
+{
+ Handle memberHandle(handle);
+ for(int32_t i=0; i < n; ++i)
+ {
+ ErrorType error;
+ if((error = memberHandle.set(i + offset)) != ERROR_NONE)
+ {
+ PX_ASSERT(error == ERROR_NONE);
+ return(error);
+ }
+
+ if((error = rawSetParamString(memberHandle, array[i] )) != ERROR_NONE)
+ {
+ PX_ASSERT(error == ERROR_NONE);
+ return(error);
+ }
+
+ memberHandle.popIndex();
+ }
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::setParamStringArray(const Handle &handle, const char **array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(STRING)
+ return(rawSetParamStringArray(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** Enum
+//******************************************************************************
+
+ErrorType NvParameters::getParamEnum(const Handle &handle, const char *&val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_STRING)
+ {
+ return rawGetParamString(handle, val);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_ENUM)
+ {
+ return rawGetParamEnum(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+// returns the actual enum string from the ParameterDefintion object, which should be good for the liftetime
+// of the DefinitionImpl object. Returns NULL if no such enum exists.
+static const char* getEnumString(const Handle &handle, const char* str)
+{
+ PX_ASSERT(str != NULL);
+
+ const Definition* paramDef = handle.parameterDefinition();
+ PX_ASSERT(paramDef != NULL);
+ PX_ASSERT(paramDef->type() == TYPE_ENUM);
+
+ for (int32_t i = 0; i < paramDef->numEnumVals(); ++i)
+ if(!strcmp(paramDef->enumVal(i), str))
+ return(paramDef->enumVal(i));
+
+ return(NULL);
+}
+
+ErrorType NvParameters::setParamEnum(const Handle &handle, const char *val)
+{
+ CHECK_HANDLE
+
+ val = getEnumString(handle, val);
+ if(val == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INVALID_ENUM_VAL");
+ return(ERROR_INVALID_ENUM_VAL);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_ENUM)
+ {
+ return rawSetParamEnum(handle, val);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_STRING)
+ {
+ return rawSetParamString(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::rawGetParamEnumArray(const Handle &handle, char **array, int32_t n, int32_t offset) const
+{
+ Handle memberHandle(handle);
+ for(int32_t i=0; i < n; ++i)
+ {
+ ErrorType error;
+ if((error = memberHandle.set(i + offset)) != ERROR_NONE)
+ return(error);
+ const char * tmp;
+ if((error = rawGetParamEnum(memberHandle, tmp)) != ERROR_NONE)
+ return(error);
+ array[i] = const_cast<char*>(tmp);
+ memberHandle.popIndex();
+ }
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawSetParamEnumArray(const Handle &handle, const char **array, int32_t n, int32_t offset)
+{
+ Handle memberHandle(handle);
+ for(int32_t i=0; i < n; ++i)
+ {
+ ErrorType error;
+ if((error = memberHandle.set(i + offset)) != ERROR_NONE)
+ return(error);
+ if((error = rawSetParamEnum(memberHandle, array[i])) != ERROR_NONE)
+ return(error);
+ memberHandle.popIndex();
+ }
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::getParamEnumArray(const Handle &handle, char **array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(ENUM)
+ return(rawGetParamEnumArray(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamEnumArray(const Handle &handle, const char **array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(ENUM)
+ return(rawSetParamEnumArray(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** Ref
+//******************************************************************************
+
+ErrorType NvParameters::initParamRef(const Handle &handle, const char *inChosenRefStr, bool doDestroyOld)
+{
+ CHECK_HANDLE
+
+ NvParameterized::Interface *param = NULL;
+ const char *chosenRefStr = inChosenRefStr;
+
+ // create NvParam object (depends on if it's included or not)
+ const Hint *hint = handle.parameterDefinition()->hint("INCLUDED");
+ if (hint && hint->type() != TYPE_U64)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INVALID_REFERENCE_INCLUDE_HINT");
+ return(ERROR_INVALID_REFERENCE_INCLUDE_HINT);
+ }
+
+ if (hint != NULL && hint->asUInt() == 1)
+ {
+ // included
+
+ if (chosenRefStr == 0 && handle.parameterDefinition()->numRefVariants() > 1)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INVALID_REFERENCE_VALUE");
+ return(ERROR_INVALID_REFERENCE_VALUE);
+ }
+
+ for (int32_t i = 0; i < handle.parameterDefinition()->numRefVariants(); i++)
+ {
+ if (!strcmp(handle.parameterDefinition()->refVariantVal(i), chosenRefStr))
+ {
+ // create an object of type chosenRefStr, somehow
+ param = mParameterizedTraits->createNvParameterized(chosenRefStr);
+ if (!param)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_OBJECT_CONSTRUCTION_FAILED");
+ return ERROR_OBJECT_CONSTRUCTION_FAILED;
+ }
+
+ return setParamRef(handle, param, doDestroyOld);
+ }
+ }
+ // PH: debug hint
+ // If you land here, you should compare chosenRefStr and handle.mParameterDefinition.mRefVariantVals
+ // to see why it couldn't find anything, and then fix the .pl
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INVALID_REFERENCE_VALUE");
+ return(ERROR_INVALID_REFERENCE_VALUE);
+ }
+ else
+ {
+ // not included, just create generic NvParameterized
+ param = NV_PARAM_PLACEMENT_NEW(mParameterizedTraits->alloc(sizeof(NvParameters)), NvParameters)(mParameterizedTraits);
+ if (!param)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_OBJECT_CONSTRUCTION_FAILED");
+ return ERROR_OBJECT_CONSTRUCTION_FAILED;
+ }
+
+ if (chosenRefStr == 0)
+ {
+ param->setClassName(handle.parameterDefinition()->refVariantVal(0));
+ }
+ else
+ {
+ bool found = false;
+ for (int32_t i = 0; i < handle.parameterDefinition()->numRefVariants(); i++)
+ {
+ if (!strcmp(handle.parameterDefinition()->refVariantVal(i), chosenRefStr))
+ {
+ param->setClassName(handle.parameterDefinition()->refVariantVal(i));
+ found = true;
+ break;
+ }
+ }
+ if ( !found )
+ {
+ // ensure that we free this memory that we've allocated
+ mParameterizedTraits->free(param);
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INVALID_REFERENCE_VALUE");
+ return(ERROR_INVALID_REFERENCE_VALUE);
+ }
+ }
+ return setParamRef(handle, param, doDestroyOld);
+ }
+}
+
+ErrorType NvParameters::getParamRef(const Handle &handle, NvParameterized::Interface *&val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_REF)
+ {
+ return rawGetParamRef(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamRef(const Handle &handle, NvParameterized::Interface *val, bool doDestroyOld)
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_REF)
+ {
+ if (doDestroyOld)
+ {
+ NvParameterized::Interface *param = NULL;
+
+ getParamRef(handle, param);
+ if(param)
+ {
+ param->destroy();
+ param = NULL;
+ }
+ }
+ return rawSetParamRef(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::rawGetParamRefArray(const Handle &handle, NvParameterized::Interface **array, int32_t n, int32_t offset) const
+{
+ Handle memberHandle(handle);
+ for(int32_t i=0; i < n; ++i)
+ {
+ ErrorType error;
+ if((error = memberHandle.set(i + offset)) != ERROR_NONE)
+ return(error);
+ NvParameterized::Interface * tmp;
+ if((error = rawGetParamRef(memberHandle, tmp)) != ERROR_NONE)
+ return(error);
+ array[i] = tmp;
+ memberHandle.popIndex();
+ }
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawSetParamRefArray(const Handle &handle,NvParameterized::Interface **array, int32_t n, int32_t offset)
+{
+ Handle memberHandle(handle);
+ for(int32_t i=0; i < n; ++i)
+ {
+ ErrorType error;
+ if((error = memberHandle.set(i + offset)) != ERROR_NONE)
+ return(error);
+ if((error = rawSetParamRef(memberHandle, array[i])) != ERROR_NONE)
+ return(error);
+ memberHandle.popIndex();
+ }
+
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::getParamRefArray(const Handle &handle, NvParameterized::Interface * *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(REF)
+ return(rawGetParamRefArray(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamRefArray(const Handle &handle, /*const*/ NvParameterized::Interface **array, int32_t n, int32_t offset, bool doDestroyOld)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(REF)
+
+ Handle memberHandle(handle);
+ for(int32_t i = 0; i < n; ++i)
+ {
+ ErrorType error;
+ if((error = memberHandle.set(i + offset)) != ERROR_NONE)
+ {
+ return(error);
+ }
+
+ if((error = setParamRef(memberHandle, array[i]), doDestroyOld) != ERROR_NONE)
+ {
+ return(error);
+ }
+ memberHandle.popIndex();
+ }
+ return(ERROR_NONE);
+}
+
+//******************************************************************************
+//*** I8
+//******************************************************************************
+
+ErrorType NvParameters::getParamI8(const Handle &handle, int8_t &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_I8)
+ {
+ return rawGetParamI8(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamI8(const Handle &handle, int8_t val)
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_I8)
+ {
+ return rawSetParamI8(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamI8Array(const Handle &handle, int8_t *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(I8)
+ return(rawGetParamI8Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamI8Array(const Handle &handle, const int8_t *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(I8)
+ return(rawSetParamI8Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** I16
+//******************************************************************************
+
+ErrorType NvParameters::getParamI16(const Handle &handle, int16_t &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_I8)
+ {
+ int8_t tmp;
+ ErrorType result = rawGetParamI8(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (int16_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_I16)
+ {
+ return rawGetParamI16(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamI16(const Handle &handle, int16_t val)
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_I16)
+ {
+ return rawSetParamI16(handle, val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_I8)
+ {
+ return rawSetParamI8(handle, (int8_t)val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_U8)
+ {
+ return rawSetParamU8(handle, (uint8_t)val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamI16Array(const Handle &handle, int16_t *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(I16)
+ return(rawGetParamI16Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamI16Array(const Handle &handle, const int16_t *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(I16)
+ return(rawSetParamI16Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** I32
+//******************************************************************************
+
+ErrorType NvParameters::getParamI32(const Handle &handle, int32_t &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_I8)
+ {
+ int8_t tmp;
+ ErrorType result = rawGetParamI8(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (int32_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_I16)
+ {
+ int16_t tmp;
+ ErrorType result = rawGetParamI16(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (int32_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_I32)
+ {
+ int32_t tmp;
+ ErrorType result = rawGetParamI32(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (int32_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamI32(const Handle &handle, int32_t val)
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_I32)
+ {
+ return rawSetParamI32(handle, val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_I16)
+ {
+ return rawSetParamI16(handle, (int16_t)val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_U16)
+ {
+ return rawSetParamU16(handle, (uint16_t)val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_I8)
+ {
+ return rawSetParamI8(handle, (int8_t) val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_U8)
+ {
+ return rawSetParamU8(handle, (uint8_t) val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamI32Array(const Handle &handle, int32_t *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(I32)
+ return(rawGetParamI32Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamI32Array(const Handle &handle, const int32_t *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(I32)
+ return(rawSetParamI32Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** I64
+//******************************************************************************
+
+ErrorType NvParameters::getParamI64(const Handle &handle, int64_t &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_I8)
+ {
+ int8_t tmp;
+ ErrorType result = rawGetParamI8(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (int64_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_I16)
+ {
+ int16_t tmp;
+ ErrorType result = rawGetParamI16(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (int64_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_I32)
+ {
+ int32_t tmp;
+ ErrorType result = rawGetParamI32(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (int64_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_I64)
+ {
+ int64_t tmp;
+ ErrorType result = rawGetParamI64(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (int64_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamI64(const Handle &handle, int64_t val)
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_I64)
+ {
+ return rawSetParamI64(handle, val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_U32)
+ {
+ return rawSetParamU32(handle, (uint32_t)val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_I32)
+ {
+ return rawSetParamI32(handle, (int32_t)val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_I16)
+ {
+ return rawSetParamI16(handle, (int16_t)val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_U16)
+ {
+ return rawSetParamU16(handle, (uint16_t) val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_I8)
+ {
+ return rawSetParamI8(handle, (int8_t)val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_U8)
+ {
+ return rawSetParamU8(handle, (uint8_t)val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamI64Array(const Handle &handle, int64_t *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(I64)
+ return(rawGetParamI64Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamI64Array(const Handle &handle, const int64_t *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(I64)
+ return(rawSetParamI64Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** U8
+//******************************************************************************
+
+ErrorType NvParameters::getParamU8(const Handle &handle, uint8_t &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_U8)
+ {
+ return rawGetParamU8(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamU8(const Handle &handle, uint8_t val)
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_U8)
+ {
+ return rawSetParamU8(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamU8Array(const Handle &handle, const uint8_t *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(U8)
+ return(rawSetParamU8Array(handle, array, n, offset));
+}
+
+
+//******************************************************************************
+//*** U16
+//******************************************************************************
+
+ErrorType NvParameters::getParamU16(const Handle &handle, uint16_t &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_U8)
+ {
+ uint8_t tmp;
+ ErrorType result = rawGetParamU8(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (uint16_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_U16)
+ {
+ uint16_t tmp;
+ ErrorType result = rawGetParamU16(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (uint16_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamU16(const Handle &handle, uint16_t val)
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_U16)
+ {
+ return rawSetParamU16(handle, val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_U8)
+ {
+ return rawSetParamU8(handle, (uint8_t)val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamU16Array(const Handle &handle, uint16_t *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(U16)
+ return(rawGetParamU16Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamU16Array(const Handle &handle, const uint16_t *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(U16)
+ return(rawSetParamU16Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** U32
+//******************************************************************************
+
+ErrorType NvParameters::getParamU32(const Handle &handle, uint32_t &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_U8)
+ {
+ uint8_t tmp;
+ ErrorType result = rawGetParamU8(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (uint32_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_U16)
+ {
+ uint16_t tmp;
+ ErrorType result = rawGetParamU16(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (uint32_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_U32)
+ {
+ uint32_t tmp;
+ ErrorType result = rawGetParamU32(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (uint32_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamU32(const Handle &handle, uint32_t val)
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_U32)
+ {
+ return rawSetParamU32(handle, val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_U16)
+ {
+ return rawSetParamU16(handle, (uint16_t)val);
+ }
+ if(handle.parameterDefinition()->type() == TYPE_U8)
+ {
+ return rawSetParamU8(handle, (uint8_t)val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamU32Array(const Handle &handle, uint32_t *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(U32)
+ return(rawGetParamU32Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamU32Array(const Handle &handle, const uint32_t *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(U32)
+ return(rawSetParamU32Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** U64
+//******************************************************************************
+
+ErrorType NvParameters::getParamU64(const Handle &handle, uint64_t &val) const
+{
+ CHECK_HANDLE
+
+ if (handle.parameterDefinition()->type() == TYPE_BOOL)
+ {
+ bool tmp;
+ ErrorType result = rawGetParamBool(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if (result != ERROR_NONE)
+ return(result);
+ val = (uint64_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if (handle.parameterDefinition()->type() == TYPE_U8)
+ {
+ uint8_t tmp;
+ ErrorType result = rawGetParamU8(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (uint64_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_U16)
+ {
+ uint16_t tmp;
+ ErrorType result = rawGetParamU16(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (uint64_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_U32)
+ {
+ uint32_t tmp;
+ ErrorType result = rawGetParamU32(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (uint64_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_U64)
+ {
+ uint64_t tmp;
+ ErrorType result = rawGetParamU64(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (uint64_t)tmp;
+ return(ERROR_NONE);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamU64(const Handle &handle, uint64_t val)
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_U64)
+ {
+ return rawSetParamU64(handle, val);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_U32)
+ {
+ return rawSetParamU32(handle, (uint32_t)val);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_U16)
+ {
+ return rawSetParamU16(handle, (uint16_t)val);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_U8)
+ {
+ return rawSetParamU8(handle, (uint8_t)val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamU64Array(const Handle &handle, uint64_t *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(U64)
+ return(rawGetParamU64Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamU64Array(const Handle &handle, const uint64_t *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(U64)
+ return(rawSetParamU64Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** F32
+//******************************************************************************
+
+ErrorType NvParameters::getParamF32(const Handle &handle, float &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_F32)
+ {
+ return rawGetParamF32(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamF32(const Handle &handle, float val)
+{
+ CHECK_HANDLE
+ CHECK_F32_FINITE
+
+ if(handle.parameterDefinition()->type() == TYPE_F32)
+ {
+ return rawSetParamF32(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamF32Array(const Handle &handle, float *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(F32)
+ return(rawGetParamF32Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamF32Array(const Handle &handle, const float *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(F32)
+ CHECK_F32_FINITE_ARRAY
+ return(rawSetParamF32Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** F64
+//******************************************************************************
+
+ErrorType NvParameters::getParamF64(const Handle &handle, double &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_F32)
+ {
+ float tmp;
+ ErrorType result = rawGetParamF32(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (double)tmp;
+ return(ERROR_NONE);
+ }
+
+ if(handle.parameterDefinition()->type() == TYPE_F64)
+ {
+ double tmp;
+ ErrorType result = rawGetParamF64(handle, tmp);
+ PX_ASSERT(result == ERROR_NONE);
+
+ if(result != ERROR_NONE)
+ return(result);
+ val = (double)tmp;
+ return(ERROR_NONE);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamF64(const Handle &handle, double val)
+{
+ CHECK_HANDLE
+ CHECK_F64_FINITE
+
+ if(handle.parameterDefinition()->type() == TYPE_F64)
+ {
+ return rawSetParamF64(handle, val);
+ }
+ else if(handle.parameterDefinition()->type() == TYPE_F32)
+ {
+ return rawSetParamF32(handle, (float)val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::setParamF64Array(const Handle &handle, const double *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(F64)
+ CHECK_F64_FINITE_ARRAY
+ return(rawSetParamF64Array(handle, array, n, offset));
+}
+
+/**
+# When shrinking a dynamic array, the array may contain dynamically allocated Refs or Strings.
+# It may also contain Structs that contain these items, we'll call them all "dynamic parameters".
+#
+# To handle this, we generate, for every dynamic array with dynamic parameters, handle indices in
+# the Parameter Definition that help the NvParameters::rawResizeArray() method find these parameters
+# and destroy them quickly (without having to recursively traverse the parameters).
+#
+# The handle indices are layed out like this for the following struct:
+# [ handleDepth0, 3, handleDepth1, 5 ] - handleDepth0 = handleDepth1 = 1
+# struct myStruct {
+# float a;
+# float b;
+# float c;
+# string myString;
+# float a;
+# ref myRef;
+# }
+#
+# You can see that myString and myRef are the only two dynamically allocated members that need
+# to be destroyed, so only their indices appear in the list.
+#
+# Note: Currently, we only support 1D arrays with dynamic parameters in the top most struct.
+# array[i].myString is supported
+# array[i].structa.myString is supported
+# array[i].structa.structb.myString is NOT supported
+*/
+ErrorType NvParameters::releaseDownsizedParameters(const Handle &handle, int newSize, int oldSize)
+{
+ // if downsizing array, release dynamic parameters
+ // for now, just do 1D arrays
+ if( newSize >= oldSize )
+ {
+ return ERROR_NONE;
+ }
+
+ uint32_t numIndices=0;
+ Handle tmpHandle(handle);
+
+ const uint8_t *hIndices = tmpHandle.parameterDefinition()->getDynamicHandleIndicesMap(numIndices);
+
+ if( numIndices )
+ {
+ // from array[new_size] to array[old_size]
+ for( int i=newSize; i<oldSize; i++ )
+ {
+ tmpHandle.set( i );
+
+ for( uint32_t j=0; j<numIndices; )
+ {
+ // set the handle up to point to the right dynamic parameter
+ uint8_t indexDepth = hIndices[j];
+ int k=0;
+ for( ; k<indexDepth; k++ )
+ {
+ tmpHandle.set( hIndices[j+k+1] );
+ }
+ j += k + 1;
+
+ // now we have a handle that's pointing to the dynamic parameter, release it
+ DataType type = tmpHandle.parameterDefinition()->type();
+ if( type == TYPE_STRING )
+ {
+ tmpHandle.setParamString( NULL );
+ }
+ else if( type == TYPE_REF )
+ {
+ NvParameterized::Interface * paramPtr = 0;
+ tmpHandle.getParamRef( paramPtr );
+ if( paramPtr )
+ {
+ paramPtr->destroy();
+ tmpHandle.setParamRef( NULL );
+ }
+ }
+ else if( type == TYPE_ENUM )
+ {
+ // nothing to do on a downsize
+ }
+ else
+ {
+ PX_ASSERT( 0 && "Invalid dynamically allocated type defined in Definition handle list" );
+ }
+
+ // reset the handle
+ if( indexDepth > 0 )
+ {
+ tmpHandle.popIndex( indexDepth );
+ }
+ }
+
+ tmpHandle.popIndex();
+ }
+ }
+
+ return ERROR_NONE;
+}
+
+
+
+/**
+# When growing a dynamic array, the array may contain Enums or Structs that contain enums.
+#
+# To handle this, we generate, for every dynamic array with enums, handle indices in
+# the Parameter Definition that help the NvParameters::rawResizeArray() method find these parameters
+# and initialized them quickly (without having to recursively traverse the parameters).
+#
+# Note: Currently, we only support 1D arrays with enums in the top most struct.
+# array[i].enumA is supported
+# array[i].structa.enumA is supported
+# array[i].structa.structb.enumA is NOT supported
+*/
+ErrorType NvParameters::initNewResizedParameters(const Handle &handle, int newSize, int oldSize)
+{
+ // if downsizing array, release dynamic parameters
+ // for now, just do 1D arrays
+ if( newSize <= oldSize )
+ {
+ return ERROR_NONE;
+ }
+
+ uint32_t numIndices=0;
+ Handle tmpHandle(handle);
+
+ const uint8_t *hIndices = tmpHandle.parameterDefinition()->getDynamicHandleIndicesMap(numIndices);
+
+ if( numIndices )
+ {
+ // from array[new_size] to array[old_size]
+ for( int i=oldSize; i<newSize; i++ )
+ {
+ tmpHandle.set( i );
+
+ for( uint32_t j=0; j<numIndices; )
+ {
+ // set the handle up to point to the right dynamic parameter
+ uint8_t indexDepth = hIndices[j];
+ int k=0;
+ for( ; k<indexDepth; k++ )
+ {
+ tmpHandle.set( hIndices[j+k+1] );
+ }
+ j += k + 1;
+
+ // now we have a handle that's pointing to the dynamic parameter, release it
+ DataType type = tmpHandle.parameterDefinition()->type();
+ if( type == TYPE_STRING || type == TYPE_REF )
+ {
+ // nothing to do on an array growth
+ }
+ else if( type == TYPE_ENUM )
+ {
+ // this is not the default value, but that's not available from here
+ // we could possibly store the enum default values, or just always make them first
+ tmpHandle.setParamEnum( tmpHandle.parameterDefinition()->enumVal(0) );
+ }
+ else if( type == TYPE_ARRAY )
+ {
+ // FIXME: we do not fully support arrays here, this is just a brain-dead stub
+
+ const Definition *pd = 0;
+ for(pd = tmpHandle.parameterDefinition(); pd->type() == TYPE_ARRAY; pd = pd->child(0))
+ {
+ PX_ASSERT( pd->numChildren() == 1 );
+ }
+
+ if( pd->type() != TYPE_STRING && pd->type() != TYPE_REF )
+ PX_ASSERT( 0 && "Invalid dynamically allocated type defined in Definition handle list" );
+ }
+ else
+ {
+ PX_ASSERT( 0 && "Invalid dynamically allocated type defined in Definition handle list" );
+ }
+
+ // reset the handle
+ if( indexDepth > 0 )
+ {
+ tmpHandle.popIndex( indexDepth );
+ }
+ }
+
+ tmpHandle.popIndex();
+ }
+ }
+
+ return ERROR_NONE;
+}
+
+ErrorType NvParameters::rawResizeArray(const Handle &handle, int new_size)
+{
+ size_t offset;
+ ErrorType ret;
+ void *ptr=NULL;
+
+ Handle arrayRootHandle(handle);
+
+ // We should consider storing alignment in dynamic array struct at some point
+ uint32_t align = arrayRootHandle.parameterDefinition()->alignment();
+ if( 0 == align )
+ align = 8; // Default alignment
+
+ int dimension = 0;
+
+ while(arrayRootHandle.parameterDefinition()->parent() &&
+ arrayRootHandle.parameterDefinition()->parent()->type() == TYPE_ARRAY)
+ {
+ arrayRootHandle.popIndex();
+ dimension++;
+ }
+
+ getVarPtr(arrayRootHandle, ptr, offset);
+ if ( ptr == NULL )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_TYPE_NOT_SUPPORTED");
+ return ERROR_TYPE_NOT_SUPPORTED;
+ }
+
+ DummyDynamicArrayStruct *dynArray = (DummyDynamicArrayStruct *)ptr;
+ int old_size = dynArray->arraySizes[0];
+
+ releaseDownsizedParameters(handle, new_size, old_size);
+
+ ret = resizeArray(mParameterizedTraits,
+ dynArray->buf,
+ dynArray->arraySizes,
+ arrayRootHandle.parameterDefinition()->arrayDimension(),
+ dimension,
+ new_size,
+ dynArray->isAllocated,
+ dynArray->elementSize,
+ align,
+ dynArray->isAllocated);
+
+ initNewResizedParameters(handle, new_size, old_size);
+
+ return ret;
+}
+
+ErrorType NvParameters::rawGetArraySize(const Handle &array_handle, int &size, int dimension) const
+{
+ size_t offset;
+ void *ptr=NULL;
+ getVarPtr(array_handle, ptr, offset);
+ if ( ptr == NULL )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_TYPE_NOT_SUPPORTED");
+ return ERROR_TYPE_NOT_SUPPORTED;
+ }
+
+ DummyDynamicArrayStruct *dynArray = (DummyDynamicArrayStruct *)ptr;
+ size = dynArray->arraySizes[dimension];
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawSwapArrayElements(const Handle &array_handle, unsigned int firstElement, unsigned int secondElement)
+{
+ size_t offset = 0;
+ void* ptr = NULL;
+ Handle arrayRootHandle(array_handle);
+
+ getVarPtr(arrayRootHandle, ptr, offset);
+ if ( ptr == NULL )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_TYPE_NOT_SUPPORTED");
+ return ERROR_TYPE_NOT_SUPPORTED;
+ }
+
+ DummyDynamicArrayStruct* dynArray = reinterpret_cast<DummyDynamicArrayStruct*>(ptr);
+
+ const int elementSize = dynArray->elementSize;
+
+ char tempDataStack[64];
+ void* tempData = tempDataStack;
+
+ void* tempDataHeap = NULL;
+ PX_ASSERT(elementSize > 0);
+ PX_ASSERT(sizeof(elementSize) <= sizeof(uint32_t));
+ if (elementSize > 64)
+ {
+ tempDataHeap = mParameterizedTraits->alloc(static_cast<uint32_t>(elementSize));
+ tempData = tempDataHeap;
+ }
+
+ char* firstPtr = (char*)dynArray->buf + elementSize * firstElement;
+ char* secondPtr = (char*)dynArray->buf + elementSize * secondElement;
+
+ physx::intrinsics::memCopy(tempData, firstPtr, static_cast<uint32_t>(elementSize));
+ physx::intrinsics::memCopy(firstPtr, secondPtr, static_cast<uint32_t>(elementSize));
+ physx::intrinsics::memCopy(secondPtr, tempData, static_cast<uint32_t>(elementSize));
+
+ if (tempDataHeap != NULL)
+ {
+ mParameterizedTraits->free(tempDataHeap);
+ }
+
+ return(ERROR_NONE);
+}
+
+#define ARRAY_HANDLE_CHECKS \
+ if(!array_handle.isValid()) \
+ { \
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INVALID_PARAMETER_HANDLE");\
+ return(ERROR_INVALID_PARAMETER_HANDLE); \
+ }\
+ if(array_handle.parameterDefinition()->type() != TYPE_ARRAY) \
+ {\
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_NOT_AN_ARRAY"); \
+ return(ERROR_NOT_AN_ARRAY); \
+ }
+
+
+ErrorType NvParameters::resizeArray(const Handle &array_handle, int32_t new_size)
+{
+ ARRAY_HANDLE_CHECKS
+
+ if(new_size < 0)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INVALID_ARRAY_SIZE");
+ return(ERROR_INVALID_ARRAY_SIZE);
+ }
+
+ if(array_handle.parameterDefinition()->arraySizeIsFixed())
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_ARRAY_SIZE_IS_FIXED");
+ return(ERROR_ARRAY_SIZE_IS_FIXED);
+ }
+
+ return(rawResizeArray(array_handle, new_size));
+}
+
+ErrorType NvParameters::swapArrayElements(const Handle &array_handle, uint32_t firstElement, uint32_t secondElement)
+{
+ ARRAY_HANDLE_CHECKS;
+
+ if (firstElement == secondElement)
+ return(ERROR_NONE);
+
+ int array_size = 0;
+ rawGetArraySize(array_handle, array_size, 0);
+
+ if (array_size < 1)
+ return(ERROR_NONE);
+
+ if (firstElement >= (unsigned int)array_size)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ if (secondElement >= (unsigned int)array_size)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ // well, maybe swapping will work on fixed size arrays as well...
+ if (array_handle.parameterDefinition()->arraySizeIsFixed())
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_ARRAY_SIZE_IS_FIXED");
+ return(ERROR_ARRAY_SIZE_IS_FIXED);
+ }
+
+ return rawSwapArrayElements(array_handle, firstElement, secondElement);
+}
+
+ErrorType NvParameters::
+ getArraySize(const Handle &array_handle, int32_t &size, int32_t dimension) const
+{
+ ARRAY_HANDLE_CHECKS
+
+ if(dimension < 0 || dimension >= array_handle.parameterDefinition()->arrayDimension())
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INVALID_ARRAY_DIMENSION");
+ return(ERROR_INVALID_ARRAY_DIMENSION);
+ }
+
+ if(array_handle.parameterDefinition()->arraySizeIsFixed())
+ {
+ size = array_handle.parameterDefinition()->arraySize(dimension);
+ return(ERROR_NONE);
+ }
+
+ return(rawGetArraySize(array_handle, size, dimension));
+}
+
+ErrorType NvParameters::callPreSerializeCallback(Handle& handle) const
+{
+ const Definition* def = handle.parameterDefinition();
+ if (def->type() == TYPE_REF)
+ {
+ // don't preSerialize Named References
+ const Hint *hint = def->hint("INCLUDED");
+ if( hint &&
+ hint->type() == TYPE_U64 &&
+ hint->asUInt() == 1 )
+ {
+ // included
+ NvParameterized::Interface* ref = NULL;
+ NV_ERR_CHECK_RETURN( getParamRef(handle, ref) );
+ if( ref )
+ {
+ NV_ERR_CHECK_RETURN( ref->callPreSerializeCallback() );
+ }
+ }
+ }
+ else if (def->type() == TYPE_ARRAY)
+ {
+ int32_t arraySize = 0;
+ getArraySize(handle, arraySize);
+
+ for (int32_t i = 0; i < arraySize; i++)
+ {
+ handle.set(i);
+
+ NV_ERR_CHECK_RETURN( callPreSerializeCallback(handle) );
+
+ handle.popIndex();
+ }
+ }
+ else if (def->type() == TYPE_STRUCT)
+ {
+ const int32_t numChildren = def->numChildren();
+
+ for (int32_t childIndex = 0; childIndex < numChildren; childIndex++)
+ {
+ handle.set(childIndex);
+
+ NV_ERR_CHECK_RETURN( callPreSerializeCallback(handle) );
+
+ handle.popIndex();
+ }
+ }
+
+ return ERROR_NONE;
+}
+
+ErrorType NvParameters::checkParameterHandle(const Handle &handle) const
+{
+ PX_ASSERT( handle.getConstInterface() );
+ PX_ASSERT( handle.getConstInterface() == this );
+
+ if (!handle.isValid())
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INVALID_PARAMETER_HANDLE");
+ return(ERROR_INVALID_PARAMETER_HANDLE);
+ }
+
+ if (handle.getConstInterface() == NULL )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_HANDLE_MISSING_INTERFACE_POINTER");
+ return(ERROR_HANDLE_MISSING_INTERFACE_POINTER);
+ }
+
+ if (handle.getConstInterface() != this )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_HANDLE_INVALID_INTERFACE_POINTER");
+ return(ERROR_HANDLE_INVALID_INTERFACE_POINTER);
+ }
+
+ if(handle.parameterDefinition()->root() != rootParameterDefinition())
+ {
+ return(ERROR_PARAMETER_HANDLE_DOES_NOT_MATCH_CLASS);
+ }
+
+
+ const Definition *ptr = rootParameterDefinition();
+ for(int32_t i=0; i < handle.numIndexes(); ++i)
+ {
+ PX_ASSERT(ptr != NULL);
+
+ switch(ptr->type())
+ {
+ case TYPE_STRUCT:
+ if(handle.index(i) >= ptr->numChildren())
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+ ptr = ptr->child(handle.index(i));
+ break;
+
+ case TYPE_ARRAY:
+ {
+ int32_t size = ptr->arraySize();
+ Handle tmpHandle(handle);
+ tmpHandle.popIndex(handle.numIndexes() - i);
+
+ if(size <= 0)
+ if(getArraySize(tmpHandle, size) != ERROR_NONE)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ if(handle.index(i) >= size)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ ptr = ptr->child(0);
+ }
+ break;
+
+ NV_PARAMETRIZED_NO_AGGREGATE_DATATYPE_LABELS
+ default:
+ PX_ALWAYS_ASSERT();
+ ptr = NULL;
+ }
+ }
+
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::clone(NvParameterized::Interface *&nullDestObject) const
+{
+ PX_ASSERT(nullDestObject == NULL );
+ nullDestObject = mParameterizedTraits->createNvParameterized(className(), version());
+ if( !nullDestObject )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_OBJECT_CONSTRUCTION_FAILED");
+ return ERROR_OBJECT_CONSTRUCTION_FAILED;
+ }
+
+ ErrorType err = nullDestObject->copy(*this);
+ if( ERROR_NONE != err )
+ {
+ nullDestObject->destroy();
+ nullDestObject = NULL;
+ }
+
+ return err;
+}
+
+ErrorType NvParameters::copy(const NvParameterized::Interface &other,
+ Handle &thisHandle)
+{
+ const Definition *paramDef = thisHandle.parameterDefinition();
+ ErrorType error = ERROR_NONE;
+
+ if( paramDef->type() == TYPE_STRUCT )
+ {
+ for(int32_t i=0; i < paramDef->numChildren(); ++i)
+ {
+ thisHandle.set(i);
+ error = copy(other, thisHandle);
+ NV_ERR_CHECK_RETURN(error);
+
+ thisHandle.popIndex();
+ }
+ return(error);
+ }
+ else if( paramDef->type() == TYPE_ARRAY )
+ {
+ int32_t thisSize, otherSize;
+
+ error = thisHandle.getArraySize(thisSize);
+ NV_ERR_CHECK_RETURN(error);
+
+ Handle otherHandle = thisHandle;
+ otherHandle.setInterface(&other);
+ error = otherHandle.getArraySize(otherSize);
+ NV_ERR_CHECK_RETURN(error);
+
+ thisHandle.setInterface(this);
+
+ if(thisSize != otherSize)
+ {
+ error = thisHandle.resizeArray(otherSize);
+ NV_ERR_CHECK_RETURN(error);
+ thisSize = otherSize;
+ }
+
+ for(int32_t i=0; i < otherSize; ++i)
+ {
+ thisHandle.set(i);
+
+ error = this->copy(other, thisHandle);
+ NV_ERR_CHECK_RETURN(error);
+
+ thisHandle.popIndex();
+ }
+ return(error);
+ }
+
+ Handle otherHandle = thisHandle;
+ otherHandle.setInterface(&other);
+ switch(paramDef->type())
+ {
+ case TYPE_BOOL:
+ {
+ bool otherVal;
+ error = otherHandle.getParamBool(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamBool(otherVal) );
+ }
+
+ case TYPE_I8:
+ {
+ int8_t otherVal;
+ error = otherHandle.getParamI8(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamI8(otherVal) );
+ }
+
+ case TYPE_I16 :
+ {
+ int16_t otherVal;
+ error = otherHandle.getParamI16(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamI16(otherVal) );
+ }
+ case TYPE_I32 :
+ {
+ int32_t otherVal;
+ error = otherHandle.getParamI32(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamI32(otherVal) );
+ }
+ case TYPE_I64 :
+ {
+ int64_t otherVal;
+ error = otherHandle.getParamI64(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamI64(otherVal) );
+ }
+
+ case TYPE_U8 :
+ {
+ uint8_t otherVal;
+ error = otherHandle.getParamU8(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamU8(otherVal) );
+ }
+ case TYPE_U16 :
+ {
+ uint16_t otherVal;
+ error = otherHandle.getParamU16(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamU16(otherVal) );
+ }
+ case TYPE_U32 :
+ {
+ uint32_t otherVal;
+ error = otherHandle.getParamU32(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamU32(otherVal) );
+ }
+ case TYPE_U64 :
+ {
+ uint64_t otherVal;
+ error = otherHandle.getParamU64(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamU64(otherVal) );
+ }
+
+ case TYPE_F32 :
+ {
+ float otherVal;
+ error = otherHandle.getParamF32(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamF32(otherVal) );
+ }
+ case TYPE_F64 :
+ {
+ double otherVal;
+ error = otherHandle.getParamF64(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamF64(otherVal) );
+ }
+
+ case TYPE_VEC2 :
+ {
+ physx::PxVec2 otherVal;
+ error = otherHandle.getParamVec2(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamVec2(otherVal) );
+ }
+ case TYPE_VEC3 :
+ {
+ physx::PxVec3 otherVal;
+ error = otherHandle.getParamVec3(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamVec3(otherVal) );
+ }
+ case TYPE_VEC4 :
+ {
+ physx::PxVec4 otherVal;
+ error = otherHandle.getParamVec4(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamVec4(otherVal) );
+ }
+ case TYPE_QUAT :
+ {
+ physx::PxQuat otherVal;
+ error = otherHandle.getParamQuat(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamQuat(otherVal) );
+ }
+ case TYPE_MAT33 :
+ {
+ physx::PxMat33 otherVal;
+ error = otherHandle.getParamMat33(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamMat33(otherVal) );
+ }
+ case TYPE_MAT44 :
+ {
+ physx::PxMat44 otherVal;
+ error = otherHandle.getParamMat44(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamMat44(otherVal) );
+ }
+ case TYPE_MAT34 :
+ {
+ float otherVal[12];
+ error = otherHandle.getParamMat34Legacy(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamMat34Legacy(otherVal) );
+ }
+ case TYPE_BOUNDS3 :
+ {
+ physx::PxBounds3 otherVal;
+ error = otherHandle.getParamBounds3(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamBounds3(otherVal) );
+ }
+ case TYPE_TRANSFORM :
+ {
+ physx::PxTransform otherVal;
+ error = otherHandle.getParamTransform(otherVal);
+ NV_ERR_CHECK_RETURN( error );
+ return( thisHandle.setParamTransform(otherVal) );
+ }
+ case TYPE_STRING:
+ {
+ const char *val1;
+ error = otherHandle.getParamString(val1);
+ NV_ERR_CHECK_RETURN(error);
+ return(thisHandle.setParamString(val1));
+ }
+
+ case TYPE_ENUM:
+ {
+ const char *val1;
+ error = otherHandle.getParamEnum(val1);
+ NV_ERR_CHECK_RETURN(error);
+ return val1 ? thisHandle.setParamEnum(val1) : ERROR_NONE;
+ }
+
+ case TYPE_REF:
+ {
+ NvParameterized::Interface *thisRef, *otherRef;
+ error = thisHandle.getParamRef(thisRef);
+ NV_ERR_CHECK_RETURN(error);
+
+ error = otherHandle.getParamRef(otherRef);
+ NV_ERR_CHECK_RETURN(error);
+
+ if(thisRef)
+ {
+ thisRef->destroy();
+ thisHandle.setParamRef(NULL);
+ }
+
+ if(otherRef)
+ {
+ error = thisHandle.initParamRef(otherRef->className(), true);
+ NV_ERR_CHECK_RETURN(error);
+
+ error = thisHandle.getParamRef(thisRef);
+ NV_ERR_CHECK_RETURN(error);
+
+ if(thisRef == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_PARAMETER_HANDLE_NOT_INITIALIZED");
+ return(ERROR_PARAMETER_HANDLE_NOT_INITIALIZED);
+ }
+
+ return(thisRef->copy(*otherRef));
+ }
+ }
+ break;
+
+ case TYPE_POINTER:
+ //Just don't do anything with pointers
+ break;
+
+ NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+ NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS
+ default:
+ PX_ALWAYS_ASSERT();
+ break;
+ }
+
+ return ERROR_NONE;
+}
+
+bool NvParameters::areParamsOK(Handle &handle, Handle *invalidHandles, uint32_t numInvalidHandles, uint32_t &numRemainingHandles)
+{
+ class Constraints
+ {
+ const Hint *min, *max, *multOf, *powOf;
+
+ static int64_t abs(int64_t x)
+ {
+ return x >= 0 ? x : -x;
+ }
+
+ public:
+ Constraints(const Hint *min_, const Hint *max_, const Hint *multOf_, const Hint *powOf_):
+ min(min_), max(max_), multOf(multOf_), powOf(powOf_) {}
+
+ bool isOK(uint64_t val)
+ {
+ bool res = true;
+
+ if( min )
+ res = res && val >= min->asUInt();
+
+ if( max )
+ res = res && val <= max->asUInt();
+
+ if( multOf )
+ res = res && 0 == val % multOf->asUInt();
+
+ if( powOf )
+ {
+ //TODO: this is too slow
+ uint64_t base = powOf->asUInt(), acc = 1;
+ while( acc < val )
+ acc *= base;
+ res = res && acc == base;
+ }
+
+ return res;
+ }
+
+ bool isOK(int64_t val)
+ {
+ bool res = true;
+
+ if( min )
+ res = res && val >= int64_t(min->asUInt());
+
+ if( max )
+ res = res && val <= int64_t(max->asUInt());
+
+ if( multOf )
+ res = res && 0 == val % int64_t(multOf->asUInt());
+
+ if( powOf )
+ {
+ //TODO: this is too slow
+ int64_t base = int64_t(powOf->asUInt()), acc = 1;
+ while( abs(acc) < val )
+ acc *= base;
+ res = res && abs(acc) == base;
+ }
+
+ return res;
+ }
+
+ bool isOK(float val)
+ {
+ bool res = true;
+
+ if( min )
+ res = res && val >= float(min->asFloat());
+
+ if( max )
+ res = res && val <= float(max->asFloat());
+
+ if( multOf )
+ res = res && 0.0f == (float)fmod(val, float(multOf->asFloat()));
+
+ //TODO
+ if( powOf)
+ {
+ PX_ALWAYS_ASSERT();
+ return false;
+ }
+
+ return res;
+ }
+
+ bool isOK(double val)
+ {
+ bool res = true;
+
+ if( min )
+ res = res && val >= min->asFloat();
+
+ if( max )
+ res = res && val <= max->asFloat();
+
+ if( multOf )
+ res = res && 0.0f == (float)fmod((float)val, (float)multOf->asFloat());
+
+ //TODO
+ if( powOf )
+ {
+ PX_ALWAYS_ASSERT();
+ return false;
+ }
+
+ return res;
+ }
+ };
+
+ bool res = true;
+
+ const Definition *pd = handle.parameterDefinition();
+
+ Constraints con(pd->hint("min"), pd->hint("max"), pd->hint("multipleOf"), pd->hint("powerOf"));
+
+ switch( pd->type() )
+ {
+ case TYPE_STRUCT:
+ {
+ for(int32_t i = 0; i < pd->numChildren(); ++i)
+ {
+ handle.set(i);
+ res &= areParamsOK(handle, invalidHandles, numInvalidHandles, numRemainingHandles);
+ handle.popIndex();
+ }
+ return res;
+ }
+
+ case TYPE_ARRAY:
+ {
+ int32_t arraySize = -1;
+ NV_BOOL_RETURN( handle.getArraySize(arraySize) );
+
+ for(int32_t i=0; i < arraySize; ++i)
+ {
+ handle.set(i);
+ res &= areParamsOK(handle, invalidHandles, numInvalidHandles, numRemainingHandles);
+ handle.popIndex();
+ }
+ return res;
+ }
+
+ case TYPE_BOOL:
+ case TYPE_U8:
+ case TYPE_U16:
+ case TYPE_U32:
+ case TYPE_U64:
+ {
+ uint64_t val;
+ NV_BOOL_RETURN( handle.getParamU64(val) );
+ res = con.isOK(val);
+ if( !res && numRemainingHandles > 0 )
+ invalidHandles[numRemainingHandles++ - 1] = handle;
+ return res;
+ }
+
+ case TYPE_I8:
+ case TYPE_I16:
+ case TYPE_I32:
+ case TYPE_I64:
+ {
+ int64_t val;
+ NV_BOOL_RETURN( handle.getParamI64(val) );
+ res = con.isOK(val);
+ if( !res && numRemainingHandles > 0 )
+ invalidHandles[numRemainingHandles++ - 1] = handle;
+ return res;
+ }
+
+ case TYPE_F32:
+ {
+ float val = -1;
+ NV_BOOL_RETURN( handle.getParamF32(val) );
+ res = con.isOK(val);
+ if( !res && numRemainingHandles > 0 )
+ invalidHandles[numRemainingHandles++ - 1] = handle;
+ return res;
+ }
+
+ case TYPE_F64:
+ {
+ double val = -1;
+ NV_BOOL_RETURN( handle.getParamF64(val) );
+ res = con.isOK(val);
+ if( !res && numRemainingHandles > 0 )
+ invalidHandles[numRemainingHandles++ - 1] = handle;
+ return res;
+ }
+
+ NV_PARAMETRIZED_NO_AGGREGATE_AND_ARITHMETIC_DATATYPE_LABELS
+ default:
+ return true;
+ }
+}
+
+bool NvParameters::equals(const NvParameterized::Interface &obj,
+ Handle &param_handle,
+ Handle *handlesOfInequality,
+ uint32_t numHandlesOfInequality,
+ bool doCompareNotSerialized) const
+{
+ const Definition *paramDef = param_handle.parameterDefinition();
+
+ if (!doCompareNotSerialized && paramDef->hint("DONOTSERIALIZE") )
+ return true;
+
+ DataType type = paramDef->type();
+ switch(type)
+ {
+#define NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+#define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ case TYPE_ ## enum_name: \
+ { \
+ c_type a; \
+ c_type b; \
+ param_handle.setInterface(this); \
+ NV_BOOL_RETURN( param_handle.getParam ## type_name(a) ); \
+ param_handle.setInterface(&obj); \
+ NV_BOOL_RETURN( param_handle.getParam ## type_name(b) ); \
+ return !notEqual(a, b); \
+ }
+#include "nvparameterized/NvParameterized_types.h"
+
+ case TYPE_MAT34:
+ {
+ float a[12];
+ float b[12];
+ param_handle.setInterface(this);
+ NV_BOOL_RETURN( param_handle.getParamMat34Legacy(a) );
+ param_handle.setInterface(&obj);
+ NV_BOOL_RETURN( param_handle.getParamMat34Legacy(b) );
+ return !notEqual(a, b);
+ }
+
+ case TYPE_REF:
+ {
+ NvParameterized::Interface *val1, *val2;
+
+ param_handle.setInterface( this );
+ if(param_handle.getParamRef(val1) != ERROR_NONE)
+ return(false);
+
+ param_handle.setInterface( &obj );
+ if(param_handle.getParamRef(val2) != ERROR_NONE)
+ return(false);
+
+ if(val1 == NULL && val2 == NULL)
+ return(true);
+ else if(val1 == NULL || val2 == NULL)
+ return(false);
+
+ return val2->equals(
+ *val1,
+ handlesOfInequality != NULL ? handlesOfInequality+1 : NULL,
+ numHandlesOfInequality > 0 ? numHandlesOfInequality-1 : 0,
+ doCompareNotSerialized );
+ }
+
+ case TYPE_STRUCT:
+ for(int32_t i = 0; i < paramDef->numChildren(); ++i)
+ {
+ param_handle.set(i);
+ if (!equals(obj, param_handle, handlesOfInequality, numHandlesOfInequality, doCompareNotSerialized))
+ return(false);
+ param_handle.popIndex();
+ }
+ return(true);
+
+ case TYPE_ARRAY:
+ {
+ int32_t arraySize1, arraySize2;
+
+ param_handle.setInterface (this);
+ if (param_handle.getArraySize(arraySize1) != ERROR_NONE)
+ return(false);
+
+ param_handle.setInterface (&obj);
+ if (param_handle.getArraySize(arraySize2) != ERROR_NONE)
+ return(false);
+
+ if(arraySize1 != arraySize2)
+ return(false);
+
+ if( arraySize1 > 100 && paramDef->isSimpleType(false, false) )
+ {
+ // Large array of simple types, fast path
+
+ switch( type)
+ {
+ NV_PARAMETRIZED_NO_ARITHMETIC_AND_LINAL_DATATYPE_LABELS
+ NV_PARAMETRIZED_LEGACY_DATATYPE_LABELS
+ default:
+ // Fall to slow path, including TYPE_MAT34 case
+ break;
+
+#define NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+#define NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+#define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ case TYPE_ ## enum_name: { \
+ uint32_t byteSize = static_cast<uint32_t>(sizeof(c_type)) * arraySize1; \
+ c_type *data1 = (c_type *)mParameterizedTraits->alloc(byteSize), \
+ *data2 = (c_type *)mParameterizedTraits->alloc(byteSize); \
+ \
+ param_handle.setInterface(this); \
+ NV_BOOL_RETURN(param_handle.getParam ## type_name ## Array(data1, arraySize1)); \
+ \
+ param_handle.setInterface(&obj); \
+ NV_BOOL_RETURN(param_handle.getParam ## type_name ## Array(data2, arraySize2)); \
+ \
+ int ret = memcmp(data1, data2, byteSize); \
+ mParameterizedTraits->free(data1); \
+ mParameterizedTraits->free(data2); \
+ \
+ return ret == 0; \
+ }
+#include "nvparameterized/NvParameterized_types.h"
+ }
+ }
+
+ // Array of aggregates, slow path
+
+ param_handle.setInterface(this);
+
+ for (int32_t i = 0; i < arraySize1; ++i)
+ {
+ param_handle.set(i);
+ if (!equals(obj, param_handle, handlesOfInequality, numHandlesOfInequality, doCompareNotSerialized))
+ return(false);
+ param_handle.popIndex();
+ }
+
+ return(true);
+ }
+
+ case TYPE_POINTER:
+ return true;
+
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+ default:
+ PX_ALWAYS_ASSERT();
+ break;
+ }
+
+ return(false);
+}
+
+ErrorType NvParameters::copy(const NvParameterized::Interface &other)
+{
+ if (this == &other)
+ {
+ return(ERROR_NONE);
+ }
+
+ if (rootParameterDefinition() != other.rootParameterDefinition())
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_PARAMETER_DEFINITIONS_DO_NOT_MATCH");
+ return(ERROR_PARAMETER_DEFINITIONS_DO_NOT_MATCH);
+ }
+
+ // support empty, named references
+ if (rootParameterDefinition() == NULL)
+ {
+ // the name or className could be NULL, strcmp doesn't like NULL strings...
+ setClassName(other.className());
+ setName(other.name());
+ return(ERROR_NONE);
+ }
+ else
+ {
+ Handle handle (*this);
+ if (getParameterHandle("", handle) != ERROR_NONE)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INVALID_PARAMETER_HANDLE");
+ return(ERROR_INVALID_PARAMETER_HANDLE);
+ }
+
+ return(copy(other, handle));
+ }
+}
+
+bool NvParameters::areParamsOK(Handle *invalidHandles, uint32_t numInvalidHandles)
+{
+ Handle handle(*this);
+ NV_BOOL_RETURN( getParameterHandle("", handle) );
+
+ uint32_t numRemainingHandles = numInvalidHandles;
+ return areParamsOK(handle, invalidHandles, numInvalidHandles, numRemainingHandles);
+}
+
+bool NvParameters::equals(const NvParameterized::Interface &obj, Handle* handleOfInequality, uint32_t numHandlesOfInequality, bool doCompareNotSerialized) const
+{
+ if( this == &obj )
+ return(true);
+
+ if(rootParameterDefinition() != obj.rootParameterDefinition())
+ return(false);
+
+ // support empty, named references
+ if(rootParameterDefinition() == NULL)
+ {
+ // the name or className could be NULL, strcmp doesn't like NULL strings...
+ return 0 == safe_strcmp(name(), obj.name()) && 0 == safe_strcmp(className(), obj.className());
+ }
+
+ // This should be a handle that can not set any values!
+ Handle constHandle(*this);
+ NV_BOOL_RETURN( getParameterHandle("", constHandle) );
+
+ bool theSame = equals(obj, constHandle, handleOfInequality, numHandlesOfInequality, doCompareNotSerialized);
+
+ if (!theSame && numHandlesOfInequality > 0)
+ *handleOfInequality = constHandle;
+
+ return theSame;
+}
+
+ErrorType NvParameters::valueToStr(const Handle &handle,
+ char *buf,
+ uint32_t n,
+ const char *&ret)
+{
+ PX_ASSERT(buf != NULL);
+ PX_ASSERT(n > 0);
+
+ if(!handle.isValid())
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INVALID_PARAMETER_HANDLE");
+ return(ERROR_INVALID_PARAMETER_HANDLE);
+ }
+
+ const Definition *paramDef = handle.parameterDefinition();
+
+ ErrorType error = ERROR_TYPE_NOT_SUPPORTED;
+
+ switch(paramDef->type())
+ {
+ case TYPE_VEC2:
+ {
+ physx::PxVec2 val;
+ if ((error = getParamVec2(handle, val)) == ERROR_NONE)
+ {
+ char f[2][physx::PxAsc::PxF32StrLen];
+ physx::shdfnd::snprintf(buf, n,"%s %s",
+ physx::PxAsc::valueToStr(val.x, f[0], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.y, f[1], physx::PxAsc::PxF32StrLen));
+ ret = buf;
+ }
+ }
+ break;
+ case TYPE_VEC3:
+ {
+ physx::PxVec3 val;
+ if ((error = getParamVec3(handle, val)) == ERROR_NONE)
+ {
+ char f[3][physx::PxAsc::PxF32StrLen];
+ physx::shdfnd::snprintf(buf, n,"%s %s %s",
+ physx::PxAsc::valueToStr(val.x, f[0], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.y, f[1], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.z, f[2], physx::PxAsc::PxF32StrLen));
+ ret = buf;
+ }
+ }
+ break;
+ case TYPE_VEC4:
+ {
+ physx::PxVec4 val;
+ if ((error = getParamVec4(handle, val)) == ERROR_NONE)
+ {
+ char f[4][physx::PxAsc::PxF32StrLen];
+ physx::shdfnd::snprintf(buf, n,"%s %s %s %s",
+ physx::PxAsc::valueToStr(val.x, f[0], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.y, f[1], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.z, f[2], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.w, f[3], physx::PxAsc::PxF32StrLen));
+ ret = buf;
+ }
+ }
+ break;
+ case TYPE_QUAT:
+ {
+ physx::PxQuat val;
+ if ((error = getParamQuat(handle, val)) == ERROR_NONE)
+ {
+ float quat[4];
+ //val.getXYZW(quat);
+ quat[0] = val.x; quat[1] = val.y; quat[2] = val.z; quat[3] = val.w;
+ char f[4][physx::PxAsc::PxF32StrLen];
+ physx::shdfnd::snprintf(buf, n,"%s %s %s %s",
+ physx::PxAsc::valueToStr(quat[0], f[0], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(quat[1], f[1], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(quat[2], f[2], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(quat[3], f[3], physx::PxAsc::PxF32StrLen));
+
+ ret = buf;
+ }
+ }
+ break;
+ case TYPE_MAT33:
+ {
+ physx::PxMat33 val;
+ if ((error = getParamMat33(handle, val)) == ERROR_NONE)
+ {
+ char f[9][physx::PxAsc::PxF32StrLen];
+ const float *vals = val.front();
+ physx::shdfnd::snprintf(buf, n,"%s %s %s %s %s %s %s %s %s",
+ physx::PxAsc::valueToStr(vals[0], f[0], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[1], f[1], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[2], f[2], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[3], f[3], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[4], f[4], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[5], f[5], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[6], f[6], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[7], f[7], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[8], f[8], physx::PxAsc::PxF32StrLen));
+ ret = buf;
+ }
+ }
+ break;
+ case TYPE_MAT44:
+ {
+ physx::PxMat44 val;
+ if ((error = getParamMat44(handle, val)) == ERROR_NONE)
+ {
+ char f[16][physx::PxAsc::PxF32StrLen];
+ const float *vals = val.front();
+ physx::shdfnd::snprintf(buf, n,"%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s",
+ physx::PxAsc::valueToStr(vals[0], f[0], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[1], f[1], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[2], f[2], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[3], f[3], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[4], f[4], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[5], f[5], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[6], f[6], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[7], f[7], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[8], f[8], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[9], f[9], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[10], f[10], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[11], f[11], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[12], f[12], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[13], f[13], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[14], f[14], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[15], f[15], physx::PxAsc::PxF32StrLen));
+ ret = buf;
+ }
+ }
+ break;
+ case TYPE_MAT34:
+ {
+ float vals[12];
+ if ((error = getParamMat34Legacy(handle, vals)) == ERROR_NONE)
+ {
+ char f[16][physx::PxAsc::PxF32StrLen];
+ physx::shdfnd::snprintf(buf, n,"%s %s %s %s %s %s %s %s %s %s %s %s",
+ physx::PxAsc::valueToStr(vals[0], f[0], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[1], f[1], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[2], f[2], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[3], f[3], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[4], f[4], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[5], f[5], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[6], f[6], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[7], f[7], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[8], f[8], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[9], f[9], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[10], f[10], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(vals[11], f[11], physx::PxAsc::PxF32StrLen));
+ ret = buf;
+ }
+ }
+ break;
+ case TYPE_BOUNDS3:
+ {
+ char f[6][physx::PxAsc::PxF32StrLen];
+ physx::PxBounds3 val;
+ if ((error = getParamBounds3(handle, val)) == ERROR_NONE)
+ {
+ physx::shdfnd::snprintf(buf, n,"%s %s %s %s %s %s ",
+ physx::PxAsc::valueToStr(val.minimum.x, f[0], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.minimum.y, f[1], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.minimum.z, f[2], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.maximum.x, f[3], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.maximum.y, f[4], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.maximum.z, f[5], physx::PxAsc::PxF32StrLen));
+ ret = buf;
+ }
+ }
+ break;
+ case TYPE_TRANSFORM:
+ {
+ char f[7][physx::PxAsc::PxF32StrLen];
+ physx::PxTransform val;
+ if ((error = getParamTransform(handle, val)) == ERROR_NONE)
+ {
+ physx::shdfnd::snprintf(buf, n,"%s %s %s %s %s %s %s ",
+ physx::PxAsc::valueToStr(val.q.x, f[0], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.q.y, f[1], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.q.z, f[2], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.q.w, f[3], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.p.x, f[4], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.p.y, f[5], physx::PxAsc::PxF32StrLen),
+ physx::PxAsc::valueToStr(val.p.z, f[6], physx::PxAsc::PxF32StrLen));
+ ret = buf;
+ }
+ }
+ break;
+ case TYPE_UNDEFINED:
+ case TYPE_ARRAY:
+ case TYPE_STRUCT:
+ break;
+ case TYPE_STRING:
+ error = getParamString(handle, ret);
+ break;
+ case TYPE_ENUM:
+ error = getParamEnum(handle, ret);
+ break;
+ case TYPE_REF:
+ {
+ const Hint *hint = paramDef->hint("INCLUDED");
+ if( hint && hint->type() != TYPE_U64 )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INVALID_REFERENCE_INCLUDE_HINT");
+ return(ERROR_INVALID_REFERENCE_INCLUDE_HINT);
+ }
+
+ if( hint != NULL && hint->asUInt() == 1 )
+ {
+ // included, output the entire struct
+ }
+ else
+ {
+ //not included, get the "name" from the NvParameterized pointer
+ NvParameterized::Interface *paramPtr = 0;
+ ErrorType err = getParamRef(handle, paramPtr);
+ PX_ASSERT(err == ERROR_NONE);
+
+ if(err != ERROR_NONE)
+ {
+ return err;
+ }
+
+ ret = NULL;
+ if(paramPtr)
+ {
+ ret = paramPtr->name();
+ }
+ }
+ error = ERROR_NONE;
+ }
+ break;
+ case TYPE_BOOL:
+ {
+ bool val;
+ if ((error = getParamBool(handle, val)) == ERROR_NONE)
+ {
+ ret = physx::PxAsc::valueToStr(val, buf, n);
+ }
+ }
+ break;
+ case TYPE_I8:
+ {
+ int8_t val;
+ if ((error = getParamI8(handle, val)) == ERROR_NONE)
+ {
+ ret = physx::PxAsc::valueToStr(val, buf, n);
+ }
+ }
+ break;
+ case TYPE_I16:
+ {
+ int16_t val;
+ if ((error = getParamI16(handle, val)) == ERROR_NONE)
+ {
+ ret = physx::PxAsc::valueToStr(val, buf, n);
+ }
+ }
+ break;
+ case TYPE_I32:
+ {
+ int32_t val;
+ if ((error = getParamI32(handle, val)) == ERROR_NONE)
+ {
+ ret = physx::PxAsc::valueToStr(val, buf, n);
+ }
+ }
+ break;
+ case TYPE_I64:
+ {
+ int64_t val;
+ if ((error = getParamI64(handle, val)) == ERROR_NONE)
+ {
+ ret = physx::PxAsc::valueToStr(val, buf, n);
+ }
+ }
+ break;
+ case TYPE_U8:
+ {
+ uint8_t val;
+ if ((error = getParamU8(handle, val)) == ERROR_NONE)
+ {
+ ret = physx::PxAsc::valueToStr(val, buf, n);
+ }
+ }
+ break;
+ case TYPE_U16:
+ {
+ uint16_t val;
+ if ((error = getParamU16(handle, val)) == ERROR_NONE)
+ {
+ ret = physx::PxAsc::valueToStr(val, buf, n);
+ }
+ }
+ break;
+ case TYPE_U32:
+ {
+ uint32_t val;
+ if ((error = getParamU32(handle, val)) == ERROR_NONE)
+ {
+ ret = physx::PxAsc::valueToStr(val, buf, n);
+ }
+ }
+ break;
+ case TYPE_U64:
+ {
+ uint64_t val;
+ if ((error = getParamU64(handle, val)) == ERROR_NONE)
+ {
+ ret = physx::PxAsc::valueToStr(val, buf, n);
+ }
+ }
+ break;
+ case TYPE_F32:
+ {
+ float val;
+ if ((error = getParamF32(handle, val)) == ERROR_NONE)
+ {
+ ret = physx::PxAsc::valueToStr(val, buf, n);
+ }
+ }
+ break;
+ case TYPE_F64:
+ {
+ double val;
+ if ((error = getParamF64(handle, val)) == ERROR_NONE)
+ {
+ ret = physx::PxAsc::valueToStr(val, buf, n);
+ }
+ }
+ break;
+
+ // Make compiler happy
+ case TYPE_POINTER:
+ case TYPE_LAST:
+ break;
+ }
+
+ PX_ASSERT(error == ERROR_NONE);
+
+ return error;
+}
+
+ErrorType NvParameters::strToValue(Handle &handle, const char *str, const char **endptr) // assigns this string to the value
+{
+ ErrorType ret = ERROR_NONE;
+
+ const Definition *pd = handle.parameterDefinition();
+
+ switch ( pd->type() )
+ {
+ case TYPE_UNDEFINED:
+ case TYPE_ARRAY:
+ case TYPE_STRUCT: ret = ERROR_TYPE_NOT_SUPPORTED; break;
+
+ case TYPE_STRING: ret = setParamString(handle,str); break;
+ case TYPE_ENUM: ret = setParamEnum(handle,str); break;
+ case TYPE_REF: ret = ERROR_TYPE_NOT_SUPPORTED; break;
+ case TYPE_BOOL: ret = setParamBool(handle,physx::PxAsc::strToBool(str, endptr)); break;
+ case TYPE_I8: ret = setParamI8(handle,physx::PxAsc::strToI8(str, endptr)); break;
+ case TYPE_I16: ret = setParamI16(handle,physx::PxAsc::strToI16(str, endptr)); break;
+ case TYPE_I32: ret = setParamI32(handle,physx::PxAsc::strToI32(str, endptr)); break;
+ case TYPE_I64: ret = setParamI64(handle,physx::PxAsc::strToI64(str, endptr)); break;
+ case TYPE_U8: ret = setParamU8(handle,physx::PxAsc::strToU8(str, endptr)); break;
+ case TYPE_U16: ret = setParamU16(handle,physx::PxAsc::strToU16(str, endptr)); break;
+ case TYPE_U32: ret = setParamU32(handle,physx::PxAsc::strToU32(str, endptr)); break;
+ case TYPE_U64: ret = setParamU64(handle,physx::PxAsc::strToU64(str, endptr)); break;
+ case TYPE_F32: ret = setParamF32(handle,physx::PxAsc::strToF32(str, endptr)); break;
+ case TYPE_F64: ret = setParamF64(handle,physx::PxAsc::strToF64(str, endptr)); break;
+ case TYPE_VEC2: ret = setParamVec2(handle,getVec2(str, endptr)); break;
+ case TYPE_VEC3: ret = setParamVec3(handle,getVec3(str, endptr)); break;
+ case TYPE_VEC4: ret = setParamVec4(handle,getVec4(str, endptr)); break;
+ case TYPE_QUAT: ret = setParamQuat(handle,getQuat(str, endptr)); break;
+ case TYPE_MAT33: ret = setParamMat33(handle,getMat33(str, endptr)); break;
+ case TYPE_MAT34:
+ {
+ float f[12];
+ getMat34Legacy(str, endptr, f);
+ ret = setParamMat34Legacy(handle,f);
+ break;
+ }
+ case TYPE_MAT44: ret = setParamMat44(handle,getMat44(str, endptr)); break;
+ case TYPE_BOUNDS3: ret = setParamBounds3(handle,getBounds3(str, endptr)); break;
+ case TYPE_TRANSFORM: ret = setParamTransform(handle,getTransform(str, endptr)); break;
+
+NV_PARAMETRIZED_SERVICE_AND_LAST_DATATYPE_LABELS
+ default: ret = ERROR_TYPE_NOT_SUPPORTED; break;
+ }
+
+ PX_ASSERT(ret == ERROR_NONE);
+
+ return ret;
+}
+
+physx::PxVec2 NvParameters::getVec2(const char *str, const char **endptr)
+{
+ physx::PxVec2 ret(0,0);
+ physx::PxAsc::strToF32s(&ret.x,2,str,endptr);
+
+ return ret;
+}
+
+physx::PxVec3 NvParameters::getVec3(const char *str, const char **endptr)
+{
+ physx::PxVec3 ret(0,0,0);
+ physx::PxAsc::strToF32s(&ret.x,3,str,endptr);
+
+ return ret;
+}
+
+physx::PxVec4 NvParameters::getVec4(const char *str, const char **endptr)
+{
+ physx::PxVec4 ret(0,0,0,0);
+ physx::PxAsc::strToF32s(&ret.x,4,str,endptr);
+
+ return ret;
+}
+
+physx::PxQuat NvParameters::getQuat(const char *str, const char **endptr)
+{
+ physx::PxQuat ret;
+ //ret.identity();
+ float quat[4];
+ //ret.getXYZW(quat);
+ physx::PxAsc::strToF32s(quat,4,str,endptr);
+ //ret.setXYZW(quat);
+ ret = physx::PxQuat(quat[0], quat[1], quat[2], quat[3]);
+
+ return ret;
+}
+
+physx::PxMat33 NvParameters::getMat33(const char *str, const char **endptr)
+{
+ physx::PxMat33 ret;
+ float *vals = const_cast<float *>(ret.front());
+ physx::PxAsc::strToF32s(vals,9,str,endptr);
+ return ret;
+}
+
+physx::PxMat44 NvParameters::getMat44(const char *str, const char **endptr)
+{
+ physx::PxMat44 ret;
+ float *vals = const_cast<float *>(ret.front());
+ physx::PxAsc::strToF32s(vals,16,str,endptr);
+ return ret;
+}
+
+void NvParameters::getMat34Legacy(const char *str, const char **endptr, float (&val)[12])
+{
+ physx::PxAsc::strToF32s(val,12,str,endptr);
+}
+
+physx::PxBounds3 NvParameters::getBounds3(const char *str, const char **endptr)
+{
+ physx::PxBounds3 ret;
+ ret.setEmpty();
+ physx::PxAsc::strToF32s(&ret.minimum.x,6,str,endptr);
+ return ret;
+}
+
+//******************************************************************************
+//*** Vec2
+//******************************************************************************
+
+ErrorType NvParameters::setParamVec2(const Handle &handle, const physx::PxVec2 &val)
+{
+ CHECK_HANDLE
+ CHECK_F32_FINITE
+
+ if(handle.parameterDefinition()->type() == TYPE_VEC2)
+ {
+ return rawSetParamVec2(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamVec2(const Handle &handle, physx::PxVec2 &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_VEC2)
+ {
+ return rawGetParamVec2(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamVec2Array(const Handle &handle, physx::PxVec2 *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(VEC2)
+ return(rawGetParamVec2Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamVec2Array(const Handle &handle, const physx::PxVec2 *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(VEC2)
+ CHECK_F32_FINITE_ARRAY
+ return(rawSetParamVec2Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** Vec3
+//******************************************************************************
+
+ErrorType NvParameters::setParamVec3(const Handle &handle, const physx::PxVec3 &val)
+{
+ CHECK_HANDLE
+ CHECK_F32_FINITE
+
+ if(handle.parameterDefinition()->type() == TYPE_VEC3)
+ {
+ return rawSetParamVec3(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamVec3(const Handle &handle, physx::PxVec3 &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_VEC3)
+ {
+ return rawGetParamVec3(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamVec3Array(const Handle &handle, physx::PxVec3 *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(VEC3)
+ return(rawGetParamVec3Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamVec3Array(const Handle &handle, const physx::PxVec3 *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(VEC3)
+ CHECK_F32_FINITE_ARRAY
+ return(rawSetParamVec3Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** Vec4
+//******************************************************************************
+
+ErrorType NvParameters::setParamVec4(const Handle &handle, const physx::PxVec4 &val)
+{
+ CHECK_HANDLE
+ CHECK_F32_FINITE
+
+ if(handle.parameterDefinition()->type() == TYPE_VEC4)
+ {
+ return rawSetParamVec4(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamVec4(const Handle &handle, physx::PxVec4 &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_VEC4)
+ {
+ return rawGetParamVec4(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamVec4Array(const Handle &handle, physx::PxVec4 *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(VEC4)
+ return(rawGetParamVec4Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamVec4Array(const Handle &handle, const physx::PxVec4 *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(VEC4)
+ CHECK_F32_FINITE_ARRAY
+ return(rawSetParamVec4Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** Quat
+//******************************************************************************
+
+ErrorType NvParameters::setParamQuat(const Handle &handle, const physx::PxQuat &val)
+{
+ CHECK_HANDLE
+ CHECK_F32_FINITE
+
+ if(handle.parameterDefinition()->type() == TYPE_QUAT)
+ {
+ return rawSetParamQuat(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamQuat(const Handle &handle, physx::PxQuat &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_QUAT)
+ {
+ return rawGetParamQuat(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamQuatArray(const Handle &handle, physx::PxQuat *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(QUAT)
+ return(rawGetParamQuatArray(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamQuatArray(const Handle &handle, const physx::PxQuat *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(QUAT)
+ CHECK_F32_FINITE_ARRAY
+ return(rawSetParamQuatArray(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** Mat33
+//******************************************************************************
+
+ErrorType NvParameters::setParamMat33(const Handle &handle, const physx::PxMat33 &val)
+{
+ CHECK_HANDLE
+ CHECK_F32_FINITE
+
+ if(handle.parameterDefinition()->type() == TYPE_MAT33)
+ {
+ return rawSetParamMat33(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamMat33(const Handle &handle, physx::PxMat33 &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_MAT33)
+ {
+ return rawGetParamMat33(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamMat33Array(const Handle &handle, physx::PxMat33 *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(MAT33)
+ return(rawGetParamMat33Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamMat33Array(const Handle &handle, const physx::PxMat33 *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(MAT33)
+ CHECK_F32_FINITE_ARRAY
+ return(rawSetParamMat33Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** Mat34Legacy
+//******************************************************************************
+
+ErrorType NvParameters::setParamMat34Legacy(const Handle &handle, const float (&val)[12])
+{
+ CHECK_HANDLE
+ CHECK_F32_FINITE
+
+ if(handle.parameterDefinition()->type() == TYPE_MAT34)
+ {
+ return rawSetParamMat34Legacy(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamMat34Legacy(const Handle &handle, float (&val)[12]) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_MAT34)
+ {
+ return rawGetParamMat34Legacy(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamMat34LegacyArray(const Handle &handle, float *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(MAT34)
+ return(rawGetParamMat34LegacyArray(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamMat34LegacyArray(const Handle &handle, const float *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(MAT34)
+ CHECK_F32_FINITE_ARRAY
+ return(rawSetParamMat34LegacyArray(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** Mat44
+//******************************************************************************
+
+ErrorType NvParameters::setParamMat44(const Handle &handle, const physx::PxMat44 &val)
+{
+ CHECK_HANDLE
+ CHECK_F32_FINITE
+
+ if(handle.parameterDefinition()->type() == TYPE_MAT44)
+ {
+ return rawSetParamMat44(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamMat44(const Handle &handle, physx::PxMat44 &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_MAT44)
+ {
+ return rawGetParamMat44(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamMat44Array(const Handle &handle, physx::PxMat44 *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(MAT44)
+ return(rawGetParamMat44Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamMat44Array(const Handle &handle, const physx::PxMat44 *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(MAT44)
+ CHECK_F32_FINITE_ARRAY
+ return(rawSetParamMat44Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** Bounds3
+//******************************************************************************
+
+ErrorType NvParameters::setParamBounds3(const Handle &handle, const physx::PxBounds3 &val)
+{
+ CHECK_HANDLE
+ CHECK_F32_FINITE
+
+ if(handle.parameterDefinition()->type() == TYPE_BOUNDS3)
+ {
+ return rawSetParamBounds3(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamBounds3(const Handle &handle, physx::PxBounds3 &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_BOUNDS3)
+ {
+ return rawGetParamBounds3(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamBounds3Array(const Handle &handle, physx::PxBounds3 *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(BOUNDS3)
+ return(rawGetParamBounds3Array(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamBounds3Array(const Handle &handle, const physx::PxBounds3 *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(BOUNDS3)
+ CHECK_F32_FINITE_ARRAY
+ return(rawSetParamBounds3Array(handle, array, n, offset));
+}
+
+//******************************************************************************
+//*** Transform
+//******************************************************************************
+
+ErrorType NvParameters::setParamTransform(const Handle &handle, const physx::PxTransform &val)
+{
+ CHECK_HANDLE
+ CHECK_F32_FINITE
+
+ if(handle.parameterDefinition()->type() == TYPE_TRANSFORM)
+ {
+ return rawSetParamTransform(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamTransform(const Handle &handle, physx::PxTransform &val) const
+{
+ CHECK_HANDLE
+
+ if(handle.parameterDefinition()->type() == TYPE_TRANSFORM)
+ {
+ return rawGetParamTransform(handle, val);
+ }
+
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_CAST_FAILED");
+ return(ERROR_CAST_FAILED);
+}
+
+ErrorType NvParameters::getParamTransformArray(const Handle &handle, physx::PxTransform *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(TRANSFORM)
+ return(rawGetParamTransformArray(handle, array, n, offset));
+}
+
+ErrorType NvParameters::setParamTransformArray(const Handle &handle, const physx::PxTransform *array, int32_t n, int32_t offset)
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(TRANSFORM)
+ CHECK_F32_FINITE_ARRAY
+ return(rawSetParamTransformArray(handle, array, n, offset));
+}
+
+physx::PxTransform NvParameters::getTransform(const char *str, const char **endptr)
+{
+ physx::PxTransform ret;
+ physx::PxAsc::strToF32s((float*)&ret,7,str,endptr);
+ return ret;
+}
+
+
+//***********************************************
+physx::PxVec2 NvParameters::init(float x,float y)
+{
+ physx::PxVec2 ret(x,y);
+ return ret;
+}
+
+physx::PxVec3 NvParameters::init(float x,float y,float z)
+{
+ physx::PxVec3 ret(x,y,z);
+ return ret;
+}
+
+physx::PxVec4 NvParameters::initVec4(float x,float y,float z,float w)
+{
+ physx::PxVec4 ret(x,y,z,w);
+ return ret;
+}
+
+physx::PxQuat NvParameters::init(float x,float y,float z,float w)
+{
+ physx::PxQuat ret;
+ //ret.setXYZW(x,y,z,w);
+ ret = physx::PxQuat(x,y,z,w);
+ return ret;
+}
+
+physx::PxMat33 NvParameters::init(float _11,float _12,float _13,float _21,float _22,float _23,float _31,float _32,float _33)
+{
+ physx::PxMat33 ret;
+
+ ret.column0.x = _11;
+ ret.column0.y = _21;
+ ret.column0.z = _31;
+
+ ret.column1.x = _12;
+ ret.column1.y = _22;
+ ret.column1.z = _32;
+
+ ret.column2.x = _13;
+ ret.column2.y = _23;
+ ret.column2.z = _33;
+
+ return ret;
+}
+
+physx::PxMat44 NvParameters::init(float _11,float _12,float _13,float _14,float _21,float _22,float _23,float _24,float _31,float _32,float _33,float _34,float _41,float _42,float _43,float _44)
+{
+ physx::PxMat44 ret;
+
+ ret.column0.x = _11;
+ ret.column0.y = _21;
+ ret.column0.z = _31;
+ ret.column0.w = _41;
+
+ ret.column1.x = _12;
+ ret.column1.y = _22;
+ ret.column1.z = _32;
+ ret.column1.w = _42;
+
+ ret.column2.x = _13;
+ ret.column2.y = _23;
+ ret.column2.z = _33;
+ ret.column2.w = _43;
+
+ ret.column3.x = _14;
+ ret.column3.y = _24;
+ ret.column3.z = _34;
+ ret.column3.w = _44;
+
+ return ret;
+}
+
+physx::PxTransform NvParameters::init(float x,float y,float z,float qx,float qy,float qz,float qw)
+{
+ return physx::PxTransform(physx::PxVec3(x,y,z), physx::PxQuat(qx,qy,qz,qw));
+}
+
+
+physx::PxBounds3 NvParameters::init(float minx,float miny,float minz,float maxx,float maxy,float maxz)
+{
+ physx::PxBounds3 ret;
+ ret.minimum = physx::PxVec3(minx,miny,minz);
+ ret.maximum = physx::PxVec3(maxx,maxy,maxz);
+ return ret;
+}
+
+
+
+int32_t NvParameters::MultIntArray(const int32_t *array, int32_t n)
+{
+ PX_ASSERT(array != NULL);
+ PX_ASSERT(n > 0);
+
+ int32_t ret = array[0];
+
+ for(int32_t i=1; i < n; ++i)
+ ret *= array[i];
+
+ return(ret);
+}
+
+
+ErrorType NvParameters::resizeArray(Traits *parameterizedTraits,
+ void *&buf,
+ int32_t *array_sizes,
+ int32_t dimension,
+ int32_t resize_dim,
+ int32_t new_size,
+ bool doFree,
+ int32_t element_size,
+ uint32_t element_align,
+ bool &isMemAllocated)
+{
+ PX_ASSERT(array_sizes != NULL);
+ PX_ASSERT(dimension > 0);
+ PX_ASSERT(resize_dim >= 0 && resize_dim < dimension);
+ PX_ASSERT(new_size >= 0);
+ PX_ASSERT(element_size > 0 );
+
+ if(array_sizes[resize_dim] == new_size)
+ return(ERROR_NONE); //isMemAllocated is unchanged
+
+ int32_t newSizes[Handle::MAX_DEPTH];
+ physx::intrinsics::memCopy(newSizes, array_sizes, dimension * sizeof(int32_t));
+
+ newSizes[resize_dim] = new_size;
+
+ int32_t currentNumElems = MultIntArray(array_sizes, dimension);
+ int32_t newNumElems = MultIntArray(newSizes, dimension);
+
+ if(newNumElems <= 0)
+ {
+ if(buf != NULL && doFree)
+ parameterizedTraits->free(buf);
+
+ buf = NULL;
+ goto no_error;
+ }
+
+ if(buf == NULL)
+ {
+ PX_ASSERT(element_size * newNumElems >= 0);
+ if((buf = allocAligned(parameterizedTraits, static_cast<uint32_t>(element_size * newNumElems), element_align)) == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_MEMORY_ALLOCATION_FAILURE");
+ return(ERROR_MEMORY_ALLOCATION_FAILURE);
+ }
+
+ isMemAllocated = true;
+
+ //initialize the array to 0's (for strings)
+ physx::intrinsics::memZero(buf, uint32_t(element_size * newNumElems));
+
+ goto no_error;
+ }
+
+ if(resize_dim == 0)
+ {
+ void *newBuf;
+ char *newBufDataStart;
+ int32_t newBufDataSize;
+
+ PX_ASSERT(element_size * newNumElems >= 0);
+ // alloc new buffer
+ if((newBuf = allocAligned(parameterizedTraits, static_cast<uint32_t>(element_size * newNumElems), element_align)) == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_MEMORY_ALLOCATION_FAILURE");
+ return(ERROR_MEMORY_ALLOCATION_FAILURE);
+ }
+
+ isMemAllocated = true;
+
+ // copy existing data to new buffer
+ if(newNumElems < currentNumElems)
+ physx::intrinsics::memCopy(newBuf, buf, uint32_t(element_size * newNumElems));
+ else
+ physx::intrinsics::memCopy(newBuf, buf, uint32_t(element_size * currentNumElems));
+
+ // zero the new part of the array
+ if(newNumElems > currentNumElems)
+ {
+ newBufDataStart = (char *)newBuf + (currentNumElems * element_size);
+ newBufDataSize = (newNumElems - currentNumElems) * element_size;
+
+ PX_ASSERT(newBufDataSize >= 0);
+ memset(newBufDataStart, 0, static_cast<uint32_t>(newBufDataSize));
+ }
+
+ if( doFree )
+ parameterizedTraits->free(buf);
+ buf = newBuf;
+ }
+ else
+ {
+ PX_ASSERT(element_size * newNumElems >= 0);
+ void *newBuf = allocAligned(parameterizedTraits, static_cast<uint32_t>(element_size * newNumElems), element_align);
+ if(newBuf == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_MEMORY_ALLOCATION_FAILURE");
+ return(ERROR_MEMORY_ALLOCATION_FAILURE);
+ }
+
+ isMemAllocated = true;
+
+ //initialize the array to 0's (for strings)
+ physx::intrinsics::memSet(newBuf, 0U, uint32_t(element_size * newNumElems));
+ recursiveCopy(buf, array_sizes, newBuf, newSizes, dimension, element_size);
+
+ if( doFree )
+ parameterizedTraits->free(buf);
+ buf = newBuf;
+ }
+
+
+no_error:
+
+ array_sizes[resize_dim] = new_size;
+ return(ERROR_NONE);
+}
+
+void NvParameters::recursiveCopy(const void *src,
+ const int32_t *src_sizes,
+ void *dst,
+ const int32_t *dst_sizes,
+ int32_t dimension,
+ int32_t element_size,
+ int32_t *indexes,
+ int32_t level)
+{
+ int32_t srcSize = src_sizes[level];
+ int32_t dstSize = dst_sizes[level];
+
+ int32_t size = physx::PxMin(srcSize, dstSize);
+
+ int32_t indexStore[Handle::MAX_DEPTH];
+
+ if(indexes == NULL)
+ {
+ indexes = indexStore;
+ memset(indexes, 0, Handle::MAX_DEPTH * sizeof(int32_t));
+ }
+
+ if(level == dimension - 1)
+ {
+ int32_t srcIndex = indexes[0];
+ int32_t dstIndex = indexes[0];
+
+ for(int32_t i=1; i < dimension; ++i)
+ {
+ srcIndex = src_sizes[i] * (srcIndex) + indexes[i];
+ dstIndex = dst_sizes[i] * (dstIndex) + indexes[i];
+ }
+
+ char *copy_dst = (char *)dst + dstIndex * element_size;
+ char *copy_src = (char *)src + srcIndex * element_size;
+ PX_ASSERT(element_size * size > 0);
+ physx::intrinsics::memCopy(copy_dst, copy_src, uint32_t(element_size * size));
+ return;
+ }
+
+ for(int32_t i=0; i < size; ++i)
+ {
+ indexes[level] = i;
+ recursiveCopy(src, src_sizes, dst, dst_sizes, dimension, element_size, indexes, level + 1);
+ }
+}
+
+ErrorType NvParameters::getParamU8Array(const Handle &handle, uint8_t *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(U8)
+ return(rawGetParamArray<uint8_t>(handle, array, n, offset,this));
+}
+
+ErrorType NvParameters::getParamF64Array(const Handle &handle, double *array, int32_t n, int32_t offset) const
+{
+ CHECK_HANDLE
+ CHECK_IS_SIMPLE_ARRAY(F64)
+ return(rawGetParamArray<double>(handle, array, n, offset,this));
+}
+
+
+
+
+ErrorType NvParameters::rawSetParamBool(const Handle &handle, bool val)
+{
+ return rawSetParam<bool>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamBool(const Handle &handle, bool &val) const
+{
+ return rawGetParam<bool>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamBoolArray(const Handle &handle, bool *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<bool>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamBoolArray(const Handle &handle, const bool *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<bool>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawGetParamString(const Handle &handle, const char *&val) const
+{
+ size_t offset;
+ void *ptr=NULL;
+ getVarPtr(handle, ptr, offset);
+ if ( ptr == NULL )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_TYPE_NOT_SUPPORTED");
+ return ERROR_TYPE_NOT_SUPPORTED;
+ }
+
+ DummyStringStruct *var = (DummyStringStruct *)(char *)ptr;
+ val = var->buf;
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawSetParamString(const Handle &handle, const char *val)
+{
+ size_t offset;
+ void *ptr=NULL;
+ getVarPtr(handle, ptr, offset);
+ if(ptr == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ DummyStringStruct *var = (DummyStringStruct *)(char *)ptr;
+ if( var->isAllocated )
+ {
+ getTraits()->strfree((char *)var->buf);
+ }
+
+ var->buf = getTraits()->strdup(val);
+ var->isAllocated = true;
+
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawGetParamEnum(const Handle &handle, const char *&val) const
+{
+ size_t offset;
+ void *ptr=NULL;
+ getVarPtr(handle, ptr, offset);
+ if ( ptr == NULL )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_TYPE_NOT_SUPPORTED");
+ return ERROR_TYPE_NOT_SUPPORTED;
+ }
+ const char * *var = (const char * *)((char *)ptr);
+ val = *var;
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawSetParamEnum(const Handle &handle, const char *val)
+{
+ size_t offset;
+ void *ptr=NULL;
+ getVarPtr(handle, ptr, offset);
+ if(ptr == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+ const char * *Var = (const char * *)((char *)ptr);
+ *Var = val;
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawGetParamRef(const Handle &handle, NvParameterized::Interface *&val) const
+{
+ size_t offset;
+ void *ptr=NULL;
+ getVarPtr(handle, ptr, offset);
+ if ( ptr == NULL )
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_TYPE_NOT_SUPPORTED");
+ return ERROR_TYPE_NOT_SUPPORTED;
+ }
+
+ NvParameterized::Interface * *var = (NvParameterized::Interface * *)((char *)ptr);
+ val = *var;
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawSetParamRef(const Handle &handle, NvParameterized::Interface * val)
+{
+ size_t offset;
+ void *ptr=NULL;
+ getVarPtr(handle, ptr, offset);
+ if(ptr == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ NvParameterized::Interface * *Var = (NvParameterized::Interface * *)((char *)ptr);
+ *Var = val;
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawGetParamI8(const Handle &handle, int8_t &val) const
+{
+ return rawGetParam<int8_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawSetParamI8(const Handle &handle, int8_t val)
+{
+ return rawSetParam<int8_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamI8Array(const Handle &handle, int8_t *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<int8_t>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamI8Array(const Handle &handle, const int8_t *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<int8_t>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawGetParamI16(const Handle &handle, int16_t &val) const
+{
+ return rawGetParam<int16_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawSetParamI16(const Handle &handle, int16_t val)
+{
+ return rawSetParam<int16_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamI16Array(const Handle &handle, int16_t *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<int16_t>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamI16Array(const Handle &handle, const int16_t *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<int16_t>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawGetParamI32(const Handle &handle, int32_t &val) const
+{
+ return rawGetParam<int32_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawSetParamI32(const Handle &handle, int32_t val)
+{
+ return rawSetParam<int32_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamI32Array(const Handle &handle, int32_t *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<int32_t>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamI32Array(const Handle &handle, const int32_t *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<int32_t>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawGetParamI64(const Handle &handle, int64_t &val) const
+{
+ return rawGetParam<int64_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawSetParamI64(const Handle &handle, int64_t val)
+{
+ return rawSetParam<int64_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamI64Array(const Handle &handle, int64_t *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<int64_t>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamI64Array(const Handle &handle, const int64_t *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<int64_t>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawGetParamU8(const Handle &handle, uint8_t &val) const
+{
+ return rawGetParam<uint8_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawSetParamU8(const Handle &handle, uint8_t val)
+{
+ return rawSetParam<uint8_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamU8Array(const Handle &handle, uint8_t *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<uint8_t>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamU8Array(const Handle &handle, const uint8_t *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<uint8_t>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawGetParamU16(const Handle &handle, uint16_t &val) const
+{
+ return rawGetParam<uint16_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawSetParamU16(const Handle &handle, uint16_t val)
+{
+ return rawSetParam<uint16_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamU16Array(const Handle &handle, uint16_t *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<uint16_t>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamU16Array(const Handle &handle, const uint16_t *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<uint16_t>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawGetParamU32(const Handle &handle, uint32_t &val) const
+{
+ return rawGetParam<uint32_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawSetParamU32(const Handle &handle, uint32_t val)
+{
+ return rawSetParam<uint32_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamU32Array(const Handle &handle, uint32_t *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<uint32_t>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamU32Array(const Handle &handle, const uint32_t *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<uint32_t>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawSetParamU64(const Handle &handle, uint64_t val)
+{
+ return rawSetParam<uint64_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamU64(const Handle &handle, uint64_t &val) const
+{
+ return rawGetParam<uint64_t>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamU64Array(const Handle &handle, uint64_t *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<uint64_t>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamU64Array(const Handle &handle, const uint64_t *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<uint64_t>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawGetParamF32(const Handle &handle, float &val) const
+{
+ return rawGetParam<float>(handle,val,this);
+}
+
+ErrorType NvParameters::rawSetParamF32(const Handle &handle, float val)
+{
+ return rawSetParam<float>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamF32Array(const Handle &handle, float *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<float>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamF32Array(const Handle &handle, const float *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<float>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawGetParamF64(const Handle &handle, double &val) const
+{
+ return rawGetParam<double>(handle,val,this);
+}
+
+ErrorType NvParameters::rawSetParamF64(const Handle &handle, double val)
+{
+ return rawSetParam<double>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamF64Array(const Handle &handle, double *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<double>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamF64Array(const Handle &handle, const double *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<double>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawSetParamVec2(const Handle &handle,physx::PxVec2 val)
+{
+ return rawSetParam<physx::PxVec2>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamVec2(const Handle &handle,physx::PxVec2 &val) const
+{
+ return rawGetParam<physx::PxVec2>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamVec2Array(const Handle &handle,physx::PxVec2 *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<physx::PxVec2>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamVec2Array(const Handle &handle, const physx::PxVec2 *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<physx::PxVec2>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawSetParamVec3(const Handle &handle,physx::PxVec3 val)
+{
+ return rawSetParam<physx::PxVec3>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamVec3(const Handle &handle,physx::PxVec3 &val) const
+{
+ return rawGetParam<physx::PxVec3>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamVec3Array(const Handle &handle,physx::PxVec3 *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<physx::PxVec3>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamVec3Array(const Handle &handle, const physx::PxVec3 *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<physx::PxVec3>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawSetParamVec4(const Handle &handle,physx::PxVec4 val)
+{
+ return rawSetParam<physx::PxVec4>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamVec4(const Handle &handle,physx::PxVec4 &val) const
+{
+ return rawGetParam<physx::PxVec4>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamVec4Array(const Handle &handle,physx::PxVec4 *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<physx::PxVec4>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamVec4Array(const Handle &handle, const physx::PxVec4 *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<physx::PxVec4>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawSetParamQuat(const Handle &handle,physx::PxQuat val)
+{
+ return rawSetParam<physx::PxQuat>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamQuat(const Handle &handle,physx::PxQuat &val) const
+{
+ return rawGetParam<physx::PxQuat>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamQuatArray(const Handle &handle,physx::PxQuat *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<physx::PxQuat>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamQuatArray(const Handle &handle, const physx::PxQuat *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<physx::PxQuat>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawSetParamMat33(const Handle &handle,physx::PxMat33 val)
+{
+ return rawSetParam<physx::PxMat33>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamMat33(const Handle &handle,physx::PxMat33 &val) const
+{
+ return rawGetParam<physx::PxMat33>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamMat33Array(const Handle &handle,physx::PxMat33 *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<physx::PxMat33>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamMat33Array(const Handle &handle, const physx::PxMat33 *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<physx::PxMat33>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawSetParamMat34Legacy(const Handle &handle, const float (&val)[12])
+{
+ Handle memberHandle(handle);
+
+ size_t tmp;
+ void *ptr = NULL;
+ this->getVarPtr(memberHandle, ptr, tmp);
+ if(ptr == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ physx::intrinsics::memCopy(ptr, val, 12 * sizeof(float));
+
+ // swap raw-column major
+ swap(static_cast<float*>(ptr)[1], static_cast<float*>(ptr)[3]);
+ swap(static_cast<float*>(ptr)[2], static_cast<float*>(ptr)[6]);
+ swap(static_cast<float*>(ptr)[5], static_cast<float*>(ptr)[7]);
+
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawGetParamMat34Legacy(const Handle &handle, float (&val)[12]) const
+{
+ Handle memberHandle(handle);
+
+ size_t tmp;
+ void *ptr = NULL;
+ this->getVarPtr(memberHandle, ptr, tmp);
+ if(ptr == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ physx::intrinsics::memCopy(val, ptr, 12 * sizeof(float));
+
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawGetParamMat34LegacyArray(const Handle &handle, float *array, int32_t n, int32_t offset) const
+{
+ if( n )
+ {
+ Handle memberHandle(handle);
+ NV_ERR_CHECK_RETURN(memberHandle.set(offset * 12));
+
+ size_t tmp;
+ void *ptr = NULL;
+ this->getVarPtr(memberHandle, ptr, tmp);
+ if(ptr == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ physx::intrinsics::memCopy(array, ptr, 12 * n * sizeof(float));
+ }
+
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawSetParamMat34LegacyArray(const Handle &handle, const float *array, int32_t n, int32_t offset)
+{
+ if( n )
+ {
+ Handle memberHandle(handle);
+ NV_ERR_CHECK_RETURN(memberHandle.set(offset * 12));
+
+ size_t tmp;
+ void *ptr=NULL;
+ this->getVarPtr(memberHandle, ptr, tmp);
+ if(ptr == NULL)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "NVPARAMETERIZED.ERROR_INDEX_OUT_OF_RANGE");
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ }
+
+ for (int32_t i = 0; i < n; ++i)
+ {
+ float* dst = static_cast<float*>(ptr) + 12 * sizeof(float) * i;
+ const float* src = array + 12 * sizeof(float) * i;
+
+ physx::intrinsics::memCopy(dst, src, 12 * sizeof(float));
+
+ swap(dst[1], dst[3]);
+ swap(dst[2], dst[6]);
+ swap(dst[5], dst[7]);
+ }
+ }
+
+ return(ERROR_NONE);
+}
+
+ErrorType NvParameters::rawSetParamMat44(const Handle &handle,physx::PxMat44 val)
+{
+ return rawSetParam<physx::PxMat44>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamMat44(const Handle &handle,physx::PxMat44 &val) const
+{
+ return rawGetParam<physx::PxMat44>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamMat44Array(const Handle &handle,physx::PxMat44 *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<physx::PxMat44>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamMat44Array(const Handle &handle, const physx::PxMat44 *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<physx::PxMat44>(handle,array,n,offset,this);
+}
+
+
+ErrorType NvParameters::rawSetParamBounds3(const Handle &handle,physx::PxBounds3 val)
+{
+ return rawSetParam<physx::PxBounds3>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamBounds3(const Handle &handle,physx::PxBounds3 &val) const
+{
+ return rawGetParam<physx::PxBounds3>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamBounds3Array(const Handle &handle,physx::PxBounds3 *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<physx::PxBounds3>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamBounds3Array(const Handle &handle, const physx::PxBounds3 *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<physx::PxBounds3>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamTransform(const Handle &handle,physx::PxTransform val)
+{
+ return rawSetParam<physx::PxTransform>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamTransform(const Handle &handle,physx::PxTransform &val) const
+{
+ return rawGetParam<physx::PxTransform>(handle,val,this);
+}
+
+ErrorType NvParameters::rawGetParamTransformArray(const Handle &handle,physx::PxTransform *array, int32_t n, int32_t offset) const
+{
+ return rawGetParamArray<physx::PxTransform>(handle,array,n,offset,this);
+}
+
+ErrorType NvParameters::rawSetParamTransformArray(const Handle &handle, const physx::PxTransform *array, int32_t n, int32_t offset)
+{
+ return rawSetParamArray<physx::PxTransform>(handle,array,n,offset,this);
+}
+
+void *NvParameters::getVarPtrHelper(const ParamLookupNode *rootNode, void *paramStruct, const Handle &handle, size_t &offset) const
+{
+ const ParamLookupNode* curNode = rootNode;
+
+ bool hasDynamicArray = false;
+ offset = curNode->offset;
+
+ void *ptr = const_cast<void *>(paramStruct);
+ for(int32_t i = 0; i < handle.numIndexes(); ++i)
+ {
+ int index = handle.index(i);
+
+ if (curNode->type == TYPE_ARRAY)
+ {
+ PX_ASSERT(curNode->numChildren);
+
+ if (curNode->isDynamicArrayRoot)
+ {
+ ptr = ((DummyDynamicArrayStruct*)ptr)->buf;
+ hasDynamicArray = true;
+ if (ptr == NULL)
+ {
+ offset = 0;
+ return 0;
+ }
+ }
+
+ // don't get the next curNode until after we've checked that the "parent" is dynamic
+ curNode = &rootNode[curNode->children[0]];
+
+ size_t localOffset = index * curNode->offset;
+ offset += localOffset;
+ ptr = (char*)ptr + localOffset;
+ }
+ else
+ {
+ PX_ASSERT(index >= 0 && index < curNode->numChildren);
+ curNode = &rootNode[curNode->children[index]];
+ offset += curNode->offset;
+ ptr = (char*)ptr + curNode->offset;
+ }
+ }
+
+ if (hasDynamicArray)
+ {
+ offset = 0;
+ }
+
+ return ptr;
+}
+
+bool NvParameters::checkAlignments() const
+{
+ // support empty, named references
+ if(rootParameterDefinition() == NULL)
+ {
+ return IsAligned(this, 8);
+ }
+
+ Handle constHandle(*this, "");
+ if( !constHandle.isValid() )
+ {
+ return false;
+ }
+
+ return checkAlignments(constHandle);
+}
+
+bool NvParameters::checkAlignments(Handle &param_handle) const
+{
+ const Definition *paramDef = param_handle.parameterDefinition();
+
+ uint32_t align = paramDef->alignment();
+
+ bool isDynamicArray = TYPE_ARRAY == paramDef->type() && !paramDef->arraySizeIsFixed();
+
+ // For dynamic array alignment means alignment of it's first element
+ if( !isDynamicArray )
+ {
+ size_t offset;
+ void *ptr;
+ getVarPtr(param_handle, ptr, offset);
+ if( align > 0 && !IsAligned(ptr, align) )
+ {
+ return false;
+ }
+ }
+
+ switch( paramDef->type() )
+ {
+ case TYPE_STRUCT:
+ {
+ for(int32_t i = 0; i < paramDef->numChildren(); ++i)
+ {
+ param_handle.set(i);
+ if( !checkAlignments(param_handle) )
+ {
+ return false;
+ }
+ param_handle.popIndex();
+ }
+ break;
+ }
+
+ case TYPE_REF:
+ {
+ Interface *refObj;
+ if( ERROR_NONE != param_handle.getParamRef(refObj) )
+ {
+ return false;
+ }
+
+ return 0 == refObj || refObj->checkAlignments();
+ }
+
+ case TYPE_ARRAY:
+ {
+ int32_t size;
+ if( ERROR_NONE != param_handle.getArraySize(size) )
+ {
+ return false;
+ }
+
+ // See comment above
+ if( isDynamicArray && align > 0 && size > 0 )
+ {
+ param_handle.set(0);
+
+ size_t offset;
+ void *ptr;
+ getVarPtr(param_handle, ptr, offset);
+ if( !IsAligned(ptr, align) )
+ {
+ return false;
+ }
+
+ param_handle.popIndex();
+ }
+
+ bool isSimpleType = paramDef->child(0)->isSimpleType();
+
+ // Only check for first 10 elements if simple type
+ size = physx::PxMin(size, isSimpleType ? 10 : INT32_MAX);
+
+ for(int32_t i = 0; i < size; ++i)
+ {
+ param_handle.set(i);
+ if( !checkAlignments(param_handle) )
+ {
+ return false;
+ }
+ param_handle.popIndex();
+ }
+
+ break;
+ }
+ NV_PARAMETRIZED_NO_AGGREGATE_AND_REF_DATATYPE_LABELS
+ default:
+ break;
+ }
+
+ return(true);
+}
+} // namespace NvParameterized
diff --git a/APEX_1.4/NvParameterized/src/NvParameterizedTraits.cpp b/APEX_1.4/NvParameterized/src/NvParameterizedTraits.cpp
new file mode 100644
index 00000000..0cc83578
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/NvParameterizedTraits.cpp
@@ -0,0 +1,363 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#include <PsHashMap.h>
+#include <PsHash.h>
+#include <PxAssert.h>
+#include <PsUserAllocated.h>
+
+#include "nvparameterized/NvParameterized.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+#include "NvTraitsInternal.h"
+#include "SerializerCommon.h"
+
+namespace NvParameterized
+{
+
+class DefaultParamConversion: public Conversion
+{
+ Traits *mTraits;
+ RefConversionMode::Enum mRefMode;
+
+ typedef physx::shdfnd::HashMap<const char *, uint32_t, physx::shdfnd::Hash<const char *>, Traits::Allocator> MapName2Ver;
+ MapName2Ver mapName2Ver;
+
+ bool copy(Handle &legacyHandle, Handle &handle)
+ {
+ const Definition *pdLegacy = legacyHandle.parameterDefinition(),
+ *pd = handle.parameterDefinition();
+
+ if( pdLegacy->type() != pd->type() )
+ return true;
+
+ switch( pdLegacy->type() )
+ {
+ case TYPE_STRUCT:
+ for(int32_t i = 0; i < pdLegacy->numChildren(); ++i)
+ {
+ legacyHandle.set(i);
+
+ int32_t j = -1;
+ if( pd->child(pdLegacy->child(i)->name(), j) )
+ {
+ handle.set(j);
+ if( !copy(legacyHandle, handle) )
+ {
+ char longName[128];
+ legacyHandle.getLongName(longName, sizeof(longName));
+ NV_PARAM_TRAITS_WARNING(
+ mTraits,
+ "%s: failed to copy legacy data",
+ longName
+ );
+
+ return false;
+ }
+ handle.popIndex();
+ }
+
+ legacyHandle.popIndex();
+ }
+ break;
+
+ case TYPE_ARRAY:
+ {
+ //FIXME: this is too harsh e.g. we can convert static to dynamic
+ if( pdLegacy->arraySizeIsFixed() != pd->arraySizeIsFixed() )
+ return true;
+
+ int32_t size;
+ if( pdLegacy->arraySizeIsFixed() )
+ {
+ //FIXME: this is too harsh e.g. we may just copy first elements
+ if( pdLegacy->arraySize() != pd->arraySize() )
+ return true;
+
+ size = pd->arraySize();
+ }
+ else
+ {
+ if( ERROR_NONE != legacyHandle.getArraySize(size) )
+ return false;
+
+ handle.resizeArray(size);
+ }
+
+ if( size > 100 && pdLegacy->isSimpleType(false, false) && pdLegacy->type() == pd->type() )
+ {
+ // Large array of simple types, fast path
+
+ switch( pdLegacy->type() )
+ {
+ NV_PARAMETRIZED_NO_MATH_DATATYPE_LABELS
+ NV_PARAMETRIZED_LEGACY_DATATYPE_LABELS
+ default:
+ // Fall to slow path
+ break;
+
+#define NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+#define NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+#define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ case TYPE_ ## enum_name: { \
+ c_type *data = (c_type *)mTraits->alloc(sizeof(c_type) * size); \
+ if( ERROR_NONE != legacyHandle.getParam ## type_name ## Array(data, size) ) return false; \
+ if( ERROR_NONE != handle.setParam ## type_name ## Array(data, size) ) return false; \
+ mTraits->free(data); \
+ break; \
+ }
+#include "nvparameterized/NvParameterized_types.h"
+
+ }
+ }
+
+ // Slow path for arrays of aggregates, including TYPE_MAT34
+
+ for(int32_t i = 0; i < size; ++i)
+ {
+ legacyHandle.set(i);
+ handle.set(i);
+
+ copy(legacyHandle, handle);
+
+ handle.popIndex();
+ legacyHandle.popIndex();
+ }
+
+ break;
+ }
+
+ case TYPE_REF:
+ {
+ Interface *legacyRefObj;
+ legacyHandle.getParamRef(legacyRefObj);
+
+ // Skip references which have unsupported classes (keep default version)
+ if( legacyRefObj && -1 == handle.parameterDefinition()->refVariantValIndex(legacyRefObj->className()) )
+ return true;
+
+ Interface *refObj;
+ handle.getParamRef(refObj);
+
+ switch( mRefMode )
+ {
+ case RefConversionMode::REF_CONVERT_LAST:
+ default:
+ DEBUG_ALWAYS_ASSERT();
+ break;
+
+ case RefConversionMode::REF_CONVERT_SKIP:
+ break;
+
+ case RefConversionMode::REF_CONVERT_COPY:
+ {
+ // TODO: check that this class is allowed in new version?
+
+ // Update to preferred version if necessary
+ if( legacyRefObj && pdLegacy->isIncludedRef() )
+ {
+ const char *className = legacyRefObj->className();
+
+ const MapName2Ver::Entry *e = mapName2Ver.find(pd->longName());
+ if( e )
+ {
+ uint32_t prefVer = e->second,
+ curVer = legacyRefObj->version();
+
+ if( curVer > prefVer )
+ {
+ NV_PARAM_TRAITS_WARNING(
+ mTraits,
+ "Unable to upgrade included reference of class %s, "
+ "actual version (%u) is higher than preferred version (%u), "
+ "your conversion may not work properly",
+ className,
+ (unsigned)curVer,
+ (unsigned)prefVer
+ );
+ DEBUG_ALWAYS_ASSERT();
+ return false;
+ }
+ else if( curVer < prefVer )
+ {
+ Interface *newLegacyRefObj = mTraits->createNvParameterized(className, prefVer);
+
+ if( !mTraits->updateLegacyNvParameterized(*legacyRefObj, *newLegacyRefObj) )
+ {
+ NV_PARAM_TRAITS_WARNING(
+ mTraits,
+ "Failed to upgrade reference of class %s to version %u",
+ className,
+ (unsigned)prefVer
+ );
+ DEBUG_ALWAYS_ASSERT();
+ newLegacyRefObj->destroy();
+ return false;
+ }
+
+ legacyRefObj->destroy();
+ legacyRefObj = newLegacyRefObj;
+
+ legacyHandle.setParamRef(legacyRefObj);
+ }
+ else
+ {
+ // Object has preferred version => do not do anything
+ }
+ }
+ }
+
+ if( ERROR_NONE != handle.setParamRef(legacyRefObj) )
+ return true;
+
+ if( ERROR_NONE != legacyHandle.setParamRef(0) ) { //Prevent destruction in legacyObj->destroy()
+ handle.setParamRef(0);
+ return false;
+ }
+
+ if( refObj )
+ refObj->destroy();
+
+ return true;
+ }
+
+ case RefConversionMode::REF_CONVERT_UPDATE:
+ {
+ DEBUG_ASSERT( 0 && "This was not used/tested for a long time" );
+ return false;
+
+/* if( !refObj )
+ {
+ //TODO: do we need to create refObj here?
+ return false;
+ }
+
+ if( 0 != strcmp(legacyRefObj->className(), refObj->className()) )
+ {
+ if( NvParameterized::ERROR_NONE != handle.initParamRef(legacyRefObj->className(), true) )
+ return false;
+
+ if( NvParameterized::ERROR_NONE != handle.getParamRef(refObj) )
+ return false;
+ }
+
+ if( legacyRefObj->version() != refObj->version() )
+ return mTraits->updateLegacyNvParameterized(*legacyRefObj, *refObj);
+
+ //Same version => recursive copy
+
+ Handle refHandle(*refObj, "");
+ DEBUG_ASSERT( refHandle.isValid() );
+
+ Handle legacyRefHandle(*legacyRefObj, "");
+ DEBUG_ASSERT( legacyRefHandle.isValid() );
+
+ return copy(legacyRefHandle, refHandle);*/
+ }
+ } //switch( mRefMode )
+
+ break;
+ }
+
+ case TYPE_POINTER:
+ // do nothing?
+ break;
+
+ case TYPE_ENUM:
+ {
+ const char *val;
+ legacyHandle.getParamEnum(val);
+
+ int32_t valIdx = handle.parameterDefinition()->enumValIndex(val);
+ if(-1 != valIdx)
+ {
+ const char *canonicVal = handle.parameterDefinition()->enumVal(valIdx);
+ if( ERROR_NONE != handle.setParamEnum(canonicVal) )
+ {
+ NV_PARAM_TRAITS_WARNING(
+ mTraits, "Internal error while setting enum value %s", canonicVal ? canonicVal : "" );
+ DEBUG_ALWAYS_ASSERT();
+ return false;
+ }
+ }
+
+ break;
+ }
+
+# define NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+# define NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+# define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ case TYPE_##enum_name: { c_type val; legacyHandle.getParam##type_name(val); handle.setParam##type_name(val); break; }
+
+ NV_PARAMETERIZED_TYPE(String, STRING, const char *)
+
+# include "nvparameterized/NvParameterized_types.h"
+
+ case TYPE_MAT34: { float val[12]; legacyHandle.getParamMat34Legacy(val); handle.setParamMat34Legacy(val); break; }
+
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+ default:
+ DEBUG_ALWAYS_ASSERT();
+ }
+
+ return true;
+ }
+
+public:
+ DefaultParamConversion(Traits *traits, const PrefVer *prefVers, RefConversionMode::Enum refMode)
+ : mTraits(traits), mRefMode(refMode), mapName2Ver(0, 0.75, Traits::Allocator(traits))
+ {
+ for(; prefVers && prefVers->longName; ++prefVers)
+ mapName2Ver[prefVers->longName] = prefVers->ver;
+ }
+
+ bool operator()(NvParameterized::Interface &legacyObj, NvParameterized::Interface &obj)
+ {
+ obj.initDefaults();
+
+ Handle legacyHandle(legacyObj, "");
+ DEBUG_ASSERT( legacyHandle.isValid() );
+
+ Handle handle(obj, "");
+ DEBUG_ASSERT( handle.isValid() );
+
+ return copy(legacyHandle, handle);
+ }
+
+ void release()
+ {
+ this->~DefaultParamConversion();
+ mTraits->free(this);
+ }
+};
+
+Conversion *internalCreateDefaultConversion(Traits *traits, const PrefVer *prefVers, RefConversionMode::Enum refMode)
+{
+ void *buf = traits->alloc(sizeof(DefaultParamConversion));
+ return PX_PLACEMENT_NEW(buf, DefaultParamConversion)(traits, prefVers, refMode);
+}
+
+}; // end of namespace
diff --git a/APEX_1.4/NvParameterized/src/NvSerializer.cpp b/APEX_1.4/NvParameterized/src/NvSerializer.cpp
new file mode 100644
index 00000000..0ec81855
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/NvSerializer.cpp
@@ -0,0 +1,358 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+/*!
+\file
+\brief NvParameterized serializer implementation
+*/
+
+#include <string.h>
+#include <ctype.h>
+#include <new> // for placement new
+
+#include "PxSimpleTypes.h"
+
+#include "nvparameterized/NvSerializer.h"
+#include "XmlSerializer.h"
+#include "BinSerializer.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+
+namespace
+{
+ static bool isInitialized = false;
+ static NvParameterized::SerializePlatform platform;
+}
+
+namespace NvParameterized
+{
+
+const SerializePlatform &GetCurrentPlatform()
+{
+ if( isInitialized )
+ return platform;
+
+ platform.osVer = SerializePlatform::ANY_VERSION; //Do we need this at all???
+
+ //Determine compiler
+# if PX_PS4 == 1
+ platform.compilerType = SerializePlatform::COMP_GCC;
+ platform.compilerVer = SerializePlatform::ANY_VERSION;
+# elif PX_VC != 0
+ platform.compilerType = SerializePlatform::COMP_VC;
+ platform.compilerVer = _MSC_VER;
+# elif PX_XBOXONE == 1
+ platform.compilerType = SerializePlatform::COMP_VC;
+ platform.compilerVer = _MSC_VER;
+# elif PX_GCC_FAMILY == 1
+ platform.compilerType =SerializePlatform:: COMP_GCC;
+ platform.compilerVer = (__GNUC__ << 16) + __GNUC_MINOR__;
+# elif PX_CW == 1
+ platform.compilerType = SerializePlatform::COMP_MW;
+# error "TODO: define version of Metrowerks compiler"
+# else
+# error "Unknown compiler"
+# endif
+
+ //Determine OS
+# if PX_WINDOWS_FAMILY == 1
+ platform.osType = SerializePlatform::OS_WINDOWS;
+# elif PX_APPLE_FAMILY == 1
+ platform.osType = SerializePlatform::OS_MACOSX;
+# elif PX_PS3 == 1
+ platform.osType = SerializePlatform::OS_LV2;
+# elif PX_X360 == 1
+ platform.osType = SerializePlatform::OS_XBOX;
+ platform.osVer = _XBOX_VER;
+# elif PX_XBOXONE == 1
+ platform.osType = SerializePlatform::OS_XBOXONE;
+# elif PX_PS4 == 1
+ platform.osType = SerializePlatform::OS_PS4;
+# elif PX_ANDROID == 1
+ platform.osType = SerializePlatform::OS_ANDROID;
+# elif PX_LINUX == 1
+ platform.osType = SerializePlatform::OS_LINUX;
+# else
+# error "Undefined OS"
+# endif
+
+ //Determine arch
+# if PX_X86 == 1
+ platform.archType = SerializePlatform::ARCH_X86;
+# elif PX_APPLE_FAMILY == 1
+ platform.archType = SerializePlatform::ARCH_X86;
+# elif PX_X64 == 1
+ platform.archType = SerializePlatform::ARCH_X86_64;
+# elif PX_PPC == 1
+ platform.archType = SerializePlatform::ARCH_PPC;
+# elif PX_PS3 == 1
+ platform.archType = SerializePlatform::ARCH_CELL;
+# elif PX_ARM == 1
+ platform.archType = SerializePlatform::ARCH_ARM;
+# else
+# error "Unknown architecture"
+# endif
+
+ isInitialized = true;
+ return platform;
+}
+
+bool GetPlatform(const char *name, SerializePlatform &platform_)
+{
+ platform_.osVer = platform_.compilerVer = SerializePlatform::ANY_VERSION;
+
+ if( 0 == strcmp("VcXbox", name) || 0 == strcmp("VcXbox360", name))
+ {
+ platform_.archType = SerializePlatform::ARCH_PPC;
+ platform_.compilerType = SerializePlatform::COMP_VC;
+ platform_.osType = SerializePlatform::OS_XBOX;
+ }
+ else if( 0 == strcmp("VcXboxOne", name) )
+ {
+ platform_.archType = SerializePlatform::ARCH_X86_64;
+ platform_.compilerType = SerializePlatform::COMP_VC;
+ platform_.osType = SerializePlatform::OS_XBOXONE;
+ }
+ else if( 0 == strcmp("GccPs4", name) )
+ {
+ platform_.archType = SerializePlatform::ARCH_X86_64;
+ platform_.compilerType = SerializePlatform::COMP_GCC;
+ platform_.osType = SerializePlatform::OS_PS4;
+ }
+ else if( 0 == strcmp("VcWin32", name) )
+ {
+ platform_.archType = SerializePlatform::ARCH_X86;
+ platform_.compilerType = SerializePlatform::COMP_VC;
+ platform_.osType = SerializePlatform::OS_WINDOWS;
+ }
+ else if( 0 == strcmp("VcWin64", name) )
+ {
+ platform_.archType = SerializePlatform::ARCH_X86_64;
+ platform_.compilerType = SerializePlatform::COMP_VC;
+ platform_.osType = SerializePlatform::OS_WINDOWS;
+ }
+ else if( 0 == strcmp("GccPs3", name) )
+ {
+ platform_.archType = SerializePlatform::ARCH_CELL;
+ platform_.compilerType = SerializePlatform::COMP_GCC;
+ platform_.osType = SerializePlatform::OS_LV2;
+ }
+ else if( 0 == strcmp("GccOsX32", name) )
+ {
+ platform_.archType = SerializePlatform::ARCH_X86;
+ platform_.compilerType = SerializePlatform::COMP_GCC;
+ platform_.osType = SerializePlatform::OS_MACOSX;
+ }
+ else if( 0 == strcmp("GccOsX64", name) )
+ {
+ platform.archType = SerializePlatform::ARCH_X86_64;
+ platform.compilerType = SerializePlatform::COMP_GCC;
+ platform.osType = SerializePlatform::OS_MACOSX;
+ }
+ else if( 0 == strcmp("AndroidARM", name) )
+ {
+ platform_.archType = SerializePlatform::ARCH_ARM;
+ platform_.compilerType = SerializePlatform::COMP_GCC;
+ platform_.osType = SerializePlatform::OS_ANDROID;
+ }
+ else if( 0 == strcmp("GccLinux32", name) )
+ {
+ platform_.archType = SerializePlatform::ARCH_X86;
+ platform_.compilerType = SerializePlatform::COMP_GCC;
+ platform_.osType = SerializePlatform::OS_LINUX;
+ }
+ else if( 0 == strcmp("GccLinux64", name) )
+ {
+ platform_.archType = SerializePlatform::ARCH_X86_64;
+ platform_.compilerType = SerializePlatform::COMP_GCC;
+ platform_.osType = SerializePlatform::OS_LINUX;
+ }
+ else if( 0 == strcmp("Pib", name) ) //Abstract platform for platform-independent serialization
+ {
+ platform_.archType = SerializePlatform::ARCH_GEN;
+ platform_.compilerType = SerializePlatform::COMP_GEN;
+ platform_.osType = SerializePlatform::OS_GEN;
+ }
+ else
+ return false;
+
+ return true;
+}
+
+const char *GetPlatformName(const SerializePlatform &platform_)
+{
+ static const char *unknown = "<Unknown>";
+
+ switch(platform_.osType )
+ {
+ case SerializePlatform::OS_XBOX:
+ return SerializePlatform::COMP_VC == platform_.compilerType
+ ? "VcXbox360" : unknown;
+
+ case SerializePlatform::OS_XBOXONE:
+ return SerializePlatform::COMP_VC == platform_.compilerType
+ ? "VcXboxOne" : unknown;
+
+ case SerializePlatform::OS_PS4:
+ return SerializePlatform::COMP_GCC == platform_.compilerType
+ ? "GccPs4" : unknown;
+
+ case SerializePlatform::OS_WINDOWS:
+ if( SerializePlatform::COMP_VC != platform_.compilerType )
+ return unknown;
+
+ switch(platform_.archType )
+ {
+ case SerializePlatform::ARCH_X86:
+ return "VcWin32";
+
+ case SerializePlatform::ARCH_X86_64:
+ return "VcWin64";
+
+ case SerializePlatform::ARCH_GEN:
+ case SerializePlatform::ARCH_PPC:
+ case SerializePlatform::ARCH_CELL:
+ case SerializePlatform::ARCH_ARM:
+ case SerializePlatform::ARCH_LAST:
+ default:
+ return unknown;
+ }
+
+ case SerializePlatform::OS_MACOSX:
+ if( SerializePlatform::COMP_GCC != platform.compilerType )
+ return unknown;
+
+ switch( platform.archType )
+ {
+ case SerializePlatform::ARCH_X86:
+ return "GccOsX32";
+
+ case SerializePlatform::ARCH_X86_64:
+ return "GccOsX64";
+
+ default:
+ return unknown;
+ }
+
+ case SerializePlatform::OS_LV2:
+ return SerializePlatform::COMP_GCC == platform_.compilerType
+ ? "GccPs3" : unknown;
+
+ case SerializePlatform::OS_GEN:
+ return "Pib";
+
+ case SerializePlatform::OS_ANDROID:
+ return SerializePlatform::ARCH_ARM == platform_.archType
+ ? "AndroidARM" : 0;
+
+ case SerializePlatform::OS_LINUX:
+ if( SerializePlatform::COMP_GCC != platform_.compilerType )
+ return unknown;
+
+ switch(platform_.archType )
+ {
+ case SerializePlatform::ARCH_X86:
+ return "GccLinux32";
+
+ case SerializePlatform::ARCH_X86_64:
+ return "GccLinux64";
+
+ case SerializePlatform::ARCH_GEN:
+ case SerializePlatform::ARCH_PPC:
+ case SerializePlatform::ARCH_CELL:
+ case SerializePlatform::ARCH_ARM:
+ case SerializePlatform::ARCH_LAST:
+ default:
+ return unknown;
+ }
+
+ case SerializePlatform::OS_LAST:
+ default:
+ return unknown;
+ }
+}
+
+Serializer *internalCreateSerializer(Serializer::SerializeType type, Traits *traits)
+{
+ switch ( type )
+ {
+ case Serializer::NST_XML:
+ {
+ void *buf = serializerMemAlloc(sizeof(XmlSerializer), traits);
+ return buf ? PX_PLACEMENT_NEW(buf, XmlSerializer)(traits) : 0;
+ }
+ case Serializer::NST_BINARY:
+ {
+ void *buf = serializerMemAlloc(sizeof(BinSerializer), traits);
+ return buf ? PX_PLACEMENT_NEW(buf, BinSerializer)(traits) : 0;
+ }
+ case Serializer::NST_LAST:
+ default:
+ NV_PARAM_TRAITS_WARNING(
+ traits,
+ "Unknown serializer type: %d",
+ (int)type );
+ break;
+ }
+
+ return 0;
+}
+
+Serializer::SerializeType Serializer::peekSerializeType(physx::PxFileBuf &stream)
+{
+ return isBinaryFormat(stream) ? Serializer::NST_BINARY
+ : isXmlFormat(stream) ? Serializer::NST_XML : Serializer::NST_LAST;
+}
+
+Serializer::ErrorType Serializer::peekPlatform(physx::PxFileBuf &stream, SerializePlatform &platform_)
+{
+ if( isBinaryFormat(stream) )
+ return peekBinaryPlatform(stream, platform_);
+
+ //Xml has no native platform
+ platform_ = GetCurrentPlatform();
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType Serializer::deserializeMetadata(physx::PxFileBuf & /*stream*/, DeserializedMetadata & /*desData*/)
+{
+ //Xml currently does not implement this
+ return Serializer::ERROR_NOT_IMPLEMENTED;
+}
+
+Serializer::ErrorType Serializer::deserialize(physx::PxFileBuf &stream, Serializer::DeserializedData &desData)
+{
+ bool tmp;
+ return deserialize(stream, desData, tmp);
+}
+
+Serializer::ErrorType Serializer::deserializeInplace(void *data, uint32_t dataLen, Serializer::DeserializedData &desData)
+{
+ bool tmp;
+ return deserializeInplace(data, dataLen, desData, tmp);
+}
+
+}; // end of namespace
diff --git a/APEX_1.4/NvParameterized/src/NvTraits.cpp b/APEX_1.4/NvParameterized/src/NvTraits.cpp
new file mode 100644
index 00000000..f1983a1f
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/NvTraits.cpp
@@ -0,0 +1,446 @@
+#include "NvTraits.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+#include "PsUserAllocated.h"
+#include "PsArray.h"
+#include "PsAtomic.h"
+#include "PsAlignedMalloc.h"
+#include "PxFoundation.h"
+#include "PxErrorCallback.h"
+#include "PsString.h"
+
+#define ALIGNED_ALLOC(n, align) physx::shdfnd::AlignedAllocator<align>().allocate(n, __FILE__, __LINE__)
+
+// Does not depend on alignment in AlignedAllocator
+#define ALIGNED_FREE(p) physx::shdfnd::AlignedAllocator<16>().deallocate(p)
+
+
+namespace NvParameterized
+{
+
+class NvTraits : public Traits, public physx::shdfnd::UserAllocated
+{
+public:
+ NvTraits(void)
+ {
+
+ }
+
+ virtual ~NvTraits(void)
+ {
+ }
+
+ virtual void release(void)
+ {
+ delete this;
+ }
+
+ /**
+ \brief Register NvParameterized class factory
+ */
+ virtual void registerFactory( ::NvParameterized::Factory & factory )
+ {
+ bool ok = true;
+
+ for (uint32_t i=0; i<mFactories.size(); ++i)
+ {
+ Factory *f = mFactories[i];
+ if ( f == &factory )
+ {
+ ok = false;
+ traitsWarn("Factory already registered.");
+ break;
+ }
+ if ( strcmp(f->getClassName(),factory.getClassName()) == 0 && f->getVersion() == factory.getVersion() )
+ {
+ ok = false;
+ traitsWarn("factory with this name and version already registered.");
+ break;
+ }
+ }
+ if ( ok )
+ {
+ mFactories.pushBack(&factory);
+ }
+ }
+
+ /**
+ \brief Remove NvParameterized class factory for current version of class
+ \return Removed factory or NULL if it is not found
+ */
+ virtual ::NvParameterized::Factory *removeFactory( const char * className )
+ {
+ NvParameterized::Factory *f = NULL;
+ uint32_t index=0;
+ uint32_t maxVersion = 0;
+ for (uint32_t i=0; i<mFactories.size(); i++)
+ {
+ if ( strcmp(mFactories[i]->getClassName(),className) == 0 )
+ {
+ if ( mFactories[i]->getVersion() >= maxVersion )
+ {
+ f = mFactories[i];
+ maxVersion = f->getVersion();
+ index = i;
+ }
+ }
+ }
+ if ( f )
+ {
+ mFactories.remove(index);
+ }
+ else
+ {
+ traitsWarn("Unable to remove factory.");
+ }
+ return f;
+ }
+
+ /**
+ \brief Remove NvParameterized class factory for given version of class
+ \return Removed factory or NULL if it is not found
+ */
+ virtual ::NvParameterized::Factory *removeFactory( const char * className, uint32_t version )
+ {
+ Factory *f = NULL;
+ for (uint32_t i=0; i<mFactories.size(); ++i)
+ {
+ if ( strcmp(mFactories[i]->getClassName(),className) == 0 && mFactories[i]->getVersion() == version )
+ {
+ f = mFactories[i];
+ mFactories.remove(i);
+ break;
+ }
+ }
+ if ( !f )
+ {
+ traitsWarn("Unable to remove factory, not found");
+ }
+ return f;
+ }
+
+ /**
+ \brief Checks whether any class factory is registered
+ */
+ virtual bool doesFactoryExist(const char* className)
+ {
+ bool ret = false;
+ for (uint32_t i=0; i<mFactories.size(); ++i)
+ {
+ if ( strcmp(mFactories[i]->getClassName(),className) == 0 )
+ {
+ ret = true;
+ break;
+ }
+ }
+ return ret;
+ }
+
+ /**
+ \brief Checks whether class factory for given version is registered
+ */
+ virtual bool doesFactoryExist(const char* className, uint32_t version)
+ {
+ bool ret = false;
+ for (uint32_t i=0; i<mFactories.size(); ++i)
+ {
+ if ( strcmp(mFactories[i]->getClassName(),className) == 0 && mFactories[i]->getVersion() == version )
+ {
+ ret = true;
+ break;
+ }
+ }
+ return ret;
+ }
+
+ // Helper method, locate a factory of this name and exact version, of it specific version not being searched for, return the highest registered version number.
+ Factory * locateFactory(const char *className,uint32_t version,bool useVersion) const
+ {
+ NvParameterized::Factory *f = NULL;
+ uint32_t maxVersion = 0;
+ for (uint32_t i=0; i<mFactories.size(); i++)
+ {
+ if ( strcmp(mFactories[i]->getClassName(),className) == 0 )
+ {
+ if ( useVersion )
+ {
+ if ( mFactories[i]->getVersion() == version )
+ {
+ f = mFactories[i];
+ }
+ }
+ else if ( mFactories[i]->getVersion() >= maxVersion )
+ {
+ f = mFactories[i];
+ maxVersion = f->getVersion();
+ }
+ }
+ }
+ return f;
+ }
+
+ /**
+ \brief Create object of NvParameterized class
+
+ Most probably this just calls Factory::create on appropriate factory.
+ */
+ virtual ::NvParameterized::Interface * createNvParameterized( const char * name )
+ {
+ NvParameterized::Interface *ret = NULL;
+ Factory *f = locateFactory(name,0,false);
+ if ( f )
+ {
+ ret = f->create(this);
+ }
+ return ret;
+ }
+
+ /**
+ \brief Create object of NvParameterized class
+
+ Most probably this just calls Factory::create on appropriate factory.
+ */
+ virtual ::NvParameterized::Interface * createNvParameterized( const char * name, uint32_t ver )
+ {
+ NvParameterized::Interface *ret = NULL;
+ Factory *f = locateFactory(name,ver,true);
+ if ( f )
+ {
+ ret = f->create(this);
+ }
+ return ret;
+ }
+
+ /**
+ \brief Finish construction of inplace object of NvParameterized class
+
+ Most probably this just calls Factory::finish using appropriate factory.
+ */
+ virtual ::NvParameterized::Interface * finishNvParameterized( const char * name, void *obj, void *buf, int32_t *refCount )
+ {
+ Factory *f = locateFactory(name,0,false);
+ return f ? f->finish(this,obj,buf,refCount) : NULL;
+ }
+
+ /**
+ \brief Finish construction of inplace object of NvParameterized class
+
+ Most probably this just calls Factory::finish using appropriate factory.
+ */
+ virtual ::NvParameterized::Interface * finishNvParameterized( const char * name, uint32_t ver, void *obj, void *buf, int32_t *refCount )
+ {
+ Factory *f = locateFactory(name,ver,true);
+ return f ? f->finish(this,obj,buf,refCount) : NULL;
+ }
+
+ /**
+ \brief Get version of class which is currently used
+ */
+ virtual uint32_t getCurrentVersion(const char *className) const
+ {
+ Factory *f = locateFactory(className,0,false);
+ return f ? f->getVersion() : 0;
+ }
+
+ /**
+ \brief Get memory alignment required for objects of class
+ */
+ virtual uint32_t getAlignment(const char *className, uint32_t classVersion) const
+ {
+ Factory *f = locateFactory(className,classVersion,true);
+ return f ? f->getAlignment() : 16;
+ }
+
+ /**
+ \brief Register converter for legacy version of class
+ */
+ virtual void registerConversion(const char * /*className*/, uint32_t /*from*/, uint32_t /*to*/, Conversion & /*conv*/)
+ {
+ PX_ALWAYS_ASSERT(); // TODO : Not yet implemented
+ }
+
+ /**
+ \brief Remove converter for legacy version of class
+ */
+ virtual ::NvParameterized::Conversion *removeConversion(const char * /*className*/, uint32_t /*from*/, uint32_t /*to*/)
+ {
+ PX_ALWAYS_ASSERT(); // TODO : Not yet implemented
+ return 0;
+ }
+
+ /**
+ \brief Update legacy object (most probably using appropriate registered converter)
+ \param [in] legacyObj legacy object to be converted
+ \param [in] obj destination object
+ \return True if conversion was successful, false otherwise
+ \warning Note that update is intrusive - legacyObj may be modified as a result of update
+ */
+ virtual bool updateLegacyNvParameterized(::NvParameterized::Interface &legacyObj, ::NvParameterized::Interface &obj)
+ {
+ PX_ALWAYS_ASSERT(); // TODO : Not yet implemented
+ PX_UNUSED(&legacyObj);
+ PX_UNUSED(&obj);
+
+ return false;
+ }
+
+ /**
+ \brief Get a list of the NvParameterized class type names
+
+ \param [in] names buffer for names
+ \param [out] outCount minimal required length of buffer
+ \param [in] inCount length of buffer
+ \return False if 'inCount' is not large enough to contain all of the names, true otherwise
+
+ \warning The memory for the strings returned is owned by the traits class
+ and should only be read, not written or freed.
+ */
+ virtual bool getNvParameterizedNames( const char ** names, uint32_t &outCount, uint32_t inCount) const
+ {
+ bool ret = true;
+
+ outCount = 0;
+ for (uint32_t i=0; i<mFactories.size(); i++)
+ {
+ Factory *f = mFactories[i];
+ const char *name = f->getClassName();
+ for (uint32_t j=0; j<outCount; j++)
+ {
+ if ( strcmp(name,names[j]) == 0 )
+ {
+ name = NULL;
+ break;
+ }
+ }
+ if ( name )
+ {
+ if ( outCount == inCount )
+ {
+ ret = false;
+ break;
+ }
+ else
+ {
+ names[outCount] = name;
+ outCount++;
+ }
+ }
+ }
+ return ret;
+ }
+
+ /**
+ \brief Get a list of versions of particular NvParameterized class
+
+ \param [in] className Name of the class
+ \param [in] versions buffer for versions
+ \param [out] outCount minimal required length of buffer
+ \param [in] inCount length of buffer
+ \return False if 'inCount' is not large enough to contain all of version names, true otherwise
+
+ \warning The memory for the strings returned is owned by the traits class
+ and should only be read, not written or freed.
+ */
+ virtual bool getNvParameterizedVersions(const char* className, uint32_t* versions, uint32_t &outCount, uint32_t inCount) const
+ {
+ bool ret = true;
+
+ outCount = 0;
+ for (uint32_t i=0; i<mFactories.size(); i++)
+ {
+ Factory *f = mFactories[i];
+ const char *name = f->getClassName();
+ if ( strcmp(name,className) == 0 )
+ {
+ if ( outCount == inCount )
+ {
+ ret = false;
+ break;
+ }
+ else
+ {
+ versions[outCount] = f->getVersion();
+ outCount++;
+ }
+ }
+ }
+ return ret;
+ }
+
+ /**
+ \brief Called when inplace object is destroyed
+ */
+ virtual void onInplaceObjectDestroyed(void * /*buf*/, ::NvParameterized::Interface * /*obj*/)
+ {
+
+ }
+
+ /**
+ \brief Called when all inplace objects are destroyed
+ */
+ virtual void onAllInplaceObjectsDestroyed(void *buf)
+ {
+ free(buf);
+ }
+
+ void* alloc(uint32_t nbytes)
+ {
+ return alloc(nbytes, 16);
+ }
+
+ void* alloc(uint32_t nbytes, uint32_t align)
+ {
+ if (align <= 16)
+ {
+ return ALIGNED_ALLOC(nbytes, 16);
+ }
+ else switch (align)
+ {
+ case 32:
+ return ALIGNED_ALLOC(nbytes, 32);
+ case 64:
+ return ALIGNED_ALLOC(nbytes, 64);
+ case 128:
+ return ALIGNED_ALLOC(nbytes, 128);
+ }
+
+ // Do not support larger alignments
+
+ return 0;
+ }
+
+ void free(void* buf)
+ {
+ ALIGNED_FREE(buf);
+ }
+
+ int32_t incRefCount(int32_t* refCount)
+ {
+ return physx::shdfnd::atomicIncrement(refCount);
+ }
+
+ virtual int32_t decRefCount(int32_t* refCount)
+ {
+ return physx::shdfnd::atomicDecrement(refCount);
+ }
+
+
+ /**
+ \brief Warns user
+ */
+ virtual void traitsWarn(const char * msg) const
+ {
+ char scratch[512];
+ physx::shdfnd::snprintf(scratch,512,"NvParameterized::Traits::Warning(%s)", msg);
+ PxGetFoundation().getErrorCallback().reportError(physx::PxErrorCode::eDEBUG_WARNING,scratch,__FILE__,__LINE__ );
+ }
+
+ physx::shdfnd::Array< Factory * > mFactories;
+};
+
+Traits *createTraits(void)
+{
+ NvTraits *n = PX_NEW(NvTraits);
+ return static_cast< Traits *>(n);
+}
+
+}
diff --git a/APEX_1.4/NvParameterized/src/NvTraits.h b/APEX_1.4/NvParameterized/src/NvTraits.h
new file mode 100644
index 00000000..159662a2
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/NvTraits.h
@@ -0,0 +1,41 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef PX_TRAITS_H
+
+#define PX_TRAITS_H
+
+namespace NvParameterized
+{
+
+class Traits;
+
+Traits *createTraits(void);
+
+}
+
+#endif
diff --git a/APEX_1.4/NvParameterized/src/PlatformABI.cpp b/APEX_1.4/NvParameterized/src/PlatformABI.cpp
new file mode 100644
index 00000000..6062cdfe
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/PlatformABI.cpp
@@ -0,0 +1,414 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+#include "PxSimpleTypes.h"
+#include "PlatformABI.h"
+#include "NvSerializerInternal.h"
+#include "SerializerCommon.h"
+
+using namespace NvParameterized;
+
+//Returns ABI for predefined platforms
+Serializer::ErrorType PlatformABI::GetPredefinedABI(const SerializePlatform &platform, PlatformABI &params)
+{
+ //Most common parameters
+ params.endian = LITTLE;
+ params.sizes.Char = 1;
+ params.sizes.Bool = 1;
+ params.sizes.pointer = 4;
+ params.sizes.real = 4; //float
+ params.aligns.Char = 1;
+ params.aligns.pointer = 4;
+ params.aligns.Bool = 1;
+ params.aligns.i8 = 1;
+ params.aligns.i16 = 2;
+ params.aligns.i32 = 4;
+ params.aligns.i64 = 8;
+ params.aligns.f32 = 4;
+ params.aligns.f64 = 8;
+ params.aligns.real = params.aligns.f32;
+ params.doReuseParentPadding = false;
+ params.doEbo = true;
+
+ SerializePlatform knownPlatform;
+
+ //TODO: all those GetPlatforms are ugly
+
+ NV_BOOL_ERR_CHECK_RETURN( GetPlatform("VcWin32", knownPlatform), Serializer::ERROR_UNKNOWN );
+ if( knownPlatform == platform )
+ {
+ //Default params are ok
+ return Serializer::ERROR_NONE;
+ }
+
+ NV_BOOL_ERR_CHECK_RETURN( GetPlatform("VcWin64", knownPlatform), Serializer::ERROR_UNKNOWN );
+ if( knownPlatform == platform )
+ {
+ params.sizes.pointer = params.aligns.pointer = 8;
+ return Serializer::ERROR_NONE;
+ }
+
+ NV_BOOL_ERR_CHECK_RETURN( GetPlatform("VcXbox360", knownPlatform), Serializer::ERROR_UNKNOWN );
+ if( knownPlatform == platform )
+ {
+ //Pointers remain 32-bit
+ params.endian = BIG;
+ return Serializer::ERROR_NONE;
+ }
+
+ // Snc says that it's binary compatible with Gcc...
+ NV_BOOL_ERR_CHECK_RETURN( GetPlatform("GccPs3", knownPlatform), Serializer::ERROR_UNKNOWN );
+ if( knownPlatform == platform )
+ {
+ //Pointers remain 32-bit
+ params.doReuseParentPadding = true;
+ params.endian = BIG;
+ return Serializer::ERROR_NONE;
+ }
+
+ // Same as ps3 but little endian
+ NV_BOOL_ERR_CHECK_RETURN( GetPlatform("AndroidARM", knownPlatform), Serializer::ERROR_UNKNOWN );
+ if( knownPlatform == platform )
+ {
+ //Pointers remain 32-bit
+ params.doReuseParentPadding = true;
+ params.endian = LITTLE;
+ return Serializer::ERROR_NONE;
+ }
+
+ NV_BOOL_ERR_CHECK_RETURN(GetPlatform("GccLinux32", knownPlatform), Serializer::ERROR_UNKNOWN);
+ if (knownPlatform == platform)
+ {
+ return Serializer::ERROR_NONE;
+ }
+
+ NV_BOOL_ERR_CHECK_RETURN(GetPlatform("GccLinux64", knownPlatform), Serializer::ERROR_UNKNOWN);
+ if (knownPlatform == platform)
+ {
+ params.doReuseParentPadding = true;
+ params.sizes.pointer = params.aligns.pointer = 8;
+ return Serializer::ERROR_NONE;
+ }
+
+ // FIXME: true ABI is much more complicated (sizeof(bool) is 4, etc.)
+ NV_BOOL_ERR_CHECK_RETURN( GetPlatform("GccOsX32", knownPlatform), Serializer::ERROR_UNKNOWN );
+ if( knownPlatform == platform )
+ {
+ params.doReuseParentPadding = true; // TODO (JPB): Is this correct?
+ return Serializer::ERROR_NONE;
+ }
+
+ NV_BOOL_ERR_CHECK_RETURN( GetPlatform("GccOsX64", knownPlatform), Serializer::ERROR_UNKNOWN );
+ if( knownPlatform == platform )
+ {
+ params.doReuseParentPadding = true;
+ params.sizes.pointer = params.aligns.pointer = 8;
+ return Serializer::ERROR_NONE;
+ }
+
+ NV_BOOL_ERR_CHECK_RETURN( GetPlatform("Pib", knownPlatform), Serializer::ERROR_UNKNOWN );
+ if( knownPlatform == platform )
+ {
+ params.endian = BIG;
+
+ params.sizes.Char = params.sizes.Bool = 1;
+ params.sizes.pointer = 4;
+ params.sizes.real = 4; //float
+
+ //All alignments are 1 to minimize space
+ uint32_t *aligns = (uint32_t *)&params.aligns;
+ for(uint32_t i = 0; i < sizeof(params.aligns)/sizeof(uint32_t); ++i)
+ aligns[i] = 1;
+
+ return Serializer::ERROR_NONE;
+ }
+
+ NV_BOOL_ERR_CHECK_RETURN( GetPlatform("VcXboxOne", knownPlatform), Serializer::ERROR_UNKNOWN );
+ if( knownPlatform == platform )
+ {
+ params.sizes.pointer = params.aligns.pointer = 8;
+ return Serializer::ERROR_NONE;
+ }
+
+ NV_BOOL_ERR_CHECK_RETURN( GetPlatform("GccPs4", knownPlatform), Serializer::ERROR_UNKNOWN );
+ if( knownPlatform == platform )
+ {
+ // if you don't set this then the in-place binary files could contain padding
+ // between the NvParameters class and the parameterized data.
+ params.doReuseParentPadding = true;
+ params.sizes.pointer = params.aligns.pointer = 8;
+ return Serializer::ERROR_NONE;
+ }
+
+ //Add new platforms here
+
+ return Serializer::ERROR_INVALID_PLATFORM_NAME;
+}
+
+uint32_t PlatformABI::getNatAlignment(const Definition *pd) const
+{
+ switch( pd->type() )
+ {
+ case TYPE_ARRAY:
+ return pd->arraySizeIsFixed()
+ ? getAlignment(pd->child(0)) //Array alignment = mermber alignment
+ : NvMax3(aligns.pointer, aligns.Bool, aligns.i32); //Dynamic array is DummyDynamicArrayStruct
+
+ case TYPE_STRUCT:
+ {
+ //Struct alignment is max of fields' alignment
+ uint32_t align = 1;
+ for(int32_t i = 0; i < pd->numChildren(); ++i)
+ align = physx::PxMax(align, getAlignment(pd->child(i)));
+
+ return align;
+ }
+
+ case TYPE_STRING:
+ return physx::PxMax(aligns.pointer, aligns.Bool); //String = DummyDynamicStringStruct
+
+ case TYPE_I8:
+ case TYPE_U8:
+ return aligns.i8;
+
+ case TYPE_I16:
+ case TYPE_U16:
+ return aligns.i16;
+
+ case TYPE_I32:
+ case TYPE_U32:
+ return aligns.i32;
+
+ case TYPE_I64:
+ case TYPE_U64:
+ return aligns.i64;
+
+ case TYPE_F32:
+ case TYPE_VEC2:
+ case TYPE_VEC3:
+ case TYPE_VEC4:
+ case TYPE_QUAT:
+ case TYPE_MAT33:
+ case TYPE_BOUNDS3:
+ case TYPE_MAT34:
+ case TYPE_MAT44:
+ case TYPE_TRANSFORM:
+ return aligns.f32;
+
+ case TYPE_F64:
+ return aligns.f64;
+
+ case TYPE_ENUM:
+ case TYPE_REF:
+ case TYPE_POINTER:
+ return aligns.pointer;
+
+ case TYPE_BOOL:
+ return aligns.Bool;
+
+ NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+ default:
+ PX_ASSERT( 0 && "Unexpected type" );
+ }
+
+ return UINT32_MAX;
+}
+
+//Returns alignment of given DataType
+uint32_t PlatformABI::getAlignment(const Definition *pd) const
+{
+ uint32_t natAlign = getNatAlignment(pd),
+ customAlign = pd->alignment();
+
+ // Alignment of dynamic array means alignment of dynamic memory
+ return !customAlign || ( TYPE_ARRAY == pd->type() && !pd->arraySizeIsFixed() )
+ ? natAlign
+ : physx::PxMax(natAlign, customAlign);
+}
+
+//Returns alignment of given DataType
+uint32_t PlatformABI::getPadding(const Definition *pd) const
+{
+ uint32_t natAlign = getNatAlignment(pd),
+ customPad = pd->padding();
+
+ // Alignment of dynamic array means alignment of dynamic memory
+ return !customPad || ( TYPE_ARRAY == pd->type() && !pd->arraySizeIsFixed() )
+ ? natAlign
+ : physx::PxMax(natAlign, customPad);
+}
+
+//Returns size of given DataType
+uint32_t PlatformABI::getSize(const Definition *pd) const
+{
+ switch( pd->type() )
+ {
+ case TYPE_ARRAY:
+ if( pd->arraySizeIsFixed() )
+ {
+ //Size of static array = number of elements * size of element
+ const Definition *elemPd = pd;
+ uint32_t totalSize = 1;
+ for(int32_t i = 0; i < pd->arrayDimension(); ++i)
+ {
+ // Currently no nested dynamic arrays
+ NV_BOOL_ERR_CHECK_RETURN( elemPd->arraySizeIsFixed(), Serializer::ERROR_NOT_IMPLEMENTED );
+
+ int32_t size = elemPd->arraySize();
+ totalSize *= size;
+
+ elemPd = elemPd->child(0);
+ }
+ return totalSize * getSize(elemPd);
+ }
+ else
+ {
+ //Dynamic array = DummyDynamicArrayStruct
+
+ uint32_t totalAlign = NvMax3(aligns.pointer, aligns.Bool, aligns.i32);
+
+ uint32_t size = sizes.pointer; //buf
+ size = align(size, aligns.Bool) + 1U; //isAllocated
+ size = align(size, aligns.i32) + 4U; //elementSize
+ size = align(size, aligns.i32) + pd->arrayDimension() * 4U; //arraySizes
+
+ uint32_t paddedSize = align(size, totalAlign);
+
+ return paddedSize;
+ }
+
+ case TYPE_STRUCT:
+ {
+ if( !pd->numChildren() )
+ return 1;
+
+ //Size of struct = sum of member sizes + sum of padding bytes + tail padding
+
+ uint32_t totalAlign = 1, size = 0;
+ for(int32_t i = 0; i < pd->numChildren(); ++i)
+ {
+ uint32_t childAlign = getAlignment(pd->child(i));
+ totalAlign = physx::PxMax(totalAlign, childAlign);
+ size = align(size, childAlign) + getSize(pd->child(i));
+ }
+
+ uint32_t customPad = pd->padding();
+ if( customPad )
+ totalAlign = physx::PxMax(totalAlign, customPad);
+
+ return align(size, totalAlign); //Tail padding bytes
+ }
+
+ case TYPE_STRING:
+ {
+ //String = DummyDynamicStringStruct
+
+ uint32_t totalAlign = physx::PxMax(aligns.pointer, aligns.Bool);
+
+ uint32_t size = sizes.pointer; //buf
+ size = align(size, aligns.Bool) + 1U; //isAllocated
+
+ uint32_t paddedSize = align(size, totalAlign);
+
+ return paddedSize;
+ }
+
+ case TYPE_I8:
+ case TYPE_U8:
+ return 1;
+
+ case TYPE_I16:
+ case TYPE_U16:
+ return 2;
+
+ case TYPE_I32:
+ case TYPE_U32:
+ case TYPE_F32:
+ return 4;
+
+ case TYPE_I64:
+ case TYPE_U64:
+ case TYPE_F64:
+ return 8;
+
+ // Vectors and matrices are structs so we need tail padding
+
+ case TYPE_VEC2:
+ return align(2 * sizes.real, aligns.real);
+ case TYPE_VEC3:
+ return align(3 * sizes.real, aligns.real);
+ case TYPE_VEC4:
+ return align(4 * sizes.real, aligns.real);
+ case TYPE_QUAT:
+ return align(4 * sizes.real, aligns.real);
+ case TYPE_MAT33:
+ return align(9 * sizes.real, aligns.real);
+ case TYPE_MAT34:
+ return align(12 * sizes.real, aligns.real);
+ case TYPE_MAT44:
+ return align(16 * sizes.real, aligns.real);
+ case TYPE_BOUNDS3:
+ return align(6 * sizes.real, aligns.real);
+ case TYPE_TRANSFORM:
+ return align(7 * sizes.real, aligns.real);
+
+ case TYPE_ENUM:
+ case TYPE_REF:
+ case TYPE_POINTER:
+ return sizes.pointer;
+
+ case TYPE_BOOL:
+ return sizes.Bool;
+
+ NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+ default:
+ PX_ASSERT( 0 && "Unexpected type" );
+ }
+
+ return UINT32_MAX; //This is never reached
+}
+
+bool PlatformABI::VerifyCurrentPlatform()
+{
+ //See PlatformABI::isNormal
+
+ uint8_t one = 1,
+ zero = 0;
+
+ struct Empty {};
+
+ return 1 == GetAlignment<bool>::value && 1 == sizeof(bool)
+ && 1 == GetAlignment<uint8_t>::value
+ && 1 == GetAlignment<char>::value
+ && 4 == sizeof(float)
+ && *(bool *)&one //We assume that 0x1 corresponds to true internally
+ && !*(bool *)&zero //We assume that 0x0 corresponds to false internally
+ && 1 == sizeof(Empty); // Serializer expects sizeof empty struct to be 1
+}
diff --git a/APEX_1.4/NvParameterized/src/PlatformInputStream.cpp b/APEX_1.4/NvParameterized/src/PlatformInputStream.cpp
new file mode 100644
index 00000000..f3c6acef
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/PlatformInputStream.cpp
@@ -0,0 +1,336 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+#include "PlatformInputStream.h"
+
+using namespace NvParameterized;
+
+PlatformInputStream::PlatformInputStream(physx::PxFileBuf &stream, const PlatformABI &targetParams, Traits *traits)
+ : PlatformStream(targetParams, traits), mStream(stream), mPos(traits), mStartPos(stream.tellRead())
+{}
+
+Serializer::ErrorType PlatformInputStream::skipBytes(uint32_t nbytes)
+{
+ uint32_t newPos = mStream.tellRead() + nbytes;
+
+ if( newPos >= mStream.getFileLength() )
+ {
+ DEBUG_ALWAYS_ASSERT();
+ return Serializer::ERROR_INVALID_INTERNAL_PTR;
+ }
+
+ mStream.seekRead(newPos);
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType PlatformInputStream::pushPos(uint32_t newPos)
+{
+ if( !newPos )
+ {
+ //Trying to access NULL
+ DEBUG_ALWAYS_ASSERT();
+ return Serializer::ERROR_INVALID_INTERNAL_PTR;
+ }
+
+ if( mStartPos + newPos >= mStream.getFileLength() )
+ {
+ DEBUG_ALWAYS_ASSERT();
+ return Serializer::ERROR_INVALID_INTERNAL_PTR;
+ }
+
+ mPos.pushBack(mStream.tellRead());
+ mStream.seekRead(mStartPos + newPos);
+
+ return Serializer::ERROR_NONE;
+}
+
+void PlatformInputStream::popPos()
+{
+ mStream.seekRead(mPos.back());
+ mPos.popBack();
+}
+
+uint32_t PlatformInputStream::getPos() const
+{
+ return mStream.tellRead() - mStartPos;
+}
+
+Serializer::ErrorType PlatformInputStream::readString(uint32_t off, const char *&s)
+{
+ if( !off )
+ {
+ s = 0;
+ return Serializer::ERROR_NONE;
+ }
+
+ NV_ERR_CHECK_RETURN( pushPos(off) );
+
+ StringBuf buf(mTraits);
+ buf.reserve(10);
+
+ int8_t c;
+ do
+ {
+ NV_ERR_CHECK_RETURN( read(c) );
+ buf.append((char)c);
+ } while( c );
+
+ popPos();
+
+ s = buf.getBuffer();
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType PlatformInputStream::readObjHeader(ObjHeader &hdr)
+{
+ uint32_t align_ = NvMax3(mTargetParams.aligns.Bool, mTargetParams.aligns.i32, mTargetParams.aligns.pointer);
+
+ beginStruct(align_);
+
+ uint32_t prevPos = getPos();
+
+ uint32_t relOffset;
+ NV_ERR_CHECK_RETURN(read(relOffset));
+
+ hdr.dataOffset = prevPos + relOffset; //Convert relative offset to absolute
+
+ uint32_t classNameOff;
+ NV_ERR_CHECK_RETURN( readPtr(classNameOff) );
+ NV_ERR_CHECK_RETURN( readString(classNameOff, hdr.className) );
+
+ uint32_t nameOff;
+ NV_ERR_CHECK_RETURN( readPtr(nameOff) );
+ NV_ERR_CHECK_RETURN( readString(nameOff, hdr.name) );
+
+ NV_ERR_CHECK_RETURN( read(hdr.isIncluded) );
+ NV_ERR_CHECK_RETURN( read(hdr.version) );
+ NV_ERR_CHECK_RETURN( read(hdr.checksumSize) );
+
+ uint32_t chkOff;
+ NV_ERR_CHECK_RETURN( readPtr(chkOff) );
+
+ if( !chkOff )
+ hdr.checksum = 0;
+ else
+ {
+ NV_ERR_CHECK_RETURN( pushPos(chkOff) );
+
+ //TODO: usually we can avoid memory allocation here because checksumSize is 4
+ hdr.checksum = (uint32_t *)mTraits->alloc(4 * hdr.checksumSize);
+ for(uint32_t i = 0; i < hdr.checksumSize; ++i)
+ NV_ERR_CHECK_RETURN( read( const_cast<uint32_t &>(hdr.checksum[i]) ) );
+
+ popPos();
+ }
+
+ closeStruct();
+
+ NV_ERR_CHECK_RETURN( pushPos(hdr.dataOffset) );
+
+ //Skip NvParameters fields
+ //WARN: this depends on implementation of NvParameters
+
+ beginStruct(physx::PxMax(mTargetParams.aligns.pointer, mTargetParams.aligns.Bool));
+
+ uint32_t tmp;
+ for(uint32_t i = 0; i < 8; readPtr(tmp), ++i); //vtable and other fields
+
+ bool mDoDeallocateSelf;
+ NV_ERR_CHECK_RETURN( read(mDoDeallocateSelf) );
+
+ bool mDoDeallocateName;
+ NV_ERR_CHECK_RETURN( read(mDoDeallocateName) );
+
+ bool mDoDeallocateClassName;
+ NV_ERR_CHECK_RETURN( read(mDoDeallocateClassName) );
+
+ //See note in beginObject
+ if( !mTargetParams.doReuseParentPadding )
+ closeStruct();
+
+ hdr.dataOffset = getPos();
+
+ popPos();
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType PlatformInputStream::readSimpleStructArray(Handle &handle)
+{
+ int32_t n;
+ handle.getArraySize(n);
+
+ const NvParameterized::Definition *pdStruct = handle.parameterDefinition()->child(0);
+ int32_t nfields = pdStruct->numChildren();
+
+ uint32_t align_ = getTargetAlignment(pdStruct),
+ pad_ = getTargetPadding(pdStruct);
+
+ align(align_);
+
+ for(int32_t i = 0; i < n; ++i)
+ {
+ beginStruct(align_, pad_);
+ handle.set(i);
+
+ for(int32_t j = 0; j < nfields; ++j)
+ {
+ handle.set(j);
+
+ const Definition *pdField = pdStruct->child(j);
+
+ if( pdField->alignment() )
+ align( pdField->alignment() );
+
+ if( pdField->hint("DONOTSERIALIZE") )
+ {
+ //Simply skip bytes
+ align(getTargetAlignment(pdField));
+ NV_ERR_CHECK_RETURN( skipBytes(getTargetSize(pdField)) );
+ }
+ else
+ {
+ //No need to align structs because of tail padding
+ switch( pdField->type() )
+ {
+# define NV_PARAMETERIZED_TYPES_NO_LEGACY_TYPES
+# define NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+# define NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+# define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ case TYPE_##enum_name: \
+ { \
+ c_type val; \
+ NV_ERR_CHECK_RETURN(read(val)); \
+ handle.setParam##type_name(val); \
+ break; \
+ }
+# include "nvparameterized/NvParameterized_types.h"
+
+ case TYPE_MAT34:
+ {
+ float val[12];
+ for (int k = 0; k < 12; ++k)
+ {
+ NV_ERR_CHECK_RETURN(read(val[k]));
+ }
+ handle.setParamMat34Legacy(val);
+ break;
+ }
+ NV_PARAMETRIZED_NO_MATH_DATATYPE_LABELS
+ default:
+ DEBUG_ASSERT( 0 && "Unexpected type" );
+ return Serializer::ERROR_UNKNOWN;
+ }
+ }
+
+ handle.popIndex();
+ } //j
+
+ handle.popIndex();
+ closeStruct();
+ } //i
+
+ return Serializer::ERROR_NONE;
+}
+
+void PlatformInputStream::beginStruct(uint32_t align_, uint32_t pad_)
+{
+ mStack.pushBack(Agregate(Agregate::STRUCT, pad_));
+ align(align_); // Align _after_ we push array because otherwise align() would be ignored
+}
+
+void PlatformInputStream::beginStruct(uint32_t align_)
+{
+ beginStruct(align_, align_);
+}
+
+void PlatformInputStream::beginStruct(const Definition *pd)
+{
+ beginStruct(getTargetAlignment(pd), getTargetPadding(pd));
+}
+
+void PlatformInputStream::closeStruct()
+{
+ PX_ASSERT(mStack.size() > 0);
+
+ align(mStack.back().align); //Tail padding
+ mStack.popBack();
+}
+
+void PlatformInputStream::beginString()
+{
+ beginStruct(physx::PxMax(mTargetParams.aligns.pointer, mTargetParams.aligns.Bool));
+}
+
+void PlatformInputStream::closeString()
+{
+ closeStruct();
+}
+
+void PlatformInputStream::beginArray(const Definition *pd)
+{
+ uint32_t align_ = getTargetAlignment(pd);
+ align(align_); // Align _before_ we push array because otherwise align() would be ignored
+ mStack.pushBack(Agregate(Agregate::ARRAY, align_));
+}
+
+void PlatformInputStream::closeArray()
+{
+ // No padding in arrays
+ mStack.popBack();
+}
+
+void PlatformInputStream::align(uint32_t border)
+{
+ mStream.seekRead(mStartPos + getAlign(getPos(), border));
+}
+
+Serializer::ErrorType PlatformInputStream::readPtr(uint32_t &val)
+{
+ //Do not align on uint32_t or uint64_t boundary (already aligned at pointer boundary)
+ align(mTargetParams.aligns.pointer);
+ if( 4 == mTargetParams.sizes.pointer )
+ {
+ return read(val, false);
+ }
+ else
+ {
+ PX_ASSERT( 8 == mTargetParams.sizes.pointer );
+
+ uint64_t val64;
+ NV_ERR_CHECK_RETURN( read(val64, false) );
+
+ val = (uint32_t)val64;
+ PX_ASSERT( val == val64 );
+
+ return Serializer::ERROR_NONE;
+ }
+}
diff --git a/APEX_1.4/NvParameterized/src/PlatformOutputStream.cpp b/APEX_1.4/NvParameterized/src/PlatformOutputStream.cpp
new file mode 100644
index 00000000..74ae68e6
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/PlatformOutputStream.cpp
@@ -0,0 +1,560 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+// WARNING: before doing any changes to this file
+// check comments at the head of BinSerializer.cpp
+
+#include "PlatformOutputStream.h"
+#include <stdint.h>
+
+using namespace NvParameterized;
+
+#ifndef WITHOUT_APEX_SERIALIZATION
+
+Reloc::Reloc(RelocType type_, uint32_t ptrPos_, const PlatformOutputStream &parent)
+ : type(type_),
+ ptrPos(ptrPos_),
+ traits(parent.mTraits)
+{
+ ptrData = reinterpret_cast<PlatformOutputStream *>(traits->alloc(sizeof(PlatformOutputStream)));
+ PX_PLACEMENT_NEW(ptrData, PlatformOutputStream)(parent.mTargetParams, parent.mTraits, parent.dict);
+}
+
+Reloc::Reloc(const Reloc &cinfo): type(cinfo.type), ptrPos(cinfo.ptrPos), traits(cinfo.traits)
+{
+ Reloc &info = (Reloc &)cinfo;
+
+ //Take ownership of stream to avoid slow recursive copies (especially when reallocating array elements)
+ ptrData = info.ptrData;
+ info.ptrData = 0;
+}
+
+Reloc::~Reloc()
+{
+ if( ptrData )
+ {
+ ptrData->~PlatformOutputStream();
+ traits->free(ptrData);
+ }
+}
+
+PlatformOutputStream::PlatformOutputStream(const PlatformABI &targetParams, Traits *traits, Dictionary &dict_)
+ : PlatformStream(targetParams, traits),
+ data(traits),
+ mRelocs(Traits::Allocator(traits)),
+ mStrings(Traits::Allocator(traits)),
+ mMerges(Traits::Allocator(traits)),
+ dict(dict_),
+ mTotalAlign(1)
+{}
+
+PlatformOutputStream::PlatformOutputStream(const PlatformOutputStream &s)
+ : PlatformStream(s),
+ data(s.data),
+ mRelocs(Traits::Allocator(s.mTraits)),
+ mStrings(Traits::Allocator(s.mTraits)),
+ mMerges(Traits::Allocator(s.mTraits)),
+ dict(s.dict),
+ mTotalAlign(1)
+{
+ mRelocs.reserve(s.mRelocs.size());
+ for(uint32_t i = 0; i < s.mRelocs.size(); ++i)
+ mRelocs.pushBack(s.mRelocs[i]);
+
+ mStrings.reserve(s.mStrings.size());
+ for(uint32_t i = 0; i < s.mStrings.size(); ++i)
+ mStrings.pushBack(s.mStrings[i]);
+
+ mMerges.reserve(s.mMerges.size());
+ for(uint32_t i = 0; i < s.mMerges.size(); ++i)
+ mMerges.pushBack(s.mMerges[i]);
+}
+
+#ifndef NDEBUG
+void PlatformOutputStream::dump() const
+{
+ PlatformStream::dump();
+
+ dumpBytes(data, size());
+
+ fflush(stdout);
+ for(uint32_t i = 0; i < mRelocs.size(); ++i)
+ {
+ printf("Relocation %d at %x:\n", (int)i, mRelocs[i].ptrPos);
+ mRelocs[i].ptrData->dump();
+ }
+
+ fflush(stdout);
+}
+#endif
+
+void PlatformOutputStream::storeU32At(uint32_t x, uint32_t i)
+{
+ if( mCurParams.endian != mTargetParams.endian )
+ SwapBytes(reinterpret_cast<char *>(&x), 4U, TYPE_U32);
+
+ *reinterpret_cast<uint32_t *>(&data[i]) = x;
+}
+
+uint32_t PlatformOutputStream::storeString(const char *s)
+{
+ uint32_t off = storeSimple((uint8_t)*s);
+ while( *s++ )
+ storeSimple((uint8_t)*s);
+
+ return off;
+}
+
+uint32_t PlatformOutputStream::storeBytes(const char *s, uint32_t n)
+{
+ if( !n )
+ return size();
+
+ uint32_t off = storeSimple((uint8_t)s[0]);
+ for(uint32_t i = 1; i < n; ++i)
+ storeSimple((uint8_t)s[i]);
+
+ return off;
+}
+
+uint32_t PlatformOutputStream::beginStruct(uint32_t align_, uint32_t pad_)
+{
+ uint32_t off = size();
+ mStack.pushBack(Agregate(Agregate::STRUCT, pad_));
+ align(align_); // Align _after_ we push struct to avoid ignored align() when inside array
+ return off;
+}
+
+uint32_t PlatformOutputStream::beginStruct(uint32_t align_)
+{
+ return beginStruct(align_, align_);
+}
+
+uint32_t PlatformOutputStream::beginStruct(const Definition *pd)
+{
+ return beginStruct(getTargetAlignment(pd), getTargetPadding(pd));
+}
+
+void PlatformOutputStream::closeStruct()
+{
+ PX_ASSERT(mStack.size() > 0);
+
+ //Tail padding
+ align(mStack.back().align);// Align _before_ we pop struct to avoid ignored align() when inside array
+ mStack.popBack();
+}
+
+uint32_t PlatformOutputStream::beginString()
+{
+ return beginStruct(physx::PxMax(mTargetParams.aligns.pointer, mTargetParams.aligns.Bool));
+}
+
+void PlatformOutputStream::closeString()
+{
+ closeStruct();
+}
+
+uint32_t PlatformOutputStream::beginArray(const Definition *pd)
+{
+ return beginArray(getTargetAlignment(pd));
+}
+
+uint32_t PlatformOutputStream::beginArray(uint32_t align_)
+{
+ align(align_); // Align _before_ we push array because otherwise align() would be ignored
+ uint32_t off = size();
+ mStack.pushBack(Agregate(Agregate::ARRAY, align_));
+ return off;
+}
+
+void PlatformOutputStream::closeArray()
+{
+ // No tail padding when in array
+ mStack.popBack();
+}
+
+void PlatformOutputStream::skipBytes(uint32_t nbytes)
+{
+ data.skipBytes(nbytes);
+}
+
+void PlatformOutputStream::align(uint32_t border)
+{
+ bool isAligned;
+ uint32_t newSize = getAlign(size(), border, isAligned);
+
+ if( isAligned )
+ mTotalAlign = physx::PxMax(mTotalAlign, border);
+
+ data.skipBytes(newSize - size());
+}
+
+void PlatformOutputStream::mergeDict()
+{
+ for(uint32_t i = 0; i < dict.size(); ++i)
+ {
+ const char *s = dict.get(i);
+ uint32_t off = storeString(s);
+ dict.setOffset(s, off);
+ }
+}
+
+uint32_t PlatformOutputStream::storeNullPtr()
+{
+ //Do not align on uint32_t or uint64_t boundary (already aligned at pointer boundary)
+ align(mTargetParams.aligns.pointer);
+ uint32_t off = size();
+ if( 4 == mTargetParams.sizes.pointer )
+ data.skipBytes(4);
+ else
+ {
+ PX_ASSERT( 8 == mTargetParams.sizes.pointer );
+ data.skipBytes(8);
+ }
+ return off;
+}
+
+Reloc &PlatformOutputStream::storePtr(RelocType type, uint32_t align)
+{
+ uint32_t off = storeNullPtr();
+ mRelocs.pushBack(Reloc(type, off, *this));
+ mRelocs.back().ptrData->setAlignment(align);
+ return mRelocs.back();
+}
+
+Reloc &PlatformOutputStream::storePtr(RelocType type, const Definition *pd)
+{
+ return storePtr(type, getTargetAlignment(pd));
+}
+
+void PlatformOutputStream::storeStringPtr(const char *s)
+{
+ uint32_t off = storeNullPtr();
+ if( s )
+ {
+ mStrings.pushBack(StringReloc(off, s));
+ dict.put(s);
+ }
+}
+
+uint32_t PlatformOutputStream::storeSimpleStructArray(Handle &handle)
+{
+ int32_t n;
+ handle.getArraySize(n);
+
+ const NvParameterized::Definition *pdStruct = handle.parameterDefinition()->child(0);
+ int32_t nfields = pdStruct->numChildren();
+
+ uint32_t align_ = getTargetAlignment(pdStruct),
+ size_ = getTargetSize(pdStruct),
+ pad_ = getTargetPadding(pdStruct);
+
+ align(align_);
+ uint32_t off = size();
+
+ data.reserve(size() + n * physx::PxMax(align_, size_));
+
+ char *p = data;
+ p += data.size();
+
+ for(int32_t i = 0; i < n; ++i)
+ {
+ beginStruct(align_, pad_);
+ handle.set(i);
+
+ for(int32_t j = 0; j < nfields; ++j)
+ {
+ handle.set(j);
+
+ const Definition *pdField = pdStruct->child(j);
+
+ if( pdField->alignment() )
+ align( pdField->alignment() );
+
+ if( pdField->hint("DONOTSERIALIZE") )
+ {
+ //Simply skip bytes
+ align(getTargetAlignment(pdField));
+ skipBytes(getTargetSize(pdField));
+ }
+ else
+ {
+ //No need to align structs because of tail padding
+ switch( pdField->type() )
+ {
+# define NV_PARAMETERIZED_TYPES_NO_LEGACY_TYPES
+# define NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+# define NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+# define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ case TYPE_##enum_name: \
+ { \
+ c_type val; \
+ handle.getParam##type_name(val); \
+ storeSimple<c_type>(val); \
+ break; \
+ }
+# include "nvparameterized/NvParameterized_types.h"
+
+ case TYPE_MAT34:
+ {
+ float val[12];
+ handle.getParamMat34Legacy(val);
+ storeSimple(val, 12);
+ break;
+ }
+
+ NV_PARAMETRIZED_NO_MATH_DATATYPE_LABELS
+ default:
+ DEBUG_ASSERT( 0 && "Unexpected type" );
+ return UINT32_MAX;
+ }
+ }
+
+ handle.popIndex();
+ } //j
+
+ handle.popIndex();
+ closeStruct();
+ } //i
+
+ return off;
+}
+
+uint32_t PlatformOutputStream::storeObjHeader(const NvParameterized::Interface &obj, bool isIncluded)
+{
+ uint32_t align_ = NvMax3(mTargetParams.aligns.Bool, mTargetParams.aligns.i32, mTargetParams.aligns.pointer);
+
+ uint32_t off = beginStruct(align_);
+
+ uint32_t hdrOff = data.size();
+ PX_ASSERT( hdrOff % sizeof(uint32_t) == 0 );
+
+ storeSimple(uint32_t(0)); //Data offset
+
+ //className
+ storeStringPtr(obj.className());
+
+ //name
+ storeStringPtr(obj.name());
+
+ //isIncluded
+ storeSimple(isIncluded);
+
+ //version
+ storeSimple<uint32_t>(obj.version());
+
+ //checksum size
+ uint32_t bits = (uint32_t)-1;
+ const uint32_t *checksum = obj.checksum(bits);
+ PX_ASSERT( bits % 32 == 0 ); //32 bits in uint32_t
+ uint32_t i32s = bits / 32;
+ storeSimple(i32s);
+
+ //checksum pointer
+ Reloc &reloc = storePtr(RELOC_ABS_RAW, mTargetParams.aligns.i32);
+ for(uint32_t i = 0; i < i32s; ++i)
+ reloc.ptrData->storeSimple(checksum[i]);
+
+ closeStruct();
+
+ //We force alignment to calculate dataOffset
+ //(when object is inserted no additional padding will be inserted)
+
+ const Definition *pd = obj.rootParameterDefinition();
+ uint32_t customAlign = pd ? getTargetAlignment(pd) : 1;
+ align(physx::PxMax(16U, customAlign)); //16 for safety
+
+ storeU32At(data.size() - hdrOff, hdrOff); //Now we know object data offset
+
+ return off;
+}
+
+uint32_t PlatformOutputStream::beginObject(const NvParameterized::Interface &obj, bool /*isRoot*/, const Definition *pd)
+{
+ //NvParameterized objects is derived from NvParameters so we need to store its fields as well.
+
+ //WARN: this implementation _heavily_ depends on implementation of NvParameters
+
+ //Alignment of NvParameters
+ uint32_t parentAlign = physx::PxMax(mTargetParams.aligns.pointer, mTargetParams.aligns.Bool),
+ childAlign = pd ? getTargetAlignment(pd) : 1,
+ totalAlign = physx::PxMax(parentAlign, childAlign);
+
+ uint32_t off = beginStruct(totalAlign);
+
+ //NvParameters fields
+ for(uint32_t i = 0; i < 6; storeNullPtr(), ++i); //vtable and other fields
+ storeStringPtr(obj.name()); //mName
+ storeStringPtr(obj.className()); //mClassName
+ storeSimple(true); //mDoDeallocateSelf (all objects are responsible for memory deallocation)
+ storeSimple(false); //mDoDeallocateName
+ storeSimple(false); //mDoDeallocateClassName
+
+ //Some general theory of alignment handling
+ //Imagine that we have class:
+ //class A: A1, A2, ... An
+ //{
+ // T1 f1;
+ // T2 f2;
+ //};
+ //Then all Ai/fi are aligned on natural boundary. Whether or not padding bytes for Ai are inserted
+ //and whether or not Ai+1 or fi may reuse those bytes depends on compiler;
+ //we store this info in PlatformABI's doReusePadding flag.
+ //doReusePadding == false means that padding bytes are always there.
+ //doReusePadding == true means that padding bytes are _not_ inserted for non-POD Ai but are inserted for POD Ai.
+ //(I have yet to see compiler that does not insert padding bytes for POD base class!).
+
+ //Compilers may handle derived classes in two different ways.
+ //Say we have
+ // class B {int x; char y; };
+ // class A: public B {char z; };
+ //Then in pure C code this may look like either as
+ // struct A { struct { int x; char y; } b; char z; };
+ //or as
+ // struct A { int x; char y; char z; };
+ //(the latter is usual if B is not POD).
+ //Take care of that here (NvParameters is not POD!).
+ if( !mTargetParams.doReuseParentPadding )
+ align(parentAlign); //Insert tail padding for NvParameters
+
+ //ParametersStruct is aligned on natural boundary
+ align(childAlign);
+
+ return off;
+}
+
+uint32_t PlatformOutputStream::merge(const PlatformOutputStream &mergee)
+{
+ //All structs should be closed
+ PX_ASSERT( !mergee.mStack.size() );
+
+ align(mergee.alignment());
+
+ uint32_t base = data.size();
+
+ data.appendBytes(mergee.data, mergee.data.size());
+
+ //Update relocations
+
+ mRelocs.reserve(mRelocs.size() + mergee.mRelocs.size());
+ for(uint32_t i = 0; i < mergee.mRelocs.size(); ++i)
+ {
+ mRelocs.pushBack(mergee.mRelocs[i]);
+ mRelocs.back().ptrPos += base;
+ }
+
+ mStrings.reserve(mStrings.size() + mergee.mStrings.size());
+ for(uint32_t i = 0; i < mergee.mStrings.size(); ++i)
+ {
+ mStrings.pushBack(mergee.mStrings[i]);
+ mStrings.back().ptrPos += base;
+ }
+
+ mMerges.reserve(mMerges.size() + mergee.mMerges.size());
+ for(uint32_t i = 0; i < mergee.mMerges.size(); ++i)
+ {
+ mMerges.pushBack(mergee.mMerges[i]);
+
+ mMerges.back().ptrPos += base;
+ if( !mergee.mMerges[i].isExtern )
+ mMerges.back().targetPos += base;
+ }
+
+ return base;
+}
+
+void PlatformOutputStream::flatten()
+{
+ //It's very important that data for child objects is stored
+ //after current object to allow safe initialization
+
+ //Generic pointers
+ for(uint32_t i = 0; i < mRelocs.size(); ++i)
+ {
+ Reloc &reloc = mRelocs[i];
+
+ //Recursively add data which is pointed-to
+
+ align( reloc.ptrData->alignment() );
+
+ MergedReloc m = { reloc.ptrPos, data.size(), reloc.type, false };
+ mMerges.pushBack(m);
+
+ merge(*reloc.ptrData); //Internal pointers are recursively added here
+ }
+
+ //String pointers
+ for(uint32_t i = 0; i < mStrings.size(); ++i)
+ {
+ //String pointers are external and absolute
+ MergedReloc m = { mStrings[i].ptrPos, dict.getOffset(mStrings[i].s), RELOC_ABS_RAW, true };
+ mMerges.pushBack(m);
+ }
+
+ mRelocs.clear();
+ mStrings.clear();
+}
+
+uint32_t PlatformOutputStream::writeRelocs()
+{
+ uint32_t ptrOff = storeSimple<uint32_t>(mMerges.size()); //Offset of relocation table
+
+ data.reserve(mMerges.size() * 2 * physx::PxMax(4U, mTargetParams.aligns.i32));
+
+ for(uint32_t i = 0; i < mMerges.size(); ++i)
+ {
+ char *ptr = &data[mMerges[i].ptrPos];
+ if( 4 == mTargetParams.sizes.pointer )
+ {
+ uint32_t *ptrAsInt = reinterpret_cast<uint32_t *>(ptr);
+ *ptrAsInt = mMerges[i].targetPos;
+ if( mTargetParams.endian != mCurParams.endian )
+ SwapBytes(ptr, 4U, TYPE_U32);
+ }
+ else
+ {
+ PX_ASSERT(8 == mTargetParams.sizes.pointer);
+
+ uint64_t *ptrAsInt = reinterpret_cast<uint64_t *>(ptr);
+ *ptrAsInt = mMerges[i].targetPos;
+ if( mTargetParams.endian != mCurParams.endian )
+ SwapBytes(ptr, 8U, TYPE_U64);
+ }
+
+ //BinaryReloc struct
+ beginStruct(mTargetParams.aligns.i32);
+ storeSimple<uint32_t>(static_cast<uint32_t>(mMerges[i].type));
+ storeSimple<uint32_t>(mMerges[i].ptrPos);
+ closeStruct();
+ }
+
+ mMerges.clear();
+
+ return ptrOff;
+}
+
+#endif
diff --git a/APEX_1.4/NvParameterized/src/SerializerCommon.cpp b/APEX_1.4/NvParameterized/src/SerializerCommon.cpp
new file mode 100644
index 00000000..b00a80f7
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/SerializerCommon.cpp
@@ -0,0 +1,234 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#include "PxSimpleTypes.h"
+#include "SerializerCommon.h"
+#include "NvTraitsInternal.h"
+
+namespace NvParameterized
+{
+
+#define CHECK(x) NV_BOOL_ERR_CHECK_RETURN(x, 0)
+
+bool UpgradeLegacyObjects(Serializer::DeserializedData &data, bool &isUpdated, Traits *t)
+{
+ isUpdated = false;
+
+ for(uint32_t i = 0; i < data.size(); ++i)
+ {
+ Interface *obj = data[i];
+ if( !obj )
+ continue;
+
+ Interface *newObj = UpgradeObject(*obj, isUpdated, t);
+ if( !newObj )
+ {
+ NV_PARAM_TRAITS_WARNING(
+ t,
+ "Failed to upgrade object of class %s and version %u",
+ obj->className(),
+ (unsigned)obj->version());
+
+ DEBUG_ALWAYS_ASSERT();
+
+ for(uint32_t j = 0; j < data.size(); ++j)
+ data[i]->destroy();
+
+ data.init(0, 0);
+
+ return false;
+ }
+
+ if( newObj != obj )
+ {
+ // Need to retain the name of the old object into the new object
+ const char *name = obj->name();
+ newObj->setName(name);
+ obj->destroy();
+ data[i] = newObj;
+ }
+ }
+
+ return true;
+}
+
+bool UpgradeIncludedRefs(Handle &h, bool &isUpdated, Traits *t)
+{
+ const Definition *pd = h.parameterDefinition();
+
+ switch( pd->type() )
+ {
+ case TYPE_ARRAY:
+ {
+ if( pd->child(0)->isSimpleType() )
+ break;
+
+ int32_t size;
+ CHECK( NvParameterized::ERROR_NONE == h.getArraySize(size) );
+
+ for(int32_t i = 0; i < size; ++i)
+ {
+ h.set(i);
+ CHECK( UpgradeIncludedRefs(h, isUpdated, t) );
+ h.popIndex();
+ }
+
+ break;
+ }
+
+ case TYPE_STRUCT:
+ {
+ if( pd->isSimpleType() )
+ break;
+
+ for(int32_t i = 0; i < pd->numChildren(); ++i)
+ {
+ h.set(i);
+ CHECK( UpgradeIncludedRefs(h, isUpdated, t) );
+ h.popIndex();
+ }
+
+ break;
+ }
+
+ case TYPE_REF:
+ {
+ if( !pd->isIncludedRef() )
+ break;
+
+ Interface *refObj = 0;
+ h.getParamRef(refObj);
+
+ if( !refObj ) // No reference there?
+ break;
+
+ Interface *newRefObj = UpgradeObject(*refObj, isUpdated, t);
+ CHECK( newRefObj );
+
+ if( newRefObj == refObj ) // No update?
+ break;
+
+ refObj->destroy();
+
+ if( NvParameterized::ERROR_NONE != h.setParamRef(newRefObj) )
+ {
+ DEBUG_ALWAYS_ASSERT();
+ newRefObj->destroy();
+ return false;
+ }
+
+ break;
+ }
+ NV_PARAMETRIZED_NO_AGGREGATE_AND_REF_DATATYPE_LABELS
+ default:
+ {
+ break;
+ }
+
+ }
+
+ return true;
+}
+
+bool UpgradeIncludedRefs(Interface &obj, bool &isUpdated, Traits *t)
+{
+ Handle h(obj, "");
+ CHECK( h.isValid() );
+
+ return UpgradeIncludedRefs(h, isUpdated, t);
+}
+
+Interface *UpgradeObject(Interface &obj, bool &isUpdated, Traits *t)
+{
+ const char *className = obj.className();
+
+ Interface *newObj = &obj;
+
+ if( obj.version() != t->getCurrentVersion(className) )
+ {
+ isUpdated = true;
+
+ newObj = t->createNvParameterized(className);
+
+ if( !newObj )
+ {
+ NV_PARAM_TRAITS_WARNING(t, "Failed to create object of class %s", className);
+ DEBUG_ALWAYS_ASSERT();
+ return 0;
+ }
+
+ if( !t->updateLegacyNvParameterized(obj, *newObj) )
+ {
+ NV_PARAM_TRAITS_WARNING(t, "Failed to upgrade object of class %s and version %u",
+ className,
+ (unsigned)obj.version() );
+ newObj->destroy();
+ return 0;
+ }
+ }
+
+ if( !UpgradeIncludedRefs(*newObj, isUpdated, t) )
+ {
+ newObj->destroy();
+ return 0;
+ }
+
+ return newObj;
+}
+
+void *serializerMemAlloc(uint32_t size, Traits *t)
+{
+ if( t )
+ return t->alloc(size);
+ else
+ {
+ DEBUG_ALWAYS_ASSERT(); // indicates a memory leak
+ return ::malloc(size);
+ }
+}
+
+void serializerMemFree(void *data, Traits *t)
+{
+ if( t )
+ t->free(data);
+ else
+ {
+ DEBUG_ALWAYS_ASSERT();
+ ::free(data);
+ }
+}
+
+bool DoIgnoreChecksum(const NvParameterized::Interface &obj)
+{
+ // Most of our classes initially do not have classVersion field.
+ // When it is finally added (e.g. after adding new version)
+ // schema checksum changes and we get invalid "checksum not equal" warnings;
+ // because of that we ignore checksum differences for all 0.0 classes.
+ return 0 == obj.version();
+}
+
+} // namespace NvParameterized
diff --git a/APEX_1.4/NvParameterized/src/XmlDeserializer.cpp b/APEX_1.4/NvParameterized/src/XmlDeserializer.cpp
new file mode 100644
index 00000000..69253e6c
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/XmlDeserializer.cpp
@@ -0,0 +1,759 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#include "PxSimpleTypes.h"
+#include "NvParameters.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+
+#include "NvTraitsInternal.h"
+
+#include "XmlDeserializer.h"
+
+#define XML_WARNING(_format, ...) \
+ NV_PARAM_TRAITS_WARNING(mTraits, "XML serializer: " _format, ##__VA_ARGS__)
+
+
+
+namespace NvParameterized
+{
+
+/*!
+Get number of elements in array
+*/
+template <typename T, size_t N>
+char (&ArraySizeHelper(T (&array)[N]))[N];
+#define PX_ARRAY_SIZE(_array) (sizeof(ArraySizeHelper(_array)))
+
+ static uint32_t ReadVersion(const physx::shdfnd::FastXml::AttributePairs& attr)
+ {
+ const char *versionText = attr.get("version");
+
+ // If there's no version, assume version is 0.0
+ if( !versionText )
+ return 0;
+
+ //XML stores versions in "x.y"-format
+ //FIXME: strtoul is unsafe
+
+ const char *dot = strchr(versionText, '.');
+ uint32_t minor = dot ? strtoul(dot + 1, 0, 10) : 0;
+
+ uint32_t major = strtoul(versionText, 0, 10);
+
+ return (major << 16) + minor;
+ }
+
+ static PX_INLINE bool isWhiteSpace(char c)
+ {
+ return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == ',';
+ }
+
+ static PX_INLINE const char * skipWhiteSpace(const char *scan)
+ {
+ while ( isWhiteSpace(*scan) && *scan ) scan++;
+ return *scan ? scan : 0;
+ }
+
+ static PX_FORCE_INLINE const char * skipNonWhiteSpace(const char* scan)
+ {
+ while ( !isWhiteSpace(*scan) && *scan ) scan++;
+ return *scan ? scan : 0;
+ }
+
+ bool XmlDeserializer::verifyObject(Interface *obj, const physx::shdfnd::FastXml::AttributePairs& attr)
+ {
+ if( ReadVersion(attr) != obj->version() )
+ {
+ XML_WARNING("unknown error");
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_UNKNOWN;
+ return false;
+ }
+
+ char *checksum = (char *)attr.get("checksum");
+ if( checksum && !DoIgnoreChecksum(*obj) )
+ {
+ uint32_t objBits;
+ const uint32_t *objChecksum = obj->checksum(objBits);
+
+ uint32_t bits = 0;
+
+ char *cur = checksum, *next = 0;
+ bool sameBits = true;
+ for(uint32_t i = 0; ; ++i, cur = next)
+ {
+ uint32_t val = (uint32_t)strtoul(cur, &next, 0); //FIXME: strtoul is not safe
+ if( cur == next )
+ break;
+
+ bits += 32;
+ if( bits > objBits || val != objChecksum[i] )
+ {
+ NV_PARAM_TRAITS_WARNING(
+ mTraits,
+ "Schema checksum is different for object of class %s and version %u, "
+ "asset may be corrupted",
+ obj->className(),
+ (unsigned)obj->version()
+ );
+ sameBits = false;
+ break;
+ }
+ }
+
+ if( objBits != bits && sameBits )
+ {
+ NV_PARAM_TRAITS_WARNING(
+ mTraits,
+ "Schema checksum is different for object of class %s and version %u, "
+ "asset may be corrupted",
+ obj->className(),
+ (unsigned)obj->version()
+ );
+ }
+ } //if( checksum )
+
+ return true;
+ }
+
+ bool XmlDeserializer::initAddressString(char *dest, uint32_t len, const char *name)
+ {
+ char *end = dest + len;
+
+ for (uint32_t i = 0; i < tos().getIndex(); i++)
+ {
+ FieldInfo &field = tos().getFieldInfo(i);
+
+ const char *n = field.name;
+ FieldType type = field.type;
+
+ if( SKIP == type )
+ continue;
+
+ while ( n && *n && dest < end )
+ *dest++ = *n++;
+
+ if ( ARRAY == type )
+ {
+ char temp[512];
+ physx::shdfnd::snprintf(temp, 512, "[%d]", field.idx);
+
+ if( dest + ::strlen(temp) >= end )
+ {
+ XML_WARNING("buffer overflow");
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INTERNAL_BUFFER_OVERFLOW;
+ return false;
+ }
+
+ const char *scan = temp;
+ while ( *scan && dest < end )
+ {
+ *dest++ = *scan++;
+ }
+ }
+ else
+ {
+ if( dest + 1 >= end )
+ {
+ XML_WARNING("buffer overflow");
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INTERNAL_BUFFER_OVERFLOW;
+ return false;
+ }
+
+ *dest++ = '.';
+ }
+ }
+
+ while ( name && *name && dest < end )
+ {
+ *dest++ = *name++;
+ }
+
+ *dest = 0;
+ //printf("Fully qualified name: %s\n", scratch );
+
+ return true;
+ }
+
+ bool XmlDeserializer::processClose(const char *tag,uint32_t depth,bool &isError)
+ {
+ isError = true; //By default if we return with false it's due to error
+
+ if( strcmp(tag, "NxParameters") == 0 ||
+ strcmp(tag, "NvParameters") == 0)
+ {
+ mInRootElement = false;
+
+ // in xml there's only 1 root element allowed,
+ // so we want to stop after the first NvParameters
+ isError = false;
+ return false;
+ }
+
+ static const char *validTags[] = {
+ "struct",
+ "value",
+ "array"
+ };
+
+ for(uint32_t i = 0; i < PX_ARRAY_SIZE(validTags); ++i)
+ {
+ if( 0 != ::strcmp(validTags[i], tag) )
+ continue;
+
+# ifndef NDEBUG
+ uint32_t idx = tos().getIndex();
+ DEBUG_ASSERT( idx > 0 );
+
+ static FieldType validTypes[] = {
+ STRUCT,
+ VALUE,
+ ARRAY
+ };
+
+ // Make gcc happy
+ const FieldType* tmp = &validTypes[0];
+ PX_UNUSED(tmp);
+
+ FieldType type = tos().getFieldInfo(idx - 1).type;
+ PX_UNUSED(type);
+ DEBUG_ASSERT( type == SKIP || type == validTypes[i] );
+# endif
+
+ if( !popField() )
+ return false;
+
+ if (depth == 1 && mRootIndex > MAX_ROOT_OBJ)
+ {
+ DEBUG_ASSERT(i == 1);
+ mObjects[0].getObject()->destroy();
+ }
+
+ return tos().getIndex() ? depth != 0 : popObj();
+ }
+
+ return false;
+ }
+
+ bool XmlDeserializer::processElement(
+ const char *elementName,
+ const char *elementData,
+ const physx::shdfnd::FastXml::AttributePairs& attr,
+ int32_t /*lineno*/)
+ {
+ //Force DOCTYPE
+ if( !mHasDoctype )
+ {
+ XML_WARNING("DOCTYPE is missing");
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_MISSING_DOCTYPE;
+ return false;
+ }
+
+ if( strcmp(elementName, "NxParameters") == 0 ||
+ strcmp(elementName, "NvParameters") == 0)
+ {
+ if( mObjIndex )
+ {
+ XML_WARNING("NvParameters must be root element");
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_MISSING_ROOT_ELEMENT;
+ return false;
+ }
+
+ if( mInRootElement )
+ {
+ XML_WARNING("More than one root element encountered");
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INVALID_NESTING;
+ return false;
+ }
+
+ uint32_t ver = ReadVersion(attr);
+ if( ver != mVer )
+ {
+ XML_WARNING("unknown version of APX file format: %u", (unsigned)ver);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INVALID_FILE_VERSION;
+ return false;
+ }
+
+ const char* numObjects = attr.get("numObjects");
+ if (numObjects != NULL)
+ {
+ PX_ASSERT(atoi(numObjects) >= 0);
+ const uint32_t num = static_cast<uint32_t>(atoi(numObjects));
+ if (num > MAX_ROOT_OBJ)
+ {
+ XML_WARNING("APX file has more than %d root objects, only %d will be read", num, MAX_ROOT_OBJ);
+ }
+ }
+
+
+ ++mRootTags;
+ mInRootElement = true;
+
+ return true;
+ }
+
+ if( mRootTags > 0 && !mInRootElement )
+ {
+ XML_WARNING("element %s not under root element", elementName);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_MISSING_ROOT_ELEMENT;
+ return false;
+ }
+
+ if ( strcmp(elementName, "struct") == 0 )
+ {
+ const char *name = attr.get("name");
+
+ if( !mObjIndex )
+ {
+ XML_WARNING("struct-element %s not under value-element", name);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INVALID_NESTING;
+ return false;
+ }
+
+ pushField(name, STRUCT);
+ }
+ else if ( strcmp(elementName, "value") == 0 )
+ {
+ if( !mObjIndex ) //Root object?
+ {
+ const char *className = attr.get("className");
+
+ uint32_t version = ReadVersion(attr);
+
+ Interface *obj = mTraits->createNvParameterized(className, version);
+ if( !obj )
+ {
+ XML_WARNING("failed to create object of type %s and version %u", className, (unsigned)version);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_OBJECT_CREATION_FAILED;
+ return false;
+ }
+
+ const char *objectName = attr.get("objectName");
+ if( objectName )
+ obj->setName(objectName);
+
+ if (mRootIndex < MAX_ROOT_OBJ)
+ {
+ mRootObjs[mRootIndex] = obj;
+ }
+ mRootIndex++;
+
+ pushObj(obj);
+ pushField("", SKIP); //Root <value> should not be used in initAddressString
+
+ return true;
+ }
+
+ const char *name = attr.get("name");
+
+ char scratch[2048];
+ if( !initAddressString(scratch, sizeof(scratch), name) )
+ {
+ return false;
+ }
+
+ pushField(name, VALUE);
+
+ Interface *obj = tos().getObject();
+ if( !obj )
+ {
+ XML_WARNING("unknown error");
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_UNKNOWN;
+ return false;
+ }
+
+ Handle handle(*obj, scratch);
+ if( !handle.isValid() )
+ {
+ XML_WARNING("%s: invalid path", scratch);
+ DEBUG_ALWAYS_ASSERT();
+// mError = Serializer::ERROR_INVALID_PARAM_HANDLE;
+ return true;
+ }
+
+ const char *type = attr.get("type");
+ const char *expectedType = typeToStr(handle.parameterDefinition()->type());
+ if ( type && 0 != physx::shdfnd::stricmp(type, expectedType) )
+ {
+ XML_WARNING("%s: invalid type %s (expected %s)", scratch, type, expectedType);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INVALID_ATTR;
+ return false;
+ }
+
+ const char *included = attr.get("included");
+ if ( included )
+ {
+ bool isIncludedRef = 0 != atoi(included);
+ if( isIncludedRef != handle.parameterDefinition()->isIncludedRef() )
+ {
+ XML_WARNING("%s: unexpected included-attribute", scratch);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INVALID_ATTR;
+ return false;
+ }
+
+ const char *className = attr.get("className");
+ if( !className )
+ {
+ if( attr.get("classNames") )
+ {
+ // Ref is NULL
+
+ Interface *oldObj = 0;
+ if( NvParameterized::ERROR_NONE != handle.getParamRef(oldObj) )
+ return false;
+ if( oldObj )
+ oldObj->destroy();
+
+ handle.setParamRef(0);
+
+ return true;
+ }
+ else
+ {
+ XML_WARNING("%s: missing both className and classNames attribute", scratch);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INVALID_ATTR;
+ return false;
+ }
+ }
+
+ uint32_t version = ReadVersion(attr);
+
+ Interface *refObj = 0;
+ if( isIncludedRef )
+ refObj = mTraits->createNvParameterized(className, version);
+ else
+ {
+ void *buf = mTraits->alloc(sizeof(NvParameters));
+ refObj = PX_PLACEMENT_NEW(buf, NvParameters)(mTraits);
+
+ refObj->setClassName(className);
+ }
+
+ if( !refObj )
+ {
+ XML_WARNING("%s: failed to create object of type %s and version %u", scratch, className, (unsigned)version);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_OBJECT_CREATION_FAILED;
+ return false;
+ }
+
+ if( refObj && (-1 == handle.parameterDefinition()->refVariantValIndex(refObj->className())) )
+ {
+ char longName[256];
+ handle.getLongName(longName, sizeof(longName));
+ NV_PARAM_TRAITS_WARNING(
+ mTraits,
+ "%s: setting reference of invalid class %s",
+ longName,
+ refObj->className()
+ );
+ }
+
+ if( NvParameterized::ERROR_NONE != handle.setParamRef(refObj) )
+ {
+ XML_WARNING("%s: failed to set reference of type %s", scratch, className);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INVALID_REFERENCE;
+ return false;
+ }
+
+ const char *objectName = attr.get("objectName");
+ if( objectName && refObj )
+ refObj->setName(objectName);
+
+ if( isIncludedRef )
+ pushObj(refObj);
+ else if ( elementData && refObj )
+ refObj->setName(elementData);
+ }
+ else
+ {
+ if ( elementData == 0 )
+ elementData = "";
+
+ const char *isNull = attr.get("null");
+ if( isNull && 0 != atoi(isNull) )
+ {
+ //Only strings and enums may be NULL so it's safe to call setParamString
+
+ DataType t = handle.parameterDefinition()->type();
+ PX_UNUSED(t);
+ DEBUG_ASSERT( TYPE_STRING == t || TYPE_ENUM == t );
+
+ handle.setParamString(0);
+ }
+ else
+ {
+ if( NvParameterized::ERROR_NONE != handle.strToValue(elementData, 0) )
+ {
+ XML_WARNING("%s: failed to convert string to value: %10s", scratch, elementData);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_STRING2VAL_FAILED;
+ return false;
+ }
+ }
+ } //if ( included )
+ }
+ else if ( strcmp(elementName, "array") == 0 )
+ {
+ const char *name = attr.get("name");
+
+ if( !mObjIndex )
+ {
+ XML_WARNING("array-element %s not under value-element", name);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INVALID_NESTING;
+ return false;
+ }
+
+ int32_t arraySize = 0;
+ if ( const char *sz = attr.get("size") )
+ {
+ PX_ASSERT(atoi(sz) >= 0);
+ arraySize = (int32_t)atoi(sz);
+ }
+
+ if ( arraySize > 0 )
+ {
+ Interface *obj = tos().getObject();
+ if( !obj )
+ {
+ XML_WARNING("unknown error");
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_UNKNOWN;
+ return false;
+ }
+
+ char scratch[2048];
+ if( !initAddressString(scratch, sizeof(scratch), name) )
+ {
+ return false;
+ }
+
+ Handle handle(*obj, scratch);
+ if( !handle.isValid() )
+ {
+
+ mError = Serializer::ERROR_INVALID_PARAM_HANDLE;
+ XML_WARNING("%s: invalid path", scratch);
+ DEBUG_ALWAYS_ASSERT();
+
+ return false;
+ }
+
+ if( !handle.parameterDefinition()->arraySizeIsFixed() )
+ if( NvParameterized::ERROR_NONE != handle.resizeArray(arraySize) )
+ {
+ XML_WARNING("%s: failed to resize array", scratch);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INVALID_ARRAY;
+ return false;
+ }
+ if ( elementData )
+ {
+ const char *scan = elementData;
+
+ handle.set(0);
+ const Definition *paramDef = handle.parameterDefinition();
+ handle.popIndex();
+
+
+ if ( paramDef->type() == TYPE_STRUCT )
+ {
+ // read the structElements field
+ const char* structElements = attr.get("structElements");
+
+ int32_t* simpleStructRedirect = getSimpleStructRedirect(static_cast<uint32_t>(paramDef->numChildren()));
+ uint32_t numRedirects = 0;
+ while (structElements && *structElements)
+ {
+ char fieldName[64];
+ char type[16];
+
+ size_t count = 0;
+ while(*structElements != 0 && *structElements != ',' && *structElements != '(')
+ fieldName[count++] = *structElements++;
+ if( count >= sizeof(fieldName) )
+ {
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INTERNAL_BUFFER_OVERFLOW;
+ return false;
+ }
+ fieldName[count] = 0;
+
+ if (*structElements == '(')
+ {
+ structElements++;
+ count = 0;
+ while(*structElements != 0 && *structElements != ',' && *structElements != ')')
+ type[count++] = *structElements++;
+ if( count >= sizeof(type) )
+ {
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INTERNAL_BUFFER_OVERFLOW;
+ return false;
+ }
+ type[count] = 0;
+
+ }
+ if (*structElements == ')')
+ structElements++;
+ if (*structElements == ',')
+ structElements++;
+
+ const Definition* childDef = paramDef->child(fieldName, simpleStructRedirect[numRedirects]);
+ const char* trueType = childDef ? typeToStr(childDef->type()) : 0;
+ if (childDef && ::strcmp(trueType, type) != 0)
+ {
+ XML_WARNING(
+ "%s[].%s: unexpected type: %s (must be %s)",
+ scratch, fieldName, type, trueType ? trueType : "");
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INVALID_DATA_TYPE;
+ return false;
+ }
+
+ // -2 means to reed the data but not storing it
+ // -1 means to not read the data as it was not serialized'
+ // i = [0 .. n] means to read the data and store it in child i
+ if (childDef == NULL)
+ {
+ simpleStructRedirect[numRedirects] = -2;
+
+ // Fail fast
+ XML_WARNING("%s[]: unexpected structure field: %s", scratch, fieldName);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_INVALID_PARAM_HANDLE;
+ return false;
+ }
+
+ numRedirects++;
+ }
+
+ const int32_t numChildren = paramDef->numChildren();
+ for(int32_t i = 0; i < arraySize; ++i)
+ {
+ handle.set(i);
+ for( int32_t j=0; j<numChildren; j++ )
+ {
+ if (simpleStructRedirect[j] < 0)
+ {
+ if (simpleStructRedirect[j] < -1)
+ {
+ // read the data anyways
+ scan = skipWhiteSpace(scan);
+ if (scan != NULL)
+ scan = skipNonWhiteSpace(scan);
+ }
+ continue;
+ }
+
+ scan = skipWhiteSpace(scan);
+ if ( !scan ) break;
+
+ handle.set(simpleStructRedirect[j]);
+
+ if( NvParameterized::ERROR_NONE != handle.strToValue(scan, &scan) )
+ {
+ XML_WARNING("%s: failed to convert string to value: %10s...", scan);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_STRING2VAL_FAILED;
+ return false;
+ }
+
+ handle.popIndex();
+ if ( !scan ) break;
+ }
+ handle.popIndex();
+ if ( !scan ) break;
+ }
+ }
+ else
+ {
+ // LRR: wall clock time is the same for this simple loop as the previous
+ // "unrolled" version
+ for (int32_t i = 0; i<arraySize; i++)
+ {
+ handle.set(i);
+ if( NvParameterized::ERROR_NONE != handle.strToValue(scan, &scan) )
+ {
+ XML_WARNING("%s: failed to convert string to value: %10s", scratch, scan);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_STRING2VAL_FAILED;
+ return false;
+ }
+ handle.popIndex();
+ }
+ }
+ } //if( elementData )
+ } //if ( arraySize > 0 )
+
+ pushField(name, ARRAY);
+ }
+ else
+ {
+ XML_WARNING("unknown element %s", elementName);
+ DEBUG_ALWAYS_ASSERT();
+ mError = Serializer::ERROR_UNKNOWN_XML_TAG;
+ return false;
+ }
+
+ return true;
+ }
+
+ int32_t* XmlDeserializer::getSimpleStructRedirect(uint32_t size)
+ {
+ if (mSimpleStructRedirectSize < size)
+ {
+ if (mSimpleStructRedirect != NULL)
+ mTraits->free(mSimpleStructRedirect);
+
+ if (size < 16)
+ size = 16; // just to not allocate all these small things more than once
+
+ mSimpleStructRedirect = (int32_t*)mTraits->alloc(sizeof(int32_t) * size);
+ mSimpleStructRedirectSize = size;
+ }
+
+ memset(mSimpleStructRedirect, -1, sizeof(int32_t) * size);
+ return mSimpleStructRedirect;
+ }
+
+}
diff --git a/APEX_1.4/NvParameterized/src/XmlSerializer.cpp b/APEX_1.4/NvParameterized/src/XmlSerializer.cpp
new file mode 100644
index 00000000..b3f3c22e
--- /dev/null
+++ b/APEX_1.4/NvParameterized/src/XmlSerializer.cpp
@@ -0,0 +1,1270 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#include "PxSimpleTypes.h"
+#include "PxAssert.h"
+#include "PsArray.h"
+#include "PxVec3.h"
+#include "PxQuat.h"
+#include "PxBounds3.h"
+#include "PsFastXml.h"
+#include "PsIOStream.h"
+
+#include "nvparameterized/NvSerializer.h"
+#include "XmlSerializer.h"
+#include "nvparameterized/NvParameterized.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+#include "NvParameters.h"
+
+#include "NvTraitsInternal.h"
+#include "XmlDeserializer.h"
+
+#define PRINT_ELEMENT_HINTS 0
+#define PRINT_ELEMENTS_WITHIN_EMPTY_ARRAYS 0
+
+#define UNOPTIMIZED_XML 0
+
+namespace NvParameterized
+{
+
+static const char indentStr[] = " ";
+
+struct traversalState
+{
+ traversalState()
+ {
+ indent[0] = 0;
+ indentLen = 0;
+ level = 0;
+ }
+
+ void incLevel()
+ {
+ physx::shdfnd::strlcat(indent, (uint32_t)strlen(indent) + (uint32_t)strlen(indentStr) + 1, indentStr);
+ level++;
+ }
+
+ void decLevel()
+ {
+ level--;
+ indentLen = (sizeof(indentStr) - 1) * level;
+ if(indentLen < sizeof(indent))
+ indent[indentLen] = 0;
+ }
+
+ char indent[4096];
+ uint32_t indentLen;
+ int32_t level;
+};
+
+Serializer::ErrorType XmlSerializer::peekNumObjects(char *data, uint32_t len, uint32_t &numObjects)
+{
+ //FIXME: this code is not robust
+
+ data[len-1] = 0;
+
+ const char *root = ::strstr(data, "<NvParameters");
+ if( !root )
+ {
+ root = ::strstr(data, "<NvParameters");
+ if (!root)
+ {
+ return Serializer::ERROR_MISSING_ROOT_ELEMENT;
+ }
+ }
+
+ const char *numObjectsString = ::strstr(root, "numObjects");
+ if( !numObjectsString )
+ return Serializer::ERROR_INVALID_ATTR;
+
+ numObjectsString = ::strstr(numObjectsString, "\"");
+ if( !numObjectsString )
+ return Serializer::ERROR_INVALID_ATTR;
+
+ numObjects = strtoul(numObjectsString + 1, 0, 0); //Skip leading quote
+ return Serializer::ERROR_NONE;
+}
+
+class InputDataFromPxFileBuf: public physx::PxInputData
+{
+public:
+ InputDataFromPxFileBuf(physx::PxFileBuf& fileBuf): mFileBuf(fileBuf) {}
+
+ // physx::PxInputData interface
+ virtual uint32_t getLength() const
+ {
+ return mFileBuf.getFileLength();
+ }
+
+ virtual void seek(uint32_t offset)
+ {
+ mFileBuf.seekRead(offset);
+ }
+
+ virtual uint32_t tell() const
+ {
+ return mFileBuf.tellRead();
+ }
+
+ // physx::PxInputStream interface
+ virtual uint32_t read(void* dest, uint32_t count)
+ {
+ return mFileBuf.read(dest, count);
+ }
+
+ PX_NOCOPY(InputDataFromPxFileBuf)
+private:
+ physx::PxFileBuf& mFileBuf;
+};
+
+Serializer::ErrorType XmlSerializer::peekClassNames(physx::PxFileBuf &stream, char **classNames, uint32_t &numClassNames)
+{
+ class ClassNameReader: public physx::shdfnd::FastXml::Callback
+ {
+ uint32_t mDepth;
+ uint32_t mNumObjs;
+
+ char **mClassNames;
+ uint32_t mNumClassNames;
+
+ Traits *mTraits;
+
+ public:
+ ClassNameReader(char **classNames, uint32_t &numClassNames, Traits *traits)
+ : mDepth(0), mNumObjs(0), mClassNames(classNames), mNumClassNames(numClassNames), mTraits(traits) {}
+
+ uint32_t numObjs() const { return mNumObjs; }
+
+ bool processComment(const char * /*comment*/) { return true; }
+
+ bool processClose(const char * /*element*/,uint32_t /*depth*/,bool & /*isError*/)
+ {
+ --mDepth;
+ return true;
+ }
+
+ bool processElement(
+ const char *elementName,
+ const char * /*elementData*/,
+ const physx::shdfnd::FastXml::AttributePairs& attr,
+ int32_t /*lineno*/)
+ {
+ //Ignore top-level element
+ if( 0 == strcmp(elementName, "NvParameters") || 0 == strcmp(elementName, "NxParameters"))
+ return true;
+
+ ++mDepth;
+
+ if( 1 != mDepth || 0 != strcmp(elementName, "value") )
+ return true;
+
+ //Top-level <value> => read className
+ mClassNames[mNumObjs] = mTraits->strdup( attr.get("className") );
+ ++mNumObjs;
+
+ return mNumObjs < mNumClassNames;
+ }
+
+ void *allocate(uint32_t size) { return ::malloc(size); }
+ void deallocate(void *ptr) { ::free(ptr); };
+ };
+
+ ClassNameReader myReader(classNames, numClassNames, mTraits);
+ physx::shdfnd::FastXml *xmlParser = physx::shdfnd::createFastXml(&myReader);
+
+ InputDataFromPxFileBuf inputData(stream);
+ xmlParser->processXml(inputData);
+ numClassNames = myReader.numObjs();
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType XmlSerializer::peekNumObjectsInplace(const void * data, uint32_t dataLen, uint32_t & numObjects)
+{
+ if ( !dataLen || ! data )
+ return ERROR_STREAM_ERROR;
+
+ char hdr[100];
+ uint32_t len = physx::PxMin<uint32_t>(dataLen, sizeof(hdr) - 1);
+ physx::shdfnd::strlcpy(hdr, len+1, (const char *)data);
+
+ return peekNumObjects(hdr, len, numObjects);
+}
+
+Serializer::ErrorType XmlSerializer::peekNumObjects(physx::PxFileBuf &stream, uint32_t &numObjects)
+{
+ //FIXME: this code is not robust
+
+ char hdr[100];
+ uint32_t len = stream.peek(hdr, sizeof(hdr));
+
+ return peekNumObjects(hdr, len, numObjects);
+}
+
+#ifndef WITHOUT_APEX_SERIALIZATION
+
+static void storeVersionAndChecksum(physx::PsIOStream &stream, const Interface *obj)
+{
+ uint16_t major = obj->getMajorVersion(),
+ minor = obj->getMinorVersion();
+
+ stream << " version=\"" << major << '.' << minor << '"';
+
+ uint32_t bits;
+ const uint32_t *checksum = obj->checksum(bits);
+
+ uint32_t u32s = bits / 32;
+ PX_ASSERT( 0 == bits % 32 );
+
+ stream << " checksum=\"";
+ for(uint32_t i = 0; i < u32s; ++i)
+ {
+ char hex[20];
+ physx::shdfnd::snprintf(hex, sizeof(hex), "0x%x", checksum[i]);
+ stream << hex;
+ if( u32s - 1 != i )
+ stream << ' ';
+ }
+ stream << '"';
+}
+
+static bool IsSimpleType(const Definition *d)
+{
+ //We do not consider strings simple because it causes errors with NULL and ""
+ if (d->type() == TYPE_ARRAY || d->type() == TYPE_STRUCT ||
+ d->type() == TYPE_REF || d->type() == TYPE_STRING ||
+ d->type() == TYPE_ENUM)
+ {
+ return false;
+ }
+ else
+ {
+ PX_ASSERT( d->numChildren() == 0 );
+ return true;
+ }
+}
+
+static bool IsSimpleStruct(const Definition *pd)
+{
+ bool ret = true;
+
+ int32_t count = pd->numChildren();
+ for (int32_t i=0; i < count; i++)
+ {
+ const Definition *d = pd->child(i);
+ if ( !IsSimpleType(d) )
+ {
+ ret = false;
+ break;
+ }
+ }
+
+ return ret;
+}
+
+static bool DoesNeedQuote(const char *c)
+{
+ bool ret = false;
+ while ( *c )
+ {
+ if ( *c == 32 || *c == ',' || *c == '<' || *c == '>' || *c == 9 )
+ {
+ ret = true;
+ break;
+ }
+ c++;
+ }
+
+ return ret;
+}
+
+Serializer::ErrorType XmlSerializer::traverseParamDefTree(
+ const Interface &obj,
+ physx::PsIOStream &stream,
+ traversalState &state,
+ Handle &handle,
+ bool printValues)
+{
+ bool isRoot = !handle.numIndexes() && 0 == state.level;
+
+ if( !handle.numIndexes() )
+ {
+ NV_PARAM_ERR_CHECK_RETURN( obj.getParameterHandle("", handle), Serializer::ERROR_UNKNOWN );
+
+ if( isRoot )
+ {
+ NV_ERR_CHECK_RETURN( emitElement(obj, stream, "value", handle, false, true, true) );
+ stream << "\n";
+
+ state.incLevel();
+ }
+ }
+
+ const Definition *paramDef = handle.parameterDefinition();
+
+ if( !paramDef->hint("DONOTSERIALIZE") )
+ {
+
+# if PRINT_ELEMENT_HINTS
+ bool includedRef = false;
+
+ NV_ERR_CHECK_RETURN( emitElementNxHints(stream, handle, state, includedRef) );
+# else
+ bool includedRef = paramDef->isIncludedRef();
+# endif
+
+ switch( paramDef->type() )
+ {
+ case TYPE_STRUCT:
+ {
+ stream << state.indent;
+ NV_ERR_CHECK_RETURN( emitElement(obj, stream, "struct", handle, false, true) );
+ stream << "\n";
+
+ state.incLevel();
+ for(int32_t i = 0; i < paramDef->numChildren(); ++i)
+ {
+ handle.set(i);
+ NV_ERR_CHECK_RETURN( traverseParamDefTree(obj, stream, state, handle, printValues) );
+ handle.popIndex();
+ }
+
+ state.decLevel();
+
+ stream << state.indent << "</struct>\n";
+
+ break;
+ }
+
+ case TYPE_ARRAY:
+ {
+ stream << state.indent;
+ NV_ERR_CHECK_RETURN( emitElement(obj, stream, "array", handle, false, true) );
+
+ int32_t arraySize;
+ NV_PARAM_ERR_CHECK_RETURN( handle.getArraySize(arraySize), Serializer::ERROR_INVALID_ARRAY );
+
+ if( arraySize)
+ stream << "\n";
+
+ state.incLevel();
+
+ if ( arraySize > 0 )
+ {
+#if UNOPTIMIZED_XML
+ for(int32_t i = 0; i < arraySize; ++i)
+ {
+ handle.set(i);
+ NV_ERR_CHECK_RETURN( traverseParamDefTree(obj, stream, state, handle, printValues) );
+ handle.popIndex();
+ }
+#else
+ handle.set(0);
+ const Definition *pd = handle.parameterDefinition();
+ handle.popIndex();
+ switch ( pd->type() )
+ {
+ case TYPE_STRUCT:
+ {
+ if ( IsSimpleStruct(pd) )
+ {
+ for(int32_t i = 0; i < arraySize; ++i)
+ {
+
+ if ( (i&3) == 0 )
+ {
+ if ( i )
+ stream << "\n";
+ stream << state.indent;
+ }
+
+ handle.set(i);
+
+ for( int32_t j=0; j<pd->numChildren(); j++ )
+ {
+ if (pd->child(j)->hint("DONOTSERIALIZE"))
+ continue;
+
+ handle.set(j);
+
+ char buf[512];
+ const char *str = 0;
+ NV_PARAM_ERR_CHECK_RETURN( handle.valueToStr(buf, sizeof(buf), str), Serializer::ERROR_VAL2STRING_FAILED );
+
+ stream << str;
+
+ if ( (j+1) < pd->numChildren() )
+ {
+ stream << " ";
+ }
+
+ handle.popIndex();
+ }
+
+ if ( (i+1) < arraySize )
+ {
+ stream << ",";
+ }
+
+ handle.popIndex();
+ } //i
+ stream << "\n";
+ }
+ else
+ {
+ for(int32_t i = 0; i < arraySize; ++i)
+ {
+ handle.set(i);
+ NV_ERR_CHECK_RETURN( traverseParamDefTree(obj, stream, state, handle, printValues) );
+ handle.popIndex();
+ }
+ }
+ }
+ break;
+
+ case TYPE_REF:
+ for(int32_t i = 0; i < arraySize; ++i)
+ {
+ handle.set(i);
+ NV_ERR_CHECK_RETURN( traverseParamDefTree(obj, stream, state, handle, printValues) );
+ handle.popIndex();
+ }
+ break;
+
+ case TYPE_BOOL:
+ {
+ bool v = false;
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamBoolArray(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << (uint32_t)v;
+ if ( (i+1) < arraySize )
+ {
+ stream << " ";
+ }
+ if ( ((i+1)&63) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_I8:
+ {
+ int8_t v = 0;
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamI8Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v;
+ if ( (i+1) < arraySize )
+ {
+ stream << " ";
+ }
+ if ( ((i+1)&63) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_I16:
+ {
+ int16_t v = 0;
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamI16Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v;
+ if ( (i+1) < arraySize )
+ {
+ stream << " ";
+ }
+ if ( ((i+1)&31) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_I32:
+ {
+ int32_t v = 0;
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamI32Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v;
+ if ( (i+1) < arraySize )
+ {
+ stream << " ";
+ }
+ if ( ((i+1)&31) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_I64:
+ {
+ int64_t v = 0;
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamI64Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v;
+ if ( (i+1) < arraySize )
+ {
+ stream << " ";
+ }
+ if ( ((i+1)&31) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_U8:
+ {
+ uint8_t v = 0;
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamU8Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v;
+ if ( (i+1) < arraySize )
+ {
+ stream << " ";
+ }
+ if ( ((i+1)&63) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_U16:
+ {
+ uint16_t v = 0;
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamU16Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v;
+ if ( (i+1) < arraySize )
+ {
+ stream << " ";
+ }
+ if ( ((i+1)&63) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_U32:
+ {
+ uint32_t v = 0;
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamU32Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v;
+ if ( (i+1) < arraySize )
+ {
+ stream << " ";
+ }
+ if ( ((i+1)&31) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_U64:
+ {
+ uint64_t v = 0;
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamU64Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v;
+ if ( (i+1) < arraySize )
+ {
+ stream << " ";
+ }
+ if ( ((i+1)&31) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_F32:
+ {
+ float v = 0;
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamF32Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v;
+ if ( (i+1) < arraySize )
+ {
+ stream << " ";
+ }
+ if ( ((i+1)&31) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_F64:
+ {
+ double v = 0;
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamF64Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v;
+ if ( (i+1) < arraySize )
+ {
+ stream << " ";
+ }
+ if ( ((i+1)&31) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_VEC2:
+ {
+ physx::PxVec2 v(0,0);
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamVec2Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v.x << " " << v.y;
+ if ( (i+1) < arraySize )
+ {
+ stream << ", ";
+ }
+ if ( ((i+1)&15) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_VEC3:
+ {
+ physx::PxVec3 v(0,0,0);
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamVec3Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v.x << " " << v.y << " " << v.z;
+ if ( (i+1) < arraySize )
+ {
+ stream << ", ";
+ }
+ if ( ((i+1)&15) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_VEC4:
+ {
+ physx::PxVec4 v(0,0,0,0);
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamVec4Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v.x << " " << v.y << " " << v.z << " " << v.w;
+ if ( (i+1) < arraySize )
+ {
+ stream << ", ";
+ }
+ if ( ((i+1)&15) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_QUAT:
+ {
+ physx::PxQuat v(0,0,0,1);
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamQuatArray(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v.x << " " << v.y << " " << v.z << " " << v.w;
+ if ( (i+1) < arraySize )
+ {
+ stream << ", ";
+ }
+ if ( ((i+1)&15) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_MAT33:
+ {
+ physx::PxMat33 m = physx::PxMat33(physx::PxIdentity);
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamMat33Array(&m,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ const float *f = (const float *)m.front();
+ stream << f[0] << " " << f[1] << " " << f[2] << " " ;
+ stream << f[3] << " " << f[4] << " " << f[5] << " ";
+ stream << f[6] << " " << f[7] << " " << f[8];
+ if ( (i+1) < arraySize )
+ {
+ stream << ", ";
+ }
+ if ( ((i+1)&15) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_BOUNDS3:
+ {
+ physx::PxBounds3 v;
+ v.minimum = physx::PxVec3(0.0f);
+ v.maximum = physx::PxVec3(0.0f);
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamBounds3Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ stream << v.minimum.x << " " << v.minimum.y << " " << v.minimum.z << " " << v.maximum.x << " " << v.maximum.y << " " << v.maximum.z;
+ if ( (i+1) < arraySize )
+ {
+ stream << ", ";
+ }
+ if ( ((i+1)&15) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_MAT44:
+ {
+ physx::PxMat44 v = physx::PxMat44(physx::PxIdentity);
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamMat44Array(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ const float *f = (const float *)v.front();
+ stream << f[0] << " " << f[1] << " " << f[2] << " " << f[3] << " ";
+ stream << f[4] << " " << f[5] << " " << f[6] << " " << f[7] << " ";
+ stream << f[8] << " " << f[9] << " " << f[10] << " " << f[11] << " ";
+ stream << f[12] << " " << f[13] << " " << f[14] << " " << f[15];
+ if ( (i+1) < arraySize )
+ {
+ stream << ", ";
+ }
+ if ( ((i+1)&15) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ case TYPE_TRANSFORM:
+ {
+ physx::PxTransform v = physx::PxTransform(physx::PxIdentity);
+ stream << state.indent;
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamTransformArray(&v,1,i), Serializer::ERROR_ARRAY_INDEX_OUT_OF_RANGE );
+ const float *f = (const float *)&v;
+ stream << f[0] << " " << f[1] << " " << f[2] << " " << f[3] << " ";
+ stream << f[4] << " " << f[5] << " " << f[6] << " ";
+ if ( (i+1) < arraySize )
+ {
+ stream << ", ";
+ }
+ if ( ((i+1)&15) == 0 )
+ {
+ stream << "\n";
+ stream << state.indent;
+ }
+ }
+ stream << "\n";
+ }
+ break;
+
+ NV_PARAMETRIZED_STRING_DATATYPE_LABELS
+ NV_PARAMETRIZED_ENUM_DATATYPE_LABELS
+ NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS
+ NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+ NV_PARAMETRIZED_LEGACY_DATATYPE_LABELS
+ case NvParameterized::TYPE_ARRAY:
+ default:
+ for(int32_t i = 0; i < arraySize; ++i)
+ {
+ handle.set(i);
+ NV_ERR_CHECK_RETURN( traverseParamDefTree(obj, stream, state, handle, printValues) );
+ handle.popIndex();
+ }
+ break;
+ }
+#endif
+ }
+
+# if PRINT_ELEMENTS_WITHIN_EMPTY_ARRAYS
+ if( arraySize == 0 )
+ {
+ handle.set(0);
+ NV_ERR_CHECK_RETURN( traverseParamDefTree(obj, stream, state, handle, false) );
+ handle.popIndex();
+ }
+# endif
+
+ state.decLevel();
+ if( arraySize)
+ stream << state.indent;
+
+ stream << "</array>\n";
+
+ break;
+ }
+
+ case TYPE_REF:
+ {
+ stream << state.indent;
+ NV_ERR_CHECK_RETURN( emitElement(obj, stream, "value", handle, includedRef, printValues) );
+
+ if( printValues && includedRef )
+ {
+ stream << state.indent << "\n";
+
+ Interface *refObj = 0;
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamRef(refObj), Serializer::ERROR_UNKNOWN );
+
+ if( refObj )
+ {
+ Handle refHandle(refObj);
+ state.incLevel();
+ NV_ERR_CHECK_RETURN( traverseParamDefTree(*refObj, stream, state, refHandle) );
+ state.decLevel();
+ stream << state.indent;
+ }
+ }
+
+ stream << "</value>\n";
+
+ break;
+ }
+
+ case TYPE_POINTER:
+ //Don't do anything with pointer
+ break;
+
+NV_PARAMETRIZED_LINAL_DATATYPE_LABELS
+NV_PARAMETRIZED_ARITHMETIC_DATATYPE_LABELS
+NV_PARAMETRIZED_STRING_DATATYPE_LABELS
+NV_PARAMETRIZED_ENUM_DATATYPE_LABELS
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+ default:
+ {
+ stream << state.indent;
+ NV_ERR_CHECK_RETURN( emitElement(obj, stream, "value", handle, includedRef, printValues) );
+
+ char buf[512];
+ const char *str = 0;
+ if( printValues )
+ NV_PARAM_ERR_CHECK_RETURN( handle.valueToStr(buf, sizeof(buf), str), Serializer::ERROR_VAL2STRING_FAILED );
+
+ if( str )
+ stream << str;
+
+ stream << "</value>\n";
+
+ break;
+ } //default
+ } //switch
+
+ } //DONOTSERIALIZE
+
+ if( isRoot )
+ {
+ state.decLevel();
+ stream << "</value>\n";
+ }
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType XmlSerializer::emitElementNxHints(
+ physx::PsIOStream &stream,
+ Handle &handle,
+ traversalState &state,
+ bool &includedRef)
+{
+ const Definition *paramDef = handle.parameterDefinition();
+
+ for(int32_t j = 0; j < paramDef->numHints(); ++j)
+ {
+ if( 0 == j )
+ stream << "\n";
+
+ const Hint *hint = paramDef->hint(j);
+
+ stream << state.indent << "<!-- " << hint->name() << ": ";
+
+ if( hint->type() == TYPE_STRING )
+ stream << hint->asString() ;
+ else if( hint->type() == TYPE_U64 )
+ stream << hint->asUInt() ;
+ else if( hint->type() == TYPE_F64 )
+ stream << hint->asFloat() ;
+
+ stream << " -->\n";
+ }
+
+ includedRef = paramDef->isIncludedRef();
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType XmlSerializer::emitElement(
+ const Interface &obj,
+ physx::PsIOStream &stream,
+ const char *elementName,
+ Handle &handle,
+ bool includedRef,
+ bool printValues,
+ bool isRoot)
+{
+ const Definition *paramDef = handle.parameterDefinition();
+
+ DataType parentType = TYPE_UNDEFINED;
+
+ if( paramDef->parent() )
+ parentType = paramDef->parent()->type();
+
+ stream << '<' << elementName;
+
+ if( isRoot )
+ {
+ stream << " name=\"\""
+ << " type=\"Ref\""
+ << " className=\"" << obj.className() << "\"";
+
+ const char *objectName = obj.name();
+ if( objectName )
+ stream << " objectName=\"" << objectName << "\"";
+
+ if( isRoot ) //We only emit version info for root <struct>
+ storeVersionAndChecksum(stream, &obj);
+ }
+ else
+ {
+ if( parentType != TYPE_ARRAY )
+ {
+ const char *name = paramDef->name();
+ stream << " name=\"" << (name ? name : "") << "\"";
+ }
+ }
+
+ switch( paramDef->type() )
+ {
+ case TYPE_STRUCT:
+ break;
+
+ case TYPE_ARRAY:
+ {
+ int32_t arraySize;
+ NV_PARAM_ERR_CHECK_RETURN( handle.getArraySize(arraySize), Serializer::ERROR_INVALID_ARRAY );
+ stream << " size=\"" << arraySize << '"';
+ handle.set(0);
+ const Definition *pd = handle.parameterDefinition();
+ handle.popIndex();
+ stream << " type=\"" << typeToStr(pd->type()) << '"';
+ // ** handle use case for simple structs written out flat..
+#if !UNOPTIMIZED_XML
+ if ( pd->type() == TYPE_STRUCT && IsSimpleStruct(pd) )
+ {
+ stream << " structElements=\"";
+ const int32_t count = pd->numChildren();
+
+ // find how many of them need serialization
+ int32_t serializeCount = 0;
+ for (int32_t i=0; i<count; i++)
+ {
+ const Definition *d = pd->child(i);
+ if (d->hint("DONOTSERIALIZE") == NULL)
+ {
+ serializeCount++;
+ }
+ }
+
+ for (int32_t i=0; i<count; i++)
+ {
+ const Definition *d = pd->child(i);
+ if (d->hint("DONOTSERIALIZE"))
+ continue;
+
+ stream << d->name();
+ stream << "(";
+ stream << typeToStr(d->type());
+ stream << ")";
+ if ( (i+1) < serializeCount )
+ {
+ stream<<",";
+ }
+ }
+ stream << "\"";
+ }
+#endif
+ //
+ break;
+ }
+
+ case TYPE_REF:
+ {
+ stream << " type=\"" << typeToStr(paramDef->type()) << '"';
+
+ Interface *paramPtr = 0;
+ if( printValues )
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamRef(paramPtr), Serializer::ERROR_UNKNOWN );
+
+ stream << " included=\"" << ( includedRef ? "1" : "0" ) << "\"";
+
+ if( !printValues || !paramPtr )
+ {
+ stream << " classNames=\"";
+ for(int32_t i = 0; i < paramDef->numRefVariants(); ++i)
+ {
+ const char *ref = paramDef->refVariantVal(i);
+ if ( DoesNeedQuote(ref) )
+ stream << "%20" << ref << "%20" << " ";
+ else
+ stream << ref << " ";
+ }
+ stream << '"';
+
+ break;
+ }
+
+ stream << " className=\"" << paramPtr->className() << '"';
+
+ const char *objectName = paramPtr->name();
+ if( objectName )
+ stream << " objectName=\"" << objectName << "\"";
+
+ if( includedRef )
+ storeVersionAndChecksum(stream, paramPtr);
+
+ break;
+ }
+
+ case TYPE_STRING:
+ case TYPE_ENUM:
+ {
+ const char *val;
+ NV_PARAM_ERR_CHECK_RETURN( handle.getParamString(val), Serializer::ERROR_UNKNOWN );
+
+ //Make a note if value is NULL
+ if( !val )
+ stream << " null=\"1\"";
+ }
+
+ //Fall-through to default
+
+NV_PARAMETRIZED_LINAL_DATATYPE_LABELS
+NV_PARAMETRIZED_ARITHMETIC_DATATYPE_LABELS
+NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+ default:
+ stream << " type=\"" << typeToStr(paramDef->type()) << "\"";
+ break;
+ } //switch
+
+ stream << '>';
+
+ return Serializer::ERROR_NONE;
+}
+
+Serializer::ErrorType XmlSerializer::internalSerialize(physx::PxFileBuf &fbuf, const Interface **objs, uint32_t n, bool doMetadata)
+{
+ PX_UNUSED(doMetadata);
+
+ physx::PsIOStream stream(fbuf, fbuf.getFileLength());
+ stream.setBinary(false);
+
+ uint32_t minor = version() & 0xffffUL,
+ major = version() >> 16;
+
+ stream << "<!DOCTYPE NvParameters>\n"
+ << "<NvParameters "
+ << "numObjects=\"" << n << "\" "
+ << "version=\"" << major << '.' << minor << "\" "
+ << ">\n";
+
+ for(uint32_t i = 0; i < n; ++i)
+ {
+ const Interface &obj = *objs[i];
+ Handle handle(obj);
+
+ traversalState state;
+ NV_ERR_CHECK_RETURN( traverseParamDefTree(obj, stream, state, handle) );
+ }
+
+ stream << "</NvParameters>\n";
+
+ return Serializer::ERROR_NONE;
+}
+
+#endif
+
+Serializer::ErrorType XmlSerializer::internalDeserialize(
+ physx::PxFileBuf &stream,
+ Serializer::DeserializedData &res,
+ bool & /*doesNeedUpdate*/)
+{
+ XmlDeserializer *d = XmlDeserializer::Create(mTraits, XmlSerializer::version());
+ physx::shdfnd::FastXml *xmlParser = physx::shdfnd::createFastXml(d);
+ InputDataFromPxFileBuf inputData(stream);
+ if( xmlParser && !xmlParser->processXml(inputData) )
+ {
+ Serializer::ErrorType err = d->getLastError();
+ if( Serializer::ERROR_NONE == err ) //Proper error code not set?
+ {
+ DEBUG_ALWAYS_ASSERT(); //XmlDeserializer should set explicit error codes
+ err = Serializer::ERROR_UNKNOWN;
+ }
+
+ xmlParser->release();
+
+ d->releaseAll();
+ d->destroy();
+
+ return err;
+ }
+
+ if ( xmlParser )
+ xmlParser->release();
+
+ res.init(mTraits, d->getObjs(), d->getNobjs());
+
+ d->destroy();
+
+ return Serializer::ERROR_NONE;
+}
+bool isXmlFormat(physx::PxFileBuf &stream)
+{
+ // if it is at least 32 bytes long and the first 32 byte are all ASCII, then consider it potentially valid XML
+
+ if( stream.getFileLength() < 32 )
+ return false;
+
+ char hdr[32];
+ stream.peek(hdr, sizeof(hdr));
+
+ for(size_t i = 0; i < sizeof(hdr); ++i)
+ {
+ char c = hdr[i];
+ if( !(c == '\r' || c == '\t' || c == '\n' || ( c >= 32 && c < 127)) )
+ return false;
+ }
+
+ const char *magic1 = "<!DOCTYPE NvParameters>";
+ const char *magic2 = "<!DOCTYPE NxParameters>";
+ return 0 == ::strncmp(hdr, magic1, strlen(magic1)) ||
+ 0 == ::strncmp(hdr, magic2, strlen(magic2));
+}
+
+} // namespace NvParameterized
+