2022-06-08 16:18:38 -07:00
|
|
|
[require]
|
|
|
|
shader model >= 5.0
|
2024-01-28 20:46:50 -08:00
|
|
|
shader model < 6.0
|
2022-06-08 16:18:38 -07:00
|
|
|
|
2024-01-28 20:46:50 -08:00
|
|
|
[pixel shader fail]
|
2022-06-08 16:18:38 -07:00
|
|
|
RWTexture2D<float4> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target
|
|
|
|
{
|
|
|
|
/* All four components must be written in a single statement. */
|
2022-10-25 21:14:43 -07:00
|
|
|
u[uint2(0, 0)].xy = float2(1, 2);
|
|
|
|
u[uint2(0, 0)].zw = float2(3, 4);
|
2022-06-08 16:18:38 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
Texture2D<float4> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target
|
|
|
|
{
|
|
|
|
/* SRVs are not writable. */
|
|
|
|
u[uint2(0, 0)].xyzw = float4(1, 2, 3, 4);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-10-13 21:03:24 -07:00
|
|
|
|
2022-06-08 16:18:38 -07:00
|
|
|
[uav 1]
|
|
|
|
format r32 float
|
|
|
|
size (2, 2)
|
|
|
|
|
|
|
|
0.1 0.2
|
|
|
|
0.3 0.4
|
|
|
|
|
|
|
|
[uav 2]
|
|
|
|
size (1, 1)
|
|
|
|
|
|
|
|
0.5 0.6 0.7 0.8
|
|
|
|
|
|
|
|
[pixel shader]
|
|
|
|
RWTexture2D<float> u;
|
|
|
|
RWTexture2D<float4> v;
|
|
|
|
|
|
|
|
float4 main() : sv_target
|
|
|
|
{
|
|
|
|
u[uint2(0, 0)] = 0.5;
|
|
|
|
u[uint2(0, 1)].x = 0.6;
|
|
|
|
u[uint2(1, 1)] = 0.7;
|
|
|
|
v[uint2(0, 0)].yxwz = float4(1, 2, 3, 4);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-01-28 20:46:50 -08:00
|
|
|
draw quad
|
2022-06-08 16:18:38 -07:00
|
|
|
probe uav 1 (0, 0) r (0.5)
|
|
|
|
probe uav 1 (0, 1) r (0.6)
|
|
|
|
probe uav 1 (1, 0) r (0.2)
|
|
|
|
probe uav 1 (1, 1) r (0.7)
|
|
|
|
probe uav 2 (0, 0) rgba (2.0, 1.0, 4.0, 3.0)
|
2022-10-13 21:03:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
% UAVs are implicitly allocated starting from the highest render target slot.
|
|
|
|
% They cannot overlap render target slots, and also cannot be allocated any
|
|
|
|
% lower than the highest render target.
|
|
|
|
% This ceases to be true with shader model 5.1.
|
|
|
|
|
|
|
|
[render target 1]
|
|
|
|
format r32g32b32a32 float
|
|
|
|
size (640, 480)
|
|
|
|
|
|
|
|
[uav 2]
|
|
|
|
size (1, 1)
|
|
|
|
|
|
|
|
0.1 0.2 0.3 0.4
|
|
|
|
|
2024-01-28 20:46:50 -08:00
|
|
|
[pixel shader fail]
|
2022-10-13 21:03:24 -07:00
|
|
|
RWTexture2D<float4> u : register(u0);
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
u[uint2(0, 0)] = float4(0.9, 0.8, 0.7, 0.6);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-01-28 20:46:50 -08:00
|
|
|
[pixel shader fail]
|
2022-10-13 21:03:24 -07:00
|
|
|
RWTexture2D<float4> u : register(u1);
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
u[uint2(0, 0)] = float4(0.9, 0.8, 0.7, 0.6);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader]
|
|
|
|
RWTexture2D<float4> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
u[uint2(0, 0)] = float4(0.9, 0.8, 0.7, 0.6);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-01-28 20:46:50 -08:00
|
|
|
draw quad
|
2022-10-13 21:03:24 -07:00
|
|
|
probe uav 2 (0, 0) rgba (0.9, 0.8, 0.7, 0.6)
|
|
|
|
|
|
|
|
|
|
|
|
[uav 3]
|
|
|
|
size (1, 1)
|
|
|
|
|
|
|
|
0.1 0.2 0.3 0.4
|
|
|
|
|
|
|
|
[pixel shader]
|
|
|
|
RWTexture2D<float4> u : register(u3);
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
u[uint2(0, 0)] = float4(0.9, 0.8, 0.7, 0.6);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-01-28 20:46:50 -08:00
|
|
|
draw quad
|
2022-10-13 21:03:24 -07:00
|
|
|
probe uav 3 (0, 0) rgba (0.9, 0.8, 0.7, 0.6)
|
2022-10-25 21:44:00 -07:00
|
|
|
|
2023-04-16 10:38:58 -07:00
|
|
|
% Uppercase register set name
|
|
|
|
[pixel shader]
|
|
|
|
RWTexture2D<float4> u : register(U3);
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
u[uint2(0, 0)] = float4(0.9, 0.8, 0.7, 0.6);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-01-28 20:46:50 -08:00
|
|
|
draw quad
|
2023-04-16 10:38:58 -07:00
|
|
|
probe uav 3 (0, 0) rgba (0.9, 0.8, 0.7, 0.6)
|
|
|
|
|
2022-10-25 21:44:00 -07:00
|
|
|
% Test that we can declare and use an array of UAVs.
|
|
|
|
|
|
|
|
[uav 2]
|
|
|
|
size (1, 1)
|
|
|
|
|
|
|
|
0.1 0.2 0.3 0.4
|
|
|
|
|
|
|
|
[uav 3]
|
|
|
|
size (1, 1)
|
|
|
|
|
|
|
|
0.5 0.6 0.7 0.8
|
|
|
|
|
2023-04-25 11:03:50 -07:00
|
|
|
[pixel shader]
|
2022-10-25 21:44:00 -07:00
|
|
|
RWTexture2D<float4> u[2] : register(u2);
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
u[0][uint2(0, 0)] = float4(1.1, 1.2, 1.3, 1.4);
|
|
|
|
u[1][uint2(0, 0)] = float4(2.1, 2.2, 2.3, 2.4);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-01-28 20:46:50 -08:00
|
|
|
draw quad
|
2022-10-25 21:44:00 -07:00
|
|
|
probe uav 2 (0, 0) rgba (1.1, 1.2, 1.3, 1.4)
|
|
|
|
probe uav 3 (0, 0) rgba (2.1, 2.2, 2.3, 2.4)
|
2023-05-03 16:25:24 -07:00
|
|
|
|
|
|
|
% RWTexture1D types
|
2024-01-28 20:46:50 -08:00
|
|
|
[pixel shader]
|
2023-05-03 16:25:24 -07:00
|
|
|
struct s
|
|
|
|
{
|
|
|
|
float3 a;
|
|
|
|
};
|
|
|
|
|
|
|
|
RWTexture1D<float4> u : register(u2);
|
|
|
|
RWTexture1D<float> u1;
|
|
|
|
RWTexture1D<float2x2> u2;
|
|
|
|
RWTexture1D<struct s> u3;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
u[0] = float4(11.1, 12.2, 13.3, 14.4);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-10-18 14:00:43 -07:00
|
|
|
% RWTexture1DArray types
|
2024-01-28 20:46:50 -08:00
|
|
|
[pixel shader]
|
2023-10-18 14:00:43 -07:00
|
|
|
struct s
|
|
|
|
{
|
|
|
|
float3 a;
|
|
|
|
};
|
|
|
|
|
|
|
|
RWTexture1DArray<float4> u : register(u2);
|
|
|
|
RWTexture1DArray<float> u1;
|
|
|
|
RWTexture1DArray<float2x2> u2;
|
|
|
|
RWTexture1DArray<struct s> u3;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
u[int2(0, 0)] = float4(11.1, 12.2, 13.3, 14.4);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-05-03 16:25:24 -07:00
|
|
|
% RWTexture2D types
|
2024-01-28 20:46:50 -08:00
|
|
|
[pixel shader]
|
2023-05-03 16:25:24 -07:00
|
|
|
struct s
|
|
|
|
{
|
|
|
|
float3 a;
|
|
|
|
};
|
|
|
|
|
|
|
|
RWTexture2D<float4> u : register(u2);
|
|
|
|
RWTexture2D<float> u1;
|
|
|
|
RWTexture2D<float2x2> u2;
|
|
|
|
RWTexture2D<struct s> u3;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
u[int2(0, 0)] = float4(11.1, 12.2, 13.3, 14.4);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-10-18 14:01:49 -07:00
|
|
|
% RWTexture2DArray types
|
2024-01-28 20:46:50 -08:00
|
|
|
[pixel shader]
|
2023-10-18 14:01:49 -07:00
|
|
|
struct s
|
|
|
|
{
|
|
|
|
float3 a;
|
|
|
|
};
|
|
|
|
|
|
|
|
RWTexture2DArray<float4> u : register(u2);
|
|
|
|
RWTexture2DArray<float> u1;
|
|
|
|
RWTexture2DArray<float2x2> u2;
|
|
|
|
RWTexture2DArray<struct s> u3;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
u[int3(0, 0, 0)] = float4(11.1, 12.2, 13.3, 14.4);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-05-03 16:25:24 -07:00
|
|
|
% RWTexture3D types
|
2024-01-28 20:46:50 -08:00
|
|
|
[pixel shader]
|
2023-05-03 16:25:24 -07:00
|
|
|
struct s
|
|
|
|
{
|
|
|
|
float3 a;
|
|
|
|
};
|
|
|
|
|
|
|
|
RWTexture3D<float4> u : register(u2);
|
|
|
|
RWTexture3D<float> u1;
|
|
|
|
RWTexture3D<float2x2> u2;
|
|
|
|
RWTexture3D<struct s> u3;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
u[int3(0, 0, 0)] = float4(11.1, 12.2, 13.3, 14.4);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-01-28 20:46:50 -08:00
|
|
|
|
|
|
|
[require]
|
|
|
|
shader model >= 5.0
|
|
|
|
|
2023-05-03 16:25:24 -07:00
|
|
|
% Type is too wide
|
|
|
|
[pixel shader fail]
|
|
|
|
struct s
|
|
|
|
{
|
|
|
|
float3 a;
|
|
|
|
float2 b;
|
|
|
|
};
|
|
|
|
RWTexture1D<struct s> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
struct s
|
|
|
|
{
|
|
|
|
float3 a;
|
|
|
|
float2 b;
|
|
|
|
};
|
|
|
|
RWTexture2D<struct s> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
struct s
|
|
|
|
{
|
|
|
|
float3 a;
|
|
|
|
float2 b;
|
|
|
|
};
|
|
|
|
RWTexture3D<struct s> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
% Array type
|
|
|
|
[pixel shader fail]
|
|
|
|
typedef float arr[2];
|
|
|
|
RWTexture1D<arr> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
% Object types
|
|
|
|
[pixel shader fail]
|
|
|
|
RWTexture1D<Texture2D> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-10-18 14:00:43 -07:00
|
|
|
[pixel shader fail]
|
|
|
|
RWTexture1DArray<Texture2D> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-05-03 16:25:24 -07:00
|
|
|
[pixel shader fail]
|
|
|
|
RWTexture2D<Texture2D> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-10-18 14:01:49 -07:00
|
|
|
[pixel shader fail]
|
|
|
|
RWTexture2DArray<Texture2D> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-05-03 16:25:24 -07:00
|
|
|
[pixel shader fail]
|
|
|
|
RWTexture3D<Texture2D> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
struct s
|
|
|
|
{
|
|
|
|
Texture2D t;
|
|
|
|
};
|
|
|
|
|
|
|
|
RWTexture1D<struct s> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
struct s
|
|
|
|
{
|
|
|
|
Texture2D t;
|
|
|
|
};
|
|
|
|
|
2023-10-18 14:00:43 -07:00
|
|
|
RWTexture1DArray<struct s> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
struct s
|
|
|
|
{
|
|
|
|
Texture2D t;
|
|
|
|
};
|
|
|
|
|
2023-05-03 16:25:24 -07:00
|
|
|
RWTexture2D<struct s> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
struct s
|
|
|
|
{
|
|
|
|
Texture2D t;
|
|
|
|
};
|
|
|
|
|
2023-10-18 14:01:49 -07:00
|
|
|
RWTexture2DArray<struct s> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
struct s
|
|
|
|
{
|
|
|
|
Texture2D t;
|
|
|
|
};
|
|
|
|
|
2023-05-03 16:25:24 -07:00
|
|
|
RWTexture3D<struct s> u;
|
|
|
|
|
|
|
|
float4 main() : sv_target1
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|