我觉得很清楚所以我必须遗漏一些东西。
这是句柄数组和每个句柄的声明:
// 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 *。
感谢阅读和任何智慧,你可以放心