yum-mirror/slang

Making it easier to work with shaders

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

Yong He[SPIRV] Use VectorTimesScalar opcode. (#3737)1c4e1acdd

master
592 B19 linesraw
1
2//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-vk -compute -output-using-type
3//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry computeMain -emit-spirv-directly
4
5//TEST_INPUT:set output = out ubuffer(data=[0 0 0 0], stride=4)
6RWStructuredBuffer<float> output;
7
8// Test that we are able to use the VectorTimesScalar opcode to simplify the resulting spirv.
9
10// CHECK: OpVectorTimesScalar
11
12[numthreads(1,1,1)]
13void computeMain(int3 tid : SV_DispatchThreadID)
14{
15    float3 v = tid + 2.0;
16    float3 v1 = v * 0.5;
17    // BUFFER: 1.0
18    output[0] = v1.x;
19}