Hello everyone
I'm trying to optimize the drawitem structure i use for my renderqueue. I use a struct that basically containes the same elements as the one posted by Hodgman in this post http://www.gamedev.net/topic/666419-what-are-your-opinions-on-dx12vulkanmantle/#entry5215127. I'm trying to reduce the footprint of the struct and to get all the members to be contiguous in memory to improve cache efficiency.
Replacing the pointers by 16 bits unsigned integers which are indices into arrays will considerably reduce the size of the fixed-length part of the struct (i compile for 64 bits).
I don't know how to deal with the variable part of the struct. I though about using variable size structs like the one bellow :
struct DrawItem
{
u16 shaderPermutationId;
u16 depthStencilStateId;
// ...
u16 textureCount;
u16 textureIds[];
// Cannot put more arrays or anything else after that.
};
But like the comment says, it's not possible to have any member after a variable size array.
I'm interested to know what could be done.