yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
915e05dcc
master
1//TEST(compute):COMPARE_COMPUTE: -compute -shaderobj -output-using-type 2//TEST(compute, vulkan):COMPARE_COMPUTE: -vk -compute -shaderobj -output-using-type 3//TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl -output-using-type 4 5// Test that matrix swizzle writes work correctly 6// Matrix swizzles can either be one or zero indexed 7// Reference: https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-per-component-math 8 9//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 10RWStructuredBuffer<float2x2> outputBuffer; 11 12struct MySubscriptable 13{ 14 float2x2 m; 15 __subscript() -> float2x2 16 { 17 get { return m; } 18 set { m = newValue; } 19 } 20}; 21 22[numthreads(1, 1, 1)] 23void computeMain(uint tid : SV_GroupIndex) 24{ 25 MySubscriptable s; 26 s.m = float2x2(0,0,0,0); 27 28 // _ 1 29 // 4 5 30 s[]._12_21_22 = float3(1, 4, 5); 31 32 // 2 1 33 // 4 3 34 s[]._m00_m11 = float2(2, 3); 35 36 outputBuffer[tid] = s.m; 37}