yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
7758625d3
master
1//TEST:SIMPLE(filecheck=CHECK_1):-stage compute -entry computeMain -target spirv -DT1 2//TEST:SIMPLE(filecheck=CHECK_2):-stage compute -entry computeMain -target spirv -DT2 3//TEST:SIMPLE(filecheck=CHECK_3):-stage compute -entry computeMain -target spirv -DT3 4//TEST:SIMPLE(filecheck=CHECK_4):-stage compute -entry computeMain -target spirv -DT4 5 6// Tests for invalid use of `const` with Ptr/T* 7// Due to bad syntax breaking the parser, it is more robust to use disjoint tests with 8// #define's. 9cbuffer Globals 10{ 11 int* ptr; 12} 13 14[numthreads(1, 1, 1)] 15void computeMain(int id : SV_DispatchThreadID) 16{ 17 // disallowed syntax with modifier `const` 18#ifdef T1 19 // CHECK_1: ([[# @LINE+1]]): error 20 int const* ptr1 = ptr; 21#endif 22 23#ifdef T2 24 // CHECK_2: ([[# @LINE+1]]): error 25 int* const ptr2 = ptr; 26#endif 27 28#ifdef T3 29 // CHECK_3: ([[# @LINE+1]]): error 20017 30 const int* ptr3 = ptr; 31 // CHECK_3: ([[# @LINE+1]]): error 20018 32 Ptr<const int> ptr4 = ptr; 33#endif 34 35#ifdef T4 36 // CHECK_4: OpEntryPoint 37 // CHECK_4-NOT: error 38 const Ptr<int> ptr5 = ptr; 39#endif 40}