Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualJuliean

Posted 17 August 2013 - 04:13 AM


uhmmm... so I think I will need to find a nice way to force every variable in the C++ structure to be aligned to 16-bytes.

 

While not very programmatically sofisticated:

struct ConstantBuffer
{
    Matrix value2;
    float  value1;
} g_CBData;

I mean, since the order doesn't really matter (if you switch it in the shader, too), why not switch it around? I always try to sort my constants so that no dummy-padding or else is needed.

 

Plus, if you don't want the matrix to be transposed, add:

#pragma pack_matrix( row_major )

at the top of every shader file you want the matrix to work as passed in.


#1Juliean

Posted 17 August 2013 - 04:12 AM


uhmmm... so I think I will need to find a nice way to force every variable in the C++ structure to be aligned to 16-bytes.

 

While not very programmatically sofisticated:

struct ConstantBuffer
{
    Matrix value2;
    float  value1;
} g_CBData;

I mean, since the order doesn't really matter (if you switch it in the shader, too), why not switch it around? I always try to sort my constants so that no dummy-padding or else is needed.


PARTNERS