// We can't test on VK or metal, as currently we don't support integer matrix types //DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -vk //TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj //TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -cpu //DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl // Not supported in WGSL: Integer matrices //DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-wgpu //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer outputBuffer; void silly(matrix a, inout matrix b) { b *= a; } void silly2(matrix a, out matrix b) { b = a; } [numthreads(4, 1, 1)] void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { matrix v = { 1, 2, 3, 4}; matrix u = { 5, 6, 7, 8}; int idx = int(dispatchThreadID.x); matrix uidx = { idx, idx * idx, idx + idx, idx + 2 }; v += uidx; u += idx; silly(u, v); silly(v, u); // Check that detects issues with undefined variables. matrix undef1, undef2; // undefined // Downstream compilers detect this //silly(u, undef1); silly2(u, undef2); matrix added = (u + v + undef2); uint2 added2 = added[0] + added[1]; outputBuffer[idx] = added2.x + added2.y; }