xenko icon indicating copy to clipboard operation
xenko copied to clipboard

XKSL shader compilation issue

Open matmuze opened this issue 7 years ago • 1 comments

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...

matmuze avatar May 22 '17 09:05 matmuze

Thanks for the report. This will be fixed in our next 2.0 release.

xen2 avatar May 23 '17 06:05 xen2