void ComputeShader::SetConstantBuffer( int _BufferSlot, ConstantBuffer& _Buffer ) { if ( !Lock() ) return; // Someone else is locking it ! ID3D11Buffer* pBuffer = _Buffer.GetBuffer(); m_Device.DXContext().CSSetConstantBuffers( _BufferSlot, 1, &pBuffer ); Unlock(); }
bool ComputeShader::SetConstantBuffer( const char* _pBufferName, ConstantBuffer& _Buffer ) { if ( !Lock() ) return true; // Someone else is locking it ! bool bUsed = false; ID3D11Buffer* pBuffer = _Buffer.GetBuffer(); { int SlotIndex = m_CSConstants.GetConstantBufferIndex( _pBufferName ); if ( SlotIndex != -1 ) m_Device.DXContext().CSSetConstantBuffers( SlotIndex, 1, &pBuffer ); bUsed |= SlotIndex != -1; } Unlock(); return bUsed; }