feat(physics): wire physx sdk into build
This commit is contained in:
80
engine/third_party/physx/pvdruntime/compiler/cmake/CMakeLists.txt
vendored
Normal file
80
engine/third_party/physx/pvdruntime/compiler/cmake/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
## Redistribution and use in source and binary forms, with or without
|
||||
## modification, are permitted provided that the following conditions
|
||||
## are met:
|
||||
## * Redistributions of source code must retain the above copyright
|
||||
## notice, this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright
|
||||
## notice, this list of conditions and the following disclaimer in the
|
||||
## documentation and/or other materials provided with the distribution.
|
||||
## * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
## contributors may be used to endorse or promote products derived
|
||||
## from this software without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
##
|
||||
## Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(PVDRuntime C CXX)
|
||||
|
||||
set(PVDRuntimeBuilt 1 CACHE INTERNAL "PVDRuntimeBuilt")
|
||||
|
||||
# This is required to be defined by external callers!
|
||||
IF(NOT DEFINED PHYSX_ROOT_DIR)
|
||||
MESSAGE(FATAL_ERROR "PHYSX_ROOT_DIR variable wasn't set.")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT EXISTS ${PHYSX_ROOT_DIR})
|
||||
MESSAGE(FATAL_ERROR "PHYSX_ROOT_DIR variable was invalid.")
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(NvidiaBuildOptions)
|
||||
|
||||
IF(CMAKE_CONFIGURATION_TYPES)
|
||||
SET(CMAKE_CONFIGURATION_TYPES debug checked profile release)
|
||||
SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
|
||||
"Reset config to what we need"
|
||||
FORCE)
|
||||
|
||||
# Need to define these at least once.
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_CHECKED "")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_PROFILE "")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_CHECKED "")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_PROFILE "")
|
||||
|
||||
# Build PDBs for all configurations
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "/DEBUG")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG")
|
||||
|
||||
ENDIF()
|
||||
|
||||
SET(PROJECT_CMAKE_FILES_DIR compiler/cmake)
|
||||
SET(PLATFORM_CMAKELISTS ${PHYSX_ROOT_DIR}/pvdruntime/${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/CMakeLists.txt)
|
||||
|
||||
IF(NOT EXISTS ${PLATFORM_CMAKELISTS})
|
||||
MESSAGE(FATAL_ERROR "Unable to find platform CMakeLists.txt for ${TARGET_BUILD_PLATFORM} at ${PLATFORM_CMAKELISTS}")
|
||||
ENDIF()
|
||||
|
||||
# Include the platform specific CMakeLists
|
||||
INCLUDE(${PHYSX_ROOT_DIR}/pvdruntime/${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/CMakeLists.txt)
|
||||
|
||||
# Set folder Server to all Server projects
|
||||
SET_PROPERTY(TARGET PVDRuntime PROPERTY FOLDER "PVDRuntime")
|
||||
|
||||
INSTALL(
|
||||
TARGETS PVDRuntime
|
||||
EXPORT PhysXSDK
|
||||
DESTINATION $<$<CONFIG:debug>:${PX_ROOT_LIB_DIR}/debug>$<$<CONFIG:release>:${PX_ROOT_LIB_DIR}/release>$<$<CONFIG:checked>:${PX_ROOT_LIB_DIR}/checked>$<$<CONFIG:profile>:${PX_ROOT_LIB_DIR}/profile>
|
||||
)
|
||||
|
||||
45
engine/third_party/physx/pvdruntime/compiler/cmake/linux/CMakeLists.txt
vendored
Normal file
45
engine/third_party/physx/pvdruntime/compiler/cmake/linux/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
## Redistribution and use in source and binary forms, with or without
|
||||
## modification, are permitted provided that the following conditions
|
||||
## are met:
|
||||
## * Redistributions of source code must retain the above copyright
|
||||
## notice, this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright
|
||||
## notice, this list of conditions and the following disclaimer in the
|
||||
## documentation and/or other materials provided with the distribution.
|
||||
## * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
## contributors may be used to endorse or promote products derived
|
||||
## from this software without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
##
|
||||
## Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
IF(NOT DEFINED PHYSX_LINUX_COMPILE_DEFS)
|
||||
MESSAGE(FATAL ERROR "PVDRuntime uses the PhysX compile defs, and they're not defined when they need to be.")
|
||||
ENDIF()
|
||||
|
||||
IF (NOT DEFINED PHYSX_CXX_FLAGS)
|
||||
MESSAGE(FATAL ERROR "PVDRuntime uses the PhysX CXX flags, and they're not defined when they need to be.")
|
||||
ENDIF()
|
||||
|
||||
# Get the CXX Flags from the Cached variables set by the PhysX CMakeLists
|
||||
SET(CMAKE_CXX_FLAGS "${PHYSX_CXX_FLAGS}")
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${PHYSX_CXX_FLAGS_DEBUG}")
|
||||
SET(CMAKE_CXX_FLAGS_CHECKED "${PHYSX_CXX_FLAGS_CHECKED}")
|
||||
SET(CMAKE_CXX_FLAGS_PROFILE "${PHYSX_CXX_FLAGS_PROFILE}")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${PHYSX_CXX_FLAGS_RELEASE}")
|
||||
|
||||
# Include all of the projects
|
||||
INCLUDE(PVDRuntime.cmake)
|
||||
|
||||
48
engine/third_party/physx/pvdruntime/compiler/cmake/windows/CMakeLists.txt
vendored
Normal file
48
engine/third_party/physx/pvdruntime/compiler/cmake/windows/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
## Redistribution and use in source and binary forms, with or without
|
||||
## modification, are permitted provided that the following conditions
|
||||
## are met:
|
||||
## * Redistributions of source code must retain the above copyright
|
||||
## notice, this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright
|
||||
## notice, this list of conditions and the following disclaimer in the
|
||||
## documentation and/or other materials provided with the distribution.
|
||||
## * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
## contributors may be used to endorse or promote products derived
|
||||
## from this software without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
##
|
||||
## Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
IF(NOT DEFINED PHYSX_WINDOWS_COMPILE_DEFS)
|
||||
MESSAGE(FATAL ERROR "PVDRuntime uses the PhysX compile defs, and they're not defined when they need to be.")
|
||||
ENDIF()
|
||||
|
||||
IF (NOT DEFINED PHYSX_CXX_FLAGS)
|
||||
MESSAGE(FATAL ERROR "PVDRuntime uses the PhysX CXX flags, and they're not defined when they need to be.")
|
||||
ENDIF()
|
||||
|
||||
# Get the CXX Flags from the Cached variables set by the PhysX CMakeLists
|
||||
SET(CMAKE_CXX_FLAGS "${PHYSX_CXX_FLAGS} /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4577 /EHsc")
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${PHYSX_CXX_FLAGS_DEBUG}")
|
||||
SET(CMAKE_CXX_FLAGS_CHECKED "${PHYSX_CXX_FLAGS_CHECKED}")
|
||||
SET(CMAKE_CXX_FLAGS_PROFILE "${PHYSX_CXX_FLAGS_PROFILE}")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${PHYSX_CXX_FLAGS_RELEASE}")
|
||||
|
||||
# Build PDBs for all configurations
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG")
|
||||
|
||||
# Include all of the projects
|
||||
INCLUDE(PVDRuntime.cmake)
|
||||
|
||||
53
engine/third_party/physx/pvdruntime/include/OmniPvdCommands.h
vendored
Normal file
53
engine/third_party/physx/pvdruntime/include/OmniPvdCommands.h
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_COMMANDS_H
|
||||
#define OMNI_PVD_COMMANDS_H
|
||||
|
||||
struct OmniPvdCommand
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eINVALID,
|
||||
eREGISTER_CLASS,
|
||||
eREGISTER_ENUM,
|
||||
eREGISTER_ATTRIBUTE,
|
||||
eREGISTER_CLASS_ATTRIBUTE,
|
||||
eREGISTER_UNIQUE_LIST_ATTRIBUTE,
|
||||
eSET_ATTRIBUTE,
|
||||
eADD_TO_UNIQUE_LIST_ATTRIBUTE,
|
||||
eREMOVE_FROM_UNIQUE_LIST_ATTRIBUTE,
|
||||
eCREATE_OBJECT,
|
||||
eDESTROY_OBJECT,
|
||||
eSTART_FRAME,
|
||||
eSTOP_FRAME,
|
||||
eRECORD_MESSAGE
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
199
engine/third_party/physx/pvdruntime/include/OmniPvdDefines.h
vendored
Normal file
199
engine/third_party/physx/pvdruntime/include/OmniPvdDefines.h
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_DEFINES_H
|
||||
#define OMNI_PVD_DEFINES_H
|
||||
|
||||
#define OMNI_PVD_INVALID_HANDLE 0
|
||||
|
||||
#define OMNI_PVD_VERSION_MAJOR 0
|
||||
#define OMNI_PVD_VERSION_MINOR 4
|
||||
#define OMNI_PVD_VERSION_PATCH 0
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Versions so far : (major, minor, patch), top one is newest
|
||||
//
|
||||
// [0, 4, 0]
|
||||
// add new eRECORD_MESSAGE command to record messages in the OVD stream.
|
||||
// [0, 3, 0]
|
||||
// writes/read out the base class handle in the class registration call
|
||||
// backwards compatible with [0, 2, 0] and [0, 1, 42]
|
||||
// [0, 2, 0]
|
||||
// intermediate version was never official, no real change, but there are many files with this version
|
||||
// [0, 1, 42]
|
||||
// no proper base class written/read in the class registration call
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
#define OMNI_PVD_WIN
|
||||
#define OMNI_PVD_CALL __cdecl
|
||||
#define OMNI_PVD_EXPORT extern "C" __declspec(dllexport)
|
||||
#else
|
||||
#ifdef __cdecl__
|
||||
#define OMNI_PVD_CALL __attribute__((__cdecl__))
|
||||
#else
|
||||
#define OMNI_PVD_CALL
|
||||
#endif
|
||||
#if __GNUC__ >= 4
|
||||
#define OMNI_PVD_EXPORT extern "C" __attribute__((visibility("default")))
|
||||
#else
|
||||
#define OMNI_PVD_EXPORT extern "C"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef uint64_t OmniPvdObjectHandle;
|
||||
typedef uint64_t OmniPvdContextHandle;
|
||||
typedef uint32_t OmniPvdClassHandle;
|
||||
typedef uint32_t OmniPvdAttributeHandle;
|
||||
typedef uint32_t OmniPvdVersionType;
|
||||
typedef uint32_t OmniPvdEnumValueType;
|
||||
|
||||
typedef void (OMNI_PVD_CALL *OmniPvdLogFunction)(char *logLine);
|
||||
|
||||
struct OmniPvdDataType
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eINT8,
|
||||
eINT16,
|
||||
eINT32,
|
||||
eINT64,
|
||||
eUINT8,
|
||||
eUINT16,
|
||||
eUINT32,
|
||||
eUINT64,
|
||||
eFLOAT32,
|
||||
eFLOAT64,
|
||||
eSTRING,
|
||||
eOBJECT_HANDLE,
|
||||
eENUM_VALUE,
|
||||
eFLAGS_WORD
|
||||
};
|
||||
};
|
||||
|
||||
template<uint32_t tType>
|
||||
inline uint32_t getOmniPvdDataTypeSize() { return 0; }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eINT8>() { return sizeof(int8_t); }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eINT16>() { return sizeof(int16_t); }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eINT32>() { return sizeof(int32_t); }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eINT64>() { return sizeof(int64_t); }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eUINT8>() { return sizeof(uint8_t); }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eUINT16>() { return sizeof(uint16_t); }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eUINT32>() { return sizeof(uint32_t); }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eUINT64>() { return sizeof(uint64_t); }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eFLOAT32>() { return sizeof(float); }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eFLOAT64>() { return sizeof(double); }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eSTRING>() { return 0; }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eOBJECT_HANDLE>() { return sizeof(OmniPvdObjectHandle); }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eENUM_VALUE>() { return sizeof(OmniPvdEnumValueType); }
|
||||
|
||||
template<>
|
||||
inline uint32_t getOmniPvdDataTypeSize<OmniPvdDataType::eFLAGS_WORD>() { return sizeof(OmniPvdClassHandle); }
|
||||
|
||||
inline uint32_t getOmniPvdDataTypeSizeFromEnum(OmniPvdDataType::Enum dataType)
|
||||
{
|
||||
switch (dataType)
|
||||
{
|
||||
case OmniPvdDataType::eINT8:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eINT8>();
|
||||
break;
|
||||
case OmniPvdDataType::eINT16:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eINT16>();
|
||||
break;
|
||||
case OmniPvdDataType::eINT32:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eINT32>();
|
||||
break;
|
||||
case OmniPvdDataType::eINT64:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eINT64>();
|
||||
break;
|
||||
case OmniPvdDataType::eUINT8:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eUINT8>();
|
||||
break;
|
||||
case OmniPvdDataType::eUINT16:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eUINT16>();
|
||||
break;
|
||||
case OmniPvdDataType::eUINT32:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eUINT32>();
|
||||
break;
|
||||
case OmniPvdDataType::eUINT64:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eUINT64>();
|
||||
break;
|
||||
case OmniPvdDataType::eFLOAT32:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eFLOAT32>();
|
||||
break;
|
||||
case OmniPvdDataType::eFLOAT64:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eFLOAT64>();
|
||||
break;
|
||||
case OmniPvdDataType::eSTRING:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eSTRING>();
|
||||
break;
|
||||
case OmniPvdDataType::eOBJECT_HANDLE:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eOBJECT_HANDLE>();
|
||||
break;
|
||||
case OmniPvdDataType::eENUM_VALUE:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eENUM_VALUE>();
|
||||
break;
|
||||
case OmniPvdDataType::eFLAGS_WORD:
|
||||
return getOmniPvdDataTypeSize<OmniPvdDataType::eFLAGS_WORD>();
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
68
engine/third_party/physx/pvdruntime/include/OmniPvdFileReadStream.h
vendored
Normal file
68
engine/third_party/physx/pvdruntime/include/OmniPvdFileReadStream.h
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_FILE_READ_STREAM_H
|
||||
#define OMNI_PVD_FILE_READ_STREAM_H
|
||||
|
||||
#include "OmniPvdReadStream.h"
|
||||
|
||||
/**
|
||||
* \brief Used to abstract a file read stream
|
||||
*
|
||||
* Used to set the filename, opening and closing it.
|
||||
*/
|
||||
class OmniPvdFileReadStream : public OmniPvdReadStream
|
||||
{
|
||||
public:
|
||||
virtual ~OmniPvdFileReadStream()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Sets the file name of the file to read from
|
||||
*
|
||||
* \param fileName The file name of the file to open
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL setFileName(const char* fileName) = 0;
|
||||
|
||||
/**
|
||||
* \brief Opens the file
|
||||
*
|
||||
* \return True if the file opening was successfull
|
||||
*/
|
||||
virtual bool OMNI_PVD_CALL openFile() = 0;
|
||||
|
||||
/**
|
||||
* \brief Closes the file
|
||||
*
|
||||
* \return True if the file closing was successfull
|
||||
*/
|
||||
virtual bool OMNI_PVD_CALL closeFile() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
68
engine/third_party/physx/pvdruntime/include/OmniPvdFileWriteStream.h
vendored
Normal file
68
engine/third_party/physx/pvdruntime/include/OmniPvdFileWriteStream.h
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_FILE_WRITE_STREAM_H
|
||||
#define OMNI_PVD_FILE_WRITE_STREAM_H
|
||||
|
||||
#include "OmniPvdWriteStream.h"
|
||||
|
||||
/**
|
||||
* \brief Used to abstract a file write stream
|
||||
*
|
||||
* Used to set the filename, opening and closing it.
|
||||
*/
|
||||
class OmniPvdFileWriteStream : public OmniPvdWriteStream
|
||||
{
|
||||
public:
|
||||
virtual ~OmniPvdFileWriteStream()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Sets the file name of the file to write to
|
||||
*
|
||||
* \param fileName The file name of the file to open
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL setFileName(const char* fileName) = 0;
|
||||
|
||||
/**
|
||||
* \brief Opens the file
|
||||
*
|
||||
* \return True if the file opening was successfull
|
||||
*/
|
||||
virtual bool OMNI_PVD_CALL openFile() = 0;
|
||||
|
||||
/**
|
||||
* \brief Closes the file
|
||||
*
|
||||
* \return True if the file closing was successfull
|
||||
*/
|
||||
virtual bool OMNI_PVD_CALL closeFile() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
54
engine/third_party/physx/pvdruntime/include/OmniPvdLibraryFunctions.h
vendored
Normal file
54
engine/third_party/physx/pvdruntime/include/OmniPvdLibraryFunctions.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
#ifndef OMNI_PVD_LIBRARY_FUNCTIONS_H
|
||||
#define OMNI_PVD_LIBRARY_FUNCTIONS_H
|
||||
|
||||
#include "OmniPvdDefines.h"
|
||||
|
||||
class OmniPvdReader;
|
||||
class OmniPvdWriter;
|
||||
class OmniPvdFileReadStream;
|
||||
class OmniPvdFileWriteStream;
|
||||
class OmniPvdMemoryStream;
|
||||
|
||||
typedef OmniPvdReader* (OMNI_PVD_CALL *createOmniPvdReaderFp)();
|
||||
typedef void (OMNI_PVD_CALL *destroyOmniPvdReaderFp)(OmniPvdReader& reader);
|
||||
|
||||
typedef OmniPvdWriter* (OMNI_PVD_CALL *createOmniPvdWriterFp)();
|
||||
typedef void (OMNI_PVD_CALL *destroyOmniPvdWriterFp)(OmniPvdWriter& writer);
|
||||
|
||||
typedef OmniPvdFileReadStream* (OMNI_PVD_CALL *createOmniPvdFileReadStreamFp)();
|
||||
typedef void (OMNI_PVD_CALL *destroyOmniPvdFileReadStreamFp)(OmniPvdFileReadStream& fileReadStream);
|
||||
|
||||
typedef OmniPvdFileWriteStream* (OMNI_PVD_CALL *createOmniPvdFileWriteStreamFp)();
|
||||
typedef void (OMNI_PVD_CALL *destroyOmniPvdFileWriteStreamFp)(OmniPvdFileWriteStream& fileWriteStream);
|
||||
|
||||
typedef OmniPvdMemoryStream* (OMNI_PVD_CALL *createOmniPvdMemoryStreamFp)();
|
||||
typedef void (OMNI_PVD_CALL *destroyOmniPvdMemoryStreamFp)(OmniPvdMemoryStream& memoryStream);
|
||||
|
||||
#endif
|
||||
41
engine/third_party/physx/pvdruntime/include/OmniPvdLibraryHelpers.h
vendored
Normal file
41
engine/third_party/physx/pvdruntime/include/OmniPvdLibraryHelpers.h
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_LIBRARY_FUNCTIONS_H
|
||||
#define OMNI_PVD_LIBRARY_FUNCTIONS_H
|
||||
|
||||
#include "OmniPvdDefines.h"
|
||||
|
||||
class OmniPvdReader;
|
||||
class OmniPvdWriter;
|
||||
|
||||
typedef OmniPvdReader* (OMNI_PVD_CALL *createOmniPvdReaderFp)();
|
||||
typedef void (OMNI_PVD_CALL *destroyOmniPvdReaderFp)(OmniPvdReader *reader);
|
||||
|
||||
typedef OmniPvdWriter* (OMNI_PVD_CALL *createOmniPvdWriterFp)();
|
||||
typedef void (OMNI_PVD_CALL *destroyOmniPvdWriterFp)(OmniPvdWriter *writer);
|
||||
|
||||
#endif
|
||||
178
engine/third_party/physx/pvdruntime/include/OmniPvdLoader.h
vendored
Normal file
178
engine/third_party/physx/pvdruntime/include/OmniPvdLoader.h
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_LOADER_H
|
||||
#define OMNI_PVD_LOADER_H
|
||||
|
||||
#include "OmniPvdWriter.h"
|
||||
#include "OmniPvdReader.h"
|
||||
#include "OmniPvdLibraryFunctions.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef OMNI_PVD_WIN
|
||||
#ifndef _WINDOWS_ // windows already included otherwise
|
||||
#include <foundation/windows/PxWindowsInclude.h>
|
||||
#endif
|
||||
#elif defined(__linux__)
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
class OmniPvdLoader
|
||||
{
|
||||
public:
|
||||
OmniPvdLoader();
|
||||
~OmniPvdLoader();
|
||||
bool loadOmniPvd(const char *libFile);
|
||||
void unloadOmniPvd();
|
||||
void* mLibraryHandle;
|
||||
|
||||
createOmniPvdWriterFp mCreateOmniPvdWriter;
|
||||
destroyOmniPvdWriterFp mDestroyOmniPvdWriter;
|
||||
|
||||
createOmniPvdReaderFp mCreateOmniPvdReader;
|
||||
destroyOmniPvdReaderFp mDestroyOmniPvdReader;
|
||||
|
||||
createOmniPvdFileReadStreamFp mCreateOmniPvdFileReadStream;
|
||||
destroyOmniPvdFileReadStreamFp mDestroyOmniPvdFileReadStream;
|
||||
|
||||
createOmniPvdFileWriteStreamFp mCreateOmniPvdFileWriteStream;
|
||||
destroyOmniPvdFileWriteStreamFp mDestroyOmniPvdFileWriteStream;
|
||||
|
||||
createOmniPvdMemoryStreamFp mCreateOmniPvdMemoryStream;
|
||||
destroyOmniPvdMemoryStreamFp mDestroyOmniPvdMemoryStream;
|
||||
};
|
||||
|
||||
inline OmniPvdLoader::OmniPvdLoader()
|
||||
{
|
||||
mLibraryHandle = 0;
|
||||
|
||||
mCreateOmniPvdWriter = 0;
|
||||
mDestroyOmniPvdWriter = 0;
|
||||
|
||||
mCreateOmniPvdReader = 0;
|
||||
mDestroyOmniPvdReader = 0;
|
||||
|
||||
mCreateOmniPvdFileReadStream = 0;
|
||||
mDestroyOmniPvdFileReadStream = 0;
|
||||
|
||||
mCreateOmniPvdFileWriteStream = 0;
|
||||
mDestroyOmniPvdFileWriteStream = 0;
|
||||
|
||||
mCreateOmniPvdMemoryStream = 0;
|
||||
mDestroyOmniPvdMemoryStream = 0;
|
||||
}
|
||||
|
||||
inline OmniPvdLoader::~OmniPvdLoader()
|
||||
{
|
||||
unloadOmniPvd();
|
||||
}
|
||||
|
||||
inline bool OmniPvdLoader::loadOmniPvd(const char *libFile)
|
||||
{
|
||||
|
||||
#ifdef OMNI_PVD_WIN
|
||||
mLibraryHandle = LoadLibraryA(libFile);
|
||||
#elif defined(__linux__)
|
||||
mLibraryHandle = dlopen(libFile, RTLD_NOW);
|
||||
#endif
|
||||
|
||||
if (mLibraryHandle)
|
||||
{
|
||||
#ifdef OMNI_PVD_WIN
|
||||
mCreateOmniPvdWriter = (createOmniPvdWriterFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdWriter");
|
||||
mDestroyOmniPvdWriter = (destroyOmniPvdWriterFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdWriter");
|
||||
|
||||
mCreateOmniPvdReader = (createOmniPvdReaderFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdReader");
|
||||
mDestroyOmniPvdReader = (destroyOmniPvdReaderFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdReader");
|
||||
|
||||
mCreateOmniPvdFileReadStream = (createOmniPvdFileReadStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdFileReadStream");
|
||||
mDestroyOmniPvdFileReadStream = (destroyOmniPvdFileReadStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdFileReadStream");
|
||||
|
||||
mCreateOmniPvdFileWriteStream = (createOmniPvdFileWriteStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdFileWriteStream");
|
||||
mDestroyOmniPvdFileWriteStream = (destroyOmniPvdFileWriteStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdFileWriteStream");
|
||||
|
||||
mCreateOmniPvdMemoryStream = (createOmniPvdMemoryStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdMemoryStream");
|
||||
mDestroyOmniPvdMemoryStream = (destroyOmniPvdMemoryStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdMemoryStream");
|
||||
#elif defined(__linux__)
|
||||
mCreateOmniPvdWriter = (createOmniPvdWriterFp)dlsym(mLibraryHandle, "createOmniPvdWriter");
|
||||
mDestroyOmniPvdWriter = (destroyOmniPvdWriterFp)dlsym(mLibraryHandle, "destroyOmniPvdWriter");
|
||||
|
||||
mCreateOmniPvdReader = (createOmniPvdReaderFp)dlsym(mLibraryHandle, "createOmniPvdReader");
|
||||
mDestroyOmniPvdReader = (destroyOmniPvdReaderFp)dlsym(mLibraryHandle, "destroyOmniPvdReader");
|
||||
|
||||
mCreateOmniPvdFileReadStream = (createOmniPvdFileReadStreamFp)dlsym(mLibraryHandle, "createOmniPvdFileReadStream");
|
||||
mDestroyOmniPvdFileReadStream = (destroyOmniPvdFileReadStreamFp)dlsym(mLibraryHandle, "destroyOmniPvdFileReadStream");
|
||||
|
||||
mCreateOmniPvdFileWriteStream = (createOmniPvdFileWriteStreamFp)dlsym(mLibraryHandle, "createOmniPvdFileWriteStream");
|
||||
mDestroyOmniPvdFileWriteStream = (destroyOmniPvdFileWriteStreamFp)dlsym(mLibraryHandle, "destroyOmniPvdFileWriteStream");
|
||||
|
||||
mCreateOmniPvdMemoryStream = (createOmniPvdMemoryStreamFp)dlsym(mLibraryHandle, "createOmniPvdMemoryStream");
|
||||
mDestroyOmniPvdMemoryStream = (destroyOmniPvdMemoryStreamFp)dlsym(mLibraryHandle, "destroyOmniPvdMemoryStream");
|
||||
|
||||
#endif
|
||||
|
||||
if ((!mCreateOmniPvdWriter) ||
|
||||
(!mDestroyOmniPvdWriter) ||
|
||||
(!mCreateOmniPvdReader) ||
|
||||
(!mDestroyOmniPvdReader) ||
|
||||
(!mCreateOmniPvdFileReadStream) ||
|
||||
(!mDestroyOmniPvdFileReadStream) ||
|
||||
(!mCreateOmniPvdFileWriteStream) ||
|
||||
(!mDestroyOmniPvdFileWriteStream) ||
|
||||
(!mCreateOmniPvdMemoryStream) ||
|
||||
(!mDestroyOmniPvdMemoryStream)
|
||||
)
|
||||
{
|
||||
#ifdef OMNI_PVD_WIN
|
||||
FreeLibrary((HINSTANCE)mLibraryHandle);
|
||||
#elif defined(__linux__)
|
||||
dlclose(mLibraryHandle);
|
||||
#endif
|
||||
mLibraryHandle = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void OmniPvdLoader::unloadOmniPvd()
|
||||
{
|
||||
if (mLibraryHandle)
|
||||
{
|
||||
#ifdef OMNI_PVD_WIN
|
||||
FreeLibrary((HINSTANCE)mLibraryHandle);
|
||||
#elif defined(__linux__)
|
||||
dlclose(mLibraryHandle);
|
||||
#endif
|
||||
mLibraryHandle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
68
engine/third_party/physx/pvdruntime/include/OmniPvdMemoryStream.h
vendored
Normal file
68
engine/third_party/physx/pvdruntime/include/OmniPvdMemoryStream.h
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_MEMORY_STREAM_H
|
||||
#define OMNI_PVD_MEMORY_STREAM_H
|
||||
|
||||
#include "OmniPvdReadStream.h"
|
||||
#include "OmniPvdWriteStream.h"
|
||||
|
||||
/**
|
||||
* \brief Used to abstract a memory read/write stream
|
||||
*
|
||||
* Used to get the read and write streams.
|
||||
*/
|
||||
class OmniPvdMemoryStream
|
||||
{
|
||||
public:
|
||||
virtual ~OmniPvdMemoryStream()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* \brief Used to get the read stream
|
||||
*
|
||||
* \return The read stream
|
||||
*/
|
||||
virtual OmniPvdReadStream* OMNI_PVD_CALL getReadStream() = 0;
|
||||
|
||||
/**
|
||||
* \brief Used to get the write stream
|
||||
*
|
||||
* \return The write stream
|
||||
*/
|
||||
virtual OmniPvdWriteStream* OMNI_PVD_CALL getWriteStream() = 0;
|
||||
|
||||
/**
|
||||
* \brief Sets the buffer size in bytes of the memory streams
|
||||
*
|
||||
* \return The actually allocated length of the memory stream
|
||||
*/
|
||||
virtual uint64_t OMNI_PVD_CALL setBufferSize(uint64_t bufferLength) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
78
engine/third_party/physx/pvdruntime/include/OmniPvdReadStream.h
vendored
Normal file
78
engine/third_party/physx/pvdruntime/include/OmniPvdReadStream.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_READ_STREAM_H
|
||||
#define OMNI_PVD_READ_STREAM_H
|
||||
|
||||
#include "OmniPvdDefines.h"
|
||||
|
||||
/**
|
||||
* \brief Used to abstract a memory read stream
|
||||
*
|
||||
* Allows to read and skip bytes as well as open/close it.
|
||||
*/
|
||||
class OmniPvdReadStream
|
||||
{
|
||||
public:
|
||||
virtual ~OmniPvdReadStream()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Read n bytes from the shared memory buffer
|
||||
*
|
||||
* \param bytes Reads n bytes into the destination pointer
|
||||
* \param nbrBytes The requested number of bytes to read
|
||||
* \return The actual number of bytes read
|
||||
*/
|
||||
virtual uint64_t OMNI_PVD_CALL readBytes(uint8_t* bytes, uint64_t nbrBytes) = 0;
|
||||
|
||||
/**
|
||||
* \brief Skip n bytes from the shared memory buffer
|
||||
*
|
||||
* \param nbrBytes The requested number of bytes to skip
|
||||
* \return The actual number of bytes skipped
|
||||
*/
|
||||
virtual uint64_t OMNI_PVD_CALL skipBytes(uint64_t nbrBytes) = 0;
|
||||
|
||||
/**
|
||||
* \brief Opens the read stream
|
||||
*
|
||||
* \return True if it succeeded
|
||||
*/
|
||||
virtual bool OMNI_PVD_CALL openStream() = 0;
|
||||
|
||||
/**
|
||||
* \brief Closes the read stream
|
||||
*
|
||||
* \return True if it succeeded
|
||||
*/
|
||||
virtual bool OMNI_PVD_CALL closeStream() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
237
engine/third_party/physx/pvdruntime/include/OmniPvdReader.h
vendored
Normal file
237
engine/third_party/physx/pvdruntime/include/OmniPvdReader.h
vendored
Normal file
@@ -0,0 +1,237 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_READER_H
|
||||
#define OMNI_PVD_READER_H
|
||||
|
||||
#include "OmniPvdDefines.h"
|
||||
#include "OmniPvdCommands.h"
|
||||
#include "OmniPvdReadStream.h"
|
||||
|
||||
#define OMNI_PVD_MAX_STRING_LENGTH 2048
|
||||
|
||||
|
||||
/**
|
||||
* \brief Used to read debug information from an OmniPvdReadStream
|
||||
*
|
||||
* Using the getNextCommand function in a while loop for example one can traverse the stream one command after another. Given the command, different functions below will be available.
|
||||
*
|
||||
* Using the OmniPvdCommand::Enum one can determine the type of command and like that use the appropriate get functions to extract the payload from the command.
|
||||
*/
|
||||
|
||||
class OmniPvdReader
|
||||
{
|
||||
public:
|
||||
virtual ~OmniPvdReader()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Sets the log function to print the internal debug messages of the OmniPVD Reader instance
|
||||
*
|
||||
* \param logFunction The function pointer to receive the log messages
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL setLogFunction(OmniPvdLogFunction logFunction) = 0;
|
||||
|
||||
/**
|
||||
* \brief Sets the read stream that contains the OmniPVD API command stream
|
||||
*
|
||||
* \param stream The OmniPvdReadStream that holds the stream of API calls/notifications
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL setReadStream(OmniPvdReadStream& stream) = 0;
|
||||
|
||||
/**
|
||||
* \brief Extracts the versions from the binary file to read and tests if the file is older or equal to that of the reader.
|
||||
*
|
||||
* \param majorVersion The major versions of the stream
|
||||
* \param minorVersion The minor versions of the stream
|
||||
* \param patch The patch number of the stream
|
||||
* \return If the reading was possible to start or not
|
||||
*/
|
||||
virtual bool OMNI_PVD_CALL startReading(OmniPvdVersionType& majorVersion, OmniPvdVersionType& minorVersion, OmniPvdVersionType& patch) = 0;
|
||||
|
||||
/**
|
||||
* \brief The heartbeat function of the reader class. As long as the command that is returned is not equal to OmniPvdCommand::eINVALID, then one can safely extract the data fields from the command.
|
||||
*
|
||||
* \return The command enum type
|
||||
*/
|
||||
virtual OmniPvdCommand::Enum OMNI_PVD_CALL getNextCommand() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the major version of the stream
|
||||
*
|
||||
* \return The major version
|
||||
*/
|
||||
virtual OmniPvdVersionType OMNI_PVD_CALL getMajorVersion() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the minor version of the stream
|
||||
*
|
||||
* \return The minor version
|
||||
*/
|
||||
virtual OmniPvdVersionType OMNI_PVD_CALL getMinorVersion() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the patch number of the stream
|
||||
*
|
||||
* \return The patch value
|
||||
*/
|
||||
virtual OmniPvdVersionType OMNI_PVD_CALL getPatch() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the context handle of the latest command, if it had one, else OMNI_PVD_INVALID_HANDLE
|
||||
*
|
||||
* \return The context handle of the latest command
|
||||
*/
|
||||
virtual OmniPvdContextHandle OMNI_PVD_CALL getContextHandle() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the object handle of the latest command, if it had one, else OMNI_PVD_INVALID_HANDLE
|
||||
*
|
||||
* \return The object handle of the latest command
|
||||
*/
|
||||
virtual OmniPvdObjectHandle OMNI_PVD_CALL getObjectHandle() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the class handle of the latest command, if it had one, else OMNI_PVD_INVALID_HANDLE
|
||||
*
|
||||
* \return The class handle of the latest command
|
||||
*/
|
||||
virtual OmniPvdClassHandle OMNI_PVD_CALL getClassHandle() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the base class handle of the latest command, if it had one, else OMNI_PVD_INVALID_HANDLE
|
||||
*
|
||||
* \return The base class handle of the latest command
|
||||
*/
|
||||
virtual OmniPvdClassHandle OMNI_PVD_CALL getBaseClassHandle() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the attribute handle of the latest command, if it had one, else OMNI_PVD_INVALID_HANDLE
|
||||
*
|
||||
* \return The attribute handle of the latest command
|
||||
*/
|
||||
virtual OmniPvdAttributeHandle OMNI_PVD_CALL getAttributeHandle() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the class name of the latest command, if it had one, else a null terminated string of length 0
|
||||
*
|
||||
* \return The string containing the class name
|
||||
*/
|
||||
virtual const char* OMNI_PVD_CALL getClassName() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the attribute name of the latest command, if it had one, else a null terminated string of length 0
|
||||
*
|
||||
* \return The string containing the attribute name
|
||||
*/
|
||||
virtual const char* OMNI_PVD_CALL getAttributeName() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the object name of the latest command, if it had one, else a null terminated string of length 0
|
||||
*
|
||||
* \return The string containing the object name
|
||||
*/
|
||||
virtual const char* OMNI_PVD_CALL getObjectName() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the attribute data pointer, if it had one, else returns 0
|
||||
*
|
||||
* \return The array containing the attribute data
|
||||
*/
|
||||
virtual const uint8_t* OMNI_PVD_CALL getAttributeDataPointer() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the attribute data type, the data type is undefined if the last command did not contain attribute data
|
||||
*
|
||||
* \return The attribute data type
|
||||
*/
|
||||
virtual OmniPvdDataType::Enum OMNI_PVD_CALL getAttributeDataType() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the attribute data length, the data length of the last command if it was defined, otherwise returns 0
|
||||
*
|
||||
* \return The attribute data length
|
||||
*/
|
||||
virtual uint32_t OMNI_PVD_CALL getAttributeDataLength() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the number of elements contained in the last set operation, if they were defined, otherwise returns 0
|
||||
*
|
||||
* \return The number of elements
|
||||
*/
|
||||
virtual uint32_t OMNI_PVD_CALL getAttributeNumberElements() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the numberclass handle of the attribute class, if it was defined, else returns OMNI_PVD_INVALID_HANDLE
|
||||
*
|
||||
* \return The attibute class handle
|
||||
*/
|
||||
virtual OmniPvdClassHandle OMNI_PVD_CALL getAttributeClassHandle() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the frame start value
|
||||
*
|
||||
* \return The frame ID value
|
||||
*/
|
||||
virtual uint64_t OMNI_PVD_CALL getFrameTimeStart() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the frame stop value
|
||||
*
|
||||
* \return The frame ID value
|
||||
*/
|
||||
virtual uint64_t OMNI_PVD_CALL getFrameTimeStop() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns data for the last message received.
|
||||
*
|
||||
* \param message A handle to the message string is returned.
|
||||
* \param file A handle to the string containing the file name the message originated from is returned.
|
||||
* \param line A handle to the line number in the file where the message originated from is returned.
|
||||
* \param type A handle to the message type is returned.
|
||||
* \param handle A handle to the Omni PVD class handle is returned.
|
||||
*/
|
||||
virtual bool OMNI_PVD_CALL getMessageData(const char*& message, const char*& file, uint32_t& line, uint32_t& type, OmniPvdClassHandle& handle) = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the class handle containing the enum values, if it was defined, else returns OMNI_PVD_INVALID_HANDLE
|
||||
*
|
||||
* \return The enum class handle
|
||||
*/
|
||||
virtual OmniPvdClassHandle OMNI_PVD_CALL getEnumClassHandle() = 0;
|
||||
|
||||
/**
|
||||
* \brief Returns the enum value for a specific flag, if it was defined, else returns 0
|
||||
*
|
||||
* \return The enum value
|
||||
*/
|
||||
virtual OmniPvdEnumValueType OMNI_PVD_CALL getEnumValue() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
77
engine/third_party/physx/pvdruntime/include/OmniPvdWriteStream.h
vendored
Normal file
77
engine/third_party/physx/pvdruntime/include/OmniPvdWriteStream.h
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_WRITE_STREAM_H
|
||||
#define OMNI_PVD_WRITE_STREAM_H
|
||||
|
||||
#include "OmniPvdDefines.h"
|
||||
|
||||
/**
|
||||
* \brief Used to abstract a memory write stream
|
||||
*
|
||||
* Allows to write bytes as well as open/close the stream.
|
||||
*/
|
||||
class OmniPvdWriteStream
|
||||
{
|
||||
public:
|
||||
virtual ~OmniPvdWriteStream()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Write n bytes to the shared memory buffer
|
||||
*
|
||||
* \param bytes pointer to the bytes to write
|
||||
* \param nbrBytes The requested number of bytes to write
|
||||
* \return The actual number of bytes written
|
||||
*/
|
||||
virtual uint64_t OMNI_PVD_CALL writeBytes(const uint8_t* bytes, uint64_t nbrBytes) = 0;
|
||||
|
||||
/**
|
||||
* \brief Flushes the writes
|
||||
*
|
||||
* \return The success of the operation
|
||||
*/
|
||||
virtual bool OMNI_PVD_CALL flush() = 0;
|
||||
|
||||
/**
|
||||
* \brief Opens the stream
|
||||
*
|
||||
* \return The success of the operation
|
||||
*/
|
||||
virtual bool OMNI_PVD_CALL openStream() = 0;
|
||||
|
||||
/**
|
||||
* \brief Closes the stream
|
||||
*
|
||||
* \return The success of the operation
|
||||
*/
|
||||
virtual bool OMNI_PVD_CALL closeStream() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
396
engine/third_party/physx/pvdruntime/include/OmniPvdWriter.h
vendored
Normal file
396
engine/third_party/physx/pvdruntime/include/OmniPvdWriter.h
vendored
Normal file
@@ -0,0 +1,396 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_WRITER_H
|
||||
#define OMNI_PVD_WRITER_H
|
||||
|
||||
#include "OmniPvdDefines.h"
|
||||
#include "OmniPvdWriteStream.h"
|
||||
|
||||
|
||||
/**
|
||||
\brief Flags which report the status of an OmniPvdWriter.
|
||||
*/
|
||||
struct OmniPvdWriterStatusFlag
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
/**
|
||||
* \brief Set if any attempt to write to the stream failed
|
||||
*
|
||||
* \see OmniPvdWriter.getStatus()
|
||||
*/
|
||||
eSTREAM_WRITE_FAILURE = (1<<0)
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Used to write debug information to an OmniPvdWriteStream
|
||||
*
|
||||
* Allows the registration of OmniPVD classes and attributes, in a similar fashion to an object oriented language. A registration returns a unique identifier or handle.
|
||||
*
|
||||
* Once classes and attributes have been registered, one can create for example object instances of a class and set the values of the attributes of a specific object.
|
||||
*
|
||||
* Objects can be grouped by context using the context handle. The context handle is a user-specified handle which is passed to the set functions and object creation and destruction functions.
|
||||
*
|
||||
* Each context can have its own notion of time. The current time of a context can be exported with calls to the startFrame and stopFrame functions.
|
||||
*/
|
||||
class OmniPvdWriter
|
||||
{
|
||||
public:
|
||||
virtual ~OmniPvdWriter()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Sets the log function to print the internal debug messages of the OmniPVD API
|
||||
*
|
||||
* \param logFunction The function pointer to receive the log messages
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL setLogFunction(OmniPvdLogFunction logFunction) = 0;
|
||||
|
||||
/**
|
||||
* \brief Sets the write stream to receive the API command stream
|
||||
*
|
||||
* \param writeStream The OmniPvdWriteStream to receive the stream of API calls/notifications
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL setWriteStream(OmniPvdWriteStream& writeStream) = 0;
|
||||
|
||||
/**
|
||||
* \brief Gets the pointer to the write stream
|
||||
*
|
||||
* \return A pointer to the write stream
|
||||
*/
|
||||
virtual OmniPvdWriteStream* OMNI_PVD_CALL getWriteStream() = 0;
|
||||
|
||||
/**
|
||||
* \brief Registers an OmniPVD class
|
||||
*
|
||||
* Returns a unique handle to a class, which can be used to register class attributes and express object lifetimes with the createObject and destroyObject functions. Class inheritance can be described by calling registerClass with a base class handle. Derived classes inherit the attributes of the parent classes.
|
||||
*
|
||||
* \param className The class name
|
||||
* \param baseClassHandle The handle to the base class. This handle is obtained by pre-registering the base class. Defaults to 0 which means the class has no parent class
|
||||
* \return A unique class handle for the registered class
|
||||
*
|
||||
* \see OmniPvdWriter::registerAttribute()
|
||||
* \see OmniPvdWriter::registerEnumValue()
|
||||
* \see OmniPvdWriter::registerFlagsAttribute()
|
||||
* \see OmniPvdWriter::registerClassAttribute()
|
||||
* \see OmniPvdWriter::registerUniqueListAttribute()
|
||||
* \see OmniPvdWriter::createObject()
|
||||
*/
|
||||
virtual OmniPvdClassHandle OMNI_PVD_CALL registerClass(const char* className, OmniPvdClassHandle baseClassHandle = 0) = 0;
|
||||
|
||||
/**
|
||||
* \brief Registers an enum name and corresponding value for a pre-registered class.
|
||||
*
|
||||
* Registering enums happens in two steps. First, registerClass() is called with the name of the enum. This returns a class handle, which is used in a second step for the enum value registration with registerEnumValue(). If an enum has multiple values, registerEnumValue() has to be called with the different values.
|
||||
*
|
||||
* Note that enums differ from usual classes because their attributes, the enum values, do not change over time and there is no need to call setAttribute().
|
||||
*
|
||||
* \param classHandle The handle from the registerClass() call
|
||||
* \param attributeName The name of the enum value
|
||||
* \param value The value of the enum value
|
||||
* \return A unique attribute handle for the registered enum value
|
||||
*
|
||||
* \see OmniPvdWriter::registerClass()
|
||||
*/
|
||||
virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerEnumValue(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdEnumValueType value) = 0;
|
||||
|
||||
/**
|
||||
* \brief Registers an attribute.
|
||||
*
|
||||
* The class handle is obtained from a previous call to registerClass(). After registering an attribute, one gets an attribute handle which can be used to set data values of an attribute with setAttribute(). All attributes are treated as arrays, even if the attribute has only a single data item. Set nbElements to 0 to indicate that the array has a variable length.
|
||||
*
|
||||
* \param classHandle The handle from the registerClass() call
|
||||
* \param attributeName The attribute name
|
||||
* \param attributeDataType The attribute data type
|
||||
* \param nbElements The number of elements in the array. Set this to 0 to indicate a variable length array
|
||||
* \return A unique attribute handle for the registered attribute
|
||||
*
|
||||
* \see OmniPvdWriter::registerClass()
|
||||
* \see OmniPvdWriter::setAttribute()
|
||||
*/
|
||||
virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdDataType::Enum attributeDataType, uint32_t nbElements) = 0;
|
||||
|
||||
/**
|
||||
* \brief Registers an attribute which is a flag.
|
||||
*
|
||||
* Use this function to indicate that a pre-registered class has a flag attribute, i.e., the attribute is a pre-registered enum.
|
||||
*
|
||||
* The returned attribute handle can be used in setAttribute() to set an object's flags.
|
||||
*
|
||||
* \param classHandle The handle from the registerClass() call of the class
|
||||
* \param attributeName The attribute name
|
||||
* \param enumClassHandle The handle from the registerClass() call of the enum
|
||||
* \return A unique attribute handle for the registered flags attribute
|
||||
*
|
||||
* \see OmniPvdWriter::registerClass()
|
||||
* \see OmniPvdWriter::setAttribute()
|
||||
*/
|
||||
virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerFlagsAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle enumClassHandle) = 0;
|
||||
|
||||
/**
|
||||
* \brief Registers an attribute which is a class.
|
||||
*
|
||||
* Use this function to indicate that a pre-registered class has an attribute which is a pre-registered class.
|
||||
*
|
||||
* The returned attribute handle can be used in setAttribute() to set an object's class attribute.
|
||||
*
|
||||
* \param classHandle The handle from the registerClass() call of the class
|
||||
* \param attributeName The attribute name
|
||||
* \param classAttributeHandle The handle from the registerClass() call of the class attribute
|
||||
* \return A unique handle for the registered class attribute
|
||||
*
|
||||
* \see OmniPvdWriter::registerClass()
|
||||
* \see OmniPvdWriter::setAttribute()
|
||||
*/
|
||||
virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerClassAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle classAttributeHandle) = 0;
|
||||
|
||||
/**
|
||||
* \brief Registers an attribute which can hold a list of unique items.
|
||||
*
|
||||
* The returned attribute handle can be used in calls to addToUniqueListAttribute() and removeFromUniqueListAttribute(), to add an item to and remove it from the list, respectively.
|
||||
*
|
||||
* \param classHandle The handle from the registerClass() call of the class
|
||||
* \param attributeName The attribute name
|
||||
* \param attributeDataType The data type of the items which will get added to the list attribute
|
||||
* \return A unique handle for the registered list attribute
|
||||
*
|
||||
* \see OmniPvdWriter::registerClass()
|
||||
* \see OmniPvdWriter::addToUniqueListAttribute()
|
||||
* \see OmniPvdWriter::removeFromUniqueListAttribute()
|
||||
*/
|
||||
virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerUniqueListAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdDataType::Enum attributeDataType) = 0;
|
||||
|
||||
/**
|
||||
* \brief Sets an attribute value.
|
||||
*
|
||||
* Since an attribute can be part of a nested construct of class attributes, the method
|
||||
* expects an array of attribute handles as input to uniquely identify the attribute.
|
||||
*
|
||||
* \param contextHandle The user-defined context handle for grouping objects
|
||||
* \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address
|
||||
* \param attributeHandles The attribute handles containing all class attribute handles of a nested class
|
||||
* construct. The last one has to be the handle from the registerUniqueListAttribute() call.
|
||||
* \param nbAttributeHandles The number of attribute handles provided in attributeHandles
|
||||
* \param data The pointer to the data of the element(s) to remove from the set
|
||||
* \param nbrBytes The number of bytes to be written
|
||||
*
|
||||
* \see OmniPvdWriter::registerAttribute()
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL setAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t *data, uint32_t nbrBytes) = 0;
|
||||
|
||||
/**
|
||||
* \brief Sets an attribute value.
|
||||
*
|
||||
* See other setAttribute method for details. This special version covers the case where the
|
||||
* attribute is not part of a class attribute construct.
|
||||
*
|
||||
* \param contextHandle The user-defined context handle for grouping objects
|
||||
* \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address
|
||||
* \param attributeHandle The handle from the registerAttribute() call
|
||||
* \param data The pointer to the data
|
||||
* \param nbrBytes The number of bytes to be written
|
||||
*
|
||||
* \see OmniPvdWriter::registerAttribute()
|
||||
*/
|
||||
inline void OMNI_PVD_CALL setAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, OmniPvdAttributeHandle attributeHandle, const uint8_t *data, uint32_t nbrBytes)
|
||||
{
|
||||
setAttribute(contextHandle, objectHandle, &attributeHandle, 1, data, nbrBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Adds an item to a unique list attribute.
|
||||
*
|
||||
* A unique list attribute is defined like a set in mathematics, where each element must be unique.
|
||||
*
|
||||
* Since an attribute can be part of a nested construct of class attributes, the method
|
||||
* expects an array of attribute handles as input to uniquely identify the attribute.
|
||||
*
|
||||
* \param contextHandle The user-defined context handle for grouping objects
|
||||
* \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address
|
||||
* \param attributeHandles The attribute handles containing all class attribute handles of a nested class
|
||||
* construct. The last one has to be the handle from the registerUniqueListAttribute() call.
|
||||
* \param nbAttributeHandles The number of attribute handles provided in attributeHandles
|
||||
* \param data The pointer to the data of the item to add to the list
|
||||
* \param nbrBytes The number of bytes to be written
|
||||
*
|
||||
* \see OmniPvdWriter::registerUniqueListAttribute()
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL addToUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes) = 0;
|
||||
|
||||
/**
|
||||
* \brief Adds an item to a unique list attribute.
|
||||
*
|
||||
* See other addToUniqueListAttribute method for details. This special version covers the case where the
|
||||
* attribute is not part of a class attribute construct.
|
||||
*
|
||||
* \param contextHandle The user-defined context handle for grouping objects
|
||||
* \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address
|
||||
* \param attributeHandle The handle from the registerUniqueListAttribute() call
|
||||
* \param data The pointer to the data of the item to add to the list
|
||||
* \param nbrBytes The number of bytes to be written
|
||||
*
|
||||
* \see OmniPvdWriter::registerUniqueListAttribute()
|
||||
*/
|
||||
inline void OMNI_PVD_CALL addToUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, OmniPvdAttributeHandle attributeHandle, const uint8_t* data, uint32_t nbrBytes)
|
||||
{
|
||||
addToUniqueListAttribute(contextHandle, objectHandle, &attributeHandle, 1, data, nbrBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Removes an item from a uniqe list attribute
|
||||
*
|
||||
* A uniqe list attribute is defined like a set in mathematics, where each element must be unique.
|
||||
*
|
||||
* Since an attribute can be part of a nested construct of class attributes, the method
|
||||
* expects an array of attribute handles as input to uniquely identify the attribute.
|
||||
*
|
||||
* \param contextHandle The user-defined context handle for grouping objects
|
||||
* \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address
|
||||
* \param attributeHandles The attribute handles containing all class attribute handles of a nested class
|
||||
* construct. The last one has to be the handle from the registerUniqueListAttribute() call.
|
||||
* \param nbAttributeHandles The number of attribute handles provided in attributeHandles
|
||||
* \param data The pointer to the data of the item to remove from the list
|
||||
* \param nbrBytes The number of bytes to be written
|
||||
*
|
||||
* \see OmniPvdWriter::registerUniqueListAttribute()
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL removeFromUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes) = 0;
|
||||
|
||||
/**
|
||||
* \brief Removes an item from a uniqe list attribute
|
||||
*
|
||||
* See other removeFromUniqueListAttribute method for details. This special version covers the case where the
|
||||
* attribute is not part of a class attribute construct.
|
||||
*
|
||||
* \param contextHandle The user-defined context handle for grouping objects
|
||||
* \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address
|
||||
* \param attributeHandle The handle from the registerUniqueListAttribute() call
|
||||
* \param data The pointer to the data of the item to remove from the list
|
||||
* \param nbrBytes The number of bytes to be written
|
||||
*
|
||||
* \see OmniPvdWriter::registerUniqueListAttribute()
|
||||
*/
|
||||
inline void OMNI_PVD_CALL removeFromUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, OmniPvdAttributeHandle attributeHandle, const uint8_t* data, uint32_t nbrBytes)
|
||||
{
|
||||
removeFromUniqueListAttribute(contextHandle, objectHandle, &attributeHandle, 1, data, nbrBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Creates an object creation event
|
||||
*
|
||||
* Indicates that an object is created. One can freely choose a context handle for grouping objects.
|
||||
*
|
||||
* The class handle is obtained from a registerClass() call. The object handle should be unique, but as it's not tracked by the OmniPVD API, it's important this is set to a valid handle such as the object's physical memory address.
|
||||
*
|
||||
* The object name can be freely choosen or not set.
|
||||
*
|
||||
* Create about object destruction event by calling destroyObject().
|
||||
*
|
||||
* \param contextHandle The user-defined context handle for grouping objects
|
||||
* \param classHandle The handle from the registerClass() call
|
||||
* \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address
|
||||
* \param objectName The user-defined name of the object. Can be the empty string
|
||||
*
|
||||
* \see OmniPvdWriter::registerClass()
|
||||
* \see OmniPvdWriter::destroyObject()
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL createObject(OmniPvdContextHandle contextHandle, OmniPvdClassHandle classHandle, OmniPvdObjectHandle objectHandle, const char* objectName) = 0;
|
||||
|
||||
/**
|
||||
* \brief Creates an object destruction event
|
||||
*
|
||||
* Use this to indicate that an object is destroyed. Use the same user-defined context and object handles as were used in the create object calls.
|
||||
*
|
||||
* \param contextHandle The user-defined context handle for grouping objects
|
||||
* \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address
|
||||
*
|
||||
* \see OmniPvdWriter::registerClass()
|
||||
* \see OmniPvdWriter::createObject()
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL destroyObject(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle) = 0;
|
||||
|
||||
/**
|
||||
* \brief Creates a frame start event
|
||||
*
|
||||
* Time or frames are counted separatly per user-defined context.
|
||||
*
|
||||
* \param contextHandle The user-defined context handle for grouping objects
|
||||
* \param timeStamp The timestamp of the frame start event
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL startFrame(OmniPvdContextHandle contextHandle, uint64_t timeStamp) = 0;
|
||||
|
||||
/**
|
||||
* \brief Creates a stop frame event
|
||||
*
|
||||
* Time is counted separately per user-defined context.
|
||||
*
|
||||
* \param contextHandle The user-defined context handle for grouping objects
|
||||
* \param timeStamp The timestamp of the frame stop event
|
||||
*/
|
||||
|
||||
virtual void OMNI_PVD_CALL stopFrame(OmniPvdContextHandle contextHandle, uint64_t timeStamp) = 0;
|
||||
|
||||
/**
|
||||
* \brief Record a message
|
||||
*
|
||||
* Record a message in the OVD stream. The file, line and type parameters can help locate
|
||||
* the source of the message when debugging.
|
||||
*
|
||||
* \param contextHandle The user-defined context handle for grouping objects
|
||||
* \param message A character string text message.
|
||||
* \param file A character string containing the name of the source file where the message originated from.
|
||||
* NULL is a valid value if a file name is not needed.
|
||||
* \param line The line number in the source file where the message originated from.
|
||||
* \param type An enumerated type describing the message type. If unneeded, any value can be set.
|
||||
* \param handle A handle to an Omni PVD enumerated type that contains all values for the previous type parameter.
|
||||
* Setting OMNI_PVD_INVALID_HANDLE will cause this parameter to be ignored.
|
||||
* See #registerEnumValue()
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL recordMessage(OmniPvdContextHandle contextHandle, const char* message, const char* file, uint32_t line, uint32_t type, OmniPvdClassHandle handle = OMNI_PVD_INVALID_HANDLE) = 0;
|
||||
|
||||
/**
|
||||
* @brief Gets the status of the writer
|
||||
*
|
||||
* \return The current status flags of the writer, held in a 32 bit unsigned integer with the flag bits defined by OmniPvdWriterStatusFlag
|
||||
*
|
||||
* \see OmniPvdWriterStatusFlag
|
||||
*/
|
||||
virtual uint32_t OMNI_PVD_CALL getStatus() = 0;
|
||||
|
||||
/**
|
||||
* \brief Clears or resets the status of the writer
|
||||
*
|
||||
*/
|
||||
virtual void OMNI_PVD_CALL clearStatus() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
40
engine/third_party/physx/pvdruntime/src/OmniPvdDefinesInternal.h
vendored
Normal file
40
engine/third_party/physx/pvdruntime/src/OmniPvdDefinesInternal.h
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_DEFINES_INTERNAL_H
|
||||
#define OMNI_PVD_DEFINES_INTERNAL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
// types used to store certain properties in the PVD data stream
|
||||
typedef uint8_t OmniPvdCommandStorageType;
|
||||
typedef uint16_t OmniPvdDataTypeStorageType;
|
||||
|
||||
|
||||
#endif
|
||||
144
engine/third_party/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.cpp
vendored
Normal file
144
engine/third_party/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.cpp
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#include "OmniPvdFileReadStreamImpl.h"
|
||||
|
||||
OmniPvdFileReadStreamImpl::OmniPvdFileReadStreamImpl()
|
||||
{
|
||||
mFileName = 0;
|
||||
resetFileParams();
|
||||
}
|
||||
|
||||
OmniPvdFileReadStreamImpl::~OmniPvdFileReadStreamImpl()
|
||||
{
|
||||
closeFile();
|
||||
delete[] mFileName;
|
||||
mFileName = 0;
|
||||
}
|
||||
|
||||
void OmniPvdFileReadStreamImpl::resetFileParams()
|
||||
{
|
||||
mFileOpenAttempted = false;
|
||||
mPFile = 0;
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdFileReadStreamImpl::setFileName(const char* fileName)
|
||||
{
|
||||
if (!fileName) return;
|
||||
int n = (int)strlen(fileName) + 1;
|
||||
if (n < 2) return;
|
||||
delete[] mFileName;
|
||||
mFileName = new char[n];
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
strcpy_s(mFileName, n, fileName);
|
||||
#else
|
||||
strcpy(mFileName, fileName);
|
||||
#endif
|
||||
mFileName[n - 1] = 0;
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdFileReadStreamImpl::openFile()
|
||||
{
|
||||
if (mFileOpenAttempted)
|
||||
{
|
||||
return (mPFile!=0);
|
||||
}
|
||||
if (!mFileName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
mPFile = 0;
|
||||
mFileOpenAttempted = true;
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
errno_t err = fopen_s(&mPFile, mFileName, "rb");
|
||||
if (err != 0)
|
||||
{
|
||||
mPFile = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fseek(mPFile, 0, SEEK_SET);
|
||||
}
|
||||
#else
|
||||
mPFile = fopen(mFileName, "rb");
|
||||
if (mPFile)
|
||||
{
|
||||
fseek(mPFile, 0, SEEK_SET);
|
||||
}
|
||||
#endif
|
||||
return (mPFile!=0);
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdFileReadStreamImpl::closeFile()
|
||||
{
|
||||
bool returnOK = true;
|
||||
if (mFileOpenAttempted && (mPFile!=0))
|
||||
{
|
||||
fclose(mPFile);
|
||||
mPFile = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnOK = false;
|
||||
}
|
||||
resetFileParams();
|
||||
return returnOK;
|
||||
}
|
||||
|
||||
uint64_t OMNI_PVD_CALL OmniPvdFileReadStreamImpl::readBytes(uint8_t* bytes, uint64_t nbrBytes)
|
||||
{
|
||||
size_t result = 0;
|
||||
if (mPFile!=0)
|
||||
{
|
||||
result = fread(bytes, 1, nbrBytes, mPFile);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
uint64_t OMNI_PVD_CALL OmniPvdFileReadStreamImpl::skipBytes(uint64_t nbrBytes)
|
||||
{
|
||||
if (mPFile==0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (fseek(mPFile, (long)nbrBytes, SEEK_CUR)==0)
|
||||
{
|
||||
return nbrBytes;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdFileReadStreamImpl::openStream()
|
||||
{
|
||||
return openFile();
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdFileReadStreamImpl::closeStream()
|
||||
{
|
||||
return closeFile();
|
||||
}
|
||||
56
engine/third_party/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.h
vendored
Normal file
56
engine/third_party/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.h
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_FILE_READ_STREAM_IMPL_H
|
||||
#define OMNI_PVD_FILE_READ_STREAM_IMPL_H
|
||||
|
||||
#include "OmniPvdFileReadStream.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
class OmniPvdFileReadStreamImpl : public OmniPvdFileReadStream
|
||||
{
|
||||
public:
|
||||
OmniPvdFileReadStreamImpl();
|
||||
~OmniPvdFileReadStreamImpl();
|
||||
void resetFileParams();
|
||||
void OMNI_PVD_CALL setFileName(const char *fileName);
|
||||
bool OMNI_PVD_CALL openFile();
|
||||
bool OMNI_PVD_CALL closeFile();
|
||||
uint64_t OMNI_PVD_CALL readBytes(uint8_t* bytes, uint64_t nbrBytes);
|
||||
uint64_t OMNI_PVD_CALL skipBytes(uint64_t nbrBytes);
|
||||
bool OMNI_PVD_CALL openStream();
|
||||
bool OMNI_PVD_CALL closeStream();
|
||||
|
||||
char* mFileName;
|
||||
bool mFileOpenAttempted;
|
||||
FILE* mPFile;
|
||||
};
|
||||
|
||||
#endif
|
||||
132
engine/third_party/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.cpp
vendored
Normal file
132
engine/third_party/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.cpp
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#include "OmniPvdFileWriteStreamImpl.h"
|
||||
|
||||
OmniPvdFileWriteStreamImpl::OmniPvdFileWriteStreamImpl()
|
||||
{
|
||||
mFileName = 0;
|
||||
resetFileParams();
|
||||
}
|
||||
|
||||
void OmniPvdFileWriteStreamImpl::resetFileParams()
|
||||
{
|
||||
mFileOpenAttempted = false;
|
||||
mPFile = 0;
|
||||
}
|
||||
|
||||
OmniPvdFileWriteStreamImpl::~OmniPvdFileWriteStreamImpl()
|
||||
{
|
||||
closeFile();
|
||||
delete[] mFileName;
|
||||
mFileName = 0;
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::setFileName(const char* fileName)
|
||||
{
|
||||
if (!fileName) return;
|
||||
int n = (int)strlen(fileName) + 1;
|
||||
if (n < 2) return;
|
||||
delete[] mFileName;
|
||||
mFileName = new char[n];
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
strcpy_s(mFileName, n, fileName);
|
||||
#else
|
||||
strcpy(mFileName, fileName);
|
||||
#endif
|
||||
mFileName[n - 1] = 0;
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::openFile()
|
||||
{
|
||||
if (mFileOpenAttempted)
|
||||
{
|
||||
return (mPFile!=0);
|
||||
}
|
||||
if (!mFileName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
mPFile = 0;
|
||||
mFileOpenAttempted = true;
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
errno_t err = fopen_s(&mPFile, mFileName, "wb");
|
||||
if (err != 0)
|
||||
{
|
||||
mPFile = 0;
|
||||
}
|
||||
#else
|
||||
mPFile = fopen(mFileName, "wb");
|
||||
#endif
|
||||
return (mPFile!=0);
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::closeFile()
|
||||
{
|
||||
bool returnOK = true;
|
||||
if (mFileOpenAttempted && (mPFile!=0))
|
||||
{
|
||||
fclose(mPFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
returnOK = false;
|
||||
}
|
||||
resetFileParams();
|
||||
return returnOK;
|
||||
}
|
||||
|
||||
uint64_t OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::writeBytes(const uint8_t *bytes, uint64_t nbrBytes)
|
||||
{
|
||||
size_t result = 0;
|
||||
if (mPFile!=0)
|
||||
{
|
||||
result = fwrite(bytes, 1, nbrBytes, mPFile);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::flush()
|
||||
{
|
||||
if (mPFile==0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return fflush(mPFile) != 0;
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::openStream()
|
||||
{
|
||||
return openFile();
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::closeStream()
|
||||
{
|
||||
return closeFile();
|
||||
}
|
||||
55
engine/third_party/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.h
vendored
Normal file
55
engine/third_party/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.h
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_FILE_WRITE_STREAM_IMPL_H
|
||||
#define OMNI_PVD_FILE_WRITE_STREAM_IMPL_H
|
||||
|
||||
#include "OmniPvdFileWriteStream.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
class OmniPvdFileWriteStreamImpl : public OmniPvdFileWriteStream {
|
||||
public:
|
||||
OmniPvdFileWriteStreamImpl();
|
||||
~OmniPvdFileWriteStreamImpl();
|
||||
void resetFileParams();
|
||||
void OMNI_PVD_CALL setFileName(const char *fileName);
|
||||
bool OMNI_PVD_CALL openFile();
|
||||
bool OMNI_PVD_CALL closeFile();
|
||||
uint64_t OMNI_PVD_CALL writeBytes(const uint8_t* bytes, uint64_t nbrBytes);
|
||||
bool OMNI_PVD_CALL flush();
|
||||
bool OMNI_PVD_CALL openStream();
|
||||
bool OMNI_PVD_CALL closeStream();
|
||||
|
||||
char *mFileName;
|
||||
FILE *mPFile;
|
||||
bool mFileOpenAttempted;
|
||||
};
|
||||
|
||||
#endif
|
||||
72
engine/third_party/physx/pvdruntime/src/OmniPvdHelpers.cpp
vendored
Normal file
72
engine/third_party/physx/pvdruntime/src/OmniPvdHelpers.cpp
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#include "OmniPvdHelpers.h"
|
||||
|
||||
uint8_t OmniPvdCompressInt(uint64_t handle, uint8_t *bytes) {
|
||||
uint8_t lastBitGroupIndex = 0;
|
||||
uint8_t shiftBits = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if ((handle >> shiftBits) & 0x7f) {
|
||||
lastBitGroupIndex = static_cast<uint8_t>(i);
|
||||
}
|
||||
shiftBits += 7;
|
||||
}
|
||||
shiftBits = 0;
|
||||
for (int i = 0; i <= lastBitGroupIndex; i++) {
|
||||
uint8_t currentBitGroup = (handle >> shiftBits) & 0x7f;
|
||||
if (i < lastBitGroupIndex) {
|
||||
currentBitGroup |= 0x80; // Set the continuation flag bit to true
|
||||
}
|
||||
bytes[i] = currentBitGroup;
|
||||
shiftBits += 7;
|
||||
}
|
||||
|
||||
return lastBitGroupIndex;
|
||||
}
|
||||
|
||||
uint64_t OmniPvdDeCompressInt(uint8_t *bytes, uint8_t maxBytes) {
|
||||
if (maxBytes > 8) {
|
||||
maxBytes = 8;
|
||||
}
|
||||
uint64_t decompressedInt = 0;
|
||||
uint8_t continueFlag = 1;
|
||||
uint8_t readBytes = 0;
|
||||
uint8_t shiftBits = 0;
|
||||
while (continueFlag && (readBytes < maxBytes)) {
|
||||
const uint8_t currentByte = *bytes;
|
||||
uint64_t decompressedBits = currentByte & 0x7f;
|
||||
continueFlag = currentByte & 0x80;
|
||||
decompressedInt |= (decompressedBits << shiftBits);
|
||||
shiftBits += 7;
|
||||
if (continueFlag) {
|
||||
bytes++;
|
||||
}
|
||||
}
|
||||
return decompressedInt;
|
||||
}
|
||||
37
engine/third_party/physx/pvdruntime/src/OmniPvdHelpers.h
vendored
Normal file
37
engine/third_party/physx/pvdruntime/src/OmniPvdHelpers.h
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_HELPERS_H
|
||||
#define OMNI_PVD_HELPERS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern uint8_t OmniPvdCompressInt(uint64_t handle, uint8_t *bytes);
|
||||
extern uint64_t OmniPvdDeCompressInt(uint8_t *bytes, uint8_t maxBytes);
|
||||
|
||||
#endif
|
||||
89
engine/third_party/physx/pvdruntime/src/OmniPvdLibraryFunctionsImpl.cpp
vendored
Normal file
89
engine/third_party/physx/pvdruntime/src/OmniPvdLibraryFunctionsImpl.cpp
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#include "OmniPvdLibraryFunctions.h"
|
||||
#include "OmniPvdReaderImpl.h"
|
||||
#include "OmniPvdWriterImpl.h"
|
||||
#include "OmniPvdFileReadStreamImpl.h"
|
||||
#include "OmniPvdFileWriteStreamImpl.h"
|
||||
#include "OmniPvdMemoryStreamImpl.h"
|
||||
|
||||
OMNI_PVD_EXPORT OmniPvdReader* OMNI_PVD_CALL createOmniPvdReader()
|
||||
{
|
||||
return new OmniPvdReaderImpl();
|
||||
}
|
||||
|
||||
OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdReader(OmniPvdReader& reader)
|
||||
{
|
||||
OmniPvdReaderImpl* impl = (OmniPvdReaderImpl*)(&reader);
|
||||
delete impl;
|
||||
}
|
||||
|
||||
OMNI_PVD_EXPORT OmniPvdWriter* OMNI_PVD_CALL createOmniPvdWriter()
|
||||
{
|
||||
return new OmniPvdWriterImpl();
|
||||
}
|
||||
|
||||
OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdWriter(OmniPvdWriter& writer)
|
||||
{
|
||||
OmniPvdWriterImpl* impl = (OmniPvdWriterImpl*)(&writer);
|
||||
delete impl;
|
||||
}
|
||||
|
||||
OMNI_PVD_EXPORT OmniPvdFileReadStream* OMNI_PVD_CALL createOmniPvdFileReadStream()
|
||||
{
|
||||
return new OmniPvdFileReadStreamImpl();
|
||||
}
|
||||
|
||||
OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdFileReadStream(OmniPvdFileReadStream& readStream)
|
||||
{
|
||||
OmniPvdFileReadStreamImpl* impl = (OmniPvdFileReadStreamImpl*)(&readStream);
|
||||
delete impl;
|
||||
}
|
||||
|
||||
OMNI_PVD_EXPORT OmniPvdFileWriteStream* OMNI_PVD_CALL createOmniPvdFileWriteStream()
|
||||
{
|
||||
return new OmniPvdFileWriteStreamImpl();
|
||||
}
|
||||
|
||||
OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdFileWriteStream(OmniPvdFileWriteStream& writeStream)
|
||||
{
|
||||
OmniPvdFileWriteStreamImpl* impl = (OmniPvdFileWriteStreamImpl*)(&writeStream);
|
||||
delete impl;
|
||||
}
|
||||
|
||||
OMNI_PVD_EXPORT OmniPvdMemoryStream* OMNI_PVD_CALL createOmniPvdMemoryStream()
|
||||
{
|
||||
return new OmniPvdMemoryStreamImpl();
|
||||
}
|
||||
|
||||
OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdMemoryStream(OmniPvdMemoryStream& memoryStream)
|
||||
{
|
||||
OmniPvdMemoryStreamImpl* impl = (OmniPvdMemoryStreamImpl*)(&memoryStream);
|
||||
delete impl;
|
||||
}
|
||||
57
engine/third_party/physx/pvdruntime/src/OmniPvdLog.cpp
vendored
Normal file
57
engine/third_party/physx/pvdruntime/src/OmniPvdLog.cpp
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#include "OmniPvdLog.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
OmniPvdLog::OmniPvdLog()
|
||||
{
|
||||
mLogFunction = 0;
|
||||
}
|
||||
|
||||
OmniPvdLog::~OmniPvdLog()
|
||||
{
|
||||
}
|
||||
|
||||
void OmniPvdLog::setLogFunction(OmniPvdLogFunction logFunction)
|
||||
{
|
||||
mLogFunction = logFunction;
|
||||
}
|
||||
|
||||
void OmniPvdLog::outputLine(const char* fmt, ...)
|
||||
{
|
||||
if (!mLogFunction) return;
|
||||
char logLineBuff[2048];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsprintf(logLineBuff, fmt, args);
|
||||
va_end(args);
|
||||
mLogFunction(logLineBuff);
|
||||
}
|
||||
43
engine/third_party/physx/pvdruntime/src/OmniPvdLog.h
vendored
Normal file
43
engine/third_party/physx/pvdruntime/src/OmniPvdLog.h
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_LOG_H
|
||||
#define OMNI_PVD_LOG_H
|
||||
|
||||
#include "OmniPvdDefines.h"
|
||||
|
||||
class OmniPvdLog {
|
||||
public:
|
||||
OmniPvdLog();
|
||||
~OmniPvdLog();
|
||||
void setLogFunction(OmniPvdLogFunction logFunction);
|
||||
void outputLine(const char* fmt, ...);
|
||||
OmniPvdLogFunction mLogFunction;
|
||||
};
|
||||
|
||||
#endif
|
||||
58
engine/third_party/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.cpp
vendored
Normal file
58
engine/third_party/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.cpp
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#include "OmniPvdMemoryStreamImpl.h"
|
||||
#include "OmniPvdMemoryReadStreamImpl.h"
|
||||
|
||||
OmniPvdMemoryReadStreamImpl::OmniPvdMemoryReadStreamImpl()
|
||||
{
|
||||
}
|
||||
|
||||
OmniPvdMemoryReadStreamImpl::~OmniPvdMemoryReadStreamImpl()
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t OMNI_PVD_CALL OmniPvdMemoryReadStreamImpl::readBytes(uint8_t* destination, uint64_t nbrBytes)
|
||||
{
|
||||
return mMemoryStream->readBytes(destination, nbrBytes);
|
||||
}
|
||||
|
||||
uint64_t OMNI_PVD_CALL OmniPvdMemoryReadStreamImpl::skipBytes(uint64_t nbrBytes)
|
||||
{
|
||||
return mMemoryStream->skipBytes(nbrBytes);
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdMemoryReadStreamImpl::openStream()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdMemoryReadStreamImpl::closeStream()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
50
engine/third_party/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.h
vendored
Normal file
50
engine/third_party/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.h
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_MEMORY_READ_STREAM_IMPL_H
|
||||
#define OMNI_PVD_MEMORY_READ_STREAM_IMPL_H
|
||||
|
||||
#include "OmniPvdReadStream.h"
|
||||
|
||||
class OmniPvdMemoryStreamImpl;
|
||||
|
||||
class OmniPvdMemoryReadStreamImpl : public OmniPvdReadStream
|
||||
{
|
||||
public:
|
||||
OmniPvdMemoryReadStreamImpl();
|
||||
~OmniPvdMemoryReadStreamImpl();
|
||||
|
||||
uint64_t OMNI_PVD_CALL readBytes(uint8_t* destination, uint64_t nbrBytes);
|
||||
uint64_t OMNI_PVD_CALL skipBytes(uint64_t nbrBytes);
|
||||
bool OMNI_PVD_CALL openStream();
|
||||
bool OMNI_PVD_CALL closeStream();
|
||||
|
||||
OmniPvdMemoryStreamImpl* mMemoryStream;
|
||||
};
|
||||
|
||||
#endif
|
||||
202
engine/third_party/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.cpp
vendored
Normal file
202
engine/third_party/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.cpp
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#include "OmniPvdMemoryStreamImpl.h"
|
||||
#include "OmniPvdMemoryReadStreamImpl.h"
|
||||
#include "OmniPvdMemoryWriteStreamImpl.h"
|
||||
#include <string.h>
|
||||
|
||||
OmniPvdMemoryStreamImpl::OmniPvdMemoryStreamImpl()
|
||||
{
|
||||
mReadStream = 0;
|
||||
mWriteStream = 0;
|
||||
|
||||
mBuffer = 0;
|
||||
mBufferLength = 0;
|
||||
mWrittenBytes = 0;
|
||||
mWritePosition = 0;
|
||||
mReadPosition = 0;
|
||||
|
||||
mReadStream = new OmniPvdMemoryReadStreamImpl();
|
||||
mReadStream->mMemoryStream = this;
|
||||
|
||||
mWriteStream = new OmniPvdMemoryWriteStreamImpl();
|
||||
mWriteStream->mMemoryStream = this;
|
||||
}
|
||||
|
||||
OmniPvdMemoryStreamImpl::~OmniPvdMemoryStreamImpl()
|
||||
{
|
||||
delete[] mBuffer;
|
||||
delete mReadStream;
|
||||
delete mWriteStream;
|
||||
}
|
||||
|
||||
OmniPvdReadStream* OMNI_PVD_CALL OmniPvdMemoryStreamImpl::getReadStream()
|
||||
{
|
||||
return mReadStream;
|
||||
}
|
||||
|
||||
OmniPvdWriteStream* OMNI_PVD_CALL OmniPvdMemoryStreamImpl::getWriteStream()
|
||||
{
|
||||
return mWriteStream;
|
||||
}
|
||||
|
||||
uint64_t OMNI_PVD_CALL OmniPvdMemoryStreamImpl::setBufferSize(uint64_t bufferLength)
|
||||
{
|
||||
if (bufferLength < mBufferLength)
|
||||
{
|
||||
return mBufferLength;
|
||||
}
|
||||
delete[] mBuffer;
|
||||
mBuffer = new uint8_t[bufferLength];
|
||||
mBufferLength = bufferLength;
|
||||
mWrittenBytes = 0;
|
||||
mWritePosition = 0;
|
||||
mReadPosition = 0;
|
||||
return bufferLength;
|
||||
}
|
||||
|
||||
uint64_t OMNI_PVD_CALL OmniPvdMemoryStreamImpl::readBytes(uint8_t* destination, uint64_t nbrBytes)
|
||||
{
|
||||
if (mWrittenBytes < 1) return 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Limit the number of bytes requested to requestedReadBytes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
uint64_t requestedReadBytes = nbrBytes;
|
||||
if (requestedReadBytes > mBufferLength)
|
||||
{
|
||||
requestedReadBytes = mBufferLength;
|
||||
}
|
||||
if (requestedReadBytes > mWrittenBytes)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Separate the reading of bytes into two operations:
|
||||
// tail bytes : bytes from mReadPosition until maximum the end of the buffer
|
||||
// head bytes : bytes from start of the buffer until maximum the mReadPosition-1
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Tail bytes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
uint64_t tailBytes = mBufferLength - mReadPosition;
|
||||
if (tailBytes > requestedReadBytes)
|
||||
{
|
||||
tailBytes = requestedReadBytes;
|
||||
}
|
||||
if (destination)
|
||||
{
|
||||
memcpy(destination, mBuffer + mReadPosition, tailBytes);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Head bytes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
uint64_t headBytes = requestedReadBytes - tailBytes;
|
||||
if (destination)
|
||||
{
|
||||
memcpy(destination + tailBytes, mBuffer, headBytes);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Update the internal parameters : mReadPosition and mWrittenBytes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
mReadPosition += requestedReadBytes;
|
||||
if (mReadPosition >= mBufferLength)
|
||||
{
|
||||
mReadPosition -= mBufferLength;
|
||||
}
|
||||
mWrittenBytes -= requestedReadBytes;
|
||||
return requestedReadBytes;
|
||||
}
|
||||
|
||||
uint64_t OmniPvdMemoryStreamImpl::skipBytes(uint64_t nbrBytes)
|
||||
{
|
||||
return readBytes(0, nbrBytes);
|
||||
}
|
||||
|
||||
uint64_t OmniPvdMemoryStreamImpl::writeBytes(const uint8_t* source, uint64_t nbrBytes)
|
||||
{
|
||||
if (mWrittenBytes >= mBufferLength)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Limit the number of bytes requested to requestedWriteBytes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
uint64_t requestedWriteBytes = nbrBytes;
|
||||
if (requestedWriteBytes > mBufferLength)
|
||||
{
|
||||
requestedWriteBytes = mBufferLength;
|
||||
}
|
||||
uint64_t writeBytesLeft = mBufferLength - mWrittenBytes;
|
||||
if (requestedWriteBytes > writeBytesLeft)
|
||||
{
|
||||
return 0;
|
||||
//requestedWriteBytes = writeBytesLeft;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Tail bytes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
uint64_t tailBytes = mBufferLength - mWritePosition;
|
||||
if (tailBytes > requestedWriteBytes)
|
||||
{
|
||||
tailBytes = requestedWriteBytes;
|
||||
}
|
||||
if (source)
|
||||
{
|
||||
memcpy(mBuffer + mWritePosition, source, tailBytes);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Head bytes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
uint64_t headBytes = requestedWriteBytes - tailBytes;
|
||||
if (source)
|
||||
{
|
||||
memcpy(mBuffer, source + tailBytes, headBytes);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Update the internal parameters : mReadPosition and mWrittenBytes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
mWritePosition += requestedWriteBytes;
|
||||
if (mWritePosition >= mBufferLength)
|
||||
{
|
||||
mWritePosition -= mBufferLength;
|
||||
}
|
||||
mWrittenBytes += requestedWriteBytes;
|
||||
return requestedWriteBytes;
|
||||
}
|
||||
|
||||
bool OmniPvdMemoryStreamImpl::flush()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
75
engine/third_party/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.h
vendored
Normal file
75
engine/third_party/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.h
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_MEMORY_STREAM_IMPL_H
|
||||
#define OMNI_PVD_MEMORY_STREAM_IMPL_H
|
||||
|
||||
#include "OmniPvdMemoryStream.h"
|
||||
|
||||
class OmniPvdMemoryReadStreamImpl;
|
||||
class OmniPvdMemoryWriteStreamImpl;
|
||||
|
||||
class OmniPvdMemoryStreamImpl : public OmniPvdMemoryStream
|
||||
{
|
||||
public:
|
||||
OmniPvdMemoryStreamImpl();
|
||||
~OmniPvdMemoryStreamImpl();
|
||||
|
||||
OmniPvdReadStream* OMNI_PVD_CALL getReadStream();
|
||||
OmniPvdWriteStream* OMNI_PVD_CALL getWriteStream();
|
||||
uint64_t OMNI_PVD_CALL setBufferSize(uint64_t bufferLength);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Read part
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
uint64_t readBytes(uint8_t* destination, uint64_t nbrBytes);
|
||||
uint64_t skipBytes(uint64_t nbrBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Write part
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
uint64_t writeBytes(const uint8_t* source, uint64_t nbrBytes);
|
||||
bool flush();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Read/write streams
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
OmniPvdMemoryReadStreamImpl *mReadStream;
|
||||
OmniPvdMemoryWriteStreamImpl *mWriteStream;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Round robin buffer
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
uint8_t *mBuffer;
|
||||
uint64_t mBufferLength;
|
||||
uint64_t mWrittenBytes;
|
||||
uint64_t mWritePosition;
|
||||
uint64_t mReadPosition;
|
||||
};
|
||||
|
||||
#endif
|
||||
58
engine/third_party/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.cpp
vendored
Normal file
58
engine/third_party/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.cpp
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#include "OmniPvdMemoryStreamImpl.h"
|
||||
#include "OmniPvdMemoryWriteStreamImpl.h"
|
||||
|
||||
OmniPvdMemoryWriteStreamImpl::OmniPvdMemoryWriteStreamImpl()
|
||||
{
|
||||
}
|
||||
|
||||
OmniPvdMemoryWriteStreamImpl::~OmniPvdMemoryWriteStreamImpl()
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t OMNI_PVD_CALL OmniPvdMemoryWriteStreamImpl::writeBytes(const uint8_t* source, uint64_t nbrBytes)
|
||||
{
|
||||
return mMemoryStream->writeBytes(source, nbrBytes);
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdMemoryWriteStreamImpl::flush()
|
||||
{
|
||||
return mMemoryStream->flush();
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdMemoryWriteStreamImpl::openStream()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdMemoryWriteStreamImpl::closeStream()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
49
engine/third_party/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.h
vendored
Normal file
49
engine/third_party/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.h
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_MEMORY_WRITE_STREAM_IMPL_H
|
||||
#define OMNI_PVD_MEMORY_WRITE_STREAM_IMPL_H
|
||||
|
||||
#include "OmniPvdWriteStream.h"
|
||||
|
||||
class OmniPvdMemoryStreamImpl;
|
||||
|
||||
class OmniPvdMemoryWriteStreamImpl : public OmniPvdWriteStream
|
||||
{
|
||||
public:
|
||||
OmniPvdMemoryWriteStreamImpl();
|
||||
~OmniPvdMemoryWriteStreamImpl();
|
||||
uint64_t OMNI_PVD_CALL writeBytes(const uint8_t* source, uint64_t nbrBytes);
|
||||
bool OMNI_PVD_CALL flush();
|
||||
bool OMNI_PVD_CALL openStream();
|
||||
bool OMNI_PVD_CALL closeStream();
|
||||
|
||||
OmniPvdMemoryStreamImpl *mMemoryStream;
|
||||
};
|
||||
|
||||
#endif
|
||||
572
engine/third_party/physx/pvdruntime/src/OmniPvdReaderImpl.cpp
vendored
Normal file
572
engine/third_party/physx/pvdruntime/src/OmniPvdReaderImpl.cpp
vendored
Normal file
@@ -0,0 +1,572 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#include "OmniPvdDefinesInternal.h"
|
||||
#include "OmniPvdReaderImpl.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
|
||||
OmniPvdReaderImpl::OmniPvdReaderImpl()
|
||||
{
|
||||
mMajorVersion = OMNI_PVD_VERSION_MAJOR;
|
||||
mMinorVersion = OMNI_PVD_VERSION_MINOR;
|
||||
mPatch = OMNI_PVD_VERSION_PATCH;
|
||||
mDataBuffer = 0;
|
||||
mDataBuffAllocatedLen = 0;
|
||||
mCmdAttributeDataPtr = 0;
|
||||
mIsReadingStarted = false;
|
||||
mReadBaseClassHandle = 1;
|
||||
}
|
||||
|
||||
OmniPvdReaderImpl::~OmniPvdReaderImpl()
|
||||
{
|
||||
mCmdAttributeDataPtr = 0;
|
||||
delete[] mDataBuffer;
|
||||
mDataBuffer = 0;
|
||||
mDataBuffAllocatedLen = 0;
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdReaderImpl::setLogFunction(OmniPvdLogFunction logFunction)
|
||||
{
|
||||
mLog.setLogFunction(logFunction);
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdReaderImpl::setReadStream(OmniPvdReadStream& stream)
|
||||
{
|
||||
mStream = &stream;
|
||||
mStream->openStream();
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdReaderImpl::startReading(OmniPvdVersionType& majorVersion, OmniPvdVersionType& minorVersion, OmniPvdVersionType& patch)
|
||||
{
|
||||
if (mIsReadingStarted)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (mStream)
|
||||
{
|
||||
mStream->readBytes((uint8_t*)&majorVersion, sizeof(OmniPvdVersionType));
|
||||
mStream->readBytes((uint8_t*)&minorVersion, sizeof(OmniPvdVersionType));
|
||||
mStream->readBytes((uint8_t*)&patch, sizeof(OmniPvdVersionType));
|
||||
|
||||
mCmdMajorVersion = majorVersion;
|
||||
mCmdMinorVersion = minorVersion;
|
||||
mCmdPatch = patch;
|
||||
|
||||
if ((mCmdMajorVersion == 0) && (mCmdMinorVersion < 3))
|
||||
{
|
||||
mCmdBaseClassHandle = 0;
|
||||
mReadBaseClassHandle = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCmdBaseClassHandle = 0;
|
||||
mReadBaseClassHandle = 1;
|
||||
}
|
||||
|
||||
mLog.outputLine("OmniPvdRuntimeReaderImpl::startReading majorVersion(%lu), minorVersion(%lu), patch(%lu)", static_cast<unsigned long>(majorVersion), static_cast<unsigned long>(minorVersion), static_cast<unsigned long>(patch));
|
||||
if (majorVersion > mMajorVersion)
|
||||
{
|
||||
mLog.outputLine("[parser] major version too new\n");
|
||||
return false;
|
||||
}
|
||||
else if (majorVersion == mMajorVersion)
|
||||
{
|
||||
if (minorVersion > mMinorVersion)
|
||||
{
|
||||
mLog.outputLine("[parser] minor version too new\n");
|
||||
return false;
|
||||
}
|
||||
else if (minorVersion == mMinorVersion)
|
||||
{
|
||||
if (patch > mPatch)
|
||||
{
|
||||
mLog.outputLine("[parser] patch too new\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
mIsReadingStarted = true;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static OmniPvdDataType::Enum readDataType(OmniPvdReadStream& stream)
|
||||
{
|
||||
OmniPvdDataTypeStorageType dataType;
|
||||
stream.readBytes((uint8_t*)&dataType, sizeof(OmniPvdDataTypeStorageType));
|
||||
return static_cast<OmniPvdDataType::Enum>(dataType);
|
||||
}
|
||||
|
||||
bool OmniPvdReaderImpl::readStringFromStream(char* string, uint16_t& stringLength)
|
||||
{
|
||||
mStream->readBytes((uint8_t*)&stringLength, sizeof(uint16_t));
|
||||
|
||||
if (stringLength < OMNI_PVD_MAX_STRING_LENGTH)
|
||||
{
|
||||
mStream->readBytes((uint8_t*)string, stringLength);
|
||||
string[stringLength] = 0; // trailing zero
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t readBytes = OMNI_PVD_MAX_STRING_LENGTH - 1;
|
||||
|
||||
mStream->readBytes((uint8_t*)string, readBytes);
|
||||
string[readBytes] = 0; // trailing zero
|
||||
mStream->skipBytes(stringLength - readBytes);
|
||||
|
||||
mLog.outputLine("[parser] ERROR: string name %s... exceeds max length of %d\n", string, OMNI_PVD_MAX_STRING_LENGTH);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
OmniPvdCommand::Enum OMNI_PVD_CALL OmniPvdReaderImpl::getNextCommand()
|
||||
{
|
||||
OmniPvdCommand::Enum cmdType = OmniPvdCommand::eINVALID;
|
||||
resetCommandParams();
|
||||
if (!mIsReadingStarted)
|
||||
{
|
||||
if (!startReading(mCmdMajorVersion, mCmdMinorVersion, mCmdPatch))
|
||||
{
|
||||
return cmdType;
|
||||
}
|
||||
}
|
||||
if (mStream) {
|
||||
OmniPvdCommandStorageType command;
|
||||
if (mStream->readBytes(&command, sizeof(OmniPvdCommandStorageType)))
|
||||
{
|
||||
mCmdMessageParsed = false;
|
||||
|
||||
switch (command) {
|
||||
case OmniPvdCommand::eREGISTER_CLASS:
|
||||
{
|
||||
cmdType = OmniPvdCommand::eREGISTER_CLASS;
|
||||
mStream->readBytes((uint8_t*)&mCmdClassHandle, sizeof(OmniPvdClassHandle));
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Skip reading the base class if the stream is older or equal to (0,2,x)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if (mReadBaseClassHandle)
|
||||
{
|
||||
mStream->readBytes((uint8_t*)&mCmdBaseClassHandle, sizeof(OmniPvdClassHandle));
|
||||
}
|
||||
|
||||
readStringFromStream(mCmdClassName, mCmdClassNameLen);
|
||||
mLog.outputLine("[parser] register class (handle: %d, name: %s)\n", mCmdClassHandle, mCmdClassName);
|
||||
}
|
||||
break;
|
||||
case OmniPvdCommand::eREGISTER_ATTRIBUTE:
|
||||
{
|
||||
cmdType = OmniPvdCommand::eREGISTER_ATTRIBUTE;
|
||||
mStream->readBytes((uint8_t*)&mCmdClassHandle, sizeof(OmniPvdClassHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle));
|
||||
mCmdAttributeDataType = readDataType(*mStream);
|
||||
if (mCmdAttributeDataType == OmniPvdDataType::eENUM_VALUE)
|
||||
{
|
||||
mStream->readBytes((uint8_t*)&mCmdEnumValue, sizeof(OmniPvdEnumValueType));
|
||||
}
|
||||
else if (mCmdAttributeDataType == OmniPvdDataType::eFLAGS_WORD)
|
||||
{
|
||||
mStream->readBytes((uint8_t*)&mCmdEnumClassHandle, sizeof(OmniPvdClassHandle));
|
||||
}
|
||||
else
|
||||
{
|
||||
mCmdEnumValue = 0;
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeNbElements, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
readStringFromStream(mCmdAttributeName, mCmdAttributeNameLen);
|
||||
mLog.outputLine("[parser] register attribute (classHandle: %d, attributeHandle: %d, attributeDataType: %d, nrFields: %d, name: %s)\n", mCmdClassHandle, mCmdAttributeHandle, mCmdAttributeDataType, mCmdAttributeNbElements, mCmdAttributeName);
|
||||
}
|
||||
break;
|
||||
case OmniPvdCommand::eREGISTER_CLASS_ATTRIBUTE:
|
||||
{
|
||||
cmdType = OmniPvdCommand::eREGISTER_CLASS_ATTRIBUTE;
|
||||
mStream->readBytes((uint8_t*)&mCmdClassHandle, sizeof(OmniPvdClassHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeClassHandle, sizeof(OmniPvdClassHandle));
|
||||
|
||||
readStringFromStream(mCmdAttributeName, mCmdAttributeNameLen);
|
||||
mLog.outputLine("[parser] register class attribute (classHandle: %d, attributeHandle: %d, attribute classAttributeHandle: %d, name: %s)\n", mCmdClassHandle, mCmdAttributeHandle, mCmdAttributeClassHandle, mCmdAttributeName);
|
||||
}
|
||||
break;
|
||||
case OmniPvdCommand::eREGISTER_UNIQUE_LIST_ATTRIBUTE:
|
||||
{
|
||||
cmdType = OmniPvdCommand::eREGISTER_UNIQUE_LIST_ATTRIBUTE;
|
||||
mStream->readBytes((uint8_t*)&mCmdClassHandle, sizeof(OmniPvdClassHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle));
|
||||
mCmdAttributeDataType = readDataType(*mStream);
|
||||
|
||||
readStringFromStream(mCmdAttributeName, mCmdAttributeNameLen);
|
||||
mLog.outputLine("[parser] register attributeSet (classHandle: %d, attributeHandle: %d, attributeDataType: %d, name: %s)\n", mCmdClassHandle, mCmdAttributeHandle, mCmdAttributeDataType, mCmdAttributeName);
|
||||
}
|
||||
break;
|
||||
case OmniPvdCommand::eSET_ATTRIBUTE:
|
||||
{
|
||||
cmdType = OmniPvdCommand::eSET_ATTRIBUTE;
|
||||
mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeHandleDepth, sizeof(uint8_t));
|
||||
uint32_t* attributeHandleStack = mCmdAttributeHandleStack;
|
||||
for (int i = 0; i < mCmdAttributeHandleDepth; i++) {
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle));
|
||||
attributeHandleStack++;
|
||||
}
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeDataLen, sizeof(uint32_t));
|
||||
readLongDataFromStream(mCmdAttributeDataLen);
|
||||
mLog.outputLine("[parser] set attribute (contextHandle:%d, objectHandle: %d, attributeHandle: %d, dataLen: %d)\n", mCmdContextHandle, mCmdObjectHandle, mCmdAttributeHandle, mCmdAttributeDataLen);
|
||||
}
|
||||
break;
|
||||
case OmniPvdCommand::eADD_TO_UNIQUE_LIST_ATTRIBUTE:
|
||||
{
|
||||
cmdType = OmniPvdCommand::eADD_TO_UNIQUE_LIST_ATTRIBUTE;
|
||||
mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeHandleDepth, sizeof(uint8_t));
|
||||
uint32_t* attributeHandleStack = mCmdAttributeHandleStack;
|
||||
for (int i = 0; i < mCmdAttributeHandleDepth; i++) {
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle));
|
||||
attributeHandleStack++;
|
||||
}
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeDataLen, sizeof(uint32_t));
|
||||
readLongDataFromStream(mCmdAttributeDataLen);
|
||||
mLog.outputLine("[parser] add to attributeSet (contextHandle:%d, objectHandle: %d, attributeHandle: %d, dataLen: %d)\n", mCmdContextHandle, mCmdObjectHandle, mCmdAttributeHandle, mCmdAttributeDataLen);
|
||||
}
|
||||
break;
|
||||
case OmniPvdCommand::eREMOVE_FROM_UNIQUE_LIST_ATTRIBUTE:
|
||||
{
|
||||
cmdType = OmniPvdCommand::eREMOVE_FROM_UNIQUE_LIST_ATTRIBUTE;
|
||||
mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeHandleDepth, sizeof(uint8_t));
|
||||
uint32_t* attributeHandleStack = mCmdAttributeHandleStack;
|
||||
for (int i = 0; i < mCmdAttributeHandleDepth; i++) {
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle));
|
||||
attributeHandleStack++;
|
||||
}
|
||||
mStream->readBytes((uint8_t*)&mCmdAttributeDataLen, sizeof(uint32_t));
|
||||
readLongDataFromStream(mCmdAttributeDataLen);
|
||||
mLog.outputLine("[parser] remove from attributeSet (contextHandle:%d, objectHandle: %d, attributeHandle: %d, dataLen: %d)\n", mCmdContextHandle, mCmdObjectHandle, mCmdAttributeHandle, mCmdAttributeDataLen);
|
||||
}
|
||||
break;
|
||||
case OmniPvdCommand::eCREATE_OBJECT:
|
||||
{
|
||||
cmdType = OmniPvdCommand::eCREATE_OBJECT;
|
||||
mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdClassHandle, sizeof(OmniPvdClassHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle));
|
||||
|
||||
readStringFromStream(mCmdObjectName, mCmdObjectNameLen);
|
||||
mLog.outputLine("[parser] create object (contextHandle: %d, classHandle: %d, objectHandle: %d, name: %s)\n", mCmdContextHandle, mCmdClassHandle, mCmdObjectHandle, mCmdObjectName);
|
||||
}
|
||||
break;
|
||||
case OmniPvdCommand::eDESTROY_OBJECT:
|
||||
{
|
||||
cmdType = OmniPvdCommand::eDESTROY_OBJECT;
|
||||
mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle));
|
||||
mLog.outputLine("[parser] destroy object (contextHandle: %d, objectHandle: %d)\n", mCmdContextHandle, mCmdObjectHandle);
|
||||
}
|
||||
break;
|
||||
case OmniPvdCommand::eSTART_FRAME:
|
||||
{
|
||||
cmdType = OmniPvdCommand::eSTART_FRAME;
|
||||
mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdFrameTimeStart, sizeof(uint64_t));
|
||||
mLog.outputLine("[parser] start frame (contextHandle: %d, timeStamp: %d)\n", mCmdContextHandle, mCmdFrameTimeStart);
|
||||
}
|
||||
break;
|
||||
case OmniPvdCommand::eSTOP_FRAME:
|
||||
{
|
||||
cmdType = OmniPvdCommand::eSTOP_FRAME;
|
||||
mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle));
|
||||
mStream->readBytes((uint8_t*)&mCmdFrameTimeStop, sizeof(uint64_t));
|
||||
mLog.outputLine("[parser] stop frame (contextHandle: %d, timeStamp: %d)\n", mCmdContextHandle, mCmdFrameTimeStop);
|
||||
}
|
||||
break;
|
||||
case OmniPvdCommand::eRECORD_MESSAGE:
|
||||
{
|
||||
cmdType = OmniPvdCommand::eRECORD_MESSAGE;
|
||||
mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle));
|
||||
|
||||
// Message.
|
||||
readStringFromStream(mCmdMessage, mCmdMessageLength);
|
||||
|
||||
// File name.
|
||||
readStringFromStream(mCmdMessageFile, mCmdMessageFileLength);
|
||||
|
||||
mStream->readBytes((uint8_t*)&mCmdMessageLine, sizeof(uint32_t));
|
||||
mStream->readBytes((uint8_t*)&mCmdMessageType, sizeof(uint32_t));
|
||||
mStream->readBytes((uint8_t*)&mCmdMessageClassHandle, sizeof(OmniPvdClassHandle));
|
||||
|
||||
mCmdMessageParsed = true;
|
||||
|
||||
mLog.outputLine("[parser] message (contextHandle: %d, message: %s, file: %s, line: %d, type: %d)\n",
|
||||
mCmdContextHandle,
|
||||
mCmdMessage, mCmdMessageFile, mCmdMessageLine, mCmdMessageType
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
return cmdType;
|
||||
} else {
|
||||
return cmdType;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return cmdType;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getMajorVersion()
|
||||
{
|
||||
return mCmdMajorVersion;
|
||||
}
|
||||
|
||||
uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getMinorVersion()
|
||||
{
|
||||
return mCmdMinorVersion;
|
||||
}
|
||||
|
||||
uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getPatch()
|
||||
{
|
||||
return mCmdPatch;
|
||||
}
|
||||
|
||||
uint64_t OMNI_PVD_CALL OmniPvdReaderImpl::getContextHandle()
|
||||
{
|
||||
return mCmdContextHandle;
|
||||
}
|
||||
|
||||
OmniPvdClassHandle OMNI_PVD_CALL OmniPvdReaderImpl::getClassHandle()
|
||||
{
|
||||
return mCmdClassHandle;
|
||||
}
|
||||
|
||||
OmniPvdClassHandle OMNI_PVD_CALL OmniPvdReaderImpl::getBaseClassHandle()
|
||||
{
|
||||
return mCmdBaseClassHandle;
|
||||
}
|
||||
|
||||
uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeHandle()
|
||||
{
|
||||
return mCmdAttributeHandle;
|
||||
}
|
||||
|
||||
uint64_t OMNI_PVD_CALL OmniPvdReaderImpl::getObjectHandle()
|
||||
{
|
||||
return mCmdObjectHandle;
|
||||
}
|
||||
|
||||
const char* OMNI_PVD_CALL OmniPvdReaderImpl::getClassName()
|
||||
{
|
||||
return mCmdClassName;
|
||||
}
|
||||
|
||||
const char* OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeName()
|
||||
{
|
||||
return mCmdAttributeName;
|
||||
}
|
||||
|
||||
const char* OMNI_PVD_CALL OmniPvdReaderImpl::getObjectName()
|
||||
{
|
||||
return mCmdObjectName;
|
||||
}
|
||||
|
||||
const uint8_t* OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeDataPointer()
|
||||
{
|
||||
return mCmdAttributeDataPtr;
|
||||
}
|
||||
|
||||
OmniPvdDataType::Enum OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeDataType()
|
||||
{
|
||||
return mCmdAttributeDataType;
|
||||
}
|
||||
|
||||
uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeDataLength()
|
||||
{
|
||||
return mCmdAttributeDataLen;
|
||||
}
|
||||
|
||||
uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeNumberElements()
|
||||
{
|
||||
return mCmdAttributeNbElements;
|
||||
}
|
||||
|
||||
OmniPvdClassHandle OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeClassHandle()
|
||||
{
|
||||
return mCmdAttributeClassHandle;
|
||||
}
|
||||
|
||||
uint8_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeNumberHandles()
|
||||
{
|
||||
return mCmdAttributeHandleDepth;
|
||||
}
|
||||
|
||||
uint32_t* OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeHandles()
|
||||
{
|
||||
return mCmdAttributeHandleStack;
|
||||
}
|
||||
|
||||
uint64_t OMNI_PVD_CALL OmniPvdReaderImpl::getFrameTimeStart()
|
||||
{
|
||||
return mCmdFrameTimeStart;
|
||||
}
|
||||
|
||||
uint64_t OMNI_PVD_CALL OmniPvdReaderImpl::getFrameTimeStop()
|
||||
{
|
||||
return mCmdFrameTimeStop;
|
||||
}
|
||||
|
||||
bool OMNI_PVD_CALL OmniPvdReaderImpl::getMessageData(const char*& message, const char*& file, uint32_t& line, uint32_t& type, OmniPvdClassHandle& handle)
|
||||
{
|
||||
message = mCmdMessage;
|
||||
file = mCmdMessageFile;
|
||||
line = mCmdMessageLine;
|
||||
type = mCmdMessageType;
|
||||
handle = mCmdMessageClassHandle;
|
||||
|
||||
return mCmdMessageParsed;
|
||||
}
|
||||
|
||||
OmniPvdClassHandle OMNI_PVD_CALL OmniPvdReaderImpl::getEnumClassHandle()
|
||||
{
|
||||
return mCmdEnumClassHandle;
|
||||
}
|
||||
|
||||
uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getEnumValue()
|
||||
{
|
||||
return mCmdEnumValue;
|
||||
}
|
||||
|
||||
void OmniPvdReaderImpl::readLongDataFromStream(uint32_t streamByteLen)
|
||||
{
|
||||
if (streamByteLen < 1) return;
|
||||
if (streamByteLen > mDataBuffAllocatedLen) {
|
||||
delete[] mDataBuffer;
|
||||
mDataBuffAllocatedLen = (uint32_t)(streamByteLen * 1.3f);
|
||||
mDataBuffer = new uint8_t[mDataBuffAllocatedLen];
|
||||
}
|
||||
mCmdAttributeDataPtr = mDataBuffer;
|
||||
mStream->readBytes(mCmdAttributeDataPtr, streamByteLen);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Resets all command parameters before a new read command is executed,
|
||||
// except for those parameters that are "stateful" which are left commented out.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void OmniPvdReaderImpl::resetCommandParams()
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Stateful: Depends on the version of the stream reader
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// OmniPvdVersionType mMajorVersion;
|
||||
// OmniPvdVersionType mMinorVersion;
|
||||
// OmniPvdVersionType mPatch;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Stateful: Depends on the stream being read and stay the same
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// OmniPvdVersionType mCmdMajorVersion;
|
||||
// OmniPvdVersionType mCmdMinorVersion;
|
||||
// OmniPvdVersionType mCmdPatch;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
mCmdContextHandle = OMNI_PVD_INVALID_HANDLE;
|
||||
mCmdObjectHandle = OMNI_PVD_INVALID_HANDLE;
|
||||
|
||||
mCmdClassHandle = OMNI_PVD_INVALID_HANDLE;
|
||||
mCmdBaseClassHandle = OMNI_PVD_INVALID_HANDLE;
|
||||
mCmdAttributeHandle = OMNI_PVD_INVALID_HANDLE;
|
||||
|
||||
mCmdClassName[0] = 0;
|
||||
mCmdAttributeName[0] = 0;
|
||||
mCmdObjectName[0] = 0;
|
||||
|
||||
mCmdClassNameLen = 0;
|
||||
mCmdAttributeNameLen = 0;
|
||||
mCmdObjectNameLen = 0;
|
||||
|
||||
mCmdAttributeDataPtr = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Unsure how to handle this, a zero value could still be valid
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//mCmdAttributeDataType = OmniPvdDataType::eINT8; // int 8 is 0
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
mCmdAttributeDataLen = 0;
|
||||
mCmdAttributeNbElements = 0;
|
||||
mCmdEnumValue = 0;
|
||||
mCmdEnumClassHandle = OMNI_PVD_INVALID_HANDLE;
|
||||
mCmdAttributeClassHandle = OMNI_PVD_INVALID_HANDLE;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Left untouched/dirty : instead depends on the depth parameter below
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// OmniPvdAttributeHandle mCmdAttributeHandleStack[32];
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
mCmdAttributeHandleDepth = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Stateful for the duration of a frame
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// uint64_t mCmdFrameTimeStart;
|
||||
// uint64_t mCmdFrameTimeStop;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal scratch buffer, instead the mCmdAttributeDataPtr is set to 0
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// uint8_t *mDataBuffer;
|
||||
// uint32_t mDataBuffAllocatedLen;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal message buffer
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
mCmdMessageParsed = false;
|
||||
mCmdMessageLength = 0;
|
||||
mCmdMessage[0] = 0;
|
||||
mCmdMessageFileLength = 0;
|
||||
mCmdMessageFile[0] = 0;
|
||||
mCmdMessageLine = 0;
|
||||
mCmdMessageType = 0;
|
||||
mCmdMessageClassHandle = 0;
|
||||
}
|
||||
141
engine/third_party/physx/pvdruntime/src/OmniPvdReaderImpl.h
vendored
Normal file
141
engine/third_party/physx/pvdruntime/src/OmniPvdReaderImpl.h
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_RUNTIME_READER_IMPL_H
|
||||
#define OMNI_PVD_RUNTIME_READER_IMPL_H
|
||||
|
||||
#include "OmniPvdReader.h"
|
||||
#include "OmniPvdLog.h"
|
||||
|
||||
|
||||
class OmniPvdReaderImpl : public OmniPvdReader {
|
||||
public:
|
||||
OmniPvdReaderImpl();
|
||||
~OmniPvdReaderImpl();
|
||||
|
||||
void OMNI_PVD_CALL setLogFunction(OmniPvdLogFunction logFunction);
|
||||
void OMNI_PVD_CALL setReadStream(OmniPvdReadStream& stream);
|
||||
bool OMNI_PVD_CALL startReading(OmniPvdVersionType& majorVersion, OmniPvdVersionType& minorVersion, OmniPvdVersionType& patch);
|
||||
OmniPvdCommand::Enum OMNI_PVD_CALL getNextCommand();
|
||||
|
||||
OmniPvdVersionType OMNI_PVD_CALL getMajorVersion();
|
||||
OmniPvdVersionType OMNI_PVD_CALL getMinorVersion();
|
||||
OmniPvdVersionType OMNI_PVD_CALL getPatch();
|
||||
|
||||
OmniPvdContextHandle OMNI_PVD_CALL getContextHandle();
|
||||
OmniPvdObjectHandle OMNI_PVD_CALL getObjectHandle();
|
||||
|
||||
OmniPvdClassHandle OMNI_PVD_CALL getClassHandle();
|
||||
OmniPvdClassHandle OMNI_PVD_CALL getBaseClassHandle();
|
||||
OmniPvdAttributeHandle OMNI_PVD_CALL getAttributeHandle();
|
||||
|
||||
const char* OMNI_PVD_CALL getClassName();
|
||||
const char* OMNI_PVD_CALL getAttributeName();
|
||||
const char* OMNI_PVD_CALL getObjectName();
|
||||
|
||||
const uint8_t* OMNI_PVD_CALL getAttributeDataPointer();
|
||||
OmniPvdDataType::Enum OMNI_PVD_CALL getAttributeDataType();
|
||||
uint32_t OMNI_PVD_CALL getAttributeDataLength();
|
||||
uint32_t OMNI_PVD_CALL getAttributeNumberElements();
|
||||
OmniPvdClassHandle OMNI_PVD_CALL getAttributeClassHandle();
|
||||
|
||||
uint8_t OMNI_PVD_CALL getAttributeNumberHandles();
|
||||
OmniPvdAttributeHandle* OMNI_PVD_CALL getAttributeHandles();
|
||||
|
||||
uint64_t OMNI_PVD_CALL getFrameTimeStart();
|
||||
uint64_t OMNI_PVD_CALL getFrameTimeStop();
|
||||
|
||||
bool OMNI_PVD_CALL getMessageData(const char*& message, const char*& file, uint32_t& line, uint32_t& type, OmniPvdClassHandle& handle) override;
|
||||
|
||||
OmniPvdClassHandle OMNI_PVD_CALL getEnumClassHandle();
|
||||
uint32_t OMNI_PVD_CALL getEnumValue();
|
||||
|
||||
// Internal helper
|
||||
void readLongDataFromStream(uint32_t streamByteLen);
|
||||
bool readStringFromStream(char* string, uint16_t& stringLength);
|
||||
void resetCommandParams();
|
||||
|
||||
OmniPvdLog mLog;
|
||||
|
||||
OmniPvdReadStream *mStream;
|
||||
|
||||
OmniPvdVersionType mMajorVersion;
|
||||
OmniPvdVersionType mMinorVersion;
|
||||
OmniPvdVersionType mPatch;
|
||||
|
||||
OmniPvdVersionType mCmdMajorVersion;
|
||||
OmniPvdVersionType mCmdMinorVersion;
|
||||
OmniPvdVersionType mCmdPatch;
|
||||
|
||||
OmniPvdContextHandle mCmdContextHandle;
|
||||
OmniPvdObjectHandle mCmdObjectHandle;
|
||||
|
||||
uint32_t mCmdClassHandle;
|
||||
uint32_t mCmdBaseClassHandle;
|
||||
uint32_t mCmdAttributeHandle;
|
||||
|
||||
char mCmdClassName[OMNI_PVD_MAX_STRING_LENGTH];
|
||||
char mCmdAttributeName[OMNI_PVD_MAX_STRING_LENGTH];
|
||||
char mCmdObjectName[OMNI_PVD_MAX_STRING_LENGTH];
|
||||
|
||||
uint16_t mCmdClassNameLen;
|
||||
uint16_t mCmdAttributeNameLen;
|
||||
uint16_t mCmdObjectNameLen;
|
||||
|
||||
uint8_t* mCmdAttributeDataPtr;
|
||||
OmniPvdDataType::Enum mCmdAttributeDataType;
|
||||
uint32_t mCmdAttributeDataLen;
|
||||
uint32_t mCmdAttributeNbElements;
|
||||
OmniPvdEnumValueType mCmdEnumValue;
|
||||
OmniPvdClassHandle mCmdEnumClassHandle;
|
||||
OmniPvdClassHandle mCmdAttributeClassHandle;
|
||||
|
||||
OmniPvdAttributeHandle mCmdAttributeHandleStack[32];
|
||||
uint8_t mCmdAttributeHandleDepth;
|
||||
|
||||
uint64_t mCmdFrameTimeStart;
|
||||
uint64_t mCmdFrameTimeStop;
|
||||
|
||||
uint8_t *mDataBuffer;
|
||||
uint32_t mDataBuffAllocatedLen;
|
||||
|
||||
bool mIsReadingStarted;
|
||||
uint8_t mReadBaseClassHandle;
|
||||
|
||||
// Messages
|
||||
bool mCmdMessageParsed;
|
||||
uint16_t mCmdMessageLength;
|
||||
char mCmdMessage[OMNI_PVD_MAX_STRING_LENGTH];
|
||||
uint16_t mCmdMessageFileLength;
|
||||
char mCmdMessageFile[OMNI_PVD_MAX_STRING_LENGTH];
|
||||
uint32_t mCmdMessageLine;
|
||||
uint32_t mCmdMessageType;
|
||||
OmniPvdClassHandle mCmdMessageClassHandle;
|
||||
};
|
||||
|
||||
#endif
|
||||
384
engine/third_party/physx/pvdruntime/src/OmniPvdWriterImpl.cpp
vendored
Normal file
384
engine/third_party/physx/pvdruntime/src/OmniPvdWriterImpl.cpp
vendored
Normal file
@@ -0,0 +1,384 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#include "OmniPvdWriterImpl.h"
|
||||
#include "OmniPvdDefines.h"
|
||||
#include <string.h>
|
||||
|
||||
OmniPvdWriterImpl::OmniPvdWriterImpl()
|
||||
{
|
||||
resetParams();
|
||||
}
|
||||
|
||||
OmniPvdWriterImpl::~OmniPvdWriterImpl()
|
||||
{
|
||||
}
|
||||
|
||||
void OmniPvdWriterImpl::resetParams()
|
||||
{
|
||||
mStream = 0;
|
||||
mLastClassHandle = 0;
|
||||
mLastAttributeHandle = 0;
|
||||
mIsFirstWrite = true;
|
||||
mStatusFlags = 0; // That or set all flag bits off
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdWriterImpl::setLogFunction(OmniPvdLogFunction logFunction)
|
||||
{
|
||||
mLog.setLogFunction(logFunction);
|
||||
}
|
||||
|
||||
void OmniPvdWriterImpl::setVersionHelper()
|
||||
{
|
||||
if (mStream && mIsFirstWrite)
|
||||
{
|
||||
const OmniPvdVersionType omniPvdVersionMajor = OMNI_PVD_VERSION_MAJOR;
|
||||
const OmniPvdVersionType omniPvdVersionMinor = OMNI_PVD_VERSION_MINOR;
|
||||
const OmniPvdVersionType omniPvdVersionPatch = OMNI_PVD_VERSION_PATCH;
|
||||
setVersion(omniPvdVersionMajor, omniPvdVersionMinor, omniPvdVersionPatch);
|
||||
}
|
||||
}
|
||||
|
||||
void OmniPvdWriterImpl::setVersion(OmniPvdVersionType majorVersion, OmniPvdVersionType minorVersion, OmniPvdVersionType patch)
|
||||
{
|
||||
if (mStream && mIsFirstWrite)
|
||||
{
|
||||
if (!mStream->openStream())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
writeWithStatus((const uint8_t*)&majorVersion, sizeof(OmniPvdVersionType));
|
||||
writeWithStatus((const uint8_t*)&minorVersion, sizeof(OmniPvdVersionType));
|
||||
writeWithStatus((const uint8_t*)&patch, sizeof(OmniPvdVersionType));
|
||||
|
||||
mLog.outputLine("OmniPvdRuntimeWriterImpl::setVersion majorVersion(%lu), minorVersion(%lu), patch(%lu)", static_cast<unsigned long>(majorVersion), static_cast<unsigned long>(minorVersion), static_cast<unsigned long>(patch));
|
||||
mIsFirstWrite = false;
|
||||
}
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdWriterImpl::setWriteStream(OmniPvdWriteStream& stream)
|
||||
{
|
||||
mLog.outputLine("OmniPvdRuntimeWriterImpl::setWriteStream");
|
||||
mStream = &stream;
|
||||
}
|
||||
|
||||
OmniPvdWriteStream* OMNI_PVD_CALL OmniPvdWriterImpl::getWriteStream()
|
||||
{
|
||||
return mStream;
|
||||
}
|
||||
|
||||
OmniPvdClassHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerClass(const char* className, OmniPvdClassHandle baseClass)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream)
|
||||
{
|
||||
mLog.outputLine("OmniPvdWriterImpl::registerClass className(%s)", className);
|
||||
|
||||
int classNameLen = (int)strlen(className);
|
||||
writeCommand(OmniPvdCommand::eREGISTER_CLASS);
|
||||
mLastClassHandle++;
|
||||
writeWithStatus((const uint8_t*)&mLastClassHandle, sizeof(OmniPvdClassHandle));
|
||||
writeWithStatus((const uint8_t*)&baseClass, sizeof(OmniPvdClassHandle));
|
||||
writeWithStatus((const uint8_t*)&classNameLen, sizeof(uint16_t));
|
||||
writeWithStatus((const uint8_t*)className, classNameLen);
|
||||
return mLastClassHandle;
|
||||
} else {
|
||||
return OMNI_PVD_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdDataType::Enum attributeDataType, uint32_t nbElements)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream) {
|
||||
|
||||
mLog.outputLine("OmniPvdWriterImpl::registerAttribute classHandle(%llu), attributeName(%s), attributeDataType(%d), nbrFields(%llu)", static_cast<unsigned long long>(classHandle), attributeName, static_cast<int>(attributeDataType), static_cast<unsigned long long>(nbElements));
|
||||
|
||||
int attribNameLen = (int)strlen(attributeName);
|
||||
writeCommand(OmniPvdCommand::eREGISTER_ATTRIBUTE);
|
||||
mLastAttributeHandle++;
|
||||
writeWithStatus((const uint8_t*)&classHandle, sizeof(OmniPvdClassHandle));
|
||||
writeWithStatus((const uint8_t*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle));
|
||||
writeDataType(attributeDataType);
|
||||
writeWithStatus((const uint8_t*)&nbElements, sizeof(uint32_t));
|
||||
writeWithStatus((const uint8_t*)&attribNameLen, sizeof(uint16_t));
|
||||
writeWithStatus((const uint8_t*)attributeName, attribNameLen);
|
||||
return mLastAttributeHandle;
|
||||
}
|
||||
else {
|
||||
return OMNI_PVD_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerFlagsAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle enumClassHandle)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream) {
|
||||
|
||||
mLog.outputLine("OmniPvdWriterImpl::registerFlagsAttribute classHandle(%llu), enumClassHandle(%llu), attributeName(%s)", static_cast<unsigned long long>(classHandle), static_cast<unsigned long long>(enumClassHandle), attributeName);
|
||||
|
||||
int attribNameLen = (int)strlen(attributeName);
|
||||
writeCommand(OmniPvdCommand::eREGISTER_ATTRIBUTE);
|
||||
mLastAttributeHandle++;
|
||||
writeWithStatus((const uint8_t*)&classHandle, sizeof(OmniPvdClassHandle));
|
||||
writeWithStatus((const uint8_t*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle));
|
||||
writeDataType(OmniPvdDataType::eFLAGS_WORD);
|
||||
writeWithStatus((const uint8_t*)&enumClassHandle, sizeof(OmniPvdClassHandle));
|
||||
writeWithStatus((const uint8_t*)&attribNameLen, sizeof(uint16_t));
|
||||
writeWithStatus((const uint8_t*)attributeName, attribNameLen);
|
||||
return mLastAttributeHandle;
|
||||
}
|
||||
else {
|
||||
return OMNI_PVD_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerEnumValue(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdEnumValueType value)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream) {
|
||||
int attribNameLen = (int)strlen(attributeName);
|
||||
writeCommand(OmniPvdCommand::eREGISTER_ATTRIBUTE);
|
||||
mLastAttributeHandle++;
|
||||
writeWithStatus((const uint8_t*)&classHandle, sizeof(OmniPvdClassHandle));
|
||||
writeWithStatus((const uint8_t*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle));
|
||||
writeDataType(OmniPvdDataType::eENUM_VALUE);
|
||||
writeWithStatus((const uint8_t*)&value, sizeof(OmniPvdEnumValueType));
|
||||
writeWithStatus((const uint8_t*)&attribNameLen, sizeof(uint16_t));
|
||||
writeWithStatus((const uint8_t*)attributeName, attribNameLen);
|
||||
return mLastAttributeHandle;
|
||||
}
|
||||
else {
|
||||
return OMNI_PVD_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerClassAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle classAttributeHandle)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream)
|
||||
{
|
||||
int attribNameLen = (int)strlen(attributeName);
|
||||
writeCommand(OmniPvdCommand::eREGISTER_CLASS_ATTRIBUTE);
|
||||
mLastAttributeHandle++;
|
||||
writeWithStatus((const uint8_t*)&classHandle, sizeof(OmniPvdClassHandle));
|
||||
writeWithStatus((const uint8_t*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle));
|
||||
writeWithStatus((const uint8_t*)&classAttributeHandle, sizeof(OmniPvdClassHandle));
|
||||
writeWithStatus((const uint8_t*)&attribNameLen, sizeof(uint16_t));
|
||||
writeWithStatus((const uint8_t*)attributeName, attribNameLen);
|
||||
return mLastAttributeHandle;
|
||||
}
|
||||
else {
|
||||
return OMNI_PVD_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerUniqueListAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdDataType::Enum attributeDataType)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream)
|
||||
{
|
||||
int attribNameLen = (int)strlen(attributeName);
|
||||
writeCommand(OmniPvdCommand::eREGISTER_UNIQUE_LIST_ATTRIBUTE);
|
||||
mLastAttributeHandle++;
|
||||
writeWithStatus((const uint8_t*)&classHandle, sizeof(OmniPvdClassHandle));
|
||||
writeWithStatus((const uint8_t*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle));
|
||||
writeDataType(attributeDataType);
|
||||
writeWithStatus((const uint8_t*)&attribNameLen, sizeof(uint16_t));
|
||||
writeWithStatus((const uint8_t*)attributeName, attribNameLen);
|
||||
return mLastAttributeHandle;
|
||||
}
|
||||
else
|
||||
{
|
||||
return OMNI_PVD_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdWriterImpl::setAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream)
|
||||
{
|
||||
writeCommand(OmniPvdCommand::eSET_ATTRIBUTE);
|
||||
writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle));
|
||||
writeWithStatus((const uint8_t*)&objectHandle, sizeof(OmniPvdObjectHandle));
|
||||
writeWithStatus((const uint8_t*)&nbAttributeHandles, sizeof(uint8_t));
|
||||
for (int i = 0; i < nbAttributeHandles; i++)
|
||||
{
|
||||
writeWithStatus((const uint8_t*)attributeHandles, sizeof(OmniPvdAttributeHandle));
|
||||
attributeHandles++;
|
||||
}
|
||||
writeWithStatus((const uint8_t*)&nbrBytes, sizeof(uint32_t));
|
||||
writeWithStatus((const uint8_t*)data, nbrBytes);
|
||||
}
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdWriterImpl::addToUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream)
|
||||
{
|
||||
writeCommand(OmniPvdCommand::eADD_TO_UNIQUE_LIST_ATTRIBUTE);
|
||||
writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle));
|
||||
writeWithStatus((const uint8_t*)&objectHandle, sizeof(OmniPvdObjectHandle));
|
||||
writeWithStatus((const uint8_t*)&nbAttributeHandles, sizeof(uint8_t));
|
||||
for (int i = 0; i < nbAttributeHandles; i++)
|
||||
{
|
||||
writeWithStatus((const uint8_t*)attributeHandles, sizeof(OmniPvdAttributeHandle));
|
||||
attributeHandles++;
|
||||
}
|
||||
writeWithStatus((const uint8_t*)&nbrBytes, sizeof(uint32_t));
|
||||
writeWithStatus((const uint8_t*)data, nbrBytes);
|
||||
}
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdWriterImpl::removeFromUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream)
|
||||
{
|
||||
writeCommand(OmniPvdCommand::eREMOVE_FROM_UNIQUE_LIST_ATTRIBUTE);
|
||||
writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle));
|
||||
writeWithStatus((const uint8_t*)&objectHandle, sizeof(OmniPvdObjectHandle));
|
||||
writeWithStatus((const uint8_t*)&nbAttributeHandles, sizeof(uint8_t));
|
||||
for (int i = 0; i < nbAttributeHandles; i++)
|
||||
{
|
||||
writeWithStatus((const uint8_t*)attributeHandles, sizeof(OmniPvdAttributeHandle));
|
||||
attributeHandles++;
|
||||
}
|
||||
writeWithStatus((const uint8_t*)&nbrBytes, sizeof(uint32_t));
|
||||
writeWithStatus((const uint8_t*)data, nbrBytes);
|
||||
}
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdWriterImpl::createObject(OmniPvdContextHandle contextHandle, OmniPvdClassHandle classHandle, OmniPvdObjectHandle objectHandle, const char* objectName)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream)
|
||||
{
|
||||
writeCommand(OmniPvdCommand::eCREATE_OBJECT);
|
||||
writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle));
|
||||
writeWithStatus((const uint8_t*)&classHandle, sizeof(OmniPvdClassHandle));
|
||||
writeWithStatus((const uint8_t*)&objectHandle, sizeof(OmniPvdObjectHandle));
|
||||
int objectNameLen = 0;
|
||||
if (objectName)
|
||||
{
|
||||
objectNameLen = (int)strlen(objectName);
|
||||
writeWithStatus((const uint8_t*)&objectNameLen, sizeof(uint16_t));
|
||||
writeWithStatus((const uint8_t*)objectName, objectNameLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeWithStatus((const uint8_t*)&objectNameLen, sizeof(uint16_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdWriterImpl::destroyObject(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream)
|
||||
{
|
||||
writeCommand(OmniPvdCommand::eDESTROY_OBJECT);
|
||||
writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle));
|
||||
writeWithStatus((const uint8_t*)&objectHandle, sizeof(OmniPvdObjectHandle));
|
||||
}
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdWriterImpl::startFrame(OmniPvdContextHandle contextHandle, uint64_t timeStamp)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream)
|
||||
{
|
||||
writeCommand(OmniPvdCommand::eSTART_FRAME);
|
||||
writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle));
|
||||
writeWithStatus((const uint8_t*)&timeStamp, sizeof(uint64_t));
|
||||
}
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdWriterImpl::stopFrame(OmniPvdContextHandle contextHandle, uint64_t timeStamp)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream)
|
||||
{
|
||||
writeCommand(OmniPvdCommand::eSTOP_FRAME);
|
||||
writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle));
|
||||
writeWithStatus((const uint8_t*)&timeStamp, sizeof(uint64_t));
|
||||
}
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdWriterImpl::recordMessage(OmniPvdContextHandle contextHandle, const char* message, const char* file, uint32_t line, uint32_t type, OmniPvdClassHandle handle)
|
||||
{
|
||||
setVersionHelper();
|
||||
if (mStream)
|
||||
{
|
||||
writeCommand(OmniPvdCommand::eRECORD_MESSAGE);
|
||||
writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle));
|
||||
|
||||
int messageLength = 0;
|
||||
|
||||
if (message)
|
||||
{
|
||||
messageLength = (int)strlen(message);
|
||||
writeWithStatus((const uint8_t*)&messageLength, sizeof(uint16_t));
|
||||
writeWithStatus((const uint8_t*)message, messageLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeWithStatus((const uint8_t*)&messageLength, sizeof(uint16_t));
|
||||
}
|
||||
|
||||
int filenameLength = 0;
|
||||
|
||||
if (file)
|
||||
{
|
||||
filenameLength = (int)strlen(file);
|
||||
writeWithStatus((const uint8_t*)&filenameLength, sizeof(uint16_t));
|
||||
writeWithStatus((const uint8_t*)file, filenameLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeWithStatus((const uint8_t*)&filenameLength, sizeof(uint16_t));
|
||||
}
|
||||
|
||||
writeWithStatus((const uint8_t*)&line, sizeof(uint32_t));
|
||||
writeWithStatus((const uint8_t*)&type, sizeof(uint32_t));
|
||||
writeWithStatus((const uint8_t*)&handle, sizeof(OmniPvdClassHandle));
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t OMNI_PVD_CALL OmniPvdWriterImpl::getStatus()
|
||||
{
|
||||
return mStatusFlags;
|
||||
}
|
||||
|
||||
void OMNI_PVD_CALL OmniPvdWriterImpl::clearStatus()
|
||||
{
|
||||
mStatusFlags = 0;
|
||||
}
|
||||
129
engine/third_party/physx/pvdruntime/src/OmniPvdWriterImpl.h
vendored
Normal file
129
engine/third_party/physx/pvdruntime/src/OmniPvdWriterImpl.h
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef OMNI_PVD_WRITER_IMPL_H
|
||||
#define OMNI_PVD_WRITER_IMPL_H
|
||||
|
||||
#include "OmniPvdWriter.h"
|
||||
#include "OmniPvdCommands.h"
|
||||
#include "OmniPvdDefinesInternal.h"
|
||||
#include "OmniPvdLog.h"
|
||||
|
||||
class OmniPvdWriterImpl : public OmniPvdWriter {
|
||||
public:
|
||||
OmniPvdWriterImpl();
|
||||
~OmniPvdWriterImpl();
|
||||
void OMNI_PVD_CALL setLogFunction(OmniPvdLogFunction logFunction);
|
||||
void setVersionHelper();
|
||||
void setVersion(OmniPvdVersionType majorVersion, OmniPvdVersionType minorVersion, OmniPvdVersionType patch);
|
||||
void OMNI_PVD_CALL setWriteStream(OmniPvdWriteStream& stream);
|
||||
OmniPvdWriteStream* OMNI_PVD_CALL getWriteStream();
|
||||
|
||||
OmniPvdClassHandle OMNI_PVD_CALL registerClass(const char* className, OmniPvdClassHandle baseClass);
|
||||
OmniPvdAttributeHandle OMNI_PVD_CALL registerEnumValue(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdEnumValueType value);
|
||||
OmniPvdAttributeHandle OMNI_PVD_CALL registerAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdDataType::Enum attributeDataType, uint32_t nbElements);
|
||||
OmniPvdAttributeHandle OMNI_PVD_CALL registerFlagsAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle enumClassHandle);
|
||||
OmniPvdAttributeHandle OMNI_PVD_CALL registerClassAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle classAttributeHandle);
|
||||
OmniPvdAttributeHandle OMNI_PVD_CALL registerUniqueListAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdDataType::Enum attributeDataType);
|
||||
void OMNI_PVD_CALL setAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes);
|
||||
|
||||
void OMNI_PVD_CALL addToUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes);
|
||||
|
||||
void OMNI_PVD_CALL removeFromUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes);
|
||||
|
||||
void OMNI_PVD_CALL createObject(OmniPvdContextHandle contextHandle, OmniPvdClassHandle classHandle, OmniPvdObjectHandle objectHandle, const char* objectName);
|
||||
void OMNI_PVD_CALL destroyObject(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle);
|
||||
void OMNI_PVD_CALL startFrame(OmniPvdContextHandle contextHandle, uint64_t timeStamp);
|
||||
void OMNI_PVD_CALL stopFrame(OmniPvdContextHandle contextHandle, uint64_t timeStamp);
|
||||
|
||||
void OMNI_PVD_CALL recordMessage(OmniPvdContextHandle contextHandle, const char* message, const char* file, uint32_t line, uint32_t type, OmniPvdClassHandle handle) override;
|
||||
|
||||
uint32_t OMNI_PVD_CALL getStatus();
|
||||
void OMNI_PVD_CALL clearStatus();
|
||||
|
||||
void resetParams();
|
||||
|
||||
bool isFlagOn(OmniPvdWriterStatusFlag::Enum flagBitMask)
|
||||
{
|
||||
return mStatusFlags & uint32_t(flagBitMask);
|
||||
}
|
||||
|
||||
void setFlagOn(OmniPvdWriterStatusFlag::Enum flagBitMask)
|
||||
{
|
||||
mStatusFlags = mStatusFlags | uint32_t(flagBitMask);
|
||||
}
|
||||
|
||||
void setFlagOff(OmniPvdWriterStatusFlag::Enum flagBitMask)
|
||||
{
|
||||
mStatusFlags = mStatusFlags & ~uint32_t(flagBitMask);
|
||||
}
|
||||
|
||||
void setFlagVal(OmniPvdWriterStatusFlag::Enum flagBitMask, bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
setFlagOn(flagBitMask);
|
||||
}
|
||||
else
|
||||
{
|
||||
setFlagOff(flagBitMask);
|
||||
}
|
||||
}
|
||||
|
||||
void writeWithStatus(const uint8_t* writePtr, uint64_t nbrBytesToWrite)
|
||||
{
|
||||
if (! (mStream && writePtr && (nbrBytesToWrite > 0)) ) return;
|
||||
uint64_t nbrBytesWritten = mStream->writeBytes(writePtr, nbrBytesToWrite);
|
||||
const bool writeFailure = nbrBytesWritten != nbrBytesToWrite;
|
||||
if (writeFailure) {
|
||||
setFlagOn(OmniPvdWriterStatusFlag::eSTREAM_WRITE_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
void writeDataType(OmniPvdDataType::Enum attributeDataType)
|
||||
{
|
||||
const OmniPvdDataTypeStorageType dataType = static_cast<OmniPvdDataTypeStorageType>(attributeDataType);
|
||||
writeWithStatus((const uint8_t*)&dataType, sizeof(OmniPvdDataTypeStorageType));
|
||||
}
|
||||
|
||||
void writeCommand(OmniPvdCommand::Enum command)
|
||||
{
|
||||
const OmniPvdCommandStorageType commandTmp = static_cast<OmniPvdCommandStorageType>(command);
|
||||
writeWithStatus((const uint8_t*)&commandTmp, sizeof(OmniPvdCommandStorageType));
|
||||
}
|
||||
|
||||
bool mIsFirstWrite;
|
||||
OmniPvdLog mLog;
|
||||
OmniPvdWriteStream* mStream;
|
||||
int mLastClassHandle;
|
||||
int mLastAttributeHandle;
|
||||
|
||||
uint32_t mStatusFlags;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user