C++ 超出CreateConstantBufferView处虚拟地址的结尾

C++ 超出CreateConstantBufferView处虚拟地址的结尾,c++,gpu,directx,direct3d,directx-12,C++,Gpu,Directx,Direct3d,Directx 12,我正在学习“使用DirectX12进行游戏编程”第6章代码 但在ID3DDevice::CreateConstantBufferView中,我发现了D3D12错误 D3D12错误:ID3D12Device::CreateConstantBufferView:pDesc->BufferLocation+SizeInBytes-1(0x00000000087b00ff)超出了资源的虚拟地址范围(0x0DA64DA0:“未命名ID3D12Resource对象”,GPU VA范围:0x000000000

我正在学习“使用DirectX12进行游戏编程”第6章代码

但在ID3DDevice::CreateConstantBufferView中,我发现了D3D12错误

D3D12错误:ID3D12Device::CreateConstantBufferView:pDesc->BufferLocation+SizeInBytes-1(0x00000000087b00ff)超出了资源的虚拟地址范围(0x0DA64DA0:“未命名ID3D12Resource对象”,GPU VA范围:0x00000000087b0000-0x00000000087b003f)。[状态\创建错误\ 649:创建\常量\缓冲区\视图\无效\资源]

这是我的密码

void BoxApp::BuildConstantBuffers()
{
    mObjectCB = std::make_unique<UploadBuffer<ObjectConstants>>(md3dDevice.Get(), 1, true);

    UINT objCBByteSize = calcConstantBufferByteSize(sizeof(ObjectConstants));

    D3D12_GPU_VIRTUAL_ADDRESS cbAddress = mObjectCB->Resource()->GetGPUVirtualAddress();

    int boxCBufIndex = 0;
    cbAddress += static_cast<UINT64>(boxCBufIndex) * static_cast<UINT64>(objCBByteSize);

    D3D12_CONSTANT_BUFFER_VIEW_DESC cbvDesc;
    cbvDesc.BufferLocation = cbAddress;
    cbvDesc.SizeInBytes = calcConstantBufferByteSize(sizeof(ObjectConstants));
    md3dDevice->CreateConstantBufferView(&cbvDesc, mCbvHeap->GetCPUDescriptorHandleForHeapStart());
}


static UINT calcConstantBufferByteSize(UINT byteSize)
{
    return (byteSize + 255) & ~255;
}
void-BoxApp::BuildConstantBuffers()
{
mObjectCB=std::使_唯一(md3dDevice.Get(),1,true);
UINT objCBByteSize=calcConstantBufferByteSize(sizeof(ObjectConstants));
D3D12_GPU_VIRTUAL_ADDRESS cbAddress=mObjectCB->Resource()->GetGPUVirtualAddress();
int-boxCBufIndex=0;
cbAddress+=静态_转换(boxCBufIndex)*静态_转换(objCBByteSize);
D3D12_常量_缓冲区_视图_描述cbvDesc;
cbvDesc.BufferLocation=cbAddress;
cbvDesc.SizeInBytes=calcConstantBufferByteSize(sizeof(ObjectConstants));
md3dDevice->CreateConstantBufferView(&cbvDesc,mCbvHeap->GetCPUDescriptorHandleForHeapStart());
}
静态UINT calcConstantBufferByteSize(UINT byteSize)
{
返回(字节大小+255)和~255;
}

发生了什么错误,以及如何修复它?

由于拼写错误而发生错误。真遗憾……因为拼写错误而出错。真遗憾。。