yum-mirror/slang

Making it easier to work with shaders

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

CopilotFix public unscoped enum constants not visible across module boundaries (#7864)8a36695f1

master
867 B29 linesraw
1//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
2//
3// Test for public unscoped enum constants visibility across module boundaries
4//
5// This test verifies that unscoped enum constants are visible across module
6// boundaries when the enum is declared as public.
7//
8
9import unscoped_enum_lib;
10
11//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4)
12RWStructuredBuffer<uint> outputBuffer;
13
14[numthreads(1,1,1)]
15void computeMain()
16{
17    // These should all be visible due to the public unscoped enum
18    TestEnum e1 = CASE_A; // Should work - unscoped access
19    TestEnum e2 = TestEnum.CASE_B; // Should work - scoped access
20    
21    // CHECK: 0
22    outputBuffer[0] = (uint)e1;
23    // CHECK: 1  
24    outputBuffer[1] = (uint)e2;
25    // CHECK: 0
26    outputBuffer[2] = (uint)CASE_A;
27    // CHECK: 1
28    outputBuffer[3] = (uint)CASE_B;
29}