Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

16byte alignment needed?

$
0
0

@AlienScribble wrote:

Was trying to find out if 16byte alignments are required for shaders to work right.
ie: I did this:
struct VS_Out
{
float4 Position: POSITION0;
float2 UV: TEXCOORD0;
float3 Normal: TEXCOORD1;
float3 worldPos: TEXCOORD2;
};
- And it would have no problems if pass the worldPos if I subtract the CameraPos (also float3)...
- But if I passed ONLY worldPos it would explode at the Apply() during runtime with:
'Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.'
All variables appear to be in use so that didn't seem to be the issue.
Then I thought maybe it needs 16byte alignment so I changed Normal to float4.... suddenly everything works - so I assume it needs 16 byte alignment (ie: doesn't pad things itself).
Is this the case?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles