Imported Upstream version 2.81
[platform/upstream/libbullet.git] / src / BulletMultiThreaded / GpuSoftBodySolvers / DX11 / btSoftBodySolver_DX11.h
1 /*\r
2 Bullet Continuous Collision Detection and Physics Library\r
3 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/\r
4 \r
5 This software is provided 'as-is', without any express or implied warranty.\r
6 In no event will the authors be held liable for any damages arising from the use of this software.\r
7 Permission is granted to anyone to use this software for any purpose, \r
8 including commercial applications, and to alter it and redistribute it freely, \r
9 subject to the following restrictions:\r
10 \r
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.\r
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.\r
13 3. This notice may not be removed or altered from any source distribution.\r
14 */\r
15 \r
16 #ifndef BT_ACCELERATED_SOFT_BODY_DX11_SOLVER_H\r
17 #define BT_ACCELERATED_SOFT_BODY_DX11_SOLVER_H\r
18 \r
19 \r
20 #include "vectormath/vmInclude.h"\r
21 #include "BulletSoftBody/btSoftBodySolvers.h"\r
22 #include "btSoftBodySolverVertexBuffer_DX11.h"\r
23 #include "btSoftBodySolverLinkData_DX11.h"\r
24 #include "btSoftBodySolverVertexData_DX11.h"\r
25 #include "btSoftBodySolverTriangleData_DX11.h"\r
26 \r
27 \r
28 \r
29 class DXFunctions\r
30 {\r
31 public:\r
32         \r
33         typedef HRESULT (WINAPI * CompileFromMemoryFunc)(LPCSTR,SIZE_T,LPCSTR,const D3D10_SHADER_MACRO*,LPD3D10INCLUDE,LPCSTR,LPCSTR,UINT,UINT,ID3DX11ThreadPump*,ID3D10Blob**,ID3D10Blob**,HRESULT*);\r
34 \r
35         ID3D11Device *           m_dx11Device;\r
36         ID3D11DeviceContext* m_dx11Context;\r
37         CompileFromMemoryFunc m_dx11CompileFromMemory;\r
38 \r
39         DXFunctions(ID3D11Device *dx11Device, ID3D11DeviceContext* dx11Context, CompileFromMemoryFunc dx11CompileFromMemory) :\r
40                 m_dx11Device( dx11Device ),\r
41                 m_dx11Context( dx11Context ),\r
42                 m_dx11CompileFromMemory( dx11CompileFromMemory )\r
43         {\r
44 \r
45         }\r
46 \r
47         class KernelDesc\r
48         {\r
49         protected:\r
50                 \r
51 \r
52         public:\r
53                 ID3D11ComputeShader* kernel;\r
54                 ID3D11Buffer* constBuffer;\r
55 \r
56                 KernelDesc()\r
57                 {\r
58                         kernel = 0;\r
59                         constBuffer = 0;\r
60                 }\r
61 \r
62                 virtual ~KernelDesc()\r
63                 {\r
64                         // TODO: this should probably destroy its kernel but we need to be careful\r
65                         // in case KernelDescs are copied\r
66                 }\r
67         }; \r
68 \r
69         /**\r
70          * Compile a compute shader kernel from a string and return the appropriate KernelDesc object.\r
71          */\r
72         KernelDesc compileComputeShaderFromString( const char* shaderString, const char* shaderName, int constBufferSize, D3D10_SHADER_MACRO *compileMacros = 0 );\r
73 \r
74 };\r
75 \r
76 class btDX11SoftBodySolver : public btSoftBodySolver\r
77 {\r
78 protected:\r
79         /**\r
80          * Entry in the collision shape array.\r
81          * Specifies the shape type, the transform matrix and the necessary details of the collisionShape.\r
82          */\r
83         struct CollisionShapeDescription\r
84         {\r
85                 Vectormath::Aos::Transform3 shapeTransform;\r
86                 Vectormath::Aos::Vector3 linearVelocity;\r
87                 Vectormath::Aos::Vector3 angularVelocity;\r
88 \r
89                 int softBodyIdentifier;\r
90                 int collisionShapeType;\r
91         \r
92                 // Both needed for capsule\r
93                 float radius;\r
94                 float halfHeight;\r
95                 \r
96                 float margin;\r
97                 float friction;\r
98 \r
99                 CollisionShapeDescription()\r
100                 {\r
101                         collisionShapeType = 0;\r
102                         margin = 0;\r
103                         friction = 0;\r
104                 }\r
105         };\r
106 \r
107         struct UIntVector3\r
108         {\r
109                 UIntVector3()\r
110                 {\r
111                         x = 0;\r
112                         y = 0;\r
113                         z = 0;\r
114                         _padding = 0;\r
115                 }\r
116                 \r
117                 UIntVector3( unsigned int x_, unsigned int y_, unsigned int z_ )\r
118                 {\r
119                         x = x_;\r
120                         y = y_;\r
121                         z = z_;\r
122                         _padding = 0;\r
123                 }\r
124                         \r
125                 unsigned int x;\r
126                 unsigned int y;\r
127                 unsigned int z;\r
128                 unsigned int _padding;\r
129         };\r
130 \r
131 \r
132 \r
133 public:\r
134         /**\r
135          * SoftBody class to maintain information about a soft body instance\r
136          * within a solver.\r
137          * This data addresses the main solver arrays.\r
138          */\r
139         class btAcceleratedSoftBodyInterface\r
140         {\r
141         protected:\r
142                 /** Current number of vertices that are part of this cloth */\r
143                 int m_numVertices;\r
144                 /** Maximum number of vertices allocated to be part of this cloth */\r
145                 int m_maxVertices;\r
146                 /** Current number of triangles that are part of this cloth */\r
147                 int m_numTriangles;\r
148                 /** Maximum number of triangles allocated to be part of this cloth */\r
149                 int m_maxTriangles;\r
150                 /** Index of first vertex in the world allocated to this cloth */\r
151                 int m_firstVertex;\r
152                 /** Index of first triangle in the world allocated to this cloth */\r
153                 int m_firstTriangle;\r
154                 /** Index of first link in the world allocated to this cloth */\r
155                 int m_firstLink;\r
156                 /** Maximum number of links allocated to this cloth */\r
157                 int m_maxLinks;\r
158                 /** Current number of links allocated to this cloth */\r
159                 int m_numLinks;\r
160 \r
161                 /** The actual soft body this data represents */\r
162                 btSoftBody *m_softBody;\r
163 \r
164 \r
165         public:\r
166                 btAcceleratedSoftBodyInterface( btSoftBody *softBody ) :\r
167                   m_softBody( softBody )\r
168                 {\r
169                         m_numVertices = 0;\r
170                         m_maxVertices = 0;\r
171                         m_numTriangles = 0;\r
172                         m_maxTriangles = 0;\r
173                         m_firstVertex = 0;\r
174                         m_firstTriangle = 0;\r
175                         m_firstLink = 0;\r
176                         m_maxLinks = 0;\r
177                         m_numLinks = 0;\r
178                 }\r
179                 int getNumVertices() const\r
180                 {\r
181                         return m_numVertices;\r
182                 }\r
183 \r
184                 int getNumTriangles() const\r
185                 {\r
186                         return m_numTriangles;\r
187                 }\r
188 \r
189                 int getMaxVertices() const\r
190                 {\r
191                         return m_maxVertices;\r
192                 }\r
193 \r
194                 int getMaxTriangles() const\r
195                 {\r
196                         return m_maxTriangles;\r
197                 }\r
198 \r
199                 int getFirstVertex() const\r
200                 {\r
201                         return m_firstVertex;\r
202                 }\r
203 \r
204                 int getFirstTriangle() const\r
205                 {\r
206                         return m_firstTriangle;\r
207                 }\r
208 \r
209 \r
210                 /**\r
211                  * Update the bounds in the btSoftBody object\r
212                  */\r
213                 void updateBounds( const btVector3 &lowerBound, const btVector3 &upperBound );\r
214 \r
215                 \r
216                 // TODO: All of these set functions will have to do checks and\r
217                 // update the world because restructuring of the arrays will be necessary\r
218                 // Reasonable use of "friend"?\r
219                 void setNumVertices( int numVertices )\r
220                 {\r
221                         m_numVertices = numVertices;\r
222                 }       \r
223         \r
224                 void setNumTriangles( int numTriangles )\r
225                 {\r
226                         m_numTriangles = numTriangles;\r
227                 }\r
228 \r
229                 void setMaxVertices( int maxVertices )\r
230                 {\r
231                         m_maxVertices = maxVertices;\r
232                 }\r
233 \r
234                 void setMaxTriangles( int maxTriangles )\r
235                 {\r
236                         m_maxTriangles = maxTriangles;\r
237                 }\r
238 \r
239                 void setFirstVertex( int firstVertex )\r
240                 {\r
241                         m_firstVertex = firstVertex;\r
242                 }\r
243 \r
244                 void setFirstTriangle( int firstTriangle )\r
245                 {\r
246                         m_firstTriangle = firstTriangle;\r
247                 }\r
248 \r
249                 void setMaxLinks( int maxLinks )\r
250                 {\r
251                         m_maxLinks = maxLinks;\r
252                 }\r
253 \r
254                 void setNumLinks( int numLinks )\r
255                 {\r
256                         m_numLinks = numLinks;\r
257                 }\r
258 \r
259                 void setFirstLink( int firstLink )\r
260                 {\r
261                         m_firstLink = firstLink;\r
262                 }\r
263 \r
264                 int getMaxLinks()\r
265                 {\r
266                         return m_maxLinks;\r
267                 }\r
268 \r
269                 int getNumLinks()\r
270                 {\r
271                         return m_numLinks;\r
272                 }\r
273 \r
274                 int getFirstLink()\r
275                 {\r
276                         return m_firstLink;\r
277                 }\r
278 \r
279                 btSoftBody* getSoftBody()\r
280                 {\r
281                         return m_softBody;\r
282                 }\r
283 \r
284         };\r
285 \r
286         \r
287         struct CollisionObjectIndices\r
288         {\r
289                 CollisionObjectIndices( int f, int e )\r
290                 {\r
291                         firstObject = f;\r
292                         endObject = e;\r
293                 }\r
294 \r
295                 int firstObject;\r
296                 int endObject;\r
297         };\r
298 \r
299 \r
300 \r
301 \r
302 \r
303         struct PrepareLinksCB\r
304         {               \r
305                 int numLinks;\r
306                 int padding0;\r
307                 int padding1;\r
308                 int padding2;\r
309         };\r
310 \r
311         struct SolvePositionsFromLinksKernelCB\r
312         {               \r
313                 int startLink;\r
314                 int numLinks;\r
315                 float kst;\r
316                 float ti;\r
317         };\r
318 \r
319         struct IntegrateCB\r
320         {\r
321                 int numNodes;\r
322                 float solverdt;\r
323                 int padding1;\r
324                 int padding2;\r
325         };\r
326 \r
327         struct UpdatePositionsFromVelocitiesCB\r
328         {\r
329                 int numNodes;\r
330                 float solverSDT;\r
331                 int padding1;\r
332                 int padding2;\r
333         };\r
334 \r
335         struct UpdateVelocitiesFromPositionsWithoutVelocitiesCB\r
336         {\r
337                 int numNodes;\r
338                 float isolverdt;\r
339                 int padding1;\r
340                 int padding2;\r
341         };\r
342 \r
343         struct UpdateVelocitiesFromPositionsWithVelocitiesCB\r
344         {\r
345                 int numNodes;\r
346                 float isolverdt;\r
347                 int padding1;\r
348                 int padding2;\r
349         };\r
350 \r
351         struct UpdateSoftBodiesCB\r
352         {\r
353                 int numNodes;\r
354                 int startFace;\r
355                 int numFaces;\r
356                 float epsilon;\r
357         };\r
358 \r
359 \r
360         struct ApplyForcesCB\r
361         {\r
362                 unsigned int numNodes;\r
363                 float solverdt;\r
364                 float epsilon;\r
365                 int padding3;\r
366         };\r
367 \r
368         struct AddVelocityCB\r
369         {\r
370                 int startNode;\r
371                 int lastNode;\r
372                 float velocityX;\r
373                 float velocityY;\r
374                 float velocityZ;\r
375                 int padding1;\r
376                 int padding2;\r
377                 int padding3;\r
378         };\r
379 \r
380         struct VSolveLinksCB\r
381         {\r
382                 int startLink;\r
383                 int numLinks;\r
384                 float kst;\r
385                 int padding;\r
386         };\r
387 \r
388         struct ComputeBoundsCB\r
389         {\r
390                 int numNodes;\r
391                 int numSoftBodies;\r
392                 int padding1;\r
393                 int padding2;\r
394         };\r
395 \r
396         struct SolveCollisionsAndUpdateVelocitiesCB\r
397         {\r
398                 unsigned int numNodes;\r
399                 float isolverdt;\r
400                 int padding0;\r
401                 int padding1;\r
402         };\r
403 \r
404         \r
405 \r
406 \r
407 protected:\r
408         ID3D11Device *           m_dx11Device;\r
409         ID3D11DeviceContext* m_dx11Context;\r
410         \r
411         DXFunctions dxFunctions;\r
412 public:\r
413         /** Link data for all cloths. Note that this will be sorted batch-wise for efficient computation and m_linkAddresses will maintain the addressing. */\r
414         btSoftBodyLinkDataDX11 m_linkData;\r
415         btSoftBodyVertexDataDX11 m_vertexData;\r
416         btSoftBodyTriangleDataDX11 m_triangleData;\r
417 \r
418 protected:\r
419 \r
420         /** Variable to define whether we need to update solver constants on the next iteration */\r
421         bool m_updateSolverConstants;\r
422 \r
423         bool m_shadersInitialized;\r
424 \r
425         /** \r
426          * Cloths owned by this solver.\r
427          * Only our cloths are in this array.\r
428          */\r
429         btAlignedObjectArray< btAcceleratedSoftBodyInterface * > m_softBodySet;\r
430 \r
431         /** Acceleration value to be applied to all non-static vertices in the solver. \r
432          * Index n is cloth n, array sized by number of cloths in the world not the solver. \r
433          */\r
434         btAlignedObjectArray< Vectormath::Aos::Vector3 >        m_perClothAcceleration;\r
435         btDX11Buffer<Vectormath::Aos::Vector3>                          m_dx11PerClothAcceleration;\r
436 \r
437         /** Wind velocity to be applied normal to all non-static vertices in the solver. \r
438          * Index n is cloth n, array sized by number of cloths in the world not the solver. \r
439          */\r
440         btAlignedObjectArray< Vectormath::Aos::Vector3 >        m_perClothWindVelocity;\r
441         btDX11Buffer<Vectormath::Aos::Vector3>                          m_dx11PerClothWindVelocity;\r
442 \r
443         /** Velocity damping factor */\r
444         btAlignedObjectArray< float >                                           m_perClothDampingFactor;\r
445         btDX11Buffer<float>                                                                     m_dx11PerClothDampingFactor;\r
446 \r
447         /** Velocity correction coefficient */\r
448         btAlignedObjectArray< float >                                           m_perClothVelocityCorrectionCoefficient;\r
449         btDX11Buffer<float>                                                                     m_dx11PerClothVelocityCorrectionCoefficient;\r
450 \r
451         /** Lift parameter for wind effect on cloth. */\r
452         btAlignedObjectArray< float >                                           m_perClothLiftFactor;\r
453         btDX11Buffer<float>                                                                     m_dx11PerClothLiftFactor;\r
454         \r
455         /** Drag parameter for wind effect on cloth. */\r
456         btAlignedObjectArray< float >                                           m_perClothDragFactor;\r
457         btDX11Buffer<float>                                                                     m_dx11PerClothDragFactor;\r
458 \r
459         /** Density of the medium in which each cloth sits */\r
460         btAlignedObjectArray< float >                                           m_perClothMediumDensity;\r
461         btDX11Buffer<float>                                                                     m_dx11PerClothMediumDensity;\r
462 \r
463         \r
464         /** \r
465          * Collision shape details: pair of index of first collision shape for the cloth and number of collision objects.\r
466          */\r
467         btAlignedObjectArray< CollisionObjectIndices >          m_perClothCollisionObjects;\r
468         btDX11Buffer<CollisionObjectIndices>                            m_dx11PerClothCollisionObjects;\r
469 \r
470         /** \r
471          * Collision shapes being passed across to the cloths in this solver.\r
472          */\r
473         btAlignedObjectArray< CollisionShapeDescription >       m_collisionObjectDetails;\r
474         btDX11Buffer< CollisionShapeDescription >                       m_dx11CollisionObjectDetails;\r
475 \r
476         /** \r
477          * Minimum bounds for each cloth.\r
478          * Updated by GPU and returned for use by broad phase.\r
479          * These are int vectors as a reminder that they store the int representation of a float, not a float.\r
480          * Bit 31 is inverted - is floats are stored with int-sortable values.\r
481          */\r
482         btAlignedObjectArray< UIntVector3 >     m_perClothMinBounds;\r
483         btDX11Buffer< UIntVector3 >                     m_dx11PerClothMinBounds;\r
484 \r
485         /** \r
486          * Maximum bounds for each cloth.\r
487          * Updated by GPU and returned for use by broad phase.\r
488          * These are int vectors as a reminder that they store the int representation of a float, not a float.\r
489          * Bit 31 is inverted - is floats are stored with int-sortable values.\r
490          */\r
491         btAlignedObjectArray< UIntVector3 >     m_perClothMaxBounds;\r
492         btDX11Buffer< UIntVector3 >                     m_dx11PerClothMaxBounds;\r
493 \r
494         \r
495         /** \r
496          * Friction coefficient for each cloth\r
497          */\r
498         btAlignedObjectArray< float >   m_perClothFriction;\r
499         btDX11Buffer< float >                   m_dx11PerClothFriction;\r
500 \r
501         DXFunctions::KernelDesc         prepareLinksKernel;\r
502         DXFunctions::KernelDesc         solvePositionsFromLinksKernel;\r
503         DXFunctions::KernelDesc         vSolveLinksKernel;\r
504         DXFunctions::KernelDesc         integrateKernel;\r
505         DXFunctions::KernelDesc         addVelocityKernel;\r
506         DXFunctions::KernelDesc         updatePositionsFromVelocitiesKernel;\r
507         DXFunctions::KernelDesc         updateVelocitiesFromPositionsWithoutVelocitiesKernel;\r
508         DXFunctions::KernelDesc         updateVelocitiesFromPositionsWithVelocitiesKernel;\r
509         DXFunctions::KernelDesc         solveCollisionsAndUpdateVelocitiesKernel;\r
510         DXFunctions::KernelDesc         resetNormalsAndAreasKernel;\r
511         DXFunctions::KernelDesc         normalizeNormalsAndAreasKernel;\r
512         DXFunctions::KernelDesc         computeBoundsKernel;\r
513         DXFunctions::KernelDesc         updateSoftBodiesKernel;\r
514 \r
515         DXFunctions::KernelDesc         applyForcesKernel;\r
516 \r
517         bool    m_enableUpdateBounds;\r
518 \r
519         /**\r
520          * Integrate motion on the solver.\r
521          */\r
522         virtual void integrate( float solverdt );\r
523         float computeTriangleArea( \r
524                 const Vectormath::Aos::Point3 &vertex0,\r
525                 const Vectormath::Aos::Point3 &vertex1,\r
526                 const Vectormath::Aos::Point3 &vertex2 );\r
527 \r
528 \r
529         virtual bool buildShaders();\r
530 \r
531         void resetNormalsAndAreas( int numVertices );\r
532 \r
533         void normalizeNormalsAndAreas( int numVertices );\r
534 \r
535         void executeUpdateSoftBodies( int firstTriangle, int numTriangles );\r
536 \r
537         void prepareCollisionConstraints();\r
538 \r
539         Vectormath::Aos::Vector3 ProjectOnAxis( const Vectormath::Aos::Vector3 &v, const Vectormath::Aos::Vector3 &a );\r
540 \r
541         void ApplyClampedForce( float solverdt, const Vectormath::Aos::Vector3 &force, const Vectormath::Aos::Vector3 &vertexVelocity, float inverseMass, Vectormath::Aos::Vector3 &vertexForce );\r
542 \r
543         virtual void applyForces( float solverdt );\r
544         \r
545         virtual void updateConstants( float timeStep );\r
546         int findSoftBodyIndex( const btSoftBody* const softBody );\r
547 \r
548         //////////////////////////////////////\r
549         // Kernel dispatches\r
550         virtual void prepareLinks();\r
551 \r
552         void updatePositionsFromVelocities( float solverdt );\r
553         void solveLinksForPosition( int startLink, int numLinks, float kst, float ti );\r
554         void solveLinksForVelocity( int startLink, int numLinks, float kst );\r
555         \r
556         void updateVelocitiesFromPositionsWithVelocities( float isolverdt );\r
557         void updateVelocitiesFromPositionsWithoutVelocities( float isolverdt );\r
558         void computeBounds( );\r
559         void solveCollisionsAndUpdateVelocities( float isolverdt );\r
560 \r
561         // End kernel dispatches\r
562         /////////////////////////////////////\r
563 \r
564         void updateBounds();\r
565 \r
566         \r
567         void releaseKernels();\r
568 \r
569 public:\r
570         btDX11SoftBodySolver(ID3D11Device * dx11Device, ID3D11DeviceContext* dx11Context, DXFunctions::CompileFromMemoryFunc dx11CompileFromMemory = &D3DX11CompileFromMemory);\r
571 \r
572         virtual ~btDX11SoftBodySolver();\r
573         \r
574         \r
575         virtual SolverTypes getSolverType() const\r
576         {\r
577                 return DX_SOLVER;\r
578         }\r
579 \r
580         void    setEnableUpdateBounds(bool enableBounds)\r
581         {\r
582                 m_enableUpdateBounds = enableBounds;\r
583         }\r
584         bool getEnableUpdateBounds() const\r
585         {\r
586                 return  m_enableUpdateBounds;\r
587         }\r
588 \r
589 \r
590 \r
591         virtual btSoftBodyLinkData &getLinkData();\r
592 \r
593         virtual btSoftBodyVertexData &getVertexData();\r
594 \r
595         virtual btSoftBodyTriangleData &getTriangleData();\r
596 \r
597 \r
598 \r
599         \r
600 \r
601         btAcceleratedSoftBodyInterface *findSoftBodyInterface( const btSoftBody* const softBody );\r
602         const btAcceleratedSoftBodyInterface * const findSoftBodyInterface( const btSoftBody* const softBody ) const;\r
603 \r
604         virtual bool checkInitialized();\r
605 \r
606         virtual void updateSoftBodies( );\r
607 \r
608         virtual void optimize( btAlignedObjectArray< btSoftBody * > &softBodies , bool forceUpdate=false);\r
609 \r
610         virtual void copyBackToSoftBodies(bool bMove = true);\r
611 \r
612         virtual void solveConstraints( float solverdt );\r
613 \r
614         virtual void predictMotion( float solverdt );\r
615 \r
616         \r
617         virtual void processCollision( btSoftBody *, const btCollisionObjectWrapper* );\r
618 \r
619         virtual void processCollision( btSoftBody*, btSoftBody* );\r
620 \r
621 };\r
622 \r
623 \r
624 \r
625 /** \r
626  * Class to manage movement of data from a solver to a given target.\r
627  * This version is the DX to CPU version.\r
628  */\r
629 class btSoftBodySolverOutputDXtoCPU : public btSoftBodySolverOutput\r
630 {\r
631 protected:\r
632 \r
633 public:\r
634         btSoftBodySolverOutputDXtoCPU()\r
635         {\r
636         }\r
637 \r
638         /** Output current computed vertex data to the vertex buffers for all cloths in the solver. */\r
639         virtual void copySoftBodyToVertexBuffer( const btSoftBody * const softBody, btVertexBufferDescriptor *vertexBuffer );\r
640 };\r
641 \r
642 /** \r
643  * Class to manage movement of data from a solver to a given target.\r
644  * This version is the DX to DX version and subclasses DX to CPU so that it works for that too.\r
645  */\r
646 class btSoftBodySolverOutputDXtoDX : public btSoftBodySolverOutputDXtoCPU\r
647 {\r
648 protected:\r
649         struct OutputToVertexArrayCB\r
650         {\r
651                 int startNode;\r
652                 int numNodes;\r
653                 int positionOffset;\r
654                 int positionStride;\r
655                 \r
656                 int normalOffset;       \r
657                 int normalStride;\r
658                 int padding1;\r
659                 int padding2;\r
660         };\r
661         \r
662         DXFunctions dxFunctions;\r
663         DXFunctions::KernelDesc outputToVertexArrayWithNormalsKernel;\r
664         DXFunctions::KernelDesc outputToVertexArrayWithoutNormalsKernel;\r
665 \r
666         \r
667         bool m_shadersInitialized;\r
668 \r
669         bool checkInitialized();\r
670         bool buildShaders();\r
671         void releaseKernels();\r
672 \r
673 public:\r
674         btSoftBodySolverOutputDXtoDX(ID3D11Device *dx11Device, ID3D11DeviceContext* dx11Context, DXFunctions::CompileFromMemoryFunc dx11CompileFromMemory = &D3DX11CompileFromMemory) :\r
675           dxFunctions( dx11Device, dx11Context, dx11CompileFromMemory )\r
676         {\r
677                 m_shadersInitialized = false;\r
678         }\r
679 \r
680         ~btSoftBodySolverOutputDXtoDX()\r
681         {\r
682                 releaseKernels();\r
683         }\r
684 \r
685         /** Output current computed vertex data to the vertex buffers for all cloths in the solver. */\r
686         virtual void copySoftBodyToVertexBuffer( const btSoftBody * const softBody, btVertexBufferDescriptor *vertexBuffer );\r
687 };\r
688 \r
689 #endif // #ifndef BT_ACCELERATED_SOFT_BODY_DX11_SOLVER_H\r
690 \r
691 \r