yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

venkataram-nvSupport HLSL `.sample` operators for MS textures (#4524)fff79c311

master
786 B27 linesraw
1//TEST:SIMPLE(filecheck=HLSL): -target hlsl -stage vertex
2//TEST:SIMPLE(filecheck=GLSL): -target glsl -stage vertex
3//TEST:SIMPLE(filecheck=METAL): -target metal -stage vertex
4//TEST:SIMPLE(filecheck=SPIRV): -target spirv -stage vertex
5//TEST:SIMPLE(filecheck=SPIRV): -target spirv-asm -stage vertex
6
7Texture2DMS <int3> t1;
8Texture2DMSArray <float4> t2;
9
10float4 main()
11{
12    // HLSL: .sample
13    // GLSL: texelFetch
14    // SPIRV: OpImageFetch %v4int {{.*}} Sample {{.*}}
15    // METAL: .read
16    uint2 p1 = uint2(1, 2);
17    int3 a1 = t1.sample[7][p1];
18
19    // HLSL: .sample
20    // GLSL: texelFetch
21    // SPIRV: OpImageFetch %v4float {{.*}} Sample {{.*}}
22    // METAL: .read
23    uint p2 = uint(1);
24    float4 a2 = t2.sample[p2][uint3(1, 2, 3)];
25
26    return float4(float3(a1), 0) + a2;
27}