I'm trying to apply data oriented design to my engine's main systems, including the renderer. This is easily done for things like particle systems and agent simulation, but I'm having a hard time applying it to mesh rendering.
Before DOD, I had a "Mesh" class with its vertices, normals, texcoords, etc. My renderer also had arrays of vertex and index buffers. This was your typical "Array of Structures" pattern.
Now, I'm trying to convert this to "Structure of Arrays" but I'm hitting a wall when it comes to sending mesh data to the shaders. My vertex shader uses a StructuredBuffer for all the vertices. Here's how it looks like:
struct Vertex
{
float3 position;
float3 normal;
float2 texcoord;
};
StructuredBuffer<Vertex> vertexBuffer : register(t0);
This encourages the "AoS" pattern. Before issuing a draw call, it forces me to upload a buffer of "Vertex" on the CPU, which is the opposite of what I want. Would shader performance be the same if I split the buffer in the shader into 3 StructuredBuffers, one for each vertex attribute? Am I doing all this for nothing in the end?