HLSL ID3D11DeviceContext::UpdateSubresource Error

Ok,

so i have a shader which expects two constant buffers, but when I use

ID3D11DeviceContext::UpdateSubresource

And I set the SubResource to 1 (the second buffer), then I'm warned (error...):

D3D11: ERROR: ID3D11DeviceContext::UpdateSubresource: DstSubresource index (1) out of range, must be less than 1. [ RESOURCE_MANIPULATION ERROR #287: UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE ]

I understand the error, but just not why it appears, i.e. why it happens?

Thank You

Answers


SubResource is designed for TextureArrays/Mipmaps, so you can for example read/write a specific mip slice. In case of buffers the SubResource is always zero (since it's just more or less raw data).

You can find some info about SubResources here

So you can use 0 to update each of your constant buffer, then you need to assign each constant buffer to the shader slot, using PSSetConstantBuffers (and for each stage where it is needed), then choose the startslot accordingly (which should match the register number in your shader).


Need Your Help

Unexpected End of Input Error

javascript node.js mongodb express

I have this nodejs app and one of the calls I've made is an upsert call that upserts the request body to mongodb. If the request body exists in mongo, update it, else insert it. The insert portion ...

What is IP security?

security ip-protocol

Is there any brief explanation for IP security? And Why do we use it?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.