[require]
shader model >= 5.0

[uav 2]
stride 16
size (buffer, 2)

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8

[pixel shader todo]
struct s
{
    float3 a;
};

struct s2
{
    float4x4 f1, f2, f3;
};

RWStructuredBuffer<float4> u : register(u2);
RWStructuredBuffer<float> u1;
RWStructuredBuffer<float2x2> u2;
RWStructuredBuffer<struct s> u3;
RWStructuredBuffer<float4x4> u4;
RWStructuredBuffer<struct s2> u5;

float4 main() : sv_target1
{
    u[0] = float4(11.1, 12.2, 13.3, 14.4);
    u[1] = float4(15.5, 16.6, 17.7, 18.8);
    return 0;
}

[test]
todo(sm<6) draw quad
probe uav 2 (0) rgba (11.1, 12.2, 13.3, 14.4)
probe uav 2 (1) rgba (15.5, 16.6, 17.7, 18.8)

[pixel shader todo]
struct s
{
    float3 a;
};

struct s2
{
    float4x4 f1, f2, f3;
};

RasterizerOrderedStructuredBuffer<float4> u : register(u2);
RasterizerOrderedStructuredBuffer<float> u1;
RasterizerOrderedStructuredBuffer<float2x2> u2;
RasterizerOrderedStructuredBuffer<struct s> u3;
RasterizerOrderedStructuredBuffer<float4x4> u4;
RasterizerOrderedStructuredBuffer<struct s2> u5;

float4 main() : sv_target1
{
    u[0] = float4(11.1, 12.2, 13.3, 14.4);
    return 0;
}

% Array type
[pixel shader]
typedef float arr[2];
RWStructuredBuffer<arr> u;

float4 main() : sv_target1
{
    return 0;
}

[pixel shader]
typedef float arr[2];
RasterizerOrderedStructuredBuffer<arr> u;

float4 main() : sv_target1
{
    return 0;
}

% Object types
[pixel shader fail(sm<6)]
RWStructuredBuffer<Texture2D> u;

float4 main() : sv_target1
{
    return 0;
}

[pixel shader fail]
struct s
{
    Texture2D t;
};
RWStructuredBuffer<struct s> u;

float4 main() : sv_target1
{
    return 0;
}

[pixel shader fail(sm<6)]
RasterizerOrderedStructuredBuffer<Texture2D> u;

float4 main() : sv_target1
{
    return 0;
}

[pixel shader fail]
struct s
{
    Texture2D t;
};
RasterizerOrderedStructuredBuffer<struct s> u;

float4 main() : sv_target1
{
    return 0;
}


[pixel shader todo]
struct apple
{
    float3 a, x;
};

RWStructuredBuffer<apple> u;

float4 main() : sv_target
{
    u[0].x = float3(30.0, 40.0, 50.0);
    return 0;
}

[uav 2]
stride 16
size (buffer, 2)

1 2 3 4 5 6 7 8

[pixel shader todo]
RWStructuredBuffer<int4> u : register(u2);

float4 main() : sv_target1
{
    u[0] = int4(11, -12, 13, -14);
    u[1] = int4(-15, 16, -17, 18);
    return 0;
}

[test]
todo(sm<6) draw quad
probe uav 2 (0) rgbai (11, -12, 13, -14)
probe uav 2 (1) rgbai (-15, 16, -17, 18)

[uav 2]
stride 4
size (buffer, 2)

1 2

% Test scalar store
[pixel shader todo]
RWStructuredBuffer<uint> u : register(u2);

float4 main() : sv_target1
{
    u[0] = 11;
    u[1] = 12;
    return 0;
}

[test]
todo(sm<6) draw quad
probe uav 2 (0) ri (11)
probe uav 2 (1) ri (12)
