Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actualmhagain

Posted 05 November 2012 - 04:23 PM

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.

#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).

PARTNERS