Has your OFFSET type got a fourth float member? Remember that your cbuffer size must be a multiple of 16, UpdateSubresource must update the entire cbuffer in D3D11, so when you're calling UpdateSubresource you're reading from a 12-byte source into a 16-byte destination, you overflow the bounds of the source data and - BOOM!
Simple solution - pad OFFSET to 4 floats (you can leave it as float3 in your shader).
Alternatively, and if you really don't want to do that, use a dynamic cbuffer and Map it with discard instead.
Show differencesHistory of post edits
#1mhagain
Posted 05 November 2012 - 04:21 PM
Has your OFFSET type got a fourth float member? Remember that your cbuffer size must be a multiple of 16, so when you're calling UpdateSubresource you're reading from a 12-byte source into a 16-byte destination. So you overflow the bounds of the source data and - BOOM!
Simple solution - pad OFFSET to 4 floats (you can leave it as float3 in your shader).
Simple solution - pad OFFSET to 4 floats (you can leave it as float3 in your shader).