yum-mirror/slang

Making it easier to work with shaders

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

James Helferty (NVIDIA)Enable metal tests (#8446)8086adc90

master
1.1 KiB34 linesraw
1//TEST:SIMPLE(filecheck=METAL): -target metal -stage compute -entry computeMain
2//TEST:SIMPLE(filecheck=METALLIB): -target metallib -stage compute -entry computeMain
3//TEST(compute, metal):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-metal -compute -output-using-type
4//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -emit-spirv-directly -compute -output-using-type
5
6//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
7RWStructuredBuffer<uint> outputBuffer;
8
9//METAL: {{\[\[}}kernel{{\]\]}} void computeMain
10//METALLIB: define void @computeMain
11
12// Test that pointer literals are handled correctly in Metal.
13
14[numthreads(1,1,1)]
15void computeMain()
16{
17    // Test pointer literals in some contexts that might generate kIROp_PtrLit.
18
19    // Test 1: Basic pointer literal assignment
20    void* ptr1 = nullptr;
21    outputBuffer[0] = (ptr1 == nullptr) ? 1 : 0;
22    // BUF: 1
23    
24    // Test 2: Pointer literal in struct
25    struct TestStruct
26    {
27        void* ptr;
28        int value;
29    };
30
31    TestStruct test = { nullptr, 42 };
32    outputBuffer[1] = (test.ptr == nullptr) ? 1 : 0;
33    // BUF: 1
34}