struct Output
{
    float4 Color : TEXCOORD0;
    float4 Position : SV_Position;
};

#include "RootConstants.hlsl"

Output main(uint vertexIndex : SV_VertexID)
{
    Output output;

    // Retrieve the buffer using SM6.6 bindless syntax
    // Use BufferIndex from RootConstants (pushed via SetPushConstants)
    ByteAddressBuffer buffer = ResourceDescriptorHeap[BufferIndex];

    // Read position from buffer (Index * stride)
    // Stride = 2 float (pos) + 4 float (color) = 6 * 4 = 24 bytes ?
    // Let's assume just position 2D (8 bytes) + Color (16 bytes)
    uint stride = 24;
    uint offset = vertexIndex * stride;

    float2 pos = asfloat(buffer.Load2(offset));
    float4 col = asfloat(buffer.Load4(offset + 8));

    output.Position = float4(pos, 0.0f, 1.0f);
    output.Color = col;
    return output;
}
