这对我来说似乎很清楚,所以我一定错过了一些东西。
这是句柄数组和每个单独句柄的声明:
// and the aggregate handle array for the setbufferscall
ID3D11Buffer * m_constantBuffers[NUM_CONSTANT_BUFFERS];
Microsoft::WRL::ComPtr<ID3D11Buffer> m_constantMatrixBuffer;
Microsoft::WRL::ComPtr<ID3D11Buffer> m_constantLightBuffer;
Microsoft::WRL::ComPtr<ID3D11Buffer> m_constantMaterialBuffer;
这就是我想要做的:
// and lastly, we need to aggregate all of these handles into
// one handle array so that it's formatted properly for the
// VSSetConstantBuffers call
m_constantBuffers[0] = m_constantMatrixBuffer.GetAddressOf();
m_constantBuffers[1] = m_constantLightBuffer.GetAddressOf();
m_constantBuffers[2] = m_constantMaterialBuffer.GetAddressOf();
最后,这是编译器所说的:
1>Renderer.cpp(66): error C2440: '=' : cannot convert from 'ID3D11Buffer **' to 'ID3D11Buffer *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Renderer.cpp(67): error C2440: '=' : cannot convert from 'ID3D11Buffer **' to 'ID3D11Buffer *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Renderer.cpp(68): error C2440: '=' : cannot convert from 'ID3D11Buffer **' to 'ID3D11Buffer *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
是什么赋予了?我认为取消引用数组意味着您正在处理数组声明之前的类型,在这种情况下是 ID3D11Buffer * 。
感谢您的阅读以及您可以节省的任何智慧