From 4f562399c251526e6a36678ac18c6bf89ef60bfb Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Fri, 11 Mar 2011 01:30:46 +0000 Subject: [PATCH] Fix in the hlsl file, to allow other wavefront sizes to work correctly, thanks Ronen for the fix. Fix in btDX11SIMDAwareSoftBodySolver::optimize, the interface changed --- .../DX11/HLSL/SolvePositionsSIMDBatched.hlsl | 10 ++-------- .../DX11/btSoftBodySolver_DX11SIMDAware.cpp | 4 ++-- .../DX11/btSoftBodySolver_DX11SIMDAware.h | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/HLSL/SolvePositionsSIMDBatched.hlsl b/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/HLSL/SolvePositionsSIMDBatched.hlsl index a3ff5c5af..a67758ff5 100644 --- a/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/HLSL/SolvePositionsSIMDBatched.hlsl +++ b/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/HLSL/SolvePositionsSIMDBatched.hlsl @@ -46,15 +46,9 @@ SolvePositionsFromLinksKernel( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchT { // Load the batch counts for the wavefronts - // Mask out in case there's a stray "wavefront" at the end that's been forced in through the multiplier - if( laneInWavefront == 0 ) - { - int2 batchesAndVertexCountsWithinWavefront = g_wavefrontBatchCountsVertexCounts[firstWavefrontInBlock + localWavefront]; - wavefrontBatchCountsVertexCounts[localWavefront] = batchesAndVertexCountsWithinWavefront; - } - - int2 batchesAndVerticesWithinWavefront = wavefrontBatchCountsVertexCounts[localWavefront]; + int2 batchesAndVerticesWithinWavefront = g_wavefrontBatchCountsVertexCounts[wavefront]; + int batchesWithinWavefront = batchesAndVerticesWithinWavefront.x; int verticesUsedByWave = batchesAndVerticesWithinWavefront.y; diff --git a/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11SIMDAware.cpp b/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11SIMDAware.cpp index 896529d95..71cc49cbb 100644 --- a/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11SIMDAware.cpp +++ b/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11SIMDAware.cpp @@ -199,9 +199,9 @@ btSoftBodyLinkData &btDX11SIMDAwareSoftBodySolver::getLinkData() -void btDX11SIMDAwareSoftBodySolver::optimize( btAlignedObjectArray< btSoftBody * > &softBodies ) +void btDX11SIMDAwareSoftBodySolver::optimize( btAlignedObjectArray< btSoftBody * > &softBodies , bool forceUpdate) { - if( m_softBodySet.size() != softBodies.size() ) + if(forceUpdate || m_softBodySet.size() != softBodies.size() ) { // Have a change in the soft body set so update, reloading all the data getVertexData().clear(); diff --git a/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11SIMDAware.h b/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11SIMDAware.h index 7b9cc2ce2..059bd44fe 100644 --- a/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11SIMDAware.h +++ b/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11SIMDAware.h @@ -66,7 +66,7 @@ public: virtual btSoftBodyLinkData &getLinkData(); - virtual void optimize( btAlignedObjectArray< btSoftBody * > &softBodies ); + virtual void optimize( btAlignedObjectArray< btSoftBody * > &softBodies , bool forceUpdate=false); virtual void solveConstraints( float solverdt );