本文整理汇总了C++中CPUTAssetLibraryDX11::AddConstantBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CPUTAssetLibraryDX11::AddConstantBuffer方法的具体用法?C++ CPUTAssetLibraryDX11::AddConstantBuffer怎么用?C++ CPUTAssetLibraryDX11::AddConstantBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPUTAssetLibraryDX11
的用法示例。
在下文中一共展示了CPUTAssetLibraryDX11::AddConstantBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
//-----------------------------------------------------------------------------
void CPUTModelDX11::CreateModelConstantBuffer()
{
CPUTAssetLibraryDX11 *pAssetLibrary = (CPUTAssetLibraryDX11*)CPUTAssetLibrary::GetAssetLibrary();
// Create the model constant buffer.
HRESULT hr;
D3D11_BUFFER_DESC bd = {0};
bd.ByteWidth = sizeof(CPUTModelConstantBuffer);
bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
bd.Usage = D3D11_USAGE_DYNAMIC;
bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
hr = (CPUT_DX11::GetDevice())->CreateBuffer( &bd, NULL, &mpModelConstantBuffer );
ASSERT( !FAILED( hr ), _L("Error creating constant buffer.") );
CPUTSetDebugName( mpModelConstantBuffer, _L("Model Constant buffer") );
cString name = _L("$cbPerModelValues");
CPUTBufferDX11 *pBuffer = new CPUTBufferDX11(name, mpModelConstantBuffer);
pAssetLibrary->AddConstantBuffer( name, pBuffer );
pBuffer->Release(); // We're done with it. We added it to the library. Release our reference.
}