struct Projector
{
float4x4 worldViewIT : WorldViewInverseTranspose;
float4x4 worldIT : WorldInverseTranspose;
float4x4 worldViewProj : WorldViewProjection;
float4x4 cameraWorld : Camera;
};
struct InstanceData
{
float4x4 cameraWorld : Camera;
float4x4 worldIT : WorldInverseTranspose;
float4x4 worldViewProj : WorldViewProjection;
float4x4 world : World;
Projector projector[8] : Projector;
uint projectorCount : ProjectorCount;
};
InstanceData gInstance[MAX_INSTANCE_CONSTANTS] : InstanceData;
[dx10] uploading uint to shader
im uploading data to a shader like this:
problem im having is that im guessing uint is 4 bytes, but when i upload data, rendering is wrong, like some matrix values are offset.
so either uint doesnt take 4 bytes, OR strats have some alignment?
if i comment out the uint, all works correctly
:-/
Constant buffers have some additional aligment rules as the buffers are organized as 4 elements vectors were each element have 4 bytes. Therefore InstanaceData should be padded to the next multiple 16 byte size.
There may be some other aligment rules active. You should use shader reflection or take at leat a look at the disassambeld shader to get the real layout of the constant buffer.
There may be some other aligment rules active. You should use shader reflection or take at leat a look at the disassambeld shader to get the real layout of the constant buffer.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement