0

我想知道这段代码是否可以压缩,因为除了一行之外我不需要 UINT。

UINT vps = 1;
D3D11_VIEWPORT viewport;
md3dImmediateContext->RSGetViewports(&vps, &viewport);

我是否必须声明一个新变量才能传入第一个参数?

4

1 回答 1

3

The function RSGetViewports uses the pointer to modify the value of the int so that is visible outside the function. In this way, you can think of that argument as being both an input and output argument. Of course, there must be an object available for it to modify. If you were to pass an integer literal, there would be no such object.

于 2013-04-07T15:44:23.010 回答