blob: 6ccb4c29ca5d4e1513490cfce73a84089cdd0b7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
//TEST(compute):COMPARE_COMPUTE: -compute -shaderobj -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE: -vk -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl -output-using-type
// Test that matrix swizzle writes work correctly
// Matrix swizzles can either be one or zero indexed
// Reference: https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-per-component-math
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<float> outputBuffer;
[numthreads(4, 1, 1)]
void computeMain(uint tid : SV_GroupIndex)
{
// 0 0
// 0 0
float2x2 m = float2x2(0);
// 0 1
// 4 0
m._12_21 = float2(1, 4);
// 2 1
// 4 3
m._m00_m11 = float2(2, 3);
outputBuffer[tid] = m[tid/2][tid%2];
}
|