Shader compilation problem

Hi there, I noticed a problem with the shader compilation when using StructuredBuffer and custom structs.

Below is the shader that I am writing in XKSL:

shader CustomEffect : ShaderBaseStream
{
    struct VertexData
    {
        float3 test;
        float4 test1;
        float test2;
    };

    StructuredBuffer<VertexData> VertexBuffer;
.....
}

And as a result I get the following .hlsl file:

StructuredBuffer<VertexData> VertexBuffer_id16;
struct PS_STREAMS 
{
    float4 ColorTarget_id1;
};
struct PS_OUTPUT 
{
    float4 ColorTarget_id1 : SV_Target0;
};
struct VS_STREAMS 
{
    float4 Position_id15;
    float4 ShadingPosition_id0;
};
struct VS_OUTPUT 
{
    float4 ShadingPosition_id0 : SV_Position;
};
struct VS_INPUT 
{
    float4 Position_id15 : POSITION;
};
struct VertexData 
{
    float4 test;
};
....

Now obviously the compiler XKSL to HLSL is doing something silly because my struct VertexData is included after my StructuredBuffer which results in a hlsl compilation error since the VertexData struct is unknown at this stage…

Any work around folks ?

Interesting. Could it be the result of ShaderBaseStream inheritance?

No, thats just how the XKSL gets compiled to HLSL the Texture and Buffer declaration always come before the structs…