yum-mirror/slang

Making it easier to work with shaders

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

Yong HeRewriting the lower-buffer-element-type pass to avoid unnecessary packing/unpacking. (#8526)a6deb5ed8

master
724 B26 linesraw
1// spirv-instruction.slang
2// TEST:SIMPLE(filecheck=CHECK):-target glsl -entry computeMain -stage compute
3
4[[vk::spirv_instruction(1, "NonSemantic.DebugBreak")]]
5void _spvDebugBreak(int v);
6
7[ForceInline] 
8void _debugBreak() { _spvDebugBreak(1); }
9
10// CHECK:spirv_instruction(id = 1, set = "NonSemantic.DebugBreak")
11// CHECK:void _spvDebugBreak_0(int _0);
12// CHECK:void main()
13// CHECK:_spvDebugBreak_0(1);
14
15//TEST_INPUT:set resultBuffer = out ubuffer(data=[0 0 0 0], stride=4)
16RWStructuredBuffer<uint> resultBuffer;
17
18[numthreads(4,1,1)]
19void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
20{
21    uint threadId = dispatchThreadID.x;
22    
23    _debugBreak();
24    
25    resultBuffer[threadId] = threadId + threadId;
26}