- added 'init' function for DoubleBuffer, in case constructor is not called.
- use proper transform for concave case thanks Marten for the patch
This commit is contained in:
@@ -25,6 +25,8 @@ public:
|
|||||||
bool isPending() const { return m_dmaPending;}
|
bool isPending() const { return m_dmaPending;}
|
||||||
DoubleBuffer();
|
DoubleBuffer();
|
||||||
|
|
||||||
|
void init ();
|
||||||
|
|
||||||
// dma get and put commands
|
// dma get and put commands
|
||||||
void backBufferDmaGet(uint64_t ea, unsigned int numBytes, unsigned int tag);
|
void backBufferDmaGet(uint64_t ea, unsigned int numBytes, unsigned int tag);
|
||||||
void backBufferDmaPut(uint64_t ea, unsigned int numBytes, unsigned int tag);
|
void backBufferDmaPut(uint64_t ea, unsigned int numBytes, unsigned int tag);
|
||||||
@@ -41,9 +43,15 @@ public:
|
|||||||
template<class T, int size>
|
template<class T, int size>
|
||||||
DoubleBuffer<T,size>::DoubleBuffer()
|
DoubleBuffer<T,size>::DoubleBuffer()
|
||||||
{
|
{
|
||||||
m_dmaPending = false;
|
init ();
|
||||||
m_frontBuffer = &m_buffer0[0];
|
}
|
||||||
m_backBuffer = &m_buffer1[0];
|
|
||||||
|
template<class T, int size>
|
||||||
|
void DoubleBuffer<T,size>::init()
|
||||||
|
{
|
||||||
|
this->m_dmaPending = false;
|
||||||
|
this->m_frontBuffer = &this->m_buffer0[0];
|
||||||
|
this->m_backBuffer = &this->m_buffer1[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, int size>
|
template<class T, int size>
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ void ProcessConvexConcaveSpuCollision(SpuCollisionPairInput* wuInput, CollisionT
|
|||||||
{
|
{
|
||||||
float margin=convexShape->getMarginNV();
|
float margin=convexShape->getMarginNV();
|
||||||
btVector3 halfExtents = convexShape->getImplicitShapeDimensions();
|
btVector3 halfExtents = convexShape->getImplicitShapeDimensions();
|
||||||
btTransform& t = wuInput->m_worldTransform0;
|
btTransform& t = convexInTriangleSpace;
|
||||||
btMatrix3x3 abs_b = t.getBasis().absolute();
|
btMatrix3x3 abs_b = t.getBasis().absolute();
|
||||||
btPoint3 center = t.getOrigin();
|
btPoint3 center = t.getOrigin();
|
||||||
btVector3 extent = btVector3(abs_b[0].dot(halfExtents),
|
btVector3 extent = btVector3(abs_b[0].dot(halfExtents),
|
||||||
@@ -343,7 +343,7 @@ void ProcessConvexConcaveSpuCollision(SpuCollisionPairInput* wuInput, CollisionT
|
|||||||
//add the radius to y-axis to get full height
|
//add the radius to y-axis to get full height
|
||||||
btScalar radius = halfExtents[0];
|
btScalar radius = halfExtents[0];
|
||||||
halfExtents[1] += radius;
|
halfExtents[1] += radius;
|
||||||
btTransform& t = wuInput->m_worldTransform0;
|
btTransform& t = convexInTriangleSpace;
|
||||||
btMatrix3x3 abs_b = t.getBasis().absolute();
|
btMatrix3x3 abs_b = t.getBasis().absolute();
|
||||||
btPoint3 center = t.getOrigin();
|
btPoint3 center = t.getOrigin();
|
||||||
btVector3 extent = btVector3(abs_b[0].dot(halfExtents),
|
btVector3 extent = btVector3(abs_b[0].dot(halfExtents),
|
||||||
@@ -360,7 +360,7 @@ void ProcessConvexConcaveSpuCollision(SpuCollisionPairInput* wuInput, CollisionT
|
|||||||
{
|
{
|
||||||
float radius = convexShape->getImplicitShapeDimensions().getX();// * convexShape->getLocalScaling().getX();
|
float radius = convexShape->getImplicitShapeDimensions().getX();// * convexShape->getLocalScaling().getX();
|
||||||
float margin = radius + convexShape->getMarginNV();
|
float margin = radius + convexShape->getMarginNV();
|
||||||
btTransform& t = wuInput->m_worldTransform0;
|
btTransform& t = convexInTriangleSpace;
|
||||||
const btVector3& center = t.getOrigin();
|
const btVector3& center = t.getOrigin();
|
||||||
btVector3 extent(margin,margin,margin);
|
btVector3 extent(margin,margin,margin);
|
||||||
aabbMin = center - extent;
|
aabbMin = center - extent;
|
||||||
@@ -377,7 +377,7 @@ void ProcessConvexConcaveSpuCollision(SpuCollisionPairInput* wuInput, CollisionT
|
|||||||
cellDmaGet(&convexHullShape0, dmaPpuAddress2 , dmaSize, DMA_TAG(1), 0, 0);
|
cellDmaGet(&convexHullShape0, dmaPpuAddress2 , dmaSize, DMA_TAG(1), 0, 0);
|
||||||
cellDmaWaitTagStatusAll(DMA_MASK(1));
|
cellDmaWaitTagStatusAll(DMA_MASK(1));
|
||||||
btConvexHullShape* localPtr = (btConvexHullShape*)&convexHullShape0;
|
btConvexHullShape* localPtr = (btConvexHullShape*)&convexHullShape0;
|
||||||
btTransform& t = wuInput->m_worldTransform0;
|
btTransform& t = convexInTriangleSpace;
|
||||||
|
|
||||||
btScalar margin = convexShape->getMarginNV();
|
btScalar margin = convexShape->getMarginNV();
|
||||||
|
|
||||||
@@ -1042,6 +1042,8 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
|
|||||||
unsigned int numOnLastPage = taskDesc.numOnLastPage;
|
unsigned int numOnLastPage = taskDesc.numOnLastPage;
|
||||||
|
|
||||||
// prefetch first set of inputs and wait
|
// prefetch first set of inputs and wait
|
||||||
|
lsMem.g_workUnitTaskBuffers.init();
|
||||||
|
|
||||||
unsigned int nextNumOnPage = (numPages > 1)? MIDPHASE_NUM_WORKUNITS_PER_PAGE : numOnLastPage;
|
unsigned int nextNumOnPage = (numPages > 1)? MIDPHASE_NUM_WORKUNITS_PER_PAGE : numOnLastPage;
|
||||||
lsMem.g_workUnitTaskBuffers.backBufferDmaGet(dmaInPtr, nextNumOnPage*sizeof(SpuGatherAndProcessWorkUnitInput), DMA_TAG(3));
|
lsMem.g_workUnitTaskBuffers.backBufferDmaGet(dmaInPtr, nextNumOnPage*sizeof(SpuGatherAndProcessWorkUnitInput), DMA_TAG(3));
|
||||||
dmaInPtr += MIDPHASE_WORKUNIT_PAGE_SIZE;
|
dmaInPtr += MIDPHASE_WORKUNIT_PAGE_SIZE;
|
||||||
|
|||||||
Reference in New Issue
Block a user