Sign in to follow this  

Get Buffer from Constant Buffer

This topic is 1452 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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,

Share this post


Link to post
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);

Share this post


Link to post
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

Share this post


Link to post
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).

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

This topic is 1452 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this