fixes in the DX11 cloth (for devices with physical wavefronts smaller than 32)
another fix for out-of-bounds check (there was no assert for this previously)
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
MSTRINGIFY(
|
MSTRINGIFY(
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cbuffer SolvePositionsFromLinksKernelCB : register( b0 )
|
cbuffer SolvePositionsFromLinksKernelCB : register( b0 )
|
||||||
{
|
{
|
||||||
int startWaveInBatch;
|
int startWaveInBatch;
|
||||||
@@ -41,16 +43,20 @@ SolvePositionsFromLinksKernel( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchT
|
|||||||
const int firstWavefrontInBlock = startWaveInBatch + Gid.x * WAVEFRONT_BLOCK_MULTIPLIER;
|
const int firstWavefrontInBlock = startWaveInBatch + Gid.x * WAVEFRONT_BLOCK_MULTIPLIER;
|
||||||
const int localWavefront = wavefront - firstWavefrontInBlock;
|
const int localWavefront = wavefront - firstWavefrontInBlock;
|
||||||
|
|
||||||
|
int batchesWithinWavefront = 0;
|
||||||
|
int verticesUsedByWave = 0;
|
||||||
|
int cond = wavefront < (startWaveInBatch + numWaves);
|
||||||
|
|
||||||
// Mask out in case there's a stray "wavefront" at the end that's been forced in through the multiplier
|
// Mask out in case there's a stray "wavefront" at the end that's been forced in through the multiplier
|
||||||
if( wavefront < (startWaveInBatch + numWaves) )
|
if( cond)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Load the batch counts for the wavefronts
|
// Load the batch counts for the wavefronts
|
||||||
|
|
||||||
int2 batchesAndVerticesWithinWavefront = g_wavefrontBatchCountsVertexCounts[wavefront];
|
int2 batchesAndVerticesWithinWavefront = g_wavefrontBatchCountsVertexCounts[wavefront];
|
||||||
|
|
||||||
int batchesWithinWavefront = batchesAndVerticesWithinWavefront.x;
|
batchesWithinWavefront = batchesAndVerticesWithinWavefront.x;
|
||||||
int verticesUsedByWave = batchesAndVerticesWithinWavefront.y;
|
verticesUsedByWave = batchesAndVerticesWithinWavefront.y;
|
||||||
|
|
||||||
// Load the vertices for the wavefronts
|
// Load the vertices for the wavefronts
|
||||||
for( int vertex = laneInWavefront; vertex < verticesUsedByWave; vertex+=WAVEFRONT_SIZE )
|
for( int vertex = laneInWavefront; vertex < verticesUsedByWave; vertex+=WAVEFRONT_SIZE )
|
||||||
@@ -62,10 +68,13 @@ SolvePositionsFromLinksKernel( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchT
|
|||||||
vertexInverseMassSharedData[localWavefront*MAX_NUM_VERTICES_PER_WAVE + vertex] = g_verticesInverseMass[vertexAddress];
|
vertexInverseMassSharedData[localWavefront*MAX_NUM_VERTICES_PER_WAVE + vertex] = g_verticesInverseMass[vertexAddress];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
// Ensure compiler does not re-order memory operations
|
// Ensure compiler does not re-order memory operations
|
||||||
AllMemoryBarrier();
|
//AllMemoryBarrier();
|
||||||
|
AllMemoryBarrierWithGroupSync ();
|
||||||
|
|
||||||
|
if( cond)
|
||||||
|
{
|
||||||
// Loop through the batches performing the solve on each in LDS
|
// Loop through the batches performing the solve on each in LDS
|
||||||
int baseDataLocationForWave = WAVEFRONT_SIZE * wavefront * MAX_BATCHES_PER_WAVE;
|
int baseDataLocationForWave = WAVEFRONT_SIZE * wavefront * MAX_BATCHES_PER_WAVE;
|
||||||
|
|
||||||
@@ -128,6 +137,11 @@ SolvePositionsFromLinksKernel( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ static void generateBatchesOfWavefronts( btAlignedObjectArray < btAlignedObjectA
|
|||||||
mapOfVerticesInBatches.resize( batch + 1 );
|
mapOfVerticesInBatches.resize( batch + 1 );
|
||||||
|
|
||||||
// Resize maps with total number of vertices
|
// Resize maps with total number of vertices
|
||||||
mapOfVerticesInBatches[batch].resize( numVertices, false );
|
mapOfVerticesInBatches[batch].resize( numVertices+1, false );
|
||||||
|
|
||||||
// Insert vertices into this batch too
|
// Insert vertices into this batch too
|
||||||
for( int link = 0; link < wavefront.size(); ++link )
|
for( int link = 0; link < wavefront.size(); ++link )
|
||||||
|
|||||||
Reference in New Issue
Block a user