apply the DX11 cloth fix to allow DLL usage, see Issue 494

This commit is contained in:
erwin.coumans
2011-04-07 16:19:51 +00:00
parent a4e8213ede
commit d80805d40c
4 changed files with 16 additions and 12 deletions

View File

@@ -547,10 +547,10 @@ void btSoftBodyTriangleDataDX11::generateBatches()
btDX11SoftBodySolver::btDX11SoftBodySolver(ID3D11Device * dx11Device, ID3D11DeviceContext* dx11Context) : btDX11SoftBodySolver::btDX11SoftBodySolver(ID3D11Device * dx11Device, ID3D11DeviceContext* dx11Context, DXFunctions::CompileFromMemoryFunc dx11CompileFromMemory) :
m_dx11Device( dx11Device ), m_dx11Device( dx11Device ),
m_dx11Context( dx11Context ), m_dx11Context( dx11Context ),
dxFunctions( m_dx11Device, m_dx11Context ), dxFunctions( m_dx11Device, m_dx11Context, dx11CompileFromMemory ),
m_linkData(m_dx11Device, m_dx11Context), m_linkData(m_dx11Device, m_dx11Context),
m_vertexData(m_dx11Device, m_dx11Context), m_vertexData(m_dx11Device, m_dx11Context),
m_triangleData(m_dx11Device, m_dx11Context), m_triangleData(m_dx11Device, m_dx11Context),
@@ -1976,7 +1976,7 @@ DXFunctions::KernelDesc DXFunctions::compileComputeShaderFromString( const char*
ID3DBlob* pBlob = NULL; ID3DBlob* pBlob = NULL;
ID3D11ComputeShader* kernelPointer = 0; ID3D11ComputeShader* kernelPointer = 0;
hr = D3DX11CompileFromMemory( hr = m_dx11CompileFromMemory(
shaderString, shaderString,
strlen(shaderString), strlen(shaderString),
shaderName, shaderName,

View File

@@ -30,12 +30,16 @@ class DXFunctions
{ {
public: public:
typedef HRESULT (WINAPI * CompileFromMemoryFunc)(LPCSTR,SIZE_T,LPCSTR,const D3D10_SHADER_MACRO*,LPD3D10INCLUDE,LPCSTR,LPCSTR,UINT,UINT,ID3DX11ThreadPump*,ID3D10Blob**,ID3D10Blob**,HRESULT*);
ID3D11Device * m_dx11Device; ID3D11Device * m_dx11Device;
ID3D11DeviceContext* m_dx11Context; ID3D11DeviceContext* m_dx11Context;
CompileFromMemoryFunc m_dx11CompileFromMemory;
DXFunctions( ID3D11Device *dx11Device, ID3D11DeviceContext* dx11Context) : DXFunctions(ID3D11Device *dx11Device, ID3D11DeviceContext* dx11Context, CompileFromMemoryFunc dx11CompileFromMemory) :
m_dx11Device( dx11Device ), m_dx11Device( dx11Device ),
m_dx11Context( dx11Context ) m_dx11Context( dx11Context ),
m_dx11CompileFromMemory( dx11CompileFromMemory )
{ {
} }
@@ -561,7 +565,7 @@ protected:
void releaseKernels(); void releaseKernels();
public: public:
btDX11SoftBodySolver(ID3D11Device * dx11Device, ID3D11DeviceContext* dx11Context); btDX11SoftBodySolver(ID3D11Device * dx11Device, ID3D11DeviceContext* dx11Context, DXFunctions::CompileFromMemoryFunc dx11CompileFromMemory = &D3DX11CompileFromMemory);
virtual ~btDX11SoftBodySolver(); virtual ~btDX11SoftBodySolver();
@@ -655,8 +659,8 @@ protected:
void releaseKernels(); void releaseKernels();
public: public:
btSoftBodySolverOutputDXtoDX(ID3D11Device *dx11Device, ID3D11DeviceContext* dx11Context) : btSoftBodySolverOutputDXtoDX(ID3D11Device *dx11Device, ID3D11DeviceContext* dx11Context, DXFunctions::CompileFromMemoryFunc dx11CompileFromMemory = &D3DX11CompileFromMemory) :
dxFunctions( dx11Device, dx11Context ) dxFunctions( dx11Device, dx11Context, dx11CompileFromMemory )
{ {
m_shadersInitialized = false; m_shadersInitialized = false;
} }

View File

@@ -173,9 +173,9 @@ bool btSoftBodyLinkDataDX11SIMDAware::moveFromAccelerator()
btDX11SIMDAwareSoftBodySolver::btDX11SIMDAwareSoftBodySolver(ID3D11Device * dx11Device, ID3D11DeviceContext* dx11Context) : btDX11SIMDAwareSoftBodySolver::btDX11SIMDAwareSoftBodySolver(ID3D11Device * dx11Device, ID3D11DeviceContext* dx11Context, DXFunctions::CompileFromMemoryFunc dx11CompileFromMemory) :
btDX11SoftBodySolver( dx11Device, dx11Context ), btDX11SoftBodySolver( dx11Device, dx11Context, dx11CompileFromMemory ),
m_linkData(m_dx11Device, m_dx11Context) m_linkData(m_dx11Device, m_dx11Context)
{ {
// Initial we will clearly need to update solver constants // Initial we will clearly need to update solver constants
// For now this is global for the cloths linked with this solver - we should probably make this body specific // For now this is global for the cloths linked with this solver - we should probably make this body specific

View File

@@ -60,7 +60,7 @@ protected:
public: public:
btDX11SIMDAwareSoftBodySolver(ID3D11Device * dx11Device, ID3D11DeviceContext* dx11Context); btDX11SIMDAwareSoftBodySolver(ID3D11Device * dx11Device, ID3D11DeviceContext* dx11Context, DXFunctions::CompileFromMemoryFunc dx11CompileFromMemory = &D3DX11CompileFromMemory);
virtual ~btDX11SIMDAwareSoftBodySolver(); virtual ~btDX11SIMDAwareSoftBodySolver();