Newton Dynamics
4.00
ndCudaContext.h
1
/* Copyright (c) <2003-2021> <Julio Jerez, Newton Game Dynamics>
2
*
3
* This software is provided 'as-is', without any express or implied
4
* warranty. In no event will the authors be held liable for any damages
5
* arising from the use of this software.
6
*
7
* Permission is granted to anyone to use this software for any purpose,
8
* including commercial applications, and to alter it and redistribute it
9
* freely, subject to the following restrictions:
10
*
11
* 1. The origin of this software must not be misrepresented; you must not
12
* claim that you wrote the original software. If you use this software
13
* in a product, an acknowledgment in the product documentation would be
14
* appreciated but is not required.
15
*
16
* 2. Altered source versions must be plainly marked as such, and must not be
17
* misrepresented as being the original software.
18
*
19
* 3. This notice may not be removed or altered from any source distribution.
20
*/
21
22
#ifndef __ND_CUDA_CONTEXT_H__
23
#define __ND_CUDA_CONTEXT_H__
24
25
#include <cuda.h>
26
#include <cuda_runtime.h>
27
#include <ndNewtonStdafx.h>
28
#include <device_launch_parameters.h>
29
30
#include "cuHostBuffer.h"
31
#include "ndBodyBuffer.h"
32
#include "cuSolverTypes.h"
33
#include "cuDeviceBuffer.h"
34
35
#define D_THREADS_PER_BLOCK_BITS 8
36
#define D_THREADS_PER_BLOCK (1<<D_THREADS_PER_BLOCK_BITS)
37
38
class
ndCudaDevice
39
{
40
public
:
41
ndCudaDevice
();
42
~
ndCudaDevice
();
43
44
struct
cudaDeviceProp m_prop;
45
ndUnsigned32 m_valid;
46
ndUnsigned32 m_blocksPerKernelCall;
47
};
48
49
class
ndCudaContext
:
public
ndClassAlloc
,
public
ndCudaDevice
50
{
51
public
:
52
ndCudaContext
();
53
~
ndCudaContext
();
54
static
ndCudaContext
* CreateContext();
55
56
void
SwapBuffers();
57
58
cuSceneInfo* m_sceneInfoGpu;
59
cuSceneInfo* m_sceneInfoCpu;
60
cuDeviceBuffer<unsigned>
m_histogram;
61
ndArray<cuBodyProxy>
m_bodyBufferCpu;
62
cuDeviceBuffer<cuBodyProxy>
m_bodyBufferGpu;
63
cuDeviceBuffer<cuBodyAabbCell>
m_bodyAabbCell;
64
cuDeviceBuffer<cuBodyAabbCell>
m_bodyAabbCellScrath;
65
cuDeviceBuffer<cuBoundingBox>
m_boundingBoxGpu;
66
cuHostBuffer<cuSpatialVector>
m_transformBufferCpu0;
67
cuHostBuffer<cuSpatialVector>
m_transformBufferCpu1;
68
cuDeviceBuffer<cuSpatialVector>
m_transformBufferGpu0;
69
cuDeviceBuffer<cuSpatialVector>
m_transformBufferGpu1;
70
71
cudaStream_t m_solverMemCpyStream;
72
cudaStream_t m_solverComputeStream;
73
ndInt32 m_frameCounter;
74
};
75
76
#endif
ndClassAlloc
Base class for providing memory allocation for all other engine classes.
Definition:
ndClassAlloc.h:30
ndArray< cuBodyProxy >
cuDeviceBuffer< unsigned >
ndCudaDevice
Definition:
ndCudaDevice.h:32
cuHostBuffer< cuSpatialVector >
ndCudaContext
Definition:
ndCudaContext.h:33
newton-dynamics
newton-4.00
sdk
dNewton
dExtensions
dCudaOld
ndCudaContext.h
Generated by
1.8.20