yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
cc1b96d91
master
1// mutating-impl-of-non-mutating-req.slang 2 3//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):-target hlsl -entry main 4interface IThing 5{ 6 int processValue(int inValue); 7} 8 9struct Counter : IThing 10{ 11 int state; 12 13 // CHECK: ([[# @LINE+1]]): error 38105: 14 [mutating] int processValue(int inValue) 15 { 16 int result = state; 17 state += inValue; 18 return state; 19 } 20} 21 22int helper<T : IThing>(T thing, int value) 23{ 24 return thing.processValue(value); 25} 26 27int test(int value) 28{ 29 Counter counter = { value }; 30 return helper(counter, value); 31} 32 33cbuffer C 34{ 35 int gValue; 36} 37 38[shader("fragment")] 39int main() : SV_Target 40{ 41 return test(gValue); 42}