joint (non-contact constraint) solver iterations is now working on GPU, but overall slower because of data copy.
Will move joint setup to GPU, and then some benefit should be visible. Don't use 64 alignment, it causes data structures size mismatch between cpu and gpu
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
|
||||
typedef float4 Quaternion;
|
||||
|
||||
typedef struct
|
||||
@@ -38,6 +39,8 @@ typedef struct
|
||||
void* m_originalBody;
|
||||
int m_originalBodyIndex;
|
||||
};
|
||||
int padding[3];
|
||||
|
||||
} b3SolverBody;
|
||||
|
||||
|
||||
@@ -131,11 +134,8 @@ void resolveSingleConstraintRowGeneric(__global b3SolverBody* body1, __global b3
|
||||
c->m_appliedImpulse.x = sum;
|
||||
}
|
||||
|
||||
if (body1->m_invMass.x)
|
||||
internalApplyImpulse(body1,c->m_contactNormal*body1->m_invMass,c->m_angularComponentA,deltaImpulse);
|
||||
|
||||
if (body2->m_invMass.x)
|
||||
internalApplyImpulse(body2,-c->m_contactNormal*body2->m_invMass,c->m_angularComponentB,deltaImpulse);
|
||||
internalApplyImpulse(body1,c->m_contactNormal*body1->m_invMass,c->m_angularComponentA,deltaImpulse);
|
||||
internalApplyImpulse(body2,-c->m_contactNormal*body2->m_invMass,c->m_angularComponentB,deltaImpulse);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//this file is autogenerated using stringify.bat (premake --stringify) in the build folder of this project
|
||||
static const char* solveConstraintRowsCL= \
|
||||
"\n"
|
||||
"\n"
|
||||
"typedef float4 Quaternion;\n"
|
||||
"\n"
|
||||
"typedef struct\n"
|
||||
@@ -40,6 +41,8 @@ static const char* solveConstraintRowsCL= \
|
||||
" void* m_originalBody;\n"
|
||||
" int m_originalBodyIndex;\n"
|
||||
" };\n"
|
||||
" int padding[3];\n"
|
||||
"\n"
|
||||
"} b3SolverBody;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
@@ -133,11 +136,8 @@ static const char* solveConstraintRowsCL= \
|
||||
" c->m_appliedImpulse.x = sum;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (body1->m_invMass.x)\n"
|
||||
" internalApplyImpulse(body1,c->m_contactNormal*body1->m_invMass,c->m_angularComponentA,deltaImpulse);\n"
|
||||
" \n"
|
||||
" if (body2->m_invMass.x)\n"
|
||||
" internalApplyImpulse(body2,-c->m_contactNormal*body2->m_invMass,c->m_angularComponentB,deltaImpulse);\n"
|
||||
" internalApplyImpulse(body1,c->m_contactNormal*body1->m_invMass,c->m_angularComponentA,deltaImpulse);\n"
|
||||
" internalApplyImpulse(body2,-c->m_contactNormal*body2->m_invMass,c->m_angularComponentB,deltaImpulse);\n"
|
||||
"\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
|
||||
Reference in New Issue
Block a user