RavEngine
Loading...
Searching...
No Matches
nvPhysXtoDrv.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef __NVPHYSXTODRV_H__
30#define __NVPHYSXTODRV_H__
31
32// The puprose of this interface is to provide graphics drivers with information
33// about PhysX state to draw PhysX visual indicator
34
35// We share information between modules using a memory section object. PhysX creates
36// such object, graphics drivers try to open it. The name of the object has
37// fixed part (NvPhysXToDrv_SectionName) followed by the process id. This allows
38// each process to have its own communication channel.
39
40namespace physx
41{
42
43#define NvPhysXToDrv_SectionName "PH71828182845_"
44
45// Vista apps cannot create stuff in Global\\ namespace when NOT elevated, so use local scope
46#define NvPhysXToDrv_Build_SectionName(PID, buf) sprintf(buf, NvPhysXToDrv_SectionName "%x", static_cast<unsigned int>(PID))
47#define NvPhysXToDrv_Build_SectionNameXP(PID, buf) sprintf(buf, "Global\\" NvPhysXToDrv_SectionName "%x", static_cast<unsigned int>(PID))
48
49typedef struct NvPhysXToDrv_Header_
50{
51 int signature; // header interface signature
52 int version; // version of the interface
53 int size; // size of the structure
54 int reserved; // reserved, must be zero
56
57// this structure describes layout of data in the shared memory section
58typedef struct NvPhysXToDrv_Data_V1_
59{
60 NvPhysXToDrv_Header header; // keep this member first in all versions of the interface.
61
62 int bCpuPhysicsPresent; // nonzero if cpu physics is initialized
63 int bGpuPhysicsPresent; // nonzero if gpu physics is initialized
64
66
67// some random magic number as our interface signature
68#define NvPhysXToDrv_Header_Signature 0xA7AB
69
70// use the macro to setup the header to the latest version of the interface
71// update the macro when a new verson of the interface is added
72#define NvPhysXToDrv_Header_Init(header) \
73{ \
74 header.signature = NvPhysXToDrv_Header_Signature; \
75 header.version = 1; \
76 header.size = sizeof(NvPhysXToDrv_Data_V1); \
77 header.reserved = 0; \
78}
79
80// validate the header against all known interface versions
81// add validation checks when new interfaces are added
82#define NvPhysXToDrv_Header_Validate(header, curVersion) \
83 ( \
84 (header.signature == NvPhysXToDrv_Header_Signature) && \
85 (header.version == curVersion) && \
86 (curVersion == 1) && \
87 (header.size == sizeof(NvPhysXToDrv_Data_V1)) \
88 )
89
90}
91
92#endif // __NVPHYSXTODRV_H__
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition nvPhysXtoDrv.h:59
Definition nvPhysXtoDrv.h:50