Followers 0

# Get Buffer from Constant Buffer

## 4 posts in this topic

Hi All,
Is there any other way to get a buffer from a certain slot in the constant buffer other than calling VSGetConstantBuffers ?
In addition, has anyone got a working snippet for VSGetConstantBuffers?
It is very poor documented and wanted some help.
Any help/insight is appreciated.
Thanks,
0

##### Share on other sites

If you are trying to retrieve a constant buffer that is currently bound to the device, this is the only way that I'm aware of to do it.  But it does seem fairly well documented to me.  The first parameter is the starting register, the second is the number of buffers you want to retrieve starting from the register you gave as the first parameter, and the last is a pointer to the array of ID3D11Buffer pointers where you want to store the results. So if you wanted to get the constant buffer in register 1, you would do something like:

ID3D11Buffer* buffer[1];
context->VSGetConstantBuffers(1, 1, &buffer);

1

##### Share on other sites

If you are trying to retrieve a constant buffer that is currently bound to the device, this is the only way that I'm aware of to do it.  But it does seem fairly well documented to me.  The first parameter is the starting register, the second is the number of buffers you want to retrieve starting from the register you gave as the first parameter, and the last is a pointer to the array of ID3D11Buffer pointers where you want to store the results. So if you wanted to get the constant buffer in register 1, you would do something like:

ID3D11Buffer* buffer[1];
context->VSGetConstantBuffers(1, 1, &buffer);


Thanks for your comment. There are nearly no examples as far as I searched.

Also how can I check if the function failed?

Any other workaround?

Edited by fs1
0

##### Share on other sites

The reason that there's a lack of examples is that I suspect most people never call that function. You can keep track of what you passed to VSSetConstantBuffers() if you want to know what's set on the device.

As there is no return code or other documented error messages, the function should always work (if you pass valid parameters).

1

##### Share on other sites

The reason that there's a lack of examples is that I suspect most people never call that function. You can keep track of what you passed to VSSetConstantBuffers() if you want to know what's set on the device.

As there is no return code or other documented error messages, the function should always work (if you pass valid parameters).

EDIT: Thanks to all.

Edited by fs1
0

## Create an account

Register a new account

Followers 0

• 11
• 19
• 14
• 23
• 11