diff options
| author | git perforce import user <a@b> | 2016-10-25 12:29:14 -0600 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees> | 2016-10-25 18:56:37 -0500 |
| commit | 3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch) | |
| tree | fa6485c169e50d7415a651bf838f5bcd0fd3bfbd /APEX_1.4/framework/include | |
| download | physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip | |
Initial commit:
PhysX 3.4.0 Update @ 21294896
APEX 1.4.0 Update @ 21275617
[CL 21300167]
Diffstat (limited to 'APEX_1.4/framework/include')
47 files changed, 9183 insertions, 0 deletions
diff --git a/APEX_1.4/framework/include/ApexAssetPreviewScene.h b/APEX_1.4/framework/include/ApexAssetPreviewScene.h new file mode 100644 index 00000000..4a091bc4 --- /dev/null +++ b/APEX_1.4/framework/include/ApexAssetPreviewScene.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_ASSET_PREVIEW_SCENE_H +#define APEX_ASSET_PREVIEW_SCENE_H + +#include "Apex.h" +#include "ApexResource.h" +#include "PsUserAllocated.h" +#include "ApexSDKImpl.h" +#include "AssetPreviewScene.h" +#include "ModuleIntl.h" +#include "ApexContext.h" +#include "PsMutex.h" + +#if PX_PHYSICS_VERSION_MAJOR == 3 +#include "PxScene.h" +#include "PxRenderBuffer.h" +#endif + +#include "ApexSceneUserNotify.h" + +#include "PsSync.h" +#include "PxTask.h" +#include "PxTaskManager.h" + +#include "ApexGroupsFiltering.h" +#include "ApexRWLockable.h" + +namespace nvidia +{ +namespace apex +{ + +class ApexAssetPreviewScene : public AssetPreviewScene, public ApexRWLockable, public UserAllocated +{ +public: + APEX_RW_LOCKABLE_BOILERPLATE + + ApexAssetPreviewScene(ApexSDKImpl* sdk); + virtual ~ApexAssetPreviewScene() {} + + //Sets the view matrix. Should be called whenever the view matrix needs to be updated. + virtual void setCameraMatrix(const PxMat44& viewTransform); + + //Returns the view matrix set by the user for the given viewID. + virtual PxMat44 getCameraMatrix() const; + + virtual void setShowFullInfo(bool showFullInfo); + + virtual bool getShowFullInfo() const; + + virtual void release(); + + void destroy(); + +private: + ApexSDKImpl* mApexSDK; + + PxMat44 mCameraMatrix; // the pose for the preview rendering + bool mShowFullInfo; +}; + +} +} // end namespace nvidia::apex + +#endif // APEX_ASSET_PREVIEW_SCENE_H diff --git a/APEX_1.4/framework/include/ApexCustomBufferIterator.h b/APEX_1.4/framework/include/ApexCustomBufferIterator.h new file mode 100644 index 00000000..14e388cf --- /dev/null +++ b/APEX_1.4/framework/include/ApexCustomBufferIterator.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef __APEX_CUSTOM_BUFFER_ITERARTOR_H__ +#define __APEX_CUSTOM_BUFFER_ITERARTOR_H__ + +#include "CustomBufferIterator.h" +#include <PsUserAllocated.h> +#include <PsArray.h> +#include <ApexUsingNamespace.h> + +namespace nvidia +{ +namespace apex +{ + +class ApexCustomBufferIterator : public CustomBufferIterator, public UserAllocated +{ +public: + ApexCustomBufferIterator(); + + // CustomBufferIterator methods + + virtual void setData(void* data, uint32_t elemSize, uint32_t maxTriangles); + + virtual void addCustomBuffer(const char* name, RenderDataFormat::Enum format, uint32_t offset); + + virtual void* getVertex(uint32_t triangleIndex, uint32_t vertexIndex) const; + + virtual int32_t getAttributeIndex(const char* attributeName) const; + + virtual void* getVertexAttribute(uint32_t triangleIndex, uint32_t vertexIndex, const char* attributeName, RenderDataFormat::Enum& outFormat) const; + + virtual void* getVertexAttribute(uint32_t triangleIndex, uint32_t vertexIndex, uint32_t attributeIndex, RenderDataFormat::Enum& outFormat, const char*& outName) const; + +private: + uint8_t* mData; + uint32_t mElemSize; + uint32_t mMaxTriangles; + struct CustomBuffer + { + const char* name; + uint32_t offset; + RenderDataFormat::Enum format; + }; + physx::Array<CustomBuffer> mCustomBuffers; +}; + +} +} // end namespace nvidia::apex + + +#endif // __APEX_CUSTOM_BUFFER_ITERARTOR_H__ diff --git a/APEX_1.4/framework/include/ApexDefaultStream.h b/APEX_1.4/framework/include/ApexDefaultStream.h new file mode 100644 index 00000000..d1d4fc96 --- /dev/null +++ b/APEX_1.4/framework/include/ApexDefaultStream.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef __APEX_DEFAULT_STREAM_ +#define __APEX_DEFAULT_STREAM_ + + +#endif
\ No newline at end of file diff --git a/APEX_1.4/framework/include/ApexInteropableBuffer.h b/APEX_1.4/framework/include/ApexInteropableBuffer.h new file mode 100644 index 00000000..a7608977 --- /dev/null +++ b/APEX_1.4/framework/include/ApexInteropableBuffer.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef __APEX_INTEROPABLE_BUFFER_H__ +#define __APEX_INTEROPABLE_BUFFER_H__ + +typedef struct CUgraphicsResource_st *CUgraphicsResource; + +namespace physx +{ + class PxCudaContextManager; +} + +namespace nvidia +{ +namespace apex +{ + +class ApexInteropableBuffer +{ +public: + ApexInteropableBuffer(bool mustBeRegistered = false, PxCudaContextManager *interopContext = NULL) + : m_mustBeRegisteredInCUDA(mustBeRegistered) + , m_registeredInCUDA(false) + , m_interopContext(interopContext) + , m_InteropHandle(NULL) + { + } + + virtual bool getInteropResourceHandle(CUgraphicsResource &handle) + { + if(m_registeredInCUDA && m_InteropHandle) + { + handle = m_InteropHandle; + + return true; + } + + return false; + } + +protected: + + bool m_mustBeRegisteredInCUDA; + bool m_registeredInCUDA; + PxCudaContextManager *m_interopContext; + CUgraphicsResource m_InteropHandle; +}; + + +} +} // end namespace nvidia::apex + + +#endif // __APEX_INTEROPABLE_BUFFER_H__ diff --git a/APEX_1.4/framework/include/ApexPhysXObjectDesc.h b/APEX_1.4/framework/include/ApexPhysXObjectDesc.h new file mode 100644 index 00000000..781908c3 --- /dev/null +++ b/APEX_1.4/framework/include/ApexPhysXObjectDesc.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef __APEX_PHYSX_OBJECT_DESC_H__ +#define __APEX_PHYSX_OBJECT_DESC_H__ + +#include "Apex.h" +#include "PhysXObjectDescIntl.h" + +namespace nvidia +{ +namespace apex +{ + +class ApexPhysXObjectDesc : public PhysXObjectDescIntl +{ +public: + typedef PhysXObjectDescIntl Parent; + ApexPhysXObjectDesc() : mNext(0), mPrev(0) + { + mFlags = 0; + userData = NULL; + mPhysXObject = NULL; + } + + // Need a copy constructor because we contain an array, and we are in arrays + ApexPhysXObjectDesc(const ApexPhysXObjectDesc& desc) : PhysXObjectDescIntl(desc) + { + *this = desc; + } + + ApexPhysXObjectDesc& operator = (const ApexPhysXObjectDesc& desc) + { + mFlags = desc.mFlags; + userData = desc.userData; + mApexActors = desc.mApexActors; + mPhysXObject = desc.mPhysXObject; + mNext = desc.mNext; + mPrev = desc.mPrev; + return *this; + } + + void swap(ApexPhysXObjectDesc& rhs) + { + Parent::swap(rhs); + shdfnd::swap(mNext, rhs.mNext); + shdfnd::swap(mPrev, rhs.mPrev); + } + + static uint16_t makeHash(size_t hashable); + + uint32_t mNext, mPrev; + + friend class ApexSDKImpl; + virtual ~ApexPhysXObjectDesc(void) + { + + } +}; + +} +} // end namespace nvidia::apex + +#endif // __APEX_PHYSX_OBJECT_DESC_H__ diff --git a/APEX_1.4/framework/include/ApexRenderDebug.h b/APEX_1.4/framework/include/ApexRenderDebug.h new file mode 100644 index 00000000..5c8522d1 --- /dev/null +++ b/APEX_1.4/framework/include/ApexRenderDebug.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_RENDER_DEBUG_H +#define APEX_RENDER_DEBUG_H + +#include "RenderDebugInterface.h" + +namespace nvidia +{ +namespace apex +{ + +class ApexSDKImpl; + +RenderDebugInterface* createApexRenderDebug(ApexSDKImpl* a, RENDER_DEBUG::RenderDebugInterface* interface, bool useRemote); +void releaseApexRenderDebug(RenderDebugInterface* n); + +} +} // end namespace nvidia::apex + +#endif diff --git a/APEX_1.4/framework/include/ApexRenderMeshActor.h b/APEX_1.4/framework/include/ApexRenderMeshActor.h new file mode 100644 index 00000000..8092fbb7 --- /dev/null +++ b/APEX_1.4/framework/include/ApexRenderMeshActor.h @@ -0,0 +1,329 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_RENDERMESH_ACTOR_H +#define APEX_RENDERMESH_ACTOR_H + +#include "ApexUsingNamespace.h" +#include "RenderMeshAssetIntl.h" +#include "ApexActor.h" + +#include "ApexRenderMeshAsset.h" +#include "ApexSharedUtils.h" +#include "ApexRWLockable.h" +#include "ReadCheck.h" +#include "WriteCheck.h" + +namespace nvidia +{ +namespace apex +{ + +// enables a hack that removes dead particles from the instance list prior to sending it to the application. +// this is a bad hack because it requires significant additional memory and copies. +#define ENABLE_INSTANCED_MESH_CLEANUP_HACK 0 + + +/* + ApexRenderMeshActor - an instantiation of an ApexRenderMeshAsset + */ +class ApexRenderMeshActor : public RenderMeshActorIntl, public ApexResourceInterface, public ApexResource, public ApexActor, public ApexRWLockable +{ +public: + APEX_RW_LOCKABLE_BOILERPLATE + + void release(); + Asset* getOwner() const + { + READ_ZONE(); + return mRenderMeshAsset; + } + PxBounds3 getBounds() const + { + READ_ZONE(); + return ApexRenderable::getBounds(); + } + void lockRenderResources() + { + ApexRenderable::renderDataLock(); + } + void unlockRenderResources() + { + ApexRenderable::renderDataUnLock(); + } + + // RenderMeshActors have global context, ignore ApexActor scene methods +#if PX_PHYSICS_VERSION_MAJOR == 3 + void setPhysXScene(PxScene*) { } + PxScene* getPhysXScene() const + { + return NULL; + } +#endif + + bool getVisibilities(uint8_t* visibilityArray, uint32_t visibilityArraySize) const; + + bool setVisibility(bool visible, uint16_t partIndex = 0); + bool isVisible(uint16_t partIndex = 0) const + { + READ_ZONE(); + return mVisiblePartsForAPI.isUsed(partIndex); + } + + uint32_t visiblePartCount() const + { + READ_ZONE(); + return mVisiblePartsForAPI.usedCount(); + } + const uint32_t* getVisibleParts() const + { + READ_ZONE(); + return mVisiblePartsForAPI.usedIndices(); + } + + uint32_t getRenderVisiblePartCount() const + { + return mBufferVisibility ? mVisiblePartsForRendering.size() : mVisiblePartsForAPI.usedCount(); + } + const uint32_t* getRenderVisibleParts() const + { + return mBufferVisibility ? mVisiblePartsForRendering.begin() : mVisiblePartsForAPI.usedIndices(); + } + + virtual uint32_t getBoneCount() const + { + READ_ZONE(); + return mRenderMeshAsset->getBoneCount(); + } + + void setTM(const PxMat44& tm, uint32_t boneIndex = 0); + void setTM(const PxMat44& tm, const PxVec3& scale, uint32_t boneIndex = 0); + + const PxMat44 getTM(uint32_t boneIndex = 0) const + { + READ_ZONE(); + return accessTM(boneIndex); + } + + void setLastFrameTM(const PxMat44& tm, uint32_t boneIndex = 0); + void setLastFrameTM(const PxMat44& tm, const PxVec3& scale, uint32_t boneIndex = 0); + + void setSkinningMode(RenderMeshActorSkinningMode::Enum mode); + RenderMeshActorSkinningMode::Enum getSkinningMode() const; + + void syncVisibility(bool useLock = true); + + void updateBounds(); + void updateRenderResources(bool rewriteBuffers, void* userRenderData); + void updateRenderResources(bool useBones, bool rewriteBuffers, void* userRenderData); + void dispatchRenderResources(UserRenderer&); + void dispatchRenderResources(UserRenderer&, const PxMat44&); + + void setReleaseResourcesIfNothingToRender(bool value); + + void setBufferVisibility(bool bufferVisibility); + + void setOverrideMaterial(uint32_t index, const char* overrideMaterialName); + + //UserRenderVertexBuffer* getUserVertexBuffer(uint32_t submeshIndex) { if (submeshIndex < mSubmeshData.size()) return renderMeshAsset->vertexBuffers[submeshIndex]; return NULL; } + //UserRenderIndexBuffer* getUserIndexBuffer(uint32_t submeshIndex) { if (submeshIndex < mSubmeshData.size()) return mSubmeshData[submeshIndex].indexBuffer; return NULL; } + + void addVertexBuffer(uint32_t submeshIndex, bool alwaysDirty, PxVec3* position, PxVec3* normal, PxVec4* tangents); + void removeVertexBuffer(uint32_t submeshIndex); + + void setStaticPositionReplacement(uint32_t submeshIndex, const PxVec3* staticPositions); + void setStaticColorReplacement(uint32_t submeshIndex, const ColorRGBA* staticColors); + + virtual UserRenderInstanceBuffer* getInstanceBuffer() const + { + READ_ZONE(); + return mInstanceBuffer; + } + /// \sa RenderMeshActor::setInstanceBuffer + virtual void setInstanceBuffer(UserRenderInstanceBuffer* instBuf); + virtual void setMaxInstanceCount(uint32_t count); + /// \sa RenderMeshActor::setInstanceBufferRange + virtual void setInstanceBufferRange(uint32_t from, uint32_t count); + + // ApexResourceInterface methods + void setListIndex(ResourceList& list, uint32_t index) + { + m_listIndex = index; + m_list = &list; + } + uint32_t getListIndex() const + { + return m_listIndex; + } + + virtual void getLodRange(float& min, float& max, bool& intOnly) const; + virtual float getActiveLod() const; + virtual void forceLod(float lod); + /** + \brief Selectively enables/disables debug visualization of a specific APEX actor. Default value it true. + */ + virtual void setEnableDebugVisualization(bool state) + { + WRITE_ZONE(); + ApexActor::setEnableDebugVisualization(state); + } + + virtual bool rayCast(RenderMeshActorRaycastHitData& hitData, + const PxVec3& worldOrig, const PxVec3& worldDisp, + RenderMeshActorRaycastFlags::Enum flags = RenderMeshActorRaycastFlags::VISIBLE_PARTS, + RenderCullMode::Enum winding = RenderCullMode::CLOCKWISE, + int32_t partIndex = -1) const; + + virtual void visualize(RenderDebugInterface& batcher, nvidia::apex::DebugRenderParams* debugParams, PxMat33* scaledRotations, PxVec3* translations, uint32_t stride, uint32_t numberOfTransforms) const; + +protected: + ApexRenderMeshActor(const RenderMeshActorDesc& desc, ApexRenderMeshAsset& _renderMeshData, ResourceList& list); + virtual ~ApexRenderMeshActor(); + + struct SubmeshData; + void loadMaterial(SubmeshData& submeshData); + void init(const RenderMeshActorDesc& desc, uint16_t partCount, uint16_t boneCount); + void destroy(); + + PxMat44& accessTM(uint32_t boneIndex = 0) const + { + return (PxMat44&)mTransforms[mKeepVisibleBonesPacked ? mVisiblePartsForAPI.getRank(boneIndex) : boneIndex]; + } + + PxMat44& accessLastFrameTM(uint32_t boneIndex = 0) const + { + return (PxMat44&)mTransformsLastFrame[mKeepVisibleBonesPacked ? mVisiblePartsForAPILastFrame.getRank(boneIndex) : boneIndex]; + } + + /* Internal rendering APIs */ + void createRenderResources(bool useBones, void* userRenderData); + void updatePartVisibility(uint32_t submeshIndex, bool useBones, void* userRenderData); + void updateBonePoses(uint32_t submeshIndex); + void updateInstances(uint32_t submeshIndex); + void releaseSubmeshRenderResources(uint32_t submeshIndex); + void releaseRenderResources(); + bool submeshHasVisibleTriangles(uint32_t submeshIndex) const; + + // Fallback skinning + void createFallbackSkinning(uint32_t submeshIndex); + void distributeFallbackData(uint32_t submeshIndex); + void updateFallbackSkinning(uint32_t submeshIndex); + void writeUserBuffers(uint32_t submeshIndex); + + // Debug rendering + void visualizeTangentSpace(RenderDebugInterface& batcher, float normalScale, float tangentScale, float bitangentScale, PxMat33* scaledRotations, PxVec3* translations, uint32_t stride, uint32_t numberOfTransforms) const; + + ApexRenderMeshAsset* mRenderMeshAsset; + Array<PxMat44> mTransforms; + Array<PxMat44> mTransformsLastFrame; + + struct ResourceData + { + ResourceData() : resource(NULL), vertexCount(0), boneCount(0) {} + UserRenderResource* resource; + uint32_t vertexCount; + uint32_t boneCount; + }; + + struct SubmeshData + { + SubmeshData(); + ~SubmeshData(); + + Array<ResourceData> renderResources; + UserRenderIndexBuffer* indexBuffer; + void* fallbackSkinningMemory; + UserRenderVertexBuffer* userDynamicVertexBuffer; + UserRenderInstanceBuffer* instanceBuffer; + + PxVec3* userPositions; + PxVec3* userNormals; + PxVec4* userTangents4; + + // And now we have colors + const ColorRGBA* staticColorReplacement; + bool staticColorReplacementDirty; + + // These are needed if the positions vary from what the asset has stored. Can happen with morph targets. + // so far we only replace positions, more can be added here + const PxVec3* staticPositionReplacement; + UserRenderVertexBuffer* staticBufferReplacement; + UserRenderVertexBuffer* dynamicBufferReplacement; + + uint32_t fallbackSkinningMemorySize; + uint32_t visibleTriangleCount; + ResID materialID; + void* material; + bool isMaterialPointerValid; + uint32_t maxBonesPerMaterial; + uint32_t indexBufferRequestedSize; + bool userSpecifiedData; + bool userVertexBufferAlwaysDirty; + bool userIndexBufferChanged; + bool fallbackSkinningDirty; + }; + + nvidia::Array<SubmeshData> mSubmeshData; + IndexBank<uint32_t> mVisiblePartsForAPI; + IndexBank<uint32_t> mVisiblePartsForAPILastFrame; + RenderBufferHint::Enum mIndexBufferHint; + + Array<uint32_t> mVisiblePartsForRendering; + + Array<UserRenderVertexBuffer*> mPerActorVertexBuffers; + + // Instancing + uint32_t mMaxInstanceCount; + uint32_t mInstanceCount; + uint32_t mInstanceOffset; + UserRenderInstanceBuffer* mInstanceBuffer; + UserRenderResource* mRenderResource; + + // configuration + bool mRenderWithoutSkinning; + bool mForceBoneIndexChannel; + bool mApiVisibilityChanged; + bool mPartVisibilityChanged; + bool mInstanceCountChanged; + bool mKeepVisibleBonesPacked; + bool mForceFallbackSkinning; + bool mBonePosesDirty; + bool mOneUserVertexBufferChanged; // this will be true if one or more user vertex buffers changed + bool mBoneBufferInUse; + bool mReleaseResourcesIfNothingToRender; // is this ever set? I think we should remove it. + bool mCreateRenderResourcesAfterInit; // only needed when mRenderWithoutSkinning is set to true + bool mBufferVisibility; + bool mKeepPreviousFrameBoneBuffer; + bool mPreviousFrameBoneBufferValid; + RenderMeshActorSkinningMode::Enum mSkinningMode; + Array<uint32_t> mTMSwapBuffer; + Array<PxMat44> mRemappedPreviousBoneTMs; + + // temporary + Array<uint16_t> mBoneIndexTempBuffer; + + // CM: For some reason the new operator doesn't see these members and allocates not enough memory for the class (on a 64 bit build) + // Even though ENABLE_INSTANCED_MESH_CLEANUP_HACK is defined to be 1 earlier in this file. + // For now, these members are permanently here, since it's a tiny amount of memory if the define is off, and it fixes the allocation problem. +//#if ENABLE_INSTANCED_MESH_CLEANUP_HACK + void* mOrderedInstanceTemp; + uint32_t mOrderedInstanceTempSize; +//#endif + + Array<uint32_t> mPartIndexTempBuffer; + + friend class ApexRenderMeshAsset; +}; + +} // namespace apex +} // namespace nvidia + +#endif // APEX_RENDERMESH_ACTOR_H diff --git a/APEX_1.4/framework/include/ApexRenderMeshAsset.h b/APEX_1.4/framework/include/ApexRenderMeshAsset.h new file mode 100644 index 00000000..8f2d613d --- /dev/null +++ b/APEX_1.4/framework/include/ApexRenderMeshAsset.h @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_RENDERMESH_ASSET_H +#define APEX_RENDERMESH_ASSET_H + +#include "RenderMeshAssetIntl.h" +#include "ApexResource.h" +#include "ApexSDKHelpers.h" +#include "ResourceProviderIntl.h" +#include "ApexRenderSubmesh.h" + +#include "RenderMeshAssetParameters.h" +#include "ApexRWLockable.h" + +namespace nvidia +{ +namespace apex +{ + +/** +ApexRenderMeshAsset - a collection of ApexRenderMeshParts and submesh extra data +*/ +class ApexRenderMeshAsset : public RenderMeshAssetIntl, public ApexResourceInterface, public ApexRWLockable, public ApexResource +{ +public: + APEX_RW_LOCKABLE_BOILERPLATE + + ApexRenderMeshAsset(ResourceList& list, const char* name, AuthObjTypeID ownerModuleID); + ~ApexRenderMeshAsset(); + + struct SubmeshData + { + UserRenderVertexBuffer* staticVertexBuffer; + UserRenderVertexBuffer* skinningVertexBuffer; + UserRenderVertexBuffer* dynamicVertexBuffer; + bool needsStaticData; + bool needsDynamicData; + }; + struct CustomSubmeshData + { + Array<RenderDataFormat::Enum> customBufferFormats; + Array<void*> customBufferVoidPtrs; + }; + + + void release() + { + GetApexSDK()->releaseAsset(*this); + } + + void destroy(); + + AuthObjTypeID getObjTypeID() const + { + return mObjTypeID; + } + const char* getObjTypeName() const + { + return getClassName(); + } + uint32_t forceLoadAssets(); + void deleteStaticBuffersAfterUse(bool set) + { + mParams->deleteStaticBuffersAfterUse = set; + } + + RenderMeshActor* createActor(const RenderMeshActorDesc& desc); + void releaseActor(RenderMeshActor& renderMeshActor); + + const char* getName(void) const + { + return mName.c_str(); + } + uint32_t getSubmeshCount() const + { + return (uint32_t)mParams->submeshes.arraySizes[0]; + } + uint32_t getPartCount() const + { + return (uint32_t)mParams->partBounds.arraySizes[0]; + } + uint32_t getBoneCount() const + { + return mParams->boneCount; + } + const RenderSubmesh& getSubmesh(uint32_t submeshIndex) const + { + return *mSubmeshes[submeshIndex]; + } + const PxBounds3& getBounds(uint32_t partIndex = 0) const + { + return mParams->partBounds.buf[partIndex]; + } + void getStats(RenderMeshAssetStats& stats) const; + + // from RenderMeshAssetIntl + RenderSubmeshIntl& getInternalSubmesh(uint32_t submeshIndex) + { + return *mSubmeshes[submeshIndex]; + } + void permuteBoneIndices(const Array<int32_t>& old2new); + void applyTransformation(const PxMat44& transformation, float scale); + void reverseWinding(); + void applyScale(float scale); + bool mergeBinormalsIntoTangents(); + void setOwnerModuleId(AuthObjTypeID id) + { + mOwnerModuleID = id; + } + TextureUVOrigin::Enum getTextureUVOrigin() const; + + const char* getMaterialName(uint32_t submeshIndex) const + { + return mParams->materialNames.buf[submeshIndex]; + } + + // ApexResourceInterface methods + void setListIndex(ResourceList& list, uint32_t index) + { + m_listIndex = index; + m_list = &list; + } + uint32_t getListIndex() const + { + return m_listIndex; + } + + /* Common data for all ApexRenderMeshAssets */ + static AuthObjTypeID mObjTypeID; + static const char* getClassName() + { + return RENDER_MESH_AUTHORING_TYPE_NAME; + }; + + const NvParameterized::Interface* getAssetNvParameterized() const + { + return mParams; + } + + /** + * \brief Releases the ApexAsset but returns the NvParameterized::Interface and *ownership* to the caller. + */ + virtual NvParameterized::Interface* releaseAndReturnNvParameterizedInterface(void) + { + NvParameterized::Interface* ret = mParams; + mParams = NULL; + release(); + return ret; + } + NvParameterized::Interface* getDefaultActorDesc() + { + APEX_INVALID_OPERATION("Not yet implemented!"); + return NULL; + }; + + NvParameterized::Interface* getDefaultAssetPreviewDesc() + { + APEX_INVALID_OPERATION("Not yet implemented!"); + return NULL; + }; + + virtual Actor* createApexActor(const NvParameterized::Interface& /*parms*/, Scene& /*apexScene*/) + { + APEX_INVALID_OPERATION("Not yet implemented!"); + return NULL; + } + + virtual AssetPreview* createApexAssetPreview(const NvParameterized::Interface& /*params*/, AssetPreviewScene* /*previewScene*/) + { + APEX_INVALID_OPERATION("Not yet implemented!"); + return NULL; + } + + void setOpaqueMesh(UserOpaqueMesh* om) + { + mOpaqueMesh = om; + } + + virtual UserOpaqueMesh* getOpaqueMesh(void) const + { + return mOpaqueMesh; + } + + virtual bool isValidForActorCreation(const ::NvParameterized::Interface& /*parms*/, Scene& /*apexScene*/) const + { + return true; // TODO implement this method + } + + virtual bool isDirty() const + { + return false; + } + +protected: + ApexRenderMeshAsset() {} // Nop constructor for use by RenderMeshAssetAuthoring + + void setSubmeshCount(uint32_t submeshCount); + + + void createLocalData(); + + bool createFromParameters(RenderMeshAssetParameters* params); + + void updatePartBounds(); + + AuthObjTypeID mOwnerModuleID; + RenderMeshAssetParameters* mParams; + UserOpaqueMesh* mOpaqueMesh; + + // Name should not be serialized + ApexSimpleString mName; + + // Local (not serialized) data + Array<ApexRenderSubmesh*> mSubmeshes; + + Array<ResID> mMaterialIDs; + ResourceList mActorList; + Array<SubmeshData> mRuntimeSubmeshData; + Array<CustomSubmeshData> mRuntimeCustomSubmeshData; + + friend class ApexRenderMeshActor; + friend class RenderMeshAuthorableObject; +}; + +} // namespace apex +} // namespace nvidia + +#endif // APEX_RENDERMESH_ASSET_H diff --git a/APEX_1.4/framework/include/ApexRenderMeshAssetAuthoring.h b/APEX_1.4/framework/include/ApexRenderMeshAssetAuthoring.h new file mode 100644 index 00000000..9cb5ce51 --- /dev/null +++ b/APEX_1.4/framework/include/ApexRenderMeshAssetAuthoring.h @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_RENDERMESH_ASSET_AUTHORING_H +#define APEX_RENDERMESH_ASSET_AUTHORING_H + +#include "ApexRenderMeshAsset.h" +#include "ApexSharedUtils.h" +#include "RenderMeshAssetIntl.h" +#include "ResourceProviderIntl.h" +#include "ApexResource.h" +#include "ApexActor.h" +#include "ApexAssetAuthoring.h" +#include "ApexString.h" +#include "ApexVertexFormat.h" +#include "ApexSDKImpl.h" +#include "ApexUsingNamespace.h" +#include "ApexRWLockable.h" + +#ifndef WITHOUT_APEX_AUTHORING + +namespace nvidia +{ +namespace apex +{ + +// PHTODO, put this into the authoring asset +struct VertexReductionExtraData +{ + void set(const ExplicitRenderTriangle& xTriangle) + { + smoothingMask = xTriangle.smoothingMask; + } + + bool canMerge(const VertexReductionExtraData& other) const + { + return (smoothingMask & other.smoothingMask) != 0 || smoothingMask == 0 || other.smoothingMask == 0; + } + + uint32_t smoothingMask; +}; + + +class ApexRenderMeshAssetAuthoring : public ApexRenderMeshAsset, public ApexAssetAuthoring, public RenderMeshAssetAuthoringIntl +{ +public: + APEX_RW_LOCKABLE_BOILERPLATE + + ApexRenderMeshAssetAuthoring(ResourceList& list, RenderMeshAssetParameters* params, const char* name); + + void release() + { + GetApexSDK()->releaseAssetAuthoring(*this); + } + + void createRenderMesh(const MeshDesc& desc, bool createMappingInformation); + uint32_t createReductionMap(uint32_t* map, const Vertex* vertices, const uint32_t* smoothingGroups, uint32_t vertexCount, + const PxVec3& positionTolerance, float normalTolerance, float UVTolerance); + + void deleteStaticBuffersAfterUse(bool set) + { + ApexRenderMeshAsset::deleteStaticBuffersAfterUse(set); + } + + const char* getName(void) const + { + return ApexRenderMeshAsset::getName(); + } + const char* getObjTypeName() const + { + return ApexRenderMeshAsset::getClassName(); + } + bool prepareForPlatform(nvidia::apex::PlatformTag) + { + APEX_INVALID_OPERATION("Not Implemented."); + return false; + } + void setToolString(const char* toolName, const char* toolVersion, uint32_t toolChangelist) + { + ApexAssetAuthoring::setToolString(toolName, toolVersion, toolChangelist); + } + uint32_t getSubmeshCount() const + { + return ApexRenderMeshAsset::getSubmeshCount(); + } + uint32_t getPartCount() const + { + return ApexRenderMeshAsset::getPartCount(); + } + const char* getMaterialName(uint32_t submeshIndex) const + { + return ApexRenderMeshAsset::getMaterialName(submeshIndex); + } + void setMaterialName(uint32_t submeshIndex, const char* name); + virtual void setWindingOrder(uint32_t submeshIndex, RenderCullMode::Enum winding); + virtual RenderCullMode::Enum getWindingOrder(uint32_t submeshIndex) const; + const RenderSubmesh& getSubmesh(uint32_t submeshIndex) const + { + return ApexRenderMeshAsset::getSubmesh(submeshIndex); + } + RenderSubmesh& getSubmeshWritable(uint32_t submeshIndex) + { + return *mSubmeshes[submeshIndex]; + } + const PxBounds3& getBounds(uint32_t partIndex = 0) const + { + return ApexRenderMeshAsset::getBounds(partIndex); + } + void getStats(RenderMeshAssetStats& stats) const + { + ApexRenderMeshAsset::getStats(stats); + } + + // From RenderMeshAssetAuthoringIntl + RenderSubmeshIntl& getInternalSubmesh(uint32_t submeshIndex) + { + return *ApexRenderMeshAsset::mSubmeshes[submeshIndex]; + } + void permuteBoneIndices(const physx::Array<int32_t>& old2new) + { + ApexRenderMeshAsset::permuteBoneIndices(old2new); + } + void applyTransformation(const PxMat44& transformation, float scale) + { + ApexRenderMeshAsset::applyTransformation(transformation, scale); + } + void applyScale(float scale) + { + ApexRenderMeshAsset::applyScale(scale); + } + void reverseWinding() + { + ApexRenderMeshAsset::reverseWinding(); + } + NvParameterized::Interface* getNvParameterized() const + { + return mParams; + } + /** + * \brief Releases the ApexAsset but returns the NvParameterized::Interface and *ownership* to the caller. + */ + virtual NvParameterized::Interface* releaseAndReturnNvParameterizedInterface(void) + { + NvParameterized::Interface* ret = mParams; + mParams = NULL; + release(); + return ret; + } + +protected: + // helper structs + struct VertexPart + { + uint32_t part, vertexIndex; + PX_INLINE bool operator()(const VertexPart& a, const VertexPart& b) const + { + if (a.part != b.part) + { + return a.part < b.part; + } + return a.vertexIndex < b.vertexIndex; + } + PX_INLINE static int cmp(const void* A, const void* B) + { + // Sorts by part, then vertexIndex + const int delta = (int)((VertexPart*)A)->part - (int)((VertexPart*)B)->part; + return delta != 0 ? delta : ((int)((VertexPart*)A)->vertexIndex - (int)((VertexPart*)B)->vertexIndex); + } + }; + + // helper methods + template<typename PxU> + bool fillSubmeshMap(physx::Array<VertexPart>& submeshMap, const void* const partIndicesVoid, uint32_t numParts, + const void* const vertexIndicesVoid, uint32_t numSubmeshIndices, uint32_t numSubmeshVertices); + + // protected constructors + ApexRenderMeshAssetAuthoring(ResourceList& list); + virtual ~ApexRenderMeshAssetAuthoring(); +}; + +} +} // end namespace nvidia::apex + +#endif // WITHOUT_APEX_AUTHORING + +#endif // APEX_RENDERMESH_ASSET_H diff --git a/APEX_1.4/framework/include/ApexRenderSubmesh.h b/APEX_1.4/framework/include/ApexRenderSubmesh.h new file mode 100644 index 00000000..f0a4e5c6 --- /dev/null +++ b/APEX_1.4/framework/include/ApexRenderSubmesh.h @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_RENDER_SUBMESH_H +#define APEX_RENDER_SUBMESH_H + +#include "RenderMeshAssetIntl.h" +#include "ApexVertexBuffer.h" +#include "SubmeshParameters.h" + +namespace nvidia +{ +namespace apex +{ + +class ApexRenderSubmesh : public RenderSubmeshIntl, public UserAllocated +{ +public: + ApexRenderSubmesh() : mParams(NULL) {} + ~ApexRenderSubmesh() {} + + // from RenderSubmesh + virtual uint32_t getVertexCount(uint32_t partIndex) const + { + return mParams->vertexPartition.buf[partIndex + 1] - mParams->vertexPartition.buf[partIndex]; + } + + virtual const VertexBufferIntl& getVertexBuffer() const + { + return mVertexBuffer; + } + + virtual uint32_t getFirstVertexIndex(uint32_t partIndex) const + { + return mParams->vertexPartition.buf[partIndex]; + } + + virtual uint32_t getIndexCount(uint32_t partIndex) const + { + return mParams->indexPartition.buf[partIndex + 1] - mParams->indexPartition.buf[partIndex]; + } + + virtual const uint32_t* getIndexBuffer(uint32_t partIndex) const + { + return mParams->indexBuffer.buf + mParams->indexPartition.buf[partIndex]; + } + + virtual const uint32_t* getSmoothingGroups(uint32_t partIndex) const + { + return mParams->smoothingGroups.buf != NULL ? (mParams->smoothingGroups.buf + mParams->indexPartition.buf[partIndex]/3) : NULL; + } + + + // from RenderSubmeshIntl + virtual VertexBufferIntl& getVertexBufferWritable() + { + return mVertexBuffer; + } + + virtual uint32_t* getIndexBufferWritable(uint32_t partIndex) + { + return mParams->indexBuffer.buf + mParams->indexPartition.buf[partIndex]; + } + + virtual void applyPermutation(const Array<uint32_t>& old2new, const Array<uint32_t>& new2old); + + // own methods + + uint32_t getTotalIndexCount() const + { + return (uint32_t)mParams->indexBuffer.arraySizes[0]; + } + + uint32_t* getIndexBufferWritable(uint32_t partIndex) const + { + return mParams->indexBuffer.buf + mParams->indexPartition.buf[partIndex]; + } + + bool createFromParameters(SubmeshParameters* params); + + void setParams(SubmeshParameters* submeshParams, VertexBufferParameters* vertexBufferParams); + + void addStats(RenderMeshAssetStats& stats) const; + + void buildVertexBuffer(const VertexFormat& format, uint32_t vertexCount); + + SubmeshParameters* mParams; + +private: + ApexVertexBuffer mVertexBuffer; + + // No assignment + ApexRenderSubmesh& operator = (const ApexRenderSubmesh&); +}; + +} // namespace apex +} // namespace nvidia + +#endif // APEX_RENDER_SUBMESH_H diff --git a/APEX_1.4/framework/include/ApexResourceProvider.h b/APEX_1.4/framework/include/ApexResourceProvider.h new file mode 100644 index 00000000..1869aa75 --- /dev/null +++ b/APEX_1.4/framework/include/ApexResourceProvider.h @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef __APEX_RESOURCE_PROVIDER_H__ +#define __APEX_RESOURCE_PROVIDER_H__ + +#include "Apex.h" +#include "PsUserAllocated.h" +#include "PsHashMap.h" +#include "ResourceProviderIntl.h" +#include "ApexString.h" +#include "PsArray.h" + +namespace nvidia +{ +namespace apex +{ + +class ApexResourceProvider : public ResourceProviderIntl, public UserAllocated +{ +public: + /* == Public ResourceProvider interface == */ + virtual void registerCallback(ResourceCallback* impl); + virtual void setResource(const char* nameSpace, const char* name, void* resource, bool incRefCount); + virtual void setResourceU32(const char* nameSpace, const char* name, uint32_t id, bool incRefCount); + virtual void* getResource(const char* nameSpace, const char* name); + virtual uint32_t releaseAllResourcesInNamespace(const char* nameSpace); + virtual uint32_t releaseResource(const char* nameSpace, const char* name); + virtual bool findRefCount(const char* nameSpace, const char* name, uint32_t& refCount); + virtual void* findResource(const char* nameSpace, const char* name); + virtual uint32_t findResourceU32(const char* nameSpace, const char* name); // find an existing resource. + virtual void** findAllResources(const char* nameSpace, uint32_t& count); // find all resources in this namespace + virtual const char** findAllResourceNames(const char* nameSpace, uint32_t& count); // find all resources in this namespace + virtual const char** findNameSpaces(uint32_t& count); + virtual void dumpResourceTable(); + + /* == Internal ResourceProviderIntl interface == */ + void setResource(const char* nameSpace, const char* name, void* resource, bool valueIsSet, bool incRefCount); + ResID createNameSpace(const char* nameSpace, bool releaseAtExit) + { + return createNameSpaceInternal(nameSpace, releaseAtExit); + } + ResID createResource(ResID nameSpace, const char* name, bool refCount); + bool checkResource(ResID nameSpace, const char* name); + bool checkResource(ResID id); + void releaseResource(ResID id); + void generateUniqueName(ResID nameSpace, ApexSimpleString& name); + void* getResource(ResID id); + const char* getResourceName(ResID id); + const char* getResourceNameSpace(ResID id); + bool getResourceIDs(const char* nameSpace, ResID* outResIDs, uint32_t& outCount, uint32_t inCount); + + // [PVD INTEGRATION CODE] =========================================== + PX_INLINE uint32_t getResourceCount() const + { + return mResources.size(); + } + // ================================================================== + + // the NRP can either be case sensitive or not, this method takes care of that option + PX_INLINE bool isCaseSensitive() + { + return mCaseSensitive; + } + + /** + \brief Sets the resource provider's case sensitive mode. + + \note This must be done immediately after initialization so no names are hashed + using the wrong mode. + */ + void setCaseSensitivity(bool caseSensitive) + { + mCaseSensitive = caseSensitive; + } + + // uses the correct string matching function based on the case sensitivity mode + bool stringsMatch(const char* str0, const char* str1); + +protected: + ApexResourceProvider(); + virtual ~ApexResourceProvider(); + void destroy(); + +private: + ResID createNameSpaceInternal(const char* &nameSpace, bool releaseAtExit); + + class NameSpace: public UserAllocated + { + public: + NameSpace(ApexResourceProvider* arp, ResID nsid, bool releaseAtExit, const char* nameSpace); + ~NameSpace(); + + ResID getOrCreateID(const char* &name, const char* NSName); + ResID getID() const + { + return mId; + } + bool releaseAtExit() const + { + return mReleaseAtExit; + } + const char* getNameSpace(void) const + { + return mNameSpace; + }; + + private: + struct entryHeader + { + const char* nextEntry; + ResID id; + }; + enum { HashSize = 1024 }; + bool mReleaseAtExit; + uint16_t genHash(const char* name); + const char* hash[HashSize]; + ApexResourceProvider* mArp; + ResID mId; + char* mNameSpace; + }; + + // NOTE: someone thinks this struct needs to be padded to nearest 16 or 32 bytes + // it's not padded at the moment, but watch out for this + struct resource + { + void* ptr; + const char* name; + const char* nameSpace; + uint16_t refCount; + uint8_t valueIsSet; + uint8_t usedGetResource; + }; + + typedef physx::HashMap<ResID, ResID> HashMapNSID; + + ResID getNSID(const char* nsName); + uint32_t getNSIndex(ResID nameSpace); + + HashMapNSID mNSID; + + NameSpace mNSNames; + physx::Array<resource> mResources; + physx::Array<NameSpace*> mNameSpaces; + ResourceCallback* mUserCallback; + physx::Array< const char* > mCharResults; + bool mCaseSensitive; + + + enum { UnknownValue = 0xFFFFFFFF }; + + friend class ApexSDKImpl; +}; + +} +} // end namespace nvidia::apex + +#endif // __APEX_RESOURCE_PROVIDER_H__ diff --git a/APEX_1.4/framework/include/ApexSDKImpl.h b/APEX_1.4/framework/include/ApexSDKImpl.h new file mode 100644 index 00000000..ec977ae2 --- /dev/null +++ b/APEX_1.4/framework/include/ApexSDKImpl.h @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_SDK_IMPL_H +#define APEX_SDK_IMPL_H + +#include "Apex.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "ApexInterface.h" +#include "ApexSDKHelpers.h" +#include "ApexContext.h" +#include "ApexPhysXObjectDesc.h" +#include "FrameworkPerfScope.h" +#include "ApexSDKIntl.h" +#include "AuthorableObjectIntl.h" +#include "SceneIntl.h" +#include "RenderDebugInterface.h" +#include "ApexRenderMeshAsset.h" +#include "ApexAuthorableObject.h" +#include "ModuleIntl.h" +#include "DebugColorParamsEx.h" + +#include "ModuleCommonRegistration.h" +#include "ModuleFrameworkRegistration.h" + +#include "ApexSDKCachedDataImpl.h" + +namespace physx +{ + class PxCudaContextManager; + class PxCudaContextManagerDesc; + + namespace pvdsdk + { + class PvdDataStream; + class ApexPvdClient; + } +} + +#if APEX_CUDA_SUPPORT +namespace nvidia +{ + class PhysXGpuIndicator; +} +#endif + +namespace nvidia +{ + namespace apex + { + + class ApexResourceProvider; + class ApexScene; + class RenderMeshAsset; + + typedef PxFileBuf* (CreateStreamFunc)(const char* filename, PxFileBuf::OpenMode mode); + + + // ApexAuthorableObject needs a "module", so we'll give it one that + // describes the APEX framework with regards to render mesh stuff + // needed: ModuleIntl, no methods implemented + class ModuleFramework : public ModuleIntl + { + void destroy() {} + + ModuleSceneIntl* createInternalModuleScene(SceneIntl& apexScene, RenderDebugInterface* rd) + { + PX_UNUSED(apexScene); + PX_UNUSED(rd); + return NULL; + } + + void releaseModuleSceneIntl(ModuleSceneIntl& moduleScene) + { + PX_UNUSED(moduleScene); + } + + public: + + void init(NvParameterized::Traits* t); + void release(NvParameterized::Traits* t); + }; + + + class ApexSDKImpl : public ApexSDKIntl, public ApexRWLockable, public UserAllocated + { + public: + APEX_RW_LOCKABLE_BOILERPLATE + + ApexSDKImpl(ApexCreateError* errorCode, uint32_t APEXsdkVersion); + void init(const ApexSDKDesc& desc); + + /* ApexSDK */ + Scene* createScene(const SceneDesc&); + void releaseScene(Scene* scene); + AssetPreviewScene* createAssetPreviewScene(); + void releaseAssetPreviewScene(AssetPreviewScene* nxScene); + + Module* createModule(const char* name, ApexCreateError* err); + +#if PX_PHYSICS_VERSION_MAJOR == 0 + PxCpuDispatcher* createCpuDispatcher(uint32_t numThreads); + PxCpuDispatcher* getDefaultThreadPool(); + void releaseCpuDispatcher(PxCpuDispatcher& cd); +#endif + + /** + Creates/releases an ApexDebugRender interface + */ + virtual RenderDebugInterface* createApexRenderDebug(RENDER_DEBUG::RenderDebugInterface* iface, bool useRemoteDebugVisualization); + virtual void releaseApexRenderDebug(RenderDebugInterface& debug); + + + /** + Create/release ApexShape interfaces + */ + + virtual SphereShape* createApexSphereShape(); + virtual CapsuleShape* createApexCapsuleShape(); + virtual BoxShape* createApexBoxShape(); + virtual HalfSpaceShape* createApexHalfSpaceShape(); + + virtual void releaseApexShape(Shape& shape); + +#if PX_PHYSICS_VERSION_MAJOR == 3 + PhysXObjectDescIntl* createObjectDesc(const Actor*, const PxActor*); + PhysXObjectDescIntl* createObjectDesc(const Actor*, const PxShape*); + PhysXObjectDescIntl* createObjectDesc(const Actor*, const PxJoint*); + PhysXObjectDescIntl* createObjectDesc(const Actor*, const PxCloth*); + PhysXObjectDescIntl* createObjectDesc(const Actor*, const PxParticleSystem*); + PhysXObjectDescIntl* createObjectDesc(const Actor*, const PxParticleFluid*); + const PhysXObjectDesc* getPhysXObjectInfo(const PxActor*) const; + const PhysXObjectDesc* getPhysXObjectInfo(const PxShape*) const; + const PhysXObjectDesc* getPhysXObjectInfo(const PxJoint*) const; + const PhysXObjectDesc* getPhysXObjectInfo(const PxCloth*) const; + const PhysXObjectDesc* getPhysXObjectInfo(const PxParticleSystem*) const; + const PhysXObjectDesc* getPhysXObjectInfo(const PxParticleFluid*) const; + PxCooking* getCookingInterface(); + PxPhysics* getPhysXSDK(); +#endif // PX_PHYSICS_VERSION_MAJOR == 3 + + ApexActor* getApexActor(Actor*) const; + + // deprecated, use getErrorCallback() + PxErrorCallback* getOutputStream(); + PxFoundation* getFoundation() const; + PxErrorCallback* getErrorCallback() const; + PxAllocatorCallback* getAllocator() const; + ResourceProvider* getNamedResourceProvider(); + ResourceProviderIntl* getInternalResourceProvider(); + PxFileBuf* createStream(const char* filename, PxFileBuf::OpenMode mode); + PxFileBuf* createMemoryReadStream(const void* mem, uint32_t len); + PxFileBuf* createMemoryWriteStream(uint32_t alignment = 0); + const void* getMemoryWriteBuffer(PxFileBuf& stream, uint32_t& len); + void releaseMemoryReadStream(PxFileBuf& stream); + void releaseMemoryWriteStream(PxFileBuf& stream); + + uint32_t getNbModules(); + Module** getModules(); + ModuleIntl** getInternalModules(); + void releaseModule(Module* module); + ModuleIntl* getInternalModuleByName(const char* name); + + uint32_t forceLoadAssets(); + + const char* checkAssetName(AuthorableObjectIntl& ao, const char* inName, ApexSimpleString& autoNameStorage); + AssetAuthoring* createAssetAuthoring(const char* authorTypeName); + AssetAuthoring* createAssetAuthoring(const char* authorTypeName, const char* name); + AssetAuthoring* createAssetAuthoring(NvParameterized::Interface* params, const char* name); + Asset* createAsset(AssetAuthoring&, const char*); + Asset* createAsset(NvParameterized::Interface* params, const char* name); + virtual Asset* createAsset(const char* opaqueMeshName, UserOpaqueMesh* om); + void releaseAsset(Asset& nxasset); + void releaseAssetAuthoring(AssetAuthoring&); + /* ApexSDKIntl */ + void reportError(PxErrorCode::Enum code, const char* file, int line, const char* functionName, const char* message, ...); + void* getTempMemory(uint32_t size); + void releaseTempMemory(void* data); + NvParameterized::Traits* getParameterizedTraits() + { + return mParameterizedTraits; + } + uint32_t getCookingVersion() const + { + return cookingVersion; + } + void registerExternalModule(Module* nx, ModuleIntl* ni) + { + registerModule(nx, ni); + } + + AuthObjTypeID registerAuthObjType(const char*, ResID nsid); + AuthObjTypeID registerAuthObjType(const char*, AuthorableObjectIntl* authObjPtr); + AuthObjTypeID registerNvParamAuthType(const char*, AuthorableObjectIntl* authObjPtr); + void unregisterAuthObjType(const char*); + void unregisterNvParamAuthType(const char*); + AuthorableObjectIntl* getAuthorableObject(const char*); + AuthorableObjectIntl* getParamAuthObject(const char*); + bool getAuthorableObjectNames(const char** authTypeNames, uint32_t& outCount, uint32_t inCount); + ResID getMaterialNameSpace() const + { + return mMaterialNS; + } + ResID getOpaqueMeshNameSpace() const + { + return mOpaqueMeshNS; + } + ResID getCustomVBNameSpace() const + { + return mCustomVBNS; + } + ResID getApexMeshNameSpace(); + ResID getCollisionGroupNameSpace() const + { + return mCollGroupNS; + } + ResID getCollisionGroup128NameSpace() const + { + return mCollGroup128NS; + } + ResID getCollisionGroup64NameSpace() const + { + return mCollGroup64NS; + } + ResID getCollisionGroupMaskNameSpace() const + { + return mCollGroupMaskNS; + } + ResID getPhysicalMaterialNameSpace() const + { + return mPhysMatNS; + } + ResID getAuthorableTypesNameSpace() const + { + return mObjTypeNS; + } + + void releaseObjectDesc(void*); + UserRenderResourceManager* getUserRenderResourceManager() const + { + return renderResourceManagerWrapper ? renderResourceManagerWrapper : renderResourceManager; + } + + const char* getWireframeMaterial(); + const char* getSolidShadedMaterial(); + virtual pvdsdk::ApexPvdClient* getApexPvdClient(); + virtual profile::PxProfileZone * getProfileZone(); + virtual profile::PxProfileZoneManager * getProfileZoneManager(); + + virtual void setEnableApexStats(bool enableApexStats) + { + mEnableApexStats = enableApexStats; + } + + virtual void setEnableConcurrencyCheck(bool enableConcurrencyCheck) + { + mEnableConcurrencyCheck = enableConcurrencyCheck; + } + + virtual bool isConcurrencyCheckEnabled() + { + return mEnableConcurrencyCheck; + } + + bool isApexStatsEnabled() const + { + return mEnableApexStats; + } + +#if PX_WINDOWS_FAMILY + virtual const char* getAppGuid(); +#endif + +#if APEX_CUDA_SUPPORT + virtual PhysXGpuIndicator* registerPhysXIndicatorGpuClient(); + virtual void unregisterPhysXIndicatorGpuClient(PhysXGpuIndicator* gpuIndicator); +#endif + + ApexSDKCachedData& getCachedData() const + { + return *mCachedData; + } + + NvParameterized::Serializer* createSerializer(NvParameterized::Serializer::SerializeType type); + NvParameterized::Serializer* createSerializer(NvParameterized::Serializer::SerializeType type, NvParameterized::Traits* traits); + + NvParameterized::Serializer::SerializeType getSerializeType(const void* data, uint32_t dlen); + NvParameterized::Serializer::SerializeType getSerializeType(PxFileBuf& stream); + + NvParameterized::Serializer::ErrorType getSerializePlatform(const void* data, uint32_t dlen, NvParameterized::SerializePlatform& platform); + NvParameterized::Serializer::ErrorType getSerializePlatform(PxFileBuf& stream, NvParameterized::SerializePlatform& platform); + void getCurrentPlatform(NvParameterized::SerializePlatform& platform) const; + bool getPlatformFromString(const char* name, NvParameterized::SerializePlatform& platform) const; + const char* getPlatformName(const NvParameterized::SerializePlatform& platform) const; + + NvParameterized::Interface* getDebugColorParams() const + { + return mDebugColorParams; + } + void updateDebugColorParams(const char* color, uint32_t val); + + bool getRMALoadMaterialsLazily(); + + // applications can append strings to the APEX DLL filenames + const char* getCustomDllNamePostfix() const + { + return mCustomDllNamePostfix.c_str(); + } + + virtual ModuleIntl *getInternalModule(Module *module); + virtual Module *getModule(ModuleIntl *module); + + virtual void enterURR(); + virtual void leaveURR(); + virtual void checkURR(); + + protected: + virtual ~ApexSDKImpl(); + void registerModule(Module*, ModuleIntl*); + void release(); + + private: + + void debugAsset(Asset* asset, const char* name); + + ApexSimpleString mDllLoadPath; + ApexSimpleString mCustomDllNamePostfix; + + ApexSimpleString mWireframeMaterial; + ApexSimpleString mSolidShadedMaterial; + +#if PX_WINDOWS_FAMILY + ApexSimpleString mAppGuid; +#endif + + ResourceList* mAuthorableObjects; + + physx::Array<Module*> modules; + physx::Array<Module*> moduleListForAPI; + physx::Array<ModuleIntl*> imodules; + physx::Array<Scene*> mScenes; + + PhysXObjectDescIntl* createObjectDesc(const Actor*, const void*); + PhysXObjectDescIntl* getGenericPhysXObjectInfo(const void*) const; + + enum { DescHashSize = 1024U * 32U }; + + uint32_t mBatchSeedSize; + + mutable nvidia::Mutex mPhysXObjDescsLock; + + physx::Array<ApexPhysXObjectDesc> mPhysXObjDescs; + uint32_t mPhysXObjDescHash[DescHashSize]; + uint32_t mDescFreeList; + ResID mObjTypeNS; + ResID mNxParamObjTypeNS; + + char* mErrorString; + //temp memories: + struct TempMemory + { + TempMemory() : memory(NULL), size(0), used(0) {} + void* memory; + uint32_t size; + uint32_t used; + }; + physx::Array<TempMemory> mTempMemories; + uint32_t mNumTempMemoriesActive; //temp memories are a LIFO, mNumTempMemoriesActive <= mTempMemories.size() + nvidia::Mutex mTempMemoryLock; + nvidia::Mutex mReportErrorLock; + + PxFoundation* foundation; + +#if PX_PHYSICS_VERSION_MAJOR == 0 + PxCpuDispatcher* mApexThreadPool; + physx::Array<PxCpuDispatcher*> mUserAllocThreadPools; +#else + PxPhysics* physXSDK; + PxCooking* cooking; +#endif // PX_PHYSICS_VERSION_MAJOR == 0 + + UserRenderResourceManager* renderResourceManager; + UserRenderResourceManager* renderResourceManagerWrapper; + ApexResourceProvider* apexResourceProvider; + uint32_t physXsdkVersion; + uint32_t cookingVersion; + + NvParameterized::Traits* mParameterizedTraits; + + ResID mMaterialNS; + ResID mOpaqueMeshNS; + ResID mCustomVBNS; + ResID mCollGroupNS; + ResID mCollGroup128NS; + ResID mCollGroup64NS; + ResID mCollGroupMaskNS; + ResID mPhysMatNS; + + ModuleFramework frameworkModule; + + ApexSDKCachedDataImpl* mCachedData; + + DebugColorParamsEx* mDebugColorParams; + + bool mRMALoadMaterialsLazily; + +#ifdef PHYSX_PROFILE_SDK + pvdsdk::ApexPvdClient* mApexPvdClient; + profile::PxProfileZone *mProfileZone; +#endif + + uint32_t mURRdepthTLSslot; + + bool mEnableApexStats; + bool mEnableConcurrencyCheck; + }; + + + /////////////////////////////////////////////////////////////////////////////// + // ApexRenderMeshAssetAuthoring + /////////////////////////////////////////////////////////////////////////////// + // Didn't use ApexAuthorableObject<> here because there were enough differences + // from a "normal" asset to make it difficult. I could probably bend the will + // of the APEX render mesh to get it to comply, but it wasn't worth it at the time. + // -LRR + + class RenderMeshAuthorableObject : public AuthorableObjectIntl + { + public: + RenderMeshAuthorableObject(ModuleIntl* m, ResourceList& list, const char* parameterizedName) : + AuthorableObjectIntl(m, list, ApexRenderMeshAsset::getClassName()) + { + // Register the proper authorable object type in the NRP (override) + mAOResID = GetInternalApexSDK()->getInternalResourceProvider()->createNameSpace(mAOTypeName.c_str()); + mAOPtrResID = GetInternalApexSDK()->registerAuthObjType(mAOTypeName.c_str(), this); + + mParameterizedName = parameterizedName; + + // Register the parameterized name in the NRP to point to this authorable object + GetInternalApexSDK()->registerNvParamAuthType(mParameterizedName.c_str(), this); + } + + Asset* createAsset(AssetAuthoring& author, const char* name); + Asset* createAsset(NvParameterized::Interface* params, const char* name); + + void releaseAsset(Asset& nxasset); + + AssetAuthoring* createAssetAuthoring(); + AssetAuthoring* createAssetAuthoring(const char* name); + AssetAuthoring* createAssetAuthoring(NvParameterized::Interface* params, const char* name); + void releaseAssetAuthoring(AssetAuthoring& nxauthor); + + uint32_t forceLoadAssets(); + virtual uint32_t getAssetCount() + { + return mAssets.getSize(); + } + virtual bool getAssetList(Asset** outAssets, uint32_t& outAssetCount, uint32_t inAssetCount) + { + PX_ASSERT(outAssets); + PX_ASSERT(inAssetCount >= mAssets.getSize()); + + if (!outAssets || inAssetCount < mAssets.getSize()) + { + outAssetCount = 0; + return false; + } + + outAssetCount = mAssets.getSize(); + for (uint32_t i = 0; i < mAssets.getSize(); i++) + { + ApexRenderMeshAsset* asset = static_cast<ApexRenderMeshAsset*>(mAssets.getResource(i)); + outAssets[i] = static_cast<Asset*>(asset); + } + + return true; + } + + + ResID getResID() + { + return mAOResID; + } + + ApexSimpleString& getName() + { + return mAOTypeName; + } + + // Resource methods + void release(); + void destroy(); + }; + + } +} // end namespace nvidia::apex + + +#endif // APEX_SDK_IMPL_H diff --git a/APEX_1.4/framework/include/ApexScene.h b/APEX_1.4/framework/include/ApexScene.h new file mode 100644 index 00000000..949a25ac --- /dev/null +++ b/APEX_1.4/framework/include/ApexScene.h @@ -0,0 +1,585 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_SCENE_H +#define APEX_SCENE_H + +#include "Apex.h" +#include "ApexResource.h" +#include "PsUserAllocated.h" +#include "ApexSDKImpl.h" +#include "SceneIntl.h" +#include "ModuleIntl.h" +#include "ApexContext.h" + +#include "PsMutex.h" +#include "PsThread.h" +#include "PairFilter.h" + +#if PX_PHYSICS_VERSION_MAJOR == 3 +#include "PxScene.h" +#include "PxRenderBuffer.h" +#endif + +#include "MirrorSceneImpl.h" +#include "ApexSceneUserNotify.h" + +#include "PsSync.h" +#include "PxTask.h" +#include "PxTaskManager.h" + +#include "ApexGroupsFiltering.h" +#include "ApexRWLockable.h" +#include "ReadCheck.h" +#include "WriteCheck.h" + +class PxDefaultSpuDispatcher; + + +namespace nvidia +{ +namespace apex +{ + +class ApexCudaTestManager; +class ApexCudaProfileManager; + +// Tasks forward declarations +class PhysXSimulateTask; +class PhysXBetweenStepsTask; + +#if APEX_DURING_TICK_TIMING_FIX +class DuringTickCompleteTask; +#endif + +class CheckResultsTask; +class FetchResultsTask; + + +class ApexScene : public SceneIntl, public ApexContext, public ApexRWLockable, public UserAllocated +{ +public: + APEX_RW_LOCKABLE_BOILERPLATE + + /* == Public Scene interface == */ + void simulate(float elapsedTime, + bool finalStep = true, + PxBaseTask *completionTask = NULL, + void* scratchMemBlock = 0, + uint32_t scratchMemBlockSize = 0); + + bool fetchResults(bool block, uint32_t* errorState); + void fetchPhysXStats(); + void fetchApexStats(); + bool checkResults(bool block) const; + + void initDebugColorParams(); + void updateDebugColorParams(const char* color, uint32_t val); + NvParameterized::Interface* getDebugRenderParams() const; + NvParameterized::Interface* getModuleDebugRenderParams(const char* name) const; + + uint32_t allocViewMatrix(ViewMatrixType::Enum); + uint32_t allocProjMatrix(ProjMatrixType::Enum); + uint32_t getNumViewMatrices() const; + uint32_t getNumProjMatrices() const; + + void setViewMatrix(const PxMat44& viewTransform, const uint32_t viewID = 0); + PxMat44 getViewMatrix(const uint32_t viewID = 0) const; + void setProjMatrix(const PxMat44& projTransform, const uint32_t projID = 0); + PxMat44 getProjMatrix(const uint32_t projID = 0) const; + + void setUseViewProjMatrix(const uint32_t viewID = 0, const uint32_t projID = 0); +#if 0 //lionel: work in progress + const PxMat44& getViewProjMatrix() const; +#endif + void setViewParams(const PxVec3& eyePosition, + const PxVec3& eyeDirection, + const PxVec3& worldUpDirection, + const uint32_t viewID = 0); + + void setProjParams(float nearPlaneDistance, + float farPlaneDistance, + float fieldOfViewDegree, + uint32_t viewportWidth, + uint32_t viewportHeight, + const uint32_t projID = 0); + + PxVec3 getEyePosition(const uint32_t viewID = 0) const; + PxVec3 getEyeDirection(const uint32_t viewID = 0) const; + + +#if 0 //lionel: work in progress + const PxMat44& buildViewMatrix(const uint32_t viewID = 0); + const PxMat44& buildProjMatrix(const uint32_t projID = 0); + //viewportToWorld?, worldToViewport? (and screenspace) + const SceneCalculator* const calculate() + { + return mSceneCalculator; + } +#endif + + float getElapsedTime() const + { + return mElapsedTime; + } + + const SceneStats* getStats(void) const; + void createApexStats(void); + void destroyApexStats(void); + void setApexStatValue(int32_t index, StatValue dataVal); + + + bool isSimulating() const + { + return mSimulating; + } + bool physXElapsedTime(float& dt) const + { + dt = mPxLastElapsedTime; + return mPxStepWasValid; + } + float getPhysXSimulateTime() const + { + return mPhysXSimulateTime; + } + + PxVec3 getGravity() const + { +#if PX_PHYSICS_VERSION_MAJOR == 3 + if (mPhysXScene) + { + mPhysXScene->lockRead(); + PxVec3 ret = mPhysXScene->getGravity(); + mPhysXScene->unlockRead(); + return ret; + } +#endif + return mGravity; + } + + void setGravity(const PxVec3& gravity) + { + mGravity = gravity; +#if PX_PHYSICS_VERSION_MAJOR == 3 + if (mPhysXScene) + { + mPhysXScene->lockWrite(); + mPhysXScene->setGravity(gravity); + mPhysXScene->unlockWrite(); + } +#endif + } + + void release() + { + mApexSDK->releaseScene(this); + } + + /* == Public Context interface == */ + ApexContext* getApexContext() + { + return DYNAMIC_CAST(ApexContext*)(this); + } + void removeAllActors(); + RenderableIterator* createRenderableIterator() + { + return ApexContext::createRenderableIterator(); + } + void releaseRenderableIterator(RenderableIterator& iter) + { + ApexContext::releaseRenderableIterator(iter); + } + uint32_t addActor(ApexActor& actor, ApexActor* actorPtr = NULL); + + /* == Renderable interface == */ + void lockRenderResources(); + void unlockRenderResources(); + void updateRenderResources(bool rewriteBuffers = false, void* userRenderData = 0); + void dispatchRenderResources(UserRenderer& renderer); + PxBounds3 getBounds() const; + + void visualize(); + + /* == SceneIntl interface == */ + void moduleReleased(ModuleSceneIntl&); + virtual PxTaskManager* getTaskManager() const + { + READ_ZONE(); + return mTaskManager; + }; + + uint32_t getTotalElapsedMS() const + { + return mTotalElapsedMS; + } + + bool isFinalStep() const + { + return mFinalStep; + } + +#if PX_PHYSICS_VERSION_MAJOR == 3 + virtual void lockRead(const char *fileName,uint32_t lineno) + { + if (mPhysXScene != NULL) + { + mPhysXScene->lockRead(fileName,lineno); + } + } + + virtual void lockWrite(const char *fileName,uint32_t lineno) + { + if (mPhysXScene != NULL) + { + mPhysXScene->lockWrite(fileName,lineno); + } + } + + + virtual void unlockRead () + { + if (mPhysXScene != NULL) + { + mPhysXScene->unlockRead(); + } + } + + virtual void unlockWrite () + { + if (mPhysXScene != NULL) + { + mPhysXScene->unlockWrite(); + } + } + + virtual void addActorPair(PxActor *actor0,PxActor *actor1); + virtual void removeActorPair(PxActor *actor0,PxActor *actor1); + virtual bool findActorPair(PxActor *actor0,PxActor *actor1) const; +#endif + + virtual void addBoundingBox(const PxBounds3& bounds, UserBoundingBoxFlags::Enum flags) + { + WRITE_ZONE(); + mBBs.pushBack(UserDefinedBoundingBox(bounds, flags)); + } + + virtual const PxBounds3 getBoundingBox(const uint32_t index) const + { + READ_ZONE(); + PX_ASSERT(index < mBBs.size()); + if(index < mBBs.size()) + { + return mBBs[index].bb; + } + return PxBounds3(PxVec3(0.0f), PxVec3(0.0f)); + } + + virtual UserBoundingBoxFlags::Enum getBoundingBoxFlags(const uint32_t index) const + { + READ_ZONE(); + PX_ASSERT(index < mBBs.size()); + if(index < mBBs.size()) + { + return mBBs[index].flags; + } + return UserBoundingBoxFlags::NONE; + } + + virtual uint32_t getBoundingBoxCount() const + { + READ_ZONE(); + return mBBs.size(); + } + + virtual void removeBoundingBox(const uint32_t index) + { + WRITE_ZONE(); + PX_ASSERT(index < mBBs.size()); + if(index < mBBs.size()) + { + mBBs.remove(index); + } + } + + virtual void removeAllBoundingBoxes() + { + WRITE_ZONE(); + mBBs.clear(); + } + + void allocateTasks(); + void freeTasks(); + void setUseDebugRenderable(bool state); + + ApexScene(const SceneDesc& desc, ApexSDKImpl* sdk); + ~ApexScene(); + + void moduleCreated(ModuleIntl&); + void destroy(); + + const PxRenderBuffer* getRenderBuffer() const; + const PxRenderBuffer* getRenderBufferScreenSpace() const; + +#if PX_PHYSICS_VERSION_MAJOR == 3 + + virtual MirrorScene *createMirrorScene(nvidia::apex::Scene &mirrorScene, + MirrorScene::MirrorFilter &mirrorFilter, + float mirrorStaticDistance, + float mirrorDynamicDistance, + float mirrorDistanceThreshold); + + + void setPhysXScene(PxScene* s); + PxScene* getPhysXScene() const + { + READ_ZONE(); + return mPhysXScene; + } + + PxScene* mPhysXScene; + + mutable PhysXRenderBuffer mRenderBuffer; + mutable PhysXRenderBuffer mRenderBufferScreenSpace; + + void addModuleUserNotifier(physx::PxSimulationEventCallback& notify) + { + mUserNotify.addModuleNotifier(notify); + } + void removeModuleUserNotifier(physx::PxSimulationEventCallback& notify) + { + mUserNotify.removeModuleNotifier(notify); + } + void addModuleUserContactModify(physx::PxContactModifyCallback& contactModify) + { + mUserContactModify.addModuleContactModify(contactModify); + } + void removeModuleUserContactModify(physx::PxContactModifyCallback& contactModify) + { + mUserContactModify.removeModuleContactModify(contactModify); + } + + ApexSceneUserNotify mUserNotify; + ApexSceneUserContactModify mUserContactModify; + + PhysX3Interface* getApexPhysX3Interface() const + { + return mPhysX3Interface; + } + + PhysX3Interface* mPhysX3Interface; +#endif + + ModuleSceneIntl* getInternalModuleScene(const char* moduleName); + + PX_INLINE void* getCudaTestManager() const + { + return mCudaTestManager; + } + PX_INLINE ApexCudaTestManager& getApexCudaTestManager() + { + return *mCudaTestManager; + } + PX_INLINE void* getCudaProfileManager() const + { + return mCudaProfileManager; + } + bool isUsingCuda() const + { + return mUseCuda; + } + + virtual void setCudaKernelCheckEnabled(bool enabled) + { + mCudaKernelCheckEnabled = enabled; + } + virtual bool getCudaKernelCheckEnabled() const + { + return mCudaKernelCheckEnabled; + } + + float mElapsedTime; + ApexSDKImpl* mApexSDK; + Array<ModuleSceneIntl*> mModuleScenes; + RenderDebugInterface* mSceneRenderDebug; + + uint32_t mOrigSceneMaxIter; + float mOrigSceneSubstepSize; + + PxTaskManager* mTaskManager; + + Mutex mPhysXLock; + + bool mSimulating; + bool mUseDebugRenderable; + float mUsedResource; + float mSumBenefit; + mutable Sync mFetchResultsReady; + Sync mSimulationComplete; + + PhysXSimulateTask* mPhysXSimulate; + PhysXBetweenStepsTask* mBetweenstepTasks; +#if APEX_DURING_TICK_TIMING_FIX + DuringTickCompleteTask* mDuringTickComplete; +#endif + CheckResultsTask* mCheckResults; + FetchResultsTask* mFetchResults; + + uint32_t mTotalElapsedMS; + float mTimeRemainder; + float mPhysXRemainder; + float mPhysXSimulateTime; + + float mPxLastElapsedTime; + float mPxAccumElapsedTime; + bool mPxStepWasValid; + bool mFinalStep; + + bool mUseCuda; + + + static double mQPC2MilliSeconds; + static PX_INLINE float ticksToMilliseconds(uint64_t t0, uint64_t t1) + { + return (float)((double)(t1 - t0) * mQPC2MilliSeconds); + } + + uint64_t mApexSimulateTickCount; + uint64_t mPhysXSimulateTickCount; + + static const uint32_t IgnoredSeed = UINT32_MAX; + + uint32_t getSeed(); + +private: + void updateGravity(); + + SceneStats mApexSceneStats; + + mutable ApexCudaTestManager* mCudaTestManager; + mutable ApexCudaProfileManager* mCudaProfileManager; + bool mCudaKernelCheckEnabled; + + /* transforms info */ +#if 0 //lionel: work in progress + void getColMajColVecArray(const PxMat44& colVecMat44, float* const result); + void getColVecMat44(const float* const colMajColVecArray, PxMat44& result); + void multiplyColMajColVecArray(const float* const fromSpace, const float* const toSpace, float* const result); + float mViewColMajColVecArray[16]; + float mProjColMajColVecArray[16]; + float mViewProjColMajColVecArray[16]; +#endif + struct ViewMatrixProperties : public UserAllocated + { + ViewMatrixProperties() {} + ~ViewMatrixProperties() {} + ViewMatrixProperties(PxMat44 v, bool l) : + viewMatrix(v), isLookAt(l), pvdCreated(false) {} + + PxMat44 viewMatrix; + bool isUserCustomized; + bool isLookAt; + bool pvdCreated; + + ApexSimpleString cameraName; + }; + + struct ViewMatrixLookAt : public ViewMatrixProperties + { + ViewMatrixLookAt() {} + ~ViewMatrixLookAt() {} + ViewMatrixLookAt(PxMat44 v, bool l, bool r) : + ViewMatrixProperties(v, l), isRightHand(r) {} + + bool isRightHand; + }; + + struct ProjMatrixProperties : public UserAllocated + { + ProjMatrixProperties() {} + ~ProjMatrixProperties() {} + ProjMatrixProperties(PxMat44 p, bool u, bool f) : + projMatrix(p), isUserCustomized(u), isPerspectiveFOV(f) {} + + PxMat44 projMatrix; + bool isUserCustomized; + bool isPerspectiveFOV; + }; + + struct ProjMatrixUserCustomized : public ProjMatrixProperties + { + ProjMatrixUserCustomized() {} + ~ProjMatrixUserCustomized() {} + ProjMatrixUserCustomized(PxMat44 p, bool u, bool f, float near, float far, float fov, uint32_t w, uint32_t h) : + ProjMatrixProperties(p, u, f), nearPlaneDistance(near), farPlaneDistance(far), fieldOfViewDegree(fov), viewportWidth(w), viewportHeight(h) {} + + float nearPlaneDistance; + float farPlaneDistance; + float fieldOfViewDegree; + uint32_t viewportWidth; //only one instance? + uint32_t viewportHeight; //only one instance? + }; + + struct ProjMatrixPerspectiveFOV : public ProjMatrixProperties + { + ProjMatrixPerspectiveFOV() {} + ~ProjMatrixPerspectiveFOV() {} + ProjMatrixPerspectiveFOV(PxMat44 p, bool u, bool f, bool i) : + ProjMatrixProperties(p, u, f), isZinvert(i) {} + + bool isZinvert; + }; + + Array<ViewMatrixProperties*> mViewMatrices; + Array<ProjMatrixProperties*> mProjMatrices; + PxMat44 mViewProjMatrix; +#if 0 //lionel: work in progress + uint32_t mCurrentViewID; + uint32_t mCurrentProjID; + SceneCalculator* mSceneCalculator; + friend class SceneCalculator; + //class SceneCalculator + //{ + //public: + // SceneCalculator():s(NULL) {} + // ~SceneCalculator() {s=NULL;} + // float distanceFromEye(PxVec3 to) {return (-s->getEyePosition(0) + to).magnitude();} //lionel: use currentIDs when multiple matrices allowed + // friend class ApexScene; + //private: + // void construct(const physx::ApexScene * scene) {s = scene;} + // void destruct() {s = NULL;} + // const physx::ApexScene * s; + //}; +#endif + + DebugRenderParams* mDebugRenderParams; + DebugColorParams* mDebugColorParams; + HashMap<const char*, RENDER_DEBUG::DebugColors::Enum> mColorMap; + + PxVec3 mGravity; + + PairFilter mPairFilter; + + struct UserDefinedBoundingBox + { + PxBounds3 bb; + UserBoundingBoxFlags::Enum flags; + + UserDefinedBoundingBox(const PxBounds3& _bb, UserBoundingBoxFlags::Enum _flags) : + bb(_bb), flags(_flags) {} + }; + Array<UserDefinedBoundingBox> mBBs; +}; + + +} +} // end namespace nvidia::apex + +#endif // APEX_SCENE_H diff --git a/APEX_1.4/framework/include/ApexSceneTasks.h b/APEX_1.4/framework/include/ApexSceneTasks.h new file mode 100644 index 00000000..b24bfba2 --- /dev/null +++ b/APEX_1.4/framework/include/ApexSceneTasks.h @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_SCENE_TASKS_H +#define APEX_SCENE_TASKS_H + +#include "ApexScene.h" + +#include "PsAllocator.h" + +namespace nvidia +{ +namespace apex +{ + +class PhysXSimulateTask : public PxTask, public UserAllocated +{ +public: + PhysXSimulateTask(ApexScene& scene, CheckResultsTask& checkResultsTask); + ~PhysXSimulateTask(); + + const char* getName() const; + void run(); + void setElapsedTime(float elapsedTime); + void setFollowingTask(PxBaseTask* following); + +#if PX_PHYSICS_VERSION_MAJOR == 3 + void setScratchBlock(void* scratchBlock, uint32_t size) + { + mScratchBlock = scratchBlock; + mScratchBlockSize = size; + } +#endif + +protected: + ApexScene* mScene; + float mElapsedTime; + + PxBaseTask* mFollowingTask; + CheckResultsTask& mCheckResultsTask; + +#if PX_PHYSICS_VERSION_MAJOR == 3 + void* mScratchBlock; + uint32_t mScratchBlockSize; +#endif + +private: + PhysXSimulateTask& operator=(const PhysXSimulateTask&); +}; + + + +class CheckResultsTask : public PxTask, public UserAllocated +{ +public: + CheckResultsTask(ApexScene& scene) : mScene(&scene) {} + + const char* getName() const; + void run(); + +protected: + ApexScene* mScene; +}; + + + +class FetchResultsTask : public PxTask, public UserAllocated +{ +public: + FetchResultsTask(ApexScene& scene) + : mScene(&scene) + , mFollowingTask(NULL) + {} + + const char* getName() const; + void run(); + + /** + * \brief Called by dispatcher after Task has been run. + * + * If you re-implement this method, you must call this base class + * version before returning. + */ + void release(); + + void setFollowingTask(PxBaseTask* following); + +protected: + ApexScene* mScene; + PxBaseTask* mFollowingTask; +}; + + +/** +* This task is solely meant to record the duration of APEX's "during tick" tasks. +* It could be removed and replaced with only the check results task if it is found +* to be a performance issue. +*/ +#if APEX_DURING_TICK_TIMING_FIX +class DuringTickCompleteTask : public PxTask, public UserAllocated +{ +public: + DuringTickCompleteTask(ApexScene& scene) : mScene(&scene) {} + + const char* getName() const; + void run(); + +protected: + ApexScene* mScene; +}; +#endif + +/* This tasks loops all intermediate steps until the final fetchResults can be called */ +class PhysXBetweenStepsTask : public PxLightCpuTask, public UserAllocated +{ +public: + PhysXBetweenStepsTask(ApexScene& scene) : mScene(scene), mSubStepSize(0.0f), + mNumSubSteps(0), mSubStepNumber(0), mLast(NULL) {} + + const char* getName() const; + void run(); + void setSubstepSize(float substepSize, uint32_t numSubSteps); + void setFollower(uint32_t substepNumber, PxTask* last); + +protected: + ApexScene& mScene; + float mSubStepSize; + uint32_t mNumSubSteps; + + uint32_t mSubStepNumber; + PxTask* mLast; + +private: + PhysXBetweenStepsTask& operator=(const PhysXBetweenStepsTask&); +}; + +} +} + +#endif diff --git a/APEX_1.4/framework/include/ApexSceneUserNotify.h b/APEX_1.4/framework/include/ApexSceneUserNotify.h new file mode 100644 index 00000000..6cf54241 --- /dev/null +++ b/APEX_1.4/framework/include/ApexSceneUserNotify.h @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_SCENE_USER_NOTIFY_H +#define APEX_SCENE_USER_NOTIFY_H + +#include "ApexDefs.h" + +#if PX_PHYSICS_VERSION_MAJOR == 3 + +#include <ApexUsingNamespace.h> + +#include <PxSimulationEventCallback.h> +#include <PxContactModifyCallback.h> + +#include "PxSimpleTypes.h" +#include <PsArray.h> +#include <PsAllocator.h> + + +namespace nvidia +{ +namespace apex +{ + +class ApexSceneUserNotify : public physx::PxSimulationEventCallback +{ +public: + ApexSceneUserNotify() : mAppNotify(NULL), mBatchAppNotify(false) {} + virtual ~ApexSceneUserNotify(); + + void addModuleNotifier(physx::PxSimulationEventCallback& notify); + void removeModuleNotifier(physx::PxSimulationEventCallback& notify); + + void setApplicationNotifier(physx::PxSimulationEventCallback* notify) + { + mAppNotify = notify; + } + PxSimulationEventCallback* getApplicationNotifier() const + { + return mAppNotify; + } + + void setBatchAppNotify(bool enable) + { + mBatchAppNotify = enable; + } + void playBatchedNotifications(); + +private: + // from PxSimulationEventCallback + virtual void onConstraintBreak(physx::PxConstraintInfo* constraints, uint32_t count); + virtual void onWake(PxActor** actors, uint32_t count); + virtual void onSleep(PxActor** actors, uint32_t count); + virtual void onContact(const physx::PxContactPairHeader& pairHeader, const physx::PxContactPair* pairs, uint32_t nbPairs); + virtual void onTrigger(physx::PxTriggerPair* pairs, uint32_t count); + virtual void onAdvance(const PxRigidBody*const* bodyBuffer, const PxTransform* poseBuffer, const PxU32 count); + +private: + Array<physx::PxSimulationEventCallback*> mModuleNotifiers; + PxSimulationEventCallback* mAppNotify; + + + // for batch notification + bool mBatchAppNotify; + + // onConstraintBreak + Array<physx::PxConstraintInfo> mBatchedBreakNotifications; + + // onContact + struct BatchedContactNotification + { + BatchedContactNotification(const physx::PxContactPairHeader& _pairHeader, const physx::PxContactPair* _pairs, uint32_t _nbPairs) + { + pairHeader = _pairHeader; + nbPairs = _nbPairs; + + pairs = (physx::PxContactPair *)PX_ALLOC(sizeof(physx::PxContactPair) * nbPairs, PX_DEBUG_EXP("BatchedContactNotifications")); + PX_ASSERT(pairs != NULL); + for (uint32_t i=0; i<nbPairs; i++) + { + pairs[i] = _pairs[i]; + } + } + + ~BatchedContactNotification() + { + if (pairs) + { + PX_FREE(pairs); + pairs = NULL; + } + } + + physx::PxContactPairHeader pairHeader; + physx::PxContactPair * pairs; + uint32_t nbPairs; + }; + Array<BatchedContactNotification> mBatchedContactNotifications; + Array<uint32_t> mBatchedContactStreams; + + // onWake/onSleep + struct SleepWakeBorders + { + SleepWakeBorders(uint32_t s, uint32_t c, bool sleep) : start(s), count(c), sleepEvents(sleep) {} + uint32_t start; + uint32_t count; + bool sleepEvents; + }; + Array<SleepWakeBorders> mBatchedSleepWakeEventBorders; + Array<PxActor*> mBatchedSleepEvents; + Array<PxActor*> mBatchedWakeEvents; + + // onTrigger + Array<physx::PxTriggerPair> mBatchedTriggerReports; +}; + + +class ApexSceneUserContactModify : public PxContactModifyCallback +{ +public: + ApexSceneUserContactModify(); + virtual ~ApexSceneUserContactModify(); + + void addModuleContactModify(physx::PxContactModifyCallback& contactModify); + void removeModuleContactModify(physx::PxContactModifyCallback& contactModify); + + void setApplicationContactModify(physx::PxContactModifyCallback* contactModify); + PxContactModifyCallback* getApplicationContactModify() const + { + return mAppContactModify; + } + +private: + // from PxContactModifyCallback + virtual void onContactModify(physx::PxContactModifyPair* const pairs, uint32_t count); + +private: + Array<physx::PxContactModifyCallback*> mModuleContactModify; + PxContactModifyCallback* mAppContactModify; +}; + +} +} // namespace nvidia::apex + +#endif // PX_PHYSICS_VERSION_MAJOR == 3 + +#endif
\ No newline at end of file diff --git a/APEX_1.4/framework/include/ApexStubPxProfileZone.h b/APEX_1.4/framework/include/ApexStubPxProfileZone.h new file mode 100644 index 00000000..4e7cc2a6 --- /dev/null +++ b/APEX_1.4/framework/include/ApexStubPxProfileZone.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_STUB_PX_PROFILE_ZONE_H +#define APEX_STUB_PX_PROFILE_ZONE_H + +#include "Px.h" +#include "PxProfileZone.h" +#include "PsUserAllocated.h" + +namespace physx +{ + namespace profile + { + class PxUserCustomProfiler; + } +} + +namespace nvidia +{ +using namespace physx::profile; + +namespace apex +{ + +// This class provides a stub implementation of PhysX's PxProfileZone. +// It would be nice to not be forced to do this, but our scoped profile event macros +// cannot have an if(gProfileZone) because it would ruin the scope. So here we just +// create a stub that will be called so that the user need not create a PxProfileZoneManager +// in debug mode (and suffer an assertion). + +class ApexStubPxProfileZone : public PxProfileZone, public UserAllocated +{ +public: + + // PxProfileZone methods + virtual const char* getName() { return 0; } + virtual void release() { PX_DELETE(this); } + + virtual void setProfileZoneManager(PxProfileZoneManager* ) {} + virtual profile::PxProfileZoneManager* getProfileZoneManager() { return 0; } + + virtual uint16_t getEventIdForName( const char* ) { return 0; } + + virtual void flushEventIdNameMap() {} + + virtual uint16_t getEventIdsForNames( const char** , uint32_t ) { return 0; } + virtual void setUserCustomProfiler(PxUserCustomProfiler* ) {}; + + // physx::PxProfileEventBufferClientManager methods + virtual void addClient( PxProfileZoneClient& ) {} + virtual void removeClient( PxProfileZoneClient& ) {} + virtual bool hasClients() const { return false; } + + // physx::PxProfileNameProvider methods + virtual PxProfileNames getProfileNames() const { return PxProfileNames(); } + + // profile::PxProfileEventSender methods + virtual void startEvent( uint16_t , uint64_t ) {} + virtual void stopEvent( uint16_t , uint64_t ) {} + + virtual void startEvent( uint16_t , uint64_t , uint32_t ) {} + virtual void stopEvent( uint16_t , uint64_t , uint32_t ) {} + virtual void eventValue( uint16_t , uint64_t , int64_t ) {} + + // physx::PxProfileEventFlusher methods + virtual void flushProfileEvents() {} +}; + +} +} // end namespace nvidia::apex + +#endif // APEX_STUB_PX_PROFILE_ZONE_H diff --git a/APEX_1.4/framework/include/ApexVertexBuffer.h b/APEX_1.4/framework/include/ApexVertexBuffer.h new file mode 100644 index 00000000..8e44c8f0 --- /dev/null +++ b/APEX_1.4/framework/include/ApexVertexBuffer.h @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_VERTEX_BUFFER_H +#define APEX_VERTEX_BUFFER_H + +#include "RenderMeshAssetIntl.h" +#include "ApexVertexFormat.h" +#include "VertexBufferParameters.h" +#include <nvparameterized/NvParameterized.h> +#include "ApexSharedUtils.h" +#include "ApexInteropableBuffer.h" + +namespace nvidia +{ +namespace apex +{ + +class ApexVertexBuffer : public VertexBufferIntl, public ApexInteropableBuffer, public NvParameterized::SerializationCallback +{ +public: + ApexVertexBuffer(); + ~ApexVertexBuffer(); + + // from VertexBuffer + const VertexFormat& getFormat() const + { + return mFormat; + } + uint32_t getVertexCount() const + { + return mParams->vertexCount; + } + void* getBuffer(uint32_t bufferIndex); + void* getBufferAndFormatWritable(RenderDataFormat::Enum& format, uint32_t bufferIndex) + { + return getBufferAndFormat(format, bufferIndex); + } + + void* getBufferAndFormat(RenderDataFormat::Enum& format, uint32_t bufferIndex) + { + format = getFormat().getBufferFormat(bufferIndex); + return getBuffer(bufferIndex); + } + bool getBufferData(void* dstBuffer, nvidia::RenderDataFormat::Enum dstBufferFormat, uint32_t dstBufferStride, uint32_t bufferIndex, + uint32_t startVertexIndex, uint32_t elementCount) const; + PX_INLINE const void* getBuffer(uint32_t bufferIndex) const + { + return (const void*)((ApexVertexBuffer*)this)->getBuffer(bufferIndex); + } + PX_INLINE const void* getBufferAndFormat(RenderDataFormat::Enum& format, uint32_t bufferIndex) const + { + return (const void*)((ApexVertexBuffer*)this)->getBufferAndFormat(format, bufferIndex); + } + + // from VertexBufferIntl + void build(const VertexFormat& format, uint32_t vertexCount); + + VertexFormat& getFormatWritable() + { + return mFormat; + } + void applyTransformation(const PxMat44& transformation); + void applyScale(float scale); + bool mergeBinormalsIntoTangents(); + + void copy(uint32_t dstIndex, uint32_t srcIndex, ApexVertexBuffer* srcBufferPtr = NULL); + void resize(uint32_t vertexCount); + + // from NvParameterized::SerializationCallback + + void preSerialize(void* userData_); + + void setParams(VertexBufferParameters* param); + VertexBufferParameters* getParams() + { + return mParams; + } + + uint32_t getAllocationSize() const; + + void applyPermutation(const Array<uint32_t>& permutation); + +protected: + VertexBufferParameters* mParams; + + ApexVertexFormat mFormat; // Wrapper class for mParams->vertexFormat +}; + + +} // namespace apex +} // namespace nvidia + + +#endif // APEX_VERTEX_BUFFER_H diff --git a/APEX_1.4/framework/include/ApexVertexFormat.h b/APEX_1.4/framework/include/ApexVertexFormat.h new file mode 100644 index 00000000..7192bee6 --- /dev/null +++ b/APEX_1.4/framework/include/ApexVertexFormat.h @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef __APEX_VERTEX_FORMAT_H__ +#define __APEX_VERTEX_FORMAT_H__ + + +#include "VertexFormat.h" +#include "PsUserAllocated.h" +#include "PsArray.h" +#include "VertexFormatParameters.h" +#include "ApexSharedUtils.h" + +namespace nvidia +{ +namespace apex +{ + + +class ApexVertexFormat : public VertexFormat, public UserAllocated +{ +public: + ApexVertexFormat(); + ApexVertexFormat(VertexFormatParameters* params); + ~ApexVertexFormat(); + explicit ApexVertexFormat(const ApexVertexFormat& f); + + // VertexFormat methods + + /** \brief Resets the format to the initial state */ + virtual void reset(); + + + /** \brief Sets the winding (cull mode) for this format */ + virtual void setWinding(RenderCullMode::Enum winding); + + /** \brief Sets whether or not a separate bone buffer is used */ + virtual void setHasSeparateBoneBuffer(bool hasSeparateBoneBuffer); + + /** \brief Accessor to read winding (cull mode) */ + virtual RenderCullMode::Enum getWinding() const; + + /** \brief Accessor to read if a seperate vertex buffer for bone indices and weights is generated */ + virtual bool hasSeparateBoneBuffer() const; + + /** \brief Returns a buffer name for a semantic. Returns NULL if the semantic is invalid. */ + virtual const char* getSemanticName(RenderVertexSemantic::Enum semantic) const; + + /** \brief Returns a buffer ID for a semantic. For custom buffers, use the getID() function. */ + virtual BufferID getSemanticID(RenderVertexSemantic::Enum semantic) const; + + /** \brief Returns a buffer ID for a named buffer. For standard semantics, the getSemanticID( semantic ) function is faster, but + is equivalent to getID( getSemanticName( semantic ) ). Returns 0 if name == NULL */ + virtual BufferID getID(const char* name) const; + + + /** \brief Adds a vertex buffer channel to this format + \param [in] name the name of a new buffer (use getSemanticName for standard semantics) + \return The buffer index. If the buffer for the semantic already exists, the index of the existing buffer is returned. Returns -1 if there is an error (e.g. name == NULL). + */ + virtual int32_t addBuffer(const char* name); + + /** \brief Removes a buffer + \param [in] index the buffer to remove + \return True if successful, false otherwise (if the buffer index was invalid) + */ + virtual bool bufferReplaceWithLast(uint32_t index); + + + /** \brief Set the format for a buffer + \return True if successful, false otherwise (if the buffer index was invalid) + */ + virtual bool setBufferFormat(uint32_t index, RenderDataFormat::Enum format); + + /** \brief Set the access type for a buffer (static, dynamic, etc.) + \return True if successful, false otherwise (if the buffer index was invalid) + */ + virtual bool setBufferAccess(uint32_t index, RenderDataAccess::Enum access); + + /** \brief Set whether or not the buffer should be serialized + \return True if successful, false otherwise (if the buffer index was invalid) + */ + virtual bool setBufferSerialize(uint32_t index, bool serialize); + + + /** \brief Accessor to read the name of a given buffer + \return The buffer name if successful, NULL otherwise. + */ + virtual const char* getBufferName(uint32_t index) const; + + /** \brief Accessor to read the semantic of a given buffer + \return The buffer semantic if successful, RenderVertexSemantic::NUM_SEMANTICS otherwise. + */ + virtual RenderVertexSemantic::Enum getBufferSemantic(uint32_t index) const; + + /** \brief Accessor to read the ID of a given buffer + \return The buffer semantic if successful, 0 otherwise. + */ + virtual BufferID getBufferID(uint32_t index) const; + + /** \brief Get the format for a buffer + \return The buffer format if successful, RenderDataFormat::UNSPECIFIED otherwise. + */ + virtual RenderDataFormat::Enum getBufferFormat(uint32_t index) const; + + /** \brief Get the access type for a buffer (static, dynamic, etc.) + \return The buffer access if successful, RenderDataAccess::ACCESS_TYPE_COUNT otherwise. + */ + virtual RenderDataAccess::Enum getBufferAccess(uint32_t index) const; + + /** \brief Get whether or not the buffer should be serialized + \return Whether or not the buffer should be serialized if successful, false otherwise. + */ + virtual bool getBufferSerialize(uint32_t index) const; + + + /** \brief Accessor to read the number of buffers */ + virtual uint32_t getBufferCount() const; + + /** \brief Returns the number of buffers that are user-specified */ + virtual uint32_t getCustomBufferCount() const; + + /** \brief Accessor to get the buffer index + If the buffer is not found, -1 is returned + */ + virtual int32_t getBufferIndexFromID(BufferID id) const; + + // ApexVertexFormat internal methods + + bool operator == (const VertexFormat& format) const; + bool operator != (const VertexFormat& format) const + { + return !(*this == format); + } + + void copy(const ApexVertexFormat& other); + +private: + void clearBuffers(); + + ApexVertexFormat& operator = (const ApexVertexFormat&) + { + return *this; // No assignment + } + + struct CustomBuffer + { + char* name; + RenderDataFormat::Enum format; + bool serialize; + }; + + VertexFormatParameters* mParams; + bool mOwnsParams; + + friend class ApexVertexBuffer; +}; + +} +} // end namespace nvidia::apex + + +#endif // __APEX_VERTEX_FORMAT_H__ diff --git a/APEX_1.4/framework/include/CudaProfileManager.h b/APEX_1.4/framework/include/CudaProfileManager.h new file mode 100644 index 00000000..5811272a --- /dev/null +++ b/APEX_1.4/framework/include/CudaProfileManager.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef CUDA_PROFILE_MANAGER_H +#define CUDA_PROFILE_MANAGER_H + +/*! +\file +\brief classes CudaProfileManager +*/ + +#include <ApexDefs.h> +#include <PxSimpleTypes.h> + +namespace nvidia +{ +namespace apex +{ + +PX_PUSH_PACK_DEFAULT + +/** +\brief Interface for options of ApexCudaProfileManager + */ +class CudaProfileManager +{ +public: + /** + * Normalized time unit for profile data + */ + enum TimeFormat + { + MILLISECOND = 1, + MICROSECOND = 1000, + NANOSECOND = 1000000 + }; + + /** + \brief Set path for writing results + */ + virtual void setPath(const char* path) = 0; + /** + \brief Set kernel for profile + */ + virtual void setKernel(const char* functionName, const char* moduleName) = 0; + /** + \brief Set normailized time unit + */ + virtual void setTimeFormat(TimeFormat tf) = 0; + /** + \brief Set state (on/off) for profile manager + */ + virtual void enable(bool state) = 0; + /** + \brief Get state (on/off) of profile manager + */ + virtual bool isEnabled() const = 0; +}; + +PX_POP_PACK + +} +} + +#endif // CUDA_PROFILE_MANAGER_H + diff --git a/APEX_1.4/framework/include/FrameworkEventDefs.h b/APEX_1.4/framework/include/FrameworkEventDefs.h new file mode 100644 index 00000000..ffd40640 --- /dev/null +++ b/APEX_1.4/framework/include/FrameworkEventDefs.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +// This file is used to define a list of AgPerfMon events. +// +// This file should only contain event definitions, using the +// DEFINE_EVENT macro. E.g.: +// +// DEFINE_EVENT(sample_name_1) +// DEFINE_EVENT(sample_name_2) +// DEFINE_EVENT(sample_name_3) + +// Framework only event definitions + +DEFINE_EVENT(ApexScene_simulate) +DEFINE_EVENT(ApexScene_fetchResults) +DEFINE_EVENT(ApexScene_checkResults) +DEFINE_EVENT(ApexSceneManualSubstep) +DEFINE_EVENT(ModuleSceneManualSubstep) +DEFINE_EVENT(ApexSceneBeforeStep) +DEFINE_EVENT(ApexSceneDuringStep) +DEFINE_EVENT(ApexSceneAfterStep) +DEFINE_EVENT(ApexScenePostFetchResults) +DEFINE_EVENT(ApexSceneLODUsedResource) +DEFINE_EVENT(ApexSceneLODSumBenefit) +DEFINE_EVENT(ApexRenderMeshUpdateRenderResources) +DEFINE_EVENT(ApexRenderMeshCreateRenderResources) +DEFINE_EVENT(ApexRenderMeshDispatchRenderResources) +DEFINE_EVENT(ApexRenderMeshUpdateInstances) +DEFINE_EVENT(ApexRenderMeshUpdateInstancesWritePoses) +DEFINE_EVENT(ApexRenderMeshUpdateInstancesWriteScales)
\ No newline at end of file diff --git a/APEX_1.4/framework/include/FrameworkPerfScope.h b/APEX_1.4/framework/include/FrameworkPerfScope.h new file mode 100644 index 00000000..7e2dc09b --- /dev/null +++ b/APEX_1.4/framework/include/FrameworkPerfScope.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +// Copyright (C) 2002-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (C) 2001-2006 NovodeX. All rights reserved. + +#ifndef __FRAMEWORK_PERF_SCOPE_H___ +#define __FRAMEWORK_PERF_SCOPE_H___ + +#include "PxSimpleTypes.h" + +#ifndef PHYSX_PROFILE_SDK +#define PX_DISABLE_USER_PROFILER_CALLBACK +#endif + +#include "ProfilerCallback.h" + +namespace nvidia +{ +namespace apex +{ +class ApexSDKImpl; +}; +}; + +namespace Framework +{ +void initFrameworkProfiling(nvidia::apex::ApexSDKImpl*); +void releaseFrameworkProfiling(); +}; + + +#endif diff --git a/APEX_1.4/framework/include/MirrorSceneImpl.h b/APEX_1.4/framework/include/MirrorSceneImpl.h new file mode 100644 index 00000000..22a8de5f --- /dev/null +++ b/APEX_1.4/framework/include/MirrorSceneImpl.h @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef MIRROR_SCENE_IMPL_H + +#define MIRROR_SCENE_IMPL_H + +#include "PhysXSDKVersion.h" + +#if PX_PHYSICS_VERSION_MAJOR == 3 + +#include "MirrorScene.h" +#include "PsUserAllocated.h" +#include "PsMutex.h" +#include "PxSimulationEventCallback.h" +#include "PxClient.h" +#include "PsHashMap.h" +#include "PxDeletionListener.h" +#include "PxTransform.h" +#include "PsArray.h" + +namespace nvidia +{ + namespace apex + { + class MirrorSceneImpl; + class MirrorActor; + + enum MirrorCommandType + { + MCT_CREATE_ACTOR, + MCT_RELEASE_ACTOR, + MCT_UPDATE_POSE, + MCT_LAST + }; + + class MirrorCommand + { + public: + MirrorCommand(MirrorCommandType type,MirrorActor *ma) + { + mType = type; + mMirrorActor = ma; + } + MirrorCommand(MirrorCommandType type,MirrorActor *ma,const PxTransform &pose) + { + mType = type; + mMirrorActor = ma; + mPose = pose; + } + MirrorCommandType mType; + MirrorActor *mMirrorActor; + PxTransform mPose; + }; + + class MirrorActor : public shdfnd::UserAllocated + { + public: + + // The constructor is only ever called from the PrimaryScene thread + MirrorActor(size_t actorHash,physx::PxRigidActor &actor,MirrorSceneImpl &parentScene); + // The destructor is only ever called from the MirrorSceneImpl thread + virtual ~MirrorActor(void); + + // Increments the reference count for the number of shapes on this actor + // currently inside the trigger volume. + // Only ever called from the primary scene thread + void addShape(void) + { + mShapeCount++; + } + + // Decrements the reference count for the number of shapes on this actor + // which are currently in the trigger volume. + // If the reference count goes to zero, then no part of this actor is + // any longer inside the trigger volume and it's mirror should in turn be released + // This is only ever called from the PrimaryScene thread + bool removeShape(void) + { + mShapeCount--; + return mShapeCount == 0; + } + + // This method is called when the reference count goes to zero and/or the primary + // actor is released. + // This method posts on the MirrorSceneImpl thread queue for this object to be deleted + // the next time it does an update. + // At this point the primary scene should remove this actor from the hash table. + void release(void); + + + // Required by the PxObserver class we inherited + virtual uint32_t getObjectSize()const + { + return sizeof(MirrorActor); + } + + // This method is only called by the PrimaryScene thread + // If the pose of the actor we are mirroring has + void synchronizePose(void); // called from the primary scene thread; see if the pose of the mirrored actor has changed. + + void createActor(PxScene &scene); + void updatePose(const PxTransform &pose); + + MirrorSceneImpl &mMirrorScene; + uint32_t mShapeCount; + uint32_t mMirrorShapeCount; + PxRigidActor *mPrimaryActor; + PxRigidActor *mMirrorActor; + bool mReleasePosted; + PxTransform mPrimaryGlobalPose; + size_t mActorHash; // hash in primary scene. + + private: + MirrorActor& operator=(const MirrorActor&); + }; + + typedef nvidia::Array< MirrorCommand > MirrorCommandArray; + + class MirrorSceneImpl : public MirrorScene, public shdfnd::UserAllocated, + public physx::PxSimulationEventCallback, physx::PxDeletionListener + { + public: + + typedef shdfnd::HashMap< size_t, MirrorActor * > ActorHash; + typedef shdfnd::HashMap< size_t, MirrorActor * > ShapeHash; + + enum ActorChange + { + AC_DELETED, + AC_FOUND, + AC_LOST + }; + + MirrorSceneImpl(physx::PxScene &primaryScene, + physx::PxScene &mirrorScene, + MirrorScene::MirrorFilter &mirrorFilter, + float mirrorStaticDistance, + float mirrorDynamicDistance, + float mirrorDistanceThreshold); + + MirrorScene::MirrorFilter & getMirrorFilter(void) const + { + return mMirrorFilter; + } + + virtual void synchronizePrimaryScene(const PxVec3 &cameraPos); + virtual void synchronizeMirrorScene(void); + + virtual void release(void); + + void postCommand(const MirrorCommand &mc); + + + /** + physx::PxSimulationEventCallback interface + */ + virtual void onConstraintBreak(physx::PxConstraintInfo* constraints, uint32_t count); + virtual void onWake(PxActor** actors, uint32_t count); + virtual void onSleep(PxActor** actors, uint32_t count); + virtual void onContact(const physx::PxContactPairHeader& pairHeader, const physx::PxContactPair* pairs, uint32_t nbPairs); + virtual void onTrigger(physx::PxTriggerPair* pairs, uint32_t count); + virtual void onAdvance(const PxRigidBody*const* bodyBuffer, const PxTransform* poseBuffer, const PxU32 count); + + // This is a notification even that the PrimayScene actor we are mirroring has been + // deleted. If this is the case, we need to zero out PrimaryActor pointer so we + // no longer attempt to access it. + // However...we do not call release, because we should get trigger events which cause + // the reference count to go to zero. + virtual void onRelease(const PxBase* observed, + void* userData, + physx::PxDeletionEventFlag::Enum deletionEvent); + + + + protected: + virtual ~MirrorSceneImpl(void); + private: + + void mirrorShape(const physx::PxTriggerPair &tp); + + void createTriggerActor(const PxVec3 &cameraPosition); + + physx::PxScene &mPrimaryScene; + physx::PxScene &mMirrorScene; + MirrorScene::MirrorFilter &mMirrorFilter; + float mMirrorStaticDistance; + float mMirrorDynamicDistance; + float mMirrorDistanceThreshold; + PxVec3 mLastCameraLocation; + physx::PxRigidDynamic *mTriggerActor; + PxMaterial *mTriggerMaterial; + physx::PxShape *mTriggerShapeStatic; + physx::PxShape *mTriggerShapeDynamic; + ActorHash mActors; + ShapeHash mShapes; + shdfnd::Mutex mMirrorCommandMutex; + MirrorCommandArray mMirrorCommands; + physx::PxSimulationEventCallback *mSimulationEventCallback; + nvidia::Array< physx::PxTriggerPair > mTriggerPairs; + }; + + }; // end of apex namespace +}; // end of physx namespace + +#endif // PX_PHYSICS_VERSION_MAJOR + +#endif // MIRROR_SCENE_IMPL_H diff --git a/APEX_1.4/framework/include/PVDBindingErrorStream.h b/APEX_1.4/framework/include/PVDBindingErrorStream.h new file mode 100644 index 00000000..2de77bd0 --- /dev/null +++ b/APEX_1.4/framework/include/PVDBindingErrorStream.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef PVDBINDING_ERROR_STREAM_H +#define PVDBINDING_ERROR_STREAM_H + +#include "PxErrorCallback.h" +#include "PxProfileBase.h" + +#include <stdio.h> + +namespace physx { namespace profile { + +inline void printInfo(const char* format, ...) +{ + PX_UNUSED(format); +#if PRINT_TEST_INFO + va_list va; + va_start(va, format); + vprintf(format, va); + va_end(va); +#endif +} + +class PVDBindingErrorStream : public PxErrorCallback +{ +public: + + PVDBindingErrorStream() {} + void reportError(PxErrorCode::Enum e, const char* message, const char* file, int line) + { + PX_UNUSED(line); + PX_UNUSED(file); + switch (e) + { + case PxErrorCode::eINVALID_PARAMETER: + printf( "on invalid parameter: %s", message ); + break; + case PxErrorCode::eINVALID_OPERATION: + printf( "on invalid operation: %s", message ); + break; + case PxErrorCode::eOUT_OF_MEMORY: + printf( "on out of memory: %s", message ); + break; + case PxErrorCode::eDEBUG_INFO: + printf( "on debug info: %s", message ); + break; + case PxErrorCode::eDEBUG_WARNING: + printf( "on debug warning: %s", message ); + break; + default: + printf( "on unknown error: %s", message ); + break; + } + } +}; + +}} + +#endif // PVDBINDING_ERROR_STREAM_H diff --git a/APEX_1.4/framework/include/RenderResourceManagerWrapper.h b/APEX_1.4/framework/include/RenderResourceManagerWrapper.h new file mode 100644 index 00000000..def98e65 --- /dev/null +++ b/APEX_1.4/framework/include/RenderResourceManagerWrapper.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef RENDER_RESOURCE_MANAGER_WRAPPER_H +#define RENDER_RESOURCE_MANAGER_WRAPPER_H + +#include "ApexSDKImpl.h" + +namespace nvidia +{ +namespace apex +{ + + +class RenderResourceManagerWrapper : public UserRenderResourceManager, public UserAllocated +{ + PX_NOCOPY(RenderResourceManagerWrapper); +public: + RenderResourceManagerWrapper(UserRenderResourceManager& rrm) : + mRrm(rrm) + { + } + + + virtual UserRenderVertexBuffer* createVertexBuffer(const UserRenderVertexBufferDesc& desc) + { + URR_CHECK; + return mRrm.createVertexBuffer(desc); + } + + virtual void releaseVertexBuffer(UserRenderVertexBuffer& buffer) + { + mRrm.releaseVertexBuffer(buffer); + } + + virtual UserRenderIndexBuffer* createIndexBuffer(const UserRenderIndexBufferDesc& desc) + { + URR_CHECK; + return mRrm.createIndexBuffer(desc); + } + + virtual void releaseIndexBuffer(UserRenderIndexBuffer& buffer) + { + mRrm.releaseIndexBuffer(buffer); + } + + virtual UserRenderBoneBuffer* createBoneBuffer(const UserRenderBoneBufferDesc& desc) + { + URR_CHECK; + return mRrm.createBoneBuffer(desc); + } + + virtual void releaseBoneBuffer(UserRenderBoneBuffer& buffer) + { + mRrm.releaseBoneBuffer(buffer); + } + + virtual UserRenderInstanceBuffer* createInstanceBuffer(const UserRenderInstanceBufferDesc& desc) + { + URR_CHECK; + return mRrm.createInstanceBuffer(desc); + } + + virtual void releaseInstanceBuffer(UserRenderInstanceBuffer& buffer) + { + mRrm.releaseInstanceBuffer(buffer); + } + + virtual UserRenderSpriteBuffer* createSpriteBuffer(const UserRenderSpriteBufferDesc& desc) + { + URR_CHECK; + return mRrm.createSpriteBuffer(desc); + } + + virtual void releaseSpriteBuffer(UserRenderSpriteBuffer& buffer) + { + mRrm.releaseSpriteBuffer(buffer); + } + + virtual UserRenderSurfaceBuffer* createSurfaceBuffer(const UserRenderSurfaceBufferDesc& desc) + { + URR_CHECK; + return mRrm.createSurfaceBuffer(desc); + } + + virtual void releaseSurfaceBuffer(UserRenderSurfaceBuffer& buffer) + { + mRrm.releaseSurfaceBuffer(buffer); + } + + virtual UserRenderResource* createResource(const UserRenderResourceDesc& desc) + { + URR_CHECK; + return mRrm.createResource(desc); + } + + virtual void releaseResource(UserRenderResource& resource) + { + mRrm.releaseResource(resource); + } + + virtual uint32_t getMaxBonesForMaterial(void* material) + { + return mRrm.getMaxBonesForMaterial(material); + } + + virtual bool getSpriteLayoutData(uint32_t spriteCount, uint32_t spriteSemanticsBitmap, UserRenderSpriteBufferDesc* textureDescArray) + { + return mRrm.getSpriteLayoutData(spriteCount, spriteSemanticsBitmap, textureDescArray); + } + + virtual bool getInstanceLayoutData(uint32_t spriteCount, uint32_t spriteSemanticsBitmap, UserRenderInstanceBufferDesc* instanceDescArray) + { + return mRrm.getInstanceLayoutData(spriteCount, spriteSemanticsBitmap, instanceDescArray); + } + +private: + UserRenderResourceManager& mRrm; +}; + + +} +} // end namespace nvidia::apex + + +#endif // RENDER_RESOURCE_MANAGER_WRAPPER_H diff --git a/APEX_1.4/framework/include/ThreadPool.h b/APEX_1.4/framework/include/ThreadPool.h new file mode 100644 index 00000000..f6f4be69 --- /dev/null +++ b/APEX_1.4/framework/include/ThreadPool.h @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef _THREAD_POOL_H_ +#define _THREAD_POOL_H_ + +#include "PxTask.h" +#include "PxTaskManager.h" +#include "PxCpuDispatcher.h" +#include "PsSList.h" +#include "PsSync.h" +#include "PsThread.h" +#include "ApexUsingNamespace.h" + +namespace physx +{ + namespace pvdsdk + { + class ApexPvdClient; + } +} + +namespace nvidia +{ +namespace apex +{ + +PxCpuDispatcher* createDefaultThreadPool(unsigned int numThreads); + +class SharedQueueEntry : public shdfnd::SListEntry +{ +public: + SharedQueueEntry(void* objectRef) : mObjectRef(objectRef), mPooledEntry(false) {} + SharedQueueEntry() : mObjectRef(NULL), mPooledEntry(true) {} + +public: + void* mObjectRef; + bool mPooledEntry; // True if the entry was preallocated in a pool +}; + +template<class Alloc = typename shdfnd::AllocatorTraits<SharedQueueEntry>::Type > +class SharedQueueEntryPool : private Alloc +{ +public: + SharedQueueEntryPool(uint32_t poolSize, const Alloc& alloc = Alloc()); + ~SharedQueueEntryPool(); + + SharedQueueEntry* getEntry(void* objectRef); + void putEntry(SharedQueueEntry& entry); + +private: + SharedQueueEntry* mTaskEntryPool; + shdfnd::SList mTaskEntryPtrPool; +}; + +template <class Alloc> +SharedQueueEntryPool<Alloc>::SharedQueueEntryPool(uint32_t poolSize, const Alloc& alloc) + : Alloc(alloc) +{ + shdfnd::AlignedAllocator<PX_SLIST_ALIGNMENT, Alloc> alignedAlloc; + + mTaskEntryPool = poolSize ? (SharedQueueEntry*)alignedAlloc.allocate(sizeof(SharedQueueEntry) * poolSize, __FILE__, __LINE__) : NULL; + + if (mTaskEntryPool) + { + for (uint32_t i = 0; i < poolSize; i++) + { + PX_ASSERT((size_t(&mTaskEntryPool[i]) & (PX_SLIST_ALIGNMENT - 1)) == 0); // The SList entry must be aligned according to PX_SLIST_ALIGNMENT + + PX_PLACEMENT_NEW(&mTaskEntryPool[i], SharedQueueEntry)(); + PX_ASSERT(mTaskEntryPool[i].mPooledEntry == true); + mTaskEntryPtrPool.push(mTaskEntryPool[i]); + } + } +} + + +template <class Alloc> +SharedQueueEntryPool<Alloc>::~SharedQueueEntryPool() +{ + if (mTaskEntryPool) + { + shdfnd::AlignedAllocator<PX_SLIST_ALIGNMENT, Alloc> alignedAlloc; + alignedAlloc.deallocate(mTaskEntryPool); + } +} + + +template <class Alloc> +SharedQueueEntry* SharedQueueEntryPool<Alloc>::getEntry(void* objectRef) +{ + SharedQueueEntry* e = static_cast<SharedQueueEntry*>(mTaskEntryPtrPool.pop()); + if (e) + { + PX_ASSERT(e->mPooledEntry == true); + e->mObjectRef = objectRef; + return e; + } + else + { + shdfnd::AlignedAllocator<PX_SLIST_ALIGNMENT, Alloc> alignedAlloc; + e = (SharedQueueEntry*)alignedAlloc.allocate(sizeof(SharedQueueEntry), __FILE__, __LINE__); + if (e) + { + PX_PLACEMENT_NEW(e, SharedQueueEntry)(objectRef); + PX_ASSERT(e->mPooledEntry == false); + } + + return e; + } +} + + +template <class Alloc> +void SharedQueueEntryPool<Alloc>::putEntry(SharedQueueEntry& entry) +{ + if (entry.mPooledEntry) + { + entry.mObjectRef = NULL; + mTaskEntryPtrPool.push(entry); + } + else + { + shdfnd::AlignedAllocator<PX_SLIST_ALIGNMENT, Alloc> alignedAlloc; + alignedAlloc.deallocate(&entry); + } +} + +#define TASK_QUEUE_ENTRY_POOL_SIZE 128 + +class TaskQueueHelper +{ +public: + static PxBaseTask* fetchTask(shdfnd::SList& taskQueue, SharedQueueEntryPool<>& entryPool) + { + SharedQueueEntry* entry = static_cast<SharedQueueEntry*>(taskQueue.pop()); + if (entry) + { + PxBaseTask* task = reinterpret_cast<PxBaseTask*>(entry->mObjectRef); + entryPool.putEntry(*entry); + return task; + } + else + { + return NULL; + } + } +}; + + +class DefaultCpuDispatcher; + +class CpuWorkerThread : public shdfnd::Thread +{ +public: + CpuWorkerThread(); + ~CpuWorkerThread(); + + void initialize(DefaultCpuDispatcher* ownerDispatcher); + void execute(); + bool tryAcceptJobToLocalQueue(PxBaseTask& task, shdfnd::Thread::Id taskSubmitionThread); + PxBaseTask* giveUpJob(); + +protected: + SharedQueueEntryPool<> mQueueEntryPool; + DefaultCpuDispatcher* mOwner; + shdfnd::SList mLocalJobList; + shdfnd::Thread::Id mThreadId; + pvdsdk::ApexPvdClient *mApexPvdClient; +}; + +/* + * Default CpuDispatcher implementation, if none is provided + */ +class DefaultCpuDispatcher : public PxCpuDispatcher, public shdfnd::UserAllocated +{ + friend class TaskQueueHelper; + +private: + DefaultCpuDispatcher() : mQueueEntryPool(0) {} + ~DefaultCpuDispatcher(); + +public: + DefaultCpuDispatcher(uint32_t numThreads, uint32_t* affinityMasks); + void submitTask(PxBaseTask& task); + void flush( PxBaseTask& task, int32_t targetRef); + uint32_t getWorkerCount() const; + void release(); + + PxBaseTask* getJob(); + PxBaseTask* stealJob(); + void waitForWork() + { + mWorkReady.wait(); + } + void resetWakeSignal(); + static uint32_t getAffinityMask(uint32_t affinityMask); + +protected: + CpuWorkerThread* mWorkerThreads; + SharedQueueEntryPool<> mQueueEntryPool; + shdfnd::SList mJobList; + shdfnd::Sync mWorkReady; + uint32_t mNumThreads; + bool mShuttingDown; + pvdsdk::ApexPvdClient *mApexPvdClient; +}; + +} // end pxtask namespace +} // end physx namespace + +#endif // _THREAD_POOL_H_ diff --git a/APEX_1.4/framework/include/autogen/BufferF32x1.h b/APEX_1.4/framework/include/autogen/BufferF32x1.h new file mode 100644 index 00000000..3b2f372c --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferF32x1.h @@ -0,0 +1,238 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferF32x1_h +#define HEADER_BufferF32x1_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferF32x1NS +{ + + +struct F32_DynamicArray1D_Type +{ + float* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + + +struct ParametersStruct +{ + + F32_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0xcdd104f7, 0x061ac76e, 0xc255d951, 0x1e7cffef, }; + +} // namespace BufferF32x1NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferF32x1 : public NvParameterized::NvParameters, public BufferF32x1NS::ParametersStruct +{ +public: + BufferF32x1(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferF32x1(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferF32x1"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferF32x1NS::checksum); + return BufferF32x1NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferF32x1NS::ParametersStruct& parameters(void) const + { + BufferF32x1* tmpThis = const_cast<BufferF32x1*>(this); + return *(static_cast<BufferF32x1NS::ParametersStruct*>(tmpThis)); + } + + BufferF32x1NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferF32x1NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferF32x1Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferF32x1::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferF32x1), BufferF32x1::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferF32x1::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferF32x1"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferF32x1)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferF32x1)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferF32x1::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferF32x1::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferF32x1"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferF32x1 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferF32x1*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferF32x1::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferF32x1::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferF32x1::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferF32x1::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferF32x2.h b/APEX_1.4/framework/include/autogen/BufferF32x2.h new file mode 100644 index 00000000..59a6b0d9 --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferF32x2.h @@ -0,0 +1,244 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferF32x2_h +#define HEADER_BufferF32x2_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferF32x2NS +{ + +struct F32x2_Type; + +struct F32x2_DynamicArray1D_Type +{ + F32x2_Type* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct F32x2_Type +{ + float x; + float y; +}; + +struct ParametersStruct +{ + + F32x2_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0x788349ee, 0x95c560e2, 0x9633945e, 0x8cc784a0, }; + +} // namespace BufferF32x2NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferF32x2 : public NvParameterized::NvParameters, public BufferF32x2NS::ParametersStruct +{ +public: + BufferF32x2(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferF32x2(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferF32x2"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferF32x2NS::checksum); + return BufferF32x2NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferF32x2NS::ParametersStruct& parameters(void) const + { + BufferF32x2* tmpThis = const_cast<BufferF32x2*>(this); + return *(static_cast<BufferF32x2NS::ParametersStruct*>(tmpThis)); + } + + BufferF32x2NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferF32x2NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferF32x2Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferF32x2::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferF32x2), BufferF32x2::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferF32x2::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferF32x2"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferF32x2)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferF32x2)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferF32x2::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferF32x2::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferF32x2"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferF32x2 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferF32x2*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferF32x2::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferF32x2::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferF32x2::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferF32x2::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferF32x3.h b/APEX_1.4/framework/include/autogen/BufferF32x3.h new file mode 100644 index 00000000..79a0c924 --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferF32x3.h @@ -0,0 +1,245 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferF32x3_h +#define HEADER_BufferF32x3_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferF32x3NS +{ + +struct F32x3_Type; + +struct VEC3_DynamicArray1D_Type +{ + physx::PxVec3* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct F32x3_Type +{ + float x; + float y; + float z; +}; + +struct ParametersStruct +{ + + VEC3_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0x458b554a, 0x7ed3e930, 0x0299ff33, 0x9d69c11b, }; + +} // namespace BufferF32x3NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferF32x3 : public NvParameterized::NvParameters, public BufferF32x3NS::ParametersStruct +{ +public: + BufferF32x3(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferF32x3(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferF32x3"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferF32x3NS::checksum); + return BufferF32x3NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferF32x3NS::ParametersStruct& parameters(void) const + { + BufferF32x3* tmpThis = const_cast<BufferF32x3*>(this); + return *(static_cast<BufferF32x3NS::ParametersStruct*>(tmpThis)); + } + + BufferF32x3NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferF32x3NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferF32x3Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferF32x3::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferF32x3), BufferF32x3::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferF32x3::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferF32x3"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferF32x3)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferF32x3)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferF32x3::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferF32x3::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferF32x3"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferF32x3 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferF32x3*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferF32x3::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferF32x3::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferF32x3::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferF32x3::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferF32x4.h b/APEX_1.4/framework/include/autogen/BufferF32x4.h new file mode 100644 index 00000000..7e596c8e --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferF32x4.h @@ -0,0 +1,246 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferF32x4_h +#define HEADER_BufferF32x4_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferF32x4NS +{ + +struct F32x4_Type; + +struct F32x4_DynamicArray1D_Type +{ + F32x4_Type* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct F32x4_Type +{ + PX_ALIGN(16, float x); + float y; + float z; + float w; +}; + +struct ParametersStruct +{ + + F32x4_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0x80321851, 0xa99e95a1, 0xd26ec9a8, 0x14206b37, }; + +} // namespace BufferF32x4NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferF32x4 : public NvParameterized::NvParameters, public BufferF32x4NS::ParametersStruct +{ +public: + BufferF32x4(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferF32x4(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferF32x4"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)1; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferF32x4NS::checksum); + return BufferF32x4NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferF32x4NS::ParametersStruct& parameters(void) const + { + BufferF32x4* tmpThis = const_cast<BufferF32x4*>(this); + return *(static_cast<BufferF32x4NS::ParametersStruct*>(tmpThis)); + } + + BufferF32x4NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferF32x4NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferF32x4Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferF32x4::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferF32x4), BufferF32x4::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferF32x4::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferF32x4"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferF32x4)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferF32x4)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferF32x4::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferF32x4::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferF32x4"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferF32x4 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferF32x4*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferF32x4::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferF32x4::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferF32x4::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferF32x4::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferU16x1.h b/APEX_1.4/framework/include/autogen/BufferU16x1.h new file mode 100644 index 00000000..b093c47c --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferU16x1.h @@ -0,0 +1,238 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferU16x1_h +#define HEADER_BufferU16x1_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferU16x1NS +{ + + +struct U16_DynamicArray1D_Type +{ + uint16_t* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + + +struct ParametersStruct +{ + + U16_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0x3c20aee2, 0x4e6abe8c, 0x8c1e5625, 0x7cabf8fc, }; + +} // namespace BufferU16x1NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferU16x1 : public NvParameterized::NvParameters, public BufferU16x1NS::ParametersStruct +{ +public: + BufferU16x1(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferU16x1(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferU16x1"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferU16x1NS::checksum); + return BufferU16x1NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferU16x1NS::ParametersStruct& parameters(void) const + { + BufferU16x1* tmpThis = const_cast<BufferU16x1*>(this); + return *(static_cast<BufferU16x1NS::ParametersStruct*>(tmpThis)); + } + + BufferU16x1NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferU16x1NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferU16x1Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferU16x1::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferU16x1), BufferU16x1::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferU16x1::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU16x1"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferU16x1)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferU16x1)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferU16x1::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferU16x1::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU16x1"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferU16x1 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferU16x1*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferU16x1::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferU16x1::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferU16x1::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferU16x1::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferU16x2.h b/APEX_1.4/framework/include/autogen/BufferU16x2.h new file mode 100644 index 00000000..75931956 --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferU16x2.h @@ -0,0 +1,244 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferU16x2_h +#define HEADER_BufferU16x2_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferU16x2NS +{ + +struct U16x2_Type; + +struct U16x2_DynamicArray1D_Type +{ + U16x2_Type* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct U16x2_Type +{ + uint16_t x; + uint16_t y; +}; + +struct ParametersStruct +{ + + U16x2_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0x35087bb2, 0x98bdb0fd, 0x22e601f6, 0x79ba85e9, }; + +} // namespace BufferU16x2NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferU16x2 : public NvParameterized::NvParameters, public BufferU16x2NS::ParametersStruct +{ +public: + BufferU16x2(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferU16x2(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferU16x2"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferU16x2NS::checksum); + return BufferU16x2NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferU16x2NS::ParametersStruct& parameters(void) const + { + BufferU16x2* tmpThis = const_cast<BufferU16x2*>(this); + return *(static_cast<BufferU16x2NS::ParametersStruct*>(tmpThis)); + } + + BufferU16x2NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferU16x2NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferU16x2Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferU16x2::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferU16x2), BufferU16x2::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferU16x2::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU16x2"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferU16x2)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferU16x2)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferU16x2::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferU16x2::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU16x2"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferU16x2 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferU16x2*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferU16x2::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferU16x2::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferU16x2::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferU16x2::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferU16x3.h b/APEX_1.4/framework/include/autogen/BufferU16x3.h new file mode 100644 index 00000000..c4e6675b --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferU16x3.h @@ -0,0 +1,245 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferU16x3_h +#define HEADER_BufferU16x3_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferU16x3NS +{ + +struct U16x3_Type; + +struct U16x3_DynamicArray1D_Type +{ + U16x3_Type* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct U16x3_Type +{ + uint16_t x; + uint16_t y; + uint16_t z; +}; + +struct ParametersStruct +{ + + U16x3_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0x904a928f, 0x9f3f0b91, 0x29168b39, 0x31638e80, }; + +} // namespace BufferU16x3NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferU16x3 : public NvParameterized::NvParameters, public BufferU16x3NS::ParametersStruct +{ +public: + BufferU16x3(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferU16x3(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferU16x3"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferU16x3NS::checksum); + return BufferU16x3NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferU16x3NS::ParametersStruct& parameters(void) const + { + BufferU16x3* tmpThis = const_cast<BufferU16x3*>(this); + return *(static_cast<BufferU16x3NS::ParametersStruct*>(tmpThis)); + } + + BufferU16x3NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferU16x3NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferU16x3Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferU16x3::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferU16x3), BufferU16x3::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferU16x3::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU16x3"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferU16x3)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferU16x3)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferU16x3::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferU16x3::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU16x3"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferU16x3 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferU16x3*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferU16x3::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferU16x3::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferU16x3::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferU16x3::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferU16x4.h b/APEX_1.4/framework/include/autogen/BufferU16x4.h new file mode 100644 index 00000000..19307114 --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferU16x4.h @@ -0,0 +1,246 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferU16x4_h +#define HEADER_BufferU16x4_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferU16x4NS +{ + +struct U16x4_Type; + +struct U16x4_DynamicArray1D_Type +{ + U16x4_Type* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct U16x4_Type +{ + uint16_t x; + uint16_t y; + uint16_t z; + uint16_t w; +}; + +struct ParametersStruct +{ + + U16x4_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0x17ce6b83, 0x32ba98aa, 0xd03f98f6, 0x26918369, }; + +} // namespace BufferU16x4NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferU16x4 : public NvParameterized::NvParameters, public BufferU16x4NS::ParametersStruct +{ +public: + BufferU16x4(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferU16x4(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferU16x4"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferU16x4NS::checksum); + return BufferU16x4NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferU16x4NS::ParametersStruct& parameters(void) const + { + BufferU16x4* tmpThis = const_cast<BufferU16x4*>(this); + return *(static_cast<BufferU16x4NS::ParametersStruct*>(tmpThis)); + } + + BufferU16x4NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferU16x4NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferU16x4Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferU16x4::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferU16x4), BufferU16x4::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferU16x4::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU16x4"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferU16x4)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferU16x4)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferU16x4::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferU16x4::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU16x4"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferU16x4 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferU16x4*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferU16x4::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferU16x4::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferU16x4::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferU16x4::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferU32x1.h b/APEX_1.4/framework/include/autogen/BufferU32x1.h new file mode 100644 index 00000000..3af9e699 --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferU32x1.h @@ -0,0 +1,238 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferU32x1_h +#define HEADER_BufferU32x1_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferU32x1NS +{ + + +struct U32_DynamicArray1D_Type +{ + uint32_t* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + + +struct ParametersStruct +{ + + U32_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0xaea8bce2, 0x233c95f7, 0xdaa9d0d3, 0x43951dbe, }; + +} // namespace BufferU32x1NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferU32x1 : public NvParameterized::NvParameters, public BufferU32x1NS::ParametersStruct +{ +public: + BufferU32x1(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferU32x1(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferU32x1"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferU32x1NS::checksum); + return BufferU32x1NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferU32x1NS::ParametersStruct& parameters(void) const + { + BufferU32x1* tmpThis = const_cast<BufferU32x1*>(this); + return *(static_cast<BufferU32x1NS::ParametersStruct*>(tmpThis)); + } + + BufferU32x1NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferU32x1NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferU32x1Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferU32x1::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferU32x1), BufferU32x1::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferU32x1::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU32x1"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferU32x1)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferU32x1)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferU32x1::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferU32x1::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU32x1"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferU32x1 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferU32x1*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferU32x1::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferU32x1::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferU32x1::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferU32x1::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferU32x2.h b/APEX_1.4/framework/include/autogen/BufferU32x2.h new file mode 100644 index 00000000..2d051d1f --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferU32x2.h @@ -0,0 +1,244 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferU32x2_h +#define HEADER_BufferU32x2_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferU32x2NS +{ + +struct U32x2_Type; + +struct U32x2_DynamicArray1D_Type +{ + U32x2_Type* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct U32x2_Type +{ + uint32_t x; + uint32_t y; +}; + +struct ParametersStruct +{ + + U32x2_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0x8f8dc3d4, 0x45e914f5, 0xe6432284, 0xf7487471, }; + +} // namespace BufferU32x2NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferU32x2 : public NvParameterized::NvParameters, public BufferU32x2NS::ParametersStruct +{ +public: + BufferU32x2(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferU32x2(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferU32x2"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferU32x2NS::checksum); + return BufferU32x2NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferU32x2NS::ParametersStruct& parameters(void) const + { + BufferU32x2* tmpThis = const_cast<BufferU32x2*>(this); + return *(static_cast<BufferU32x2NS::ParametersStruct*>(tmpThis)); + } + + BufferU32x2NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferU32x2NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferU32x2Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferU32x2::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferU32x2), BufferU32x2::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferU32x2::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU32x2"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferU32x2)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferU32x2)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferU32x2::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferU32x2::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU32x2"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferU32x2 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferU32x2*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferU32x2::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferU32x2::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferU32x2::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferU32x2::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferU32x3.h b/APEX_1.4/framework/include/autogen/BufferU32x3.h new file mode 100644 index 00000000..cfa74c7c --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferU32x3.h @@ -0,0 +1,245 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferU32x3_h +#define HEADER_BufferU32x3_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferU32x3NS +{ + +struct U32x3_Type; + +struct U32x3_DynamicArray1D_Type +{ + U32x3_Type* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct U32x3_Type +{ + uint32_t x; + uint32_t y; + uint32_t z; +}; + +struct ParametersStruct +{ + + U32x3_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0xc0b737db, 0x1cae35c4, 0xe957acc9, 0x68cb2306, }; + +} // namespace BufferU32x3NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferU32x3 : public NvParameterized::NvParameters, public BufferU32x3NS::ParametersStruct +{ +public: + BufferU32x3(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferU32x3(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferU32x3"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferU32x3NS::checksum); + return BufferU32x3NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferU32x3NS::ParametersStruct& parameters(void) const + { + BufferU32x3* tmpThis = const_cast<BufferU32x3*>(this); + return *(static_cast<BufferU32x3NS::ParametersStruct*>(tmpThis)); + } + + BufferU32x3NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferU32x3NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferU32x3Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferU32x3::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferU32x3), BufferU32x3::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferU32x3::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU32x3"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferU32x3)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferU32x3)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferU32x3::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferU32x3::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU32x3"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferU32x3 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferU32x3*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferU32x3::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferU32x3::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferU32x3::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferU32x3::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferU32x4.h b/APEX_1.4/framework/include/autogen/BufferU32x4.h new file mode 100644 index 00000000..81879495 --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferU32x4.h @@ -0,0 +1,246 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferU32x4_h +#define HEADER_BufferU32x4_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferU32x4NS +{ + +struct U32x4_Type; + +struct U32x4_DynamicArray1D_Type +{ + U32x4_Type* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct U32x4_Type +{ + uint32_t x; + uint32_t y; + uint32_t z; + uint32_t w; +}; + +struct ParametersStruct +{ + + U32x4_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0x8e5349d3, 0xbf3dae15, 0x22c57bb9, 0x7c602608, }; + +} // namespace BufferU32x4NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferU32x4 : public NvParameterized::NvParameters, public BufferU32x4NS::ParametersStruct +{ +public: + BufferU32x4(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferU32x4(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferU32x4"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferU32x4NS::checksum); + return BufferU32x4NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferU32x4NS::ParametersStruct& parameters(void) const + { + BufferU32x4* tmpThis = const_cast<BufferU32x4*>(this); + return *(static_cast<BufferU32x4NS::ParametersStruct*>(tmpThis)); + } + + BufferU32x4NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferU32x4NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferU32x4Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferU32x4::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferU32x4), BufferU32x4::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferU32x4::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU32x4"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferU32x4)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferU32x4)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferU32x4::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferU32x4::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU32x4"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferU32x4 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferU32x4*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferU32x4::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferU32x4::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferU32x4::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferU32x4::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferU8x1.h b/APEX_1.4/framework/include/autogen/BufferU8x1.h new file mode 100644 index 00000000..3466041b --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferU8x1.h @@ -0,0 +1,238 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferU8x1_h +#define HEADER_BufferU8x1_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferU8x1NS +{ + + +struct U8_DynamicArray1D_Type +{ + uint8_t* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + + +struct ParametersStruct +{ + + U8_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0x9c4137b9, 0x1fe24c98, 0xae580b55, 0x7e908e02, }; + +} // namespace BufferU8x1NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferU8x1 : public NvParameterized::NvParameters, public BufferU8x1NS::ParametersStruct +{ +public: + BufferU8x1(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferU8x1(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferU8x1"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferU8x1NS::checksum); + return BufferU8x1NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferU8x1NS::ParametersStruct& parameters(void) const + { + BufferU8x1* tmpThis = const_cast<BufferU8x1*>(this); + return *(static_cast<BufferU8x1NS::ParametersStruct*>(tmpThis)); + } + + BufferU8x1NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferU8x1NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferU8x1Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferU8x1::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferU8x1), BufferU8x1::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferU8x1::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU8x1"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferU8x1)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferU8x1)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferU8x1::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferU8x1::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU8x1"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferU8x1 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferU8x1*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferU8x1::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferU8x1::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferU8x1::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferU8x1::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferU8x2.h b/APEX_1.4/framework/include/autogen/BufferU8x2.h new file mode 100644 index 00000000..c125d61b --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferU8x2.h @@ -0,0 +1,244 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferU8x2_h +#define HEADER_BufferU8x2_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferU8x2NS +{ + +struct U8x2_Type; + +struct U8x2_DynamicArray1D_Type +{ + U8x2_Type* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct U8x2_Type +{ + uint8_t x; + uint8_t y; +}; + +struct ParametersStruct +{ + + U8x2_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0x9857276c, 0xc24be4d6, 0x1aee732c, 0xf8979343, }; + +} // namespace BufferU8x2NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferU8x2 : public NvParameterized::NvParameters, public BufferU8x2NS::ParametersStruct +{ +public: + BufferU8x2(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferU8x2(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferU8x2"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferU8x2NS::checksum); + return BufferU8x2NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferU8x2NS::ParametersStruct& parameters(void) const + { + BufferU8x2* tmpThis = const_cast<BufferU8x2*>(this); + return *(static_cast<BufferU8x2NS::ParametersStruct*>(tmpThis)); + } + + BufferU8x2NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferU8x2NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferU8x2Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferU8x2::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferU8x2), BufferU8x2::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferU8x2::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU8x2"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferU8x2)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferU8x2)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferU8x2::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferU8x2::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU8x2"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferU8x2 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferU8x2*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferU8x2::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferU8x2::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferU8x2::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferU8x2::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferU8x3.h b/APEX_1.4/framework/include/autogen/BufferU8x3.h new file mode 100644 index 00000000..0d2e5030 --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferU8x3.h @@ -0,0 +1,245 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferU8x3_h +#define HEADER_BufferU8x3_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferU8x3NS +{ + +struct U8x3_Type; + +struct U8x3_DynamicArray1D_Type +{ + U8x3_Type* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct U8x3_Type +{ + uint8_t x; + uint8_t y; + uint8_t z; +}; + +struct ParametersStruct +{ + + U8x3_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0xf5cdaf40, 0x1d38c18b, 0x85082025, 0x4cefb88a, }; + +} // namespace BufferU8x3NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferU8x3 : public NvParameterized::NvParameters, public BufferU8x3NS::ParametersStruct +{ +public: + BufferU8x3(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferU8x3(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferU8x3"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferU8x3NS::checksum); + return BufferU8x3NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferU8x3NS::ParametersStruct& parameters(void) const + { + BufferU8x3* tmpThis = const_cast<BufferU8x3*>(this); + return *(static_cast<BufferU8x3NS::ParametersStruct*>(tmpThis)); + } + + BufferU8x3NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferU8x3NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferU8x3Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferU8x3::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferU8x3), BufferU8x3::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferU8x3::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU8x3"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferU8x3)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferU8x3)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferU8x3::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferU8x3::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU8x3"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferU8x3 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferU8x3*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferU8x3::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferU8x3::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferU8x3::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferU8x3::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/BufferU8x4.h b/APEX_1.4/framework/include/autogen/BufferU8x4.h new file mode 100644 index 00000000..0e9b9c7a --- /dev/null +++ b/APEX_1.4/framework/include/autogen/BufferU8x4.h @@ -0,0 +1,246 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_BufferU8x4_h +#define HEADER_BufferU8x4_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace BufferU8x4NS +{ + +struct U8x4_Type; + +struct U8x4_DynamicArray1D_Type +{ + U8x4_Type* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct U8x4_Type +{ + uint8_t x; + uint8_t y; + uint8_t z; + uint8_t w; +}; + +struct ParametersStruct +{ + + U8x4_DynamicArray1D_Type data; + +}; + +static const uint32_t checksum[] = { 0x8364dd0f, 0xbc7542d0, 0x1a22d2d2, 0x01fc1923, }; + +} // namespace BufferU8x4NS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class BufferU8x4 : public NvParameterized::NvParameters, public BufferU8x4NS::ParametersStruct +{ +public: + BufferU8x4(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~BufferU8x4(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("BufferU8x4"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(BufferU8x4NS::checksum); + return BufferU8x4NS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const BufferU8x4NS::ParametersStruct& parameters(void) const + { + BufferU8x4* tmpThis = const_cast<BufferU8x4*>(this); + return *(static_cast<BufferU8x4NS::ParametersStruct*>(tmpThis)); + } + + BufferU8x4NS::ParametersStruct& parameters(void) + { + return *(static_cast<BufferU8x4NS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class BufferU8x4Factory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + BufferU8x4::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(BufferU8x4), BufferU8x4::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, BufferU8x4::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU8x4"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(BufferU8x4)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, BufferU8x4)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, BufferU8x4::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, BufferU8x4::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class BufferU8x4"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of BufferU8x4 here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (BufferU8x4*)bufObj; + } + + virtual const char* getClassName() + { + return (BufferU8x4::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (BufferU8x4::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (BufferU8x4::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (BufferU8x4::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/ModuleFrameworkRegistration.h b/APEX_1.4/framework/include/autogen/ModuleFrameworkRegistration.h new file mode 100644 index 00000000..3b357bd6 --- /dev/null +++ b/APEX_1.4/framework/include/autogen/ModuleFrameworkRegistration.h @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#ifndef MODULE_MODULEFRAMEWORKREGISTRATIONH_H +#define MODULE_MODULEFRAMEWORKREGISTRATIONH_H + +#include "PsAllocator.h" +#include "NvRegistrationsForTraitsBase.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "PxAssert.h" +#include <stdint.h> + +// INCLUDE GENERATED FACTORIES +#include "VertexFormatParameters.h" +#include "VertexBufferParameters.h" +#include "SurfaceBufferParameters.h" +#include "SubmeshParameters.h" +#include "RenderMeshAssetParameters.h" +#include "BufferU8x1.h" +#include "BufferU8x2.h" +#include "BufferU8x3.h" +#include "BufferU8x4.h" +#include "BufferU16x1.h" +#include "BufferU16x2.h" +#include "BufferU16x3.h" +#include "BufferU16x4.h" +#include "BufferU32x1.h" +#include "BufferU32x2.h" +#include "BufferU32x3.h" +#include "BufferU32x4.h" +#include "BufferF32x1.h" +#include "BufferF32x2.h" +#include "BufferF32x3.h" +#include "BufferF32x4.h" + + +// INCLUDE GENERATED CONVERSION + + +namespace nvidia { +namespace apex { + + +class ModuleFrameworkRegistration : public NvParameterized::RegistrationsForTraitsBase +{ +public: + static void invokeRegistration(NvParameterized::Traits* parameterizedTraits) + { + if (parameterizedTraits) + { + ModuleFrameworkRegistration().registerAll(*parameterizedTraits); + } + } + + static void invokeUnregistration(NvParameterized::Traits* parameterizedTraits) + { + if (parameterizedTraits) + { + ModuleFrameworkRegistration().unregisterAll(*parameterizedTraits); + } + } + + void registerAvailableFactories(NvParameterized::Traits& parameterizedTraits) + { + ::NvParameterized::Factory* factoriesToRegister[] = { +// REGISTER GENERATED FACTORIES + new nvidia::apex::VertexFormatParametersFactory(), + new nvidia::apex::VertexBufferParametersFactory(), + new nvidia::apex::SurfaceBufferParametersFactory(), + new nvidia::apex::SubmeshParametersFactory(), + new nvidia::apex::RenderMeshAssetParametersFactory(), + new nvidia::apex::BufferU8x1Factory(), + new nvidia::apex::BufferU8x2Factory(), + new nvidia::apex::BufferU8x3Factory(), + new nvidia::apex::BufferU8x4Factory(), + new nvidia::apex::BufferU16x1Factory(), + new nvidia::apex::BufferU16x2Factory(), + new nvidia::apex::BufferU16x3Factory(), + new nvidia::apex::BufferU16x4Factory(), + new nvidia::apex::BufferU32x1Factory(), + new nvidia::apex::BufferU32x2Factory(), + new nvidia::apex::BufferU32x3Factory(), + new nvidia::apex::BufferU32x4Factory(), + new nvidia::apex::BufferF32x1Factory(), + new nvidia::apex::BufferF32x2Factory(), + new nvidia::apex::BufferF32x3Factory(), + new nvidia::apex::BufferF32x4Factory(), + + }; + + for (size_t i = 0; i < sizeof(factoriesToRegister)/sizeof(factoriesToRegister[0]); ++i) + { + parameterizedTraits.registerFactory(*factoriesToRegister[i]); + } + } + + virtual void registerAvailableConverters(NvParameterized::Traits& parameterizedTraits) + { +// REGISTER GENERATED CONVERSION +PX_UNUSED(parameterizedTraits); + + } + + void unregisterAvailableFactories(NvParameterized::Traits& parameterizedTraits) + { + struct FactoryDesc + { + const char* name; + uint32_t version; + }; + + ::NvParameterized::Factory* factoriesToUnregister[] = { +// UNREGISTER GENERATED FACTORIES + new nvidia::apex::VertexFormatParametersFactory(), + new nvidia::apex::VertexBufferParametersFactory(), + new nvidia::apex::SurfaceBufferParametersFactory(), + new nvidia::apex::SubmeshParametersFactory(), + new nvidia::apex::RenderMeshAssetParametersFactory(), + new nvidia::apex::BufferU8x1Factory(), + new nvidia::apex::BufferU8x2Factory(), + new nvidia::apex::BufferU8x3Factory(), + new nvidia::apex::BufferU8x4Factory(), + new nvidia::apex::BufferU16x1Factory(), + new nvidia::apex::BufferU16x2Factory(), + new nvidia::apex::BufferU16x3Factory(), + new nvidia::apex::BufferU16x4Factory(), + new nvidia::apex::BufferU32x1Factory(), + new nvidia::apex::BufferU32x2Factory(), + new nvidia::apex::BufferU32x3Factory(), + new nvidia::apex::BufferU32x4Factory(), + new nvidia::apex::BufferF32x1Factory(), + new nvidia::apex::BufferF32x2Factory(), + new nvidia::apex::BufferF32x3Factory(), + new nvidia::apex::BufferF32x4Factory(), + + }; + + for (size_t i = 0; i < sizeof(factoriesToUnregister)/sizeof(factoriesToUnregister[0]); ++i) + { + ::NvParameterized::Factory* removedFactory = parameterizedTraits.removeFactory(factoriesToUnregister[i]->getClassName(), factoriesToUnregister[i]->getVersion()); + if (!removedFactory) + { + PX_ASSERT_WITH_MESSAGE(0, "Factory can not be removed!"); + } + else + { + removedFactory->freeParameterDefinitionTable(¶meterizedTraits); + delete removedFactory; + delete factoriesToUnregister[i]; + } + } + } + + virtual void unregisterAvailableConverters(NvParameterized::Traits& parameterizedTraits) + { +// UNREGISTER GENERATED CONVERSION +PX_UNUSED(parameterizedTraits); + + } + +}; + + +} +} //nvidia::apex + +#endif diff --git a/APEX_1.4/framework/include/autogen/RenderMeshAssetParameters.h b/APEX_1.4/framework/include/autogen/RenderMeshAssetParameters.h new file mode 100644 index 00000000..bb56f5a0 --- /dev/null +++ b/APEX_1.4/framework/include/autogen/RenderMeshAssetParameters.h @@ -0,0 +1,260 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_RenderMeshAssetParameters_h +#define HEADER_RenderMeshAssetParameters_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace RenderMeshAssetParametersNS +{ + + +struct REF_DynamicArray1D_Type +{ + NvParameterized::Interface** buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct STRING_DynamicArray1D_Type +{ + NvParameterized::DummyStringStruct* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct BOUNDS3_DynamicArray1D_Type +{ + physx::PxBounds3* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + + +struct ParametersStruct +{ + + REF_DynamicArray1D_Type submeshes; + STRING_DynamicArray1D_Type materialNames; + BOUNDS3_DynamicArray1D_Type partBounds; + uint32_t textureUVOrigin; + uint32_t boneCount; + bool deleteStaticBuffersAfterUse; + bool isReferenced; + +}; + +static const uint32_t checksum[] = { 0x119d6f62, 0x8d1ff03d, 0x19864d20, 0x93421fd0, }; + +} // namespace RenderMeshAssetParametersNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class RenderMeshAssetParameters : public NvParameterized::NvParameters, public RenderMeshAssetParametersNS::ParametersStruct +{ +public: + RenderMeshAssetParameters(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~RenderMeshAssetParameters(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("RenderMeshAssetParameters"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(RenderMeshAssetParametersNS::checksum); + return RenderMeshAssetParametersNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const RenderMeshAssetParametersNS::ParametersStruct& parameters(void) const + { + RenderMeshAssetParameters* tmpThis = const_cast<RenderMeshAssetParameters*>(this); + return *(static_cast<RenderMeshAssetParametersNS::ParametersStruct*>(tmpThis)); + } + + RenderMeshAssetParametersNS::ParametersStruct& parameters(void) + { + return *(static_cast<RenderMeshAssetParametersNS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class RenderMeshAssetParametersFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + RenderMeshAssetParameters::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(RenderMeshAssetParameters), RenderMeshAssetParameters::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, RenderMeshAssetParameters::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class RenderMeshAssetParameters"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(RenderMeshAssetParameters)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, RenderMeshAssetParameters)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, RenderMeshAssetParameters::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, RenderMeshAssetParameters::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class RenderMeshAssetParameters"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of RenderMeshAssetParameters here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (RenderMeshAssetParameters*)bufObj; + } + + virtual const char* getClassName() + { + return (RenderMeshAssetParameters::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (RenderMeshAssetParameters::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (RenderMeshAssetParameters::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (RenderMeshAssetParameters::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/SubmeshParameters.h b/APEX_1.4/framework/include/autogen/SubmeshParameters.h new file mode 100644 index 00000000..feca716f --- /dev/null +++ b/APEX_1.4/framework/include/autogen/SubmeshParameters.h @@ -0,0 +1,242 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_SubmeshParameters_h +#define HEADER_SubmeshParameters_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace SubmeshParametersNS +{ + + +struct U32_DynamicArray1D_Type +{ + uint32_t* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + + +struct ParametersStruct +{ + + NvParameterized::Interface* vertexBuffer; + U32_DynamicArray1D_Type indexBuffer; + U32_DynamicArray1D_Type vertexPartition; + U32_DynamicArray1D_Type indexPartition; + U32_DynamicArray1D_Type smoothingGroups; + +}; + +static const uint32_t checksum[] = { 0xb2b4f308, 0x5f4b8da6, 0x4d45daeb, 0xbfc7d9b0, }; + +} // namespace SubmeshParametersNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class SubmeshParameters : public NvParameterized::NvParameters, public SubmeshParametersNS::ParametersStruct +{ +public: + SubmeshParameters(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~SubmeshParameters(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("SubmeshParameters"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)1; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(SubmeshParametersNS::checksum); + return SubmeshParametersNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const SubmeshParametersNS::ParametersStruct& parameters(void) const + { + SubmeshParameters* tmpThis = const_cast<SubmeshParameters*>(this); + return *(static_cast<SubmeshParametersNS::ParametersStruct*>(tmpThis)); + } + + SubmeshParametersNS::ParametersStruct& parameters(void) + { + return *(static_cast<SubmeshParametersNS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class SubmeshParametersFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + SubmeshParameters::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(SubmeshParameters), SubmeshParameters::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, SubmeshParameters::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class SubmeshParameters"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(SubmeshParameters)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, SubmeshParameters)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, SubmeshParameters::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, SubmeshParameters::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class SubmeshParameters"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of SubmeshParameters here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (SubmeshParameters*)bufObj; + } + + virtual const char* getClassName() + { + return (SubmeshParameters::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (SubmeshParameters::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (SubmeshParameters::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (SubmeshParameters::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/SurfaceBufferParameters.h b/APEX_1.4/framework/include/autogen/SurfaceBufferParameters.h new file mode 100644 index 00000000..63ba3766 --- /dev/null +++ b/APEX_1.4/framework/include/autogen/SurfaceBufferParameters.h @@ -0,0 +1,233 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_SurfaceBufferParameters_h +#define HEADER_SurfaceBufferParameters_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace SurfaceBufferParametersNS +{ + + + +struct ParametersStruct +{ + + uint32_t width; + uint32_t height; + uint32_t surfaceFormat; + NvParameterized::Interface* buffer; + +}; + +static const uint32_t checksum[] = { 0x8c5efe70, 0x9563a3a7, 0x2a52ffa7, 0x43e1a4fb, }; + +} // namespace SurfaceBufferParametersNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class SurfaceBufferParameters : public NvParameterized::NvParameters, public SurfaceBufferParametersNS::ParametersStruct +{ +public: + SurfaceBufferParameters(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~SurfaceBufferParameters(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("SurfaceBufferParameters"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)1; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(SurfaceBufferParametersNS::checksum); + return SurfaceBufferParametersNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const SurfaceBufferParametersNS::ParametersStruct& parameters(void) const + { + SurfaceBufferParameters* tmpThis = const_cast<SurfaceBufferParameters*>(this); + return *(static_cast<SurfaceBufferParametersNS::ParametersStruct*>(tmpThis)); + } + + SurfaceBufferParametersNS::ParametersStruct& parameters(void) + { + return *(static_cast<SurfaceBufferParametersNS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class SurfaceBufferParametersFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + SurfaceBufferParameters::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(SurfaceBufferParameters), SurfaceBufferParameters::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, SurfaceBufferParameters::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class SurfaceBufferParameters"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(SurfaceBufferParameters)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, SurfaceBufferParameters)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, SurfaceBufferParameters::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, SurfaceBufferParameters::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class SurfaceBufferParameters"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of SurfaceBufferParameters here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (SurfaceBufferParameters*)bufObj; + } + + virtual const char* getClassName() + { + return (SurfaceBufferParameters::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (SurfaceBufferParameters::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (SurfaceBufferParameters::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (SurfaceBufferParameters::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/VertexBufferParameters.h b/APEX_1.4/framework/include/autogen/VertexBufferParameters.h new file mode 100644 index 00000000..00cc33fb --- /dev/null +++ b/APEX_1.4/framework/include/autogen/VertexBufferParameters.h @@ -0,0 +1,240 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_VertexBufferParameters_h +#define HEADER_VertexBufferParameters_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace VertexBufferParametersNS +{ + + +struct REF_DynamicArray1D_Type +{ + NvParameterized::Interface** buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + + +struct ParametersStruct +{ + + uint32_t vertexCount; + NvParameterized::Interface* vertexFormat; + REF_DynamicArray1D_Type buffers; + +}; + +static const uint32_t checksum[] = { 0x14ae7314, 0xe50741cb, 0x15eb480c, 0x63f6c571, }; + +} // namespace VertexBufferParametersNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class VertexBufferParameters : public NvParameterized::NvParameters, public VertexBufferParametersNS::ParametersStruct +{ +public: + VertexBufferParameters(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~VertexBufferParameters(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("VertexBufferParameters"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)1; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(VertexBufferParametersNS::checksum); + return VertexBufferParametersNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const VertexBufferParametersNS::ParametersStruct& parameters(void) const + { + VertexBufferParameters* tmpThis = const_cast<VertexBufferParameters*>(this); + return *(static_cast<VertexBufferParametersNS::ParametersStruct*>(tmpThis)); + } + + VertexBufferParametersNS::ParametersStruct& parameters(void) + { + return *(static_cast<VertexBufferParametersNS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class VertexBufferParametersFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + VertexBufferParameters::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(VertexBufferParameters), VertexBufferParameters::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, VertexBufferParameters::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class VertexBufferParameters"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(VertexBufferParameters)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, VertexBufferParameters)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, VertexBufferParameters::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, VertexBufferParameters::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class VertexBufferParameters"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of VertexBufferParameters here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (VertexBufferParameters*)bufObj; + } + + virtual const char* getClassName() + { + return (VertexBufferParameters::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (VertexBufferParameters::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (VertexBufferParameters::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (VertexBufferParameters::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/framework/include/autogen/VertexFormatParameters.h b/APEX_1.4/framework/include/autogen/VertexFormatParameters.h new file mode 100644 index 00000000..232a72d1 --- /dev/null +++ b/APEX_1.4/framework/include/autogen/VertexFormatParameters.h @@ -0,0 +1,250 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. + +// This file was generated by NvParameterized/scripts/GenParameterized.pl + + +#ifndef HEADER_VertexFormatParameters_h +#define HEADER_VertexFormatParameters_h + +#include "NvParametersTypes.h" + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +#include "nvparameterized/NvParameterized.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "NvParameters.h" +#include "NvTraitsInternal.h" +#endif + +namespace nvidia +{ +namespace apex +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace VertexFormatParametersNS +{ + +struct BufferFormat_Type; + +struct BufferFormat_DynamicArray1D_Type +{ + BufferFormat_Type* buf; + bool isAllocated; + int32_t elementSize; + int32_t arraySizes[1]; +}; + +struct BufferFormat_Type +{ + NvParameterized::DummyStringStruct name; + int32_t semantic; + uint32_t id; + uint32_t format; + uint32_t access; + bool serialize; +}; + +struct ParametersStruct +{ + + uint32_t winding; + bool hasSeparateBoneBuffer; + BufferFormat_DynamicArray1D_Type bufferFormats; + +}; + +static const uint32_t checksum[] = { 0xa7c1ed95, 0x570ed2b1, 0x55717659, 0x9951d139, }; + +} // namespace VertexFormatParametersNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class VertexFormatParameters : public NvParameterized::NvParameters, public VertexFormatParametersNS::ParametersStruct +{ +public: + VertexFormatParameters(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~VertexFormatParameters(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("VertexFormatParameters"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0; + + static uint32_t staticVersion(void) + { + return ClassVersion; + } + + uint32_t version(void) const + { + return(staticVersion()); + } + + static const uint32_t ClassAlignment = 8; + + static const uint32_t* staticChecksum(uint32_t& bits) + { + bits = 8 * sizeof(VertexFormatParametersNS::checksum); + return VertexFormatParametersNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const VertexFormatParametersNS::ParametersStruct& parameters(void) const + { + VertexFormatParameters* tmpThis = const_cast<VertexFormatParameters*>(this); + return *(static_cast<VertexFormatParametersNS::ParametersStruct*>(tmpThis)); + } + + VertexFormatParametersNS::ParametersStruct& parameters(void) + { + return *(static_cast<VertexFormatParametersNS::ParametersStruct*>(this)); + } + + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const; + virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle); + + void initDefaults(void); + +protected: + + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void); + virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const; + + + virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const; + +private: + + void buildTree(void); + void initDynamicArrays(void); + void initStrings(void); + void initReferences(void); + void freeDynamicArrays(void); + void freeStrings(void); + void freeReferences(void); + + static bool mBuiltFlag; + static NvParameterized::MutexType mBuiltFlagMutex; +}; + +class VertexFormatParametersFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + VertexFormatParameters::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(VertexFormatParameters), VertexFormatParameters::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, VertexFormatParameters::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class VertexFormatParameters"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(VertexFormatParameters)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, VertexFormatParameters)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, VertexFormatParameters::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, VertexFormatParameters::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class VertexFormatParameters"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of VertexFormatParameters here + // but it may call default constructors of members and spoil the data + NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount); + + // Init vtable (everything else is already initialized) + *(const char**)bufObj = vptr; + + return (VertexFormatParameters*)bufObj; + } + + virtual const char* getClassName() + { + return (VertexFormatParameters::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (VertexFormatParameters::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (VertexFormatParameters::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (VertexFormatParameters::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace apex +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif |