https://github.com/shader-slang/slang
Raw File
Tip revision: aa8f7b899b7b562b3d3c6e25c3da41569505e70c authored by Chad Engler on 29 September 2021, 20:02:47 UTC
Fix ARM64 detection for MSVC (#1951)
Tip revision: aa8f7b8
serialized-module-test.slang
// serialized-module-test.slang

// A test to try out the basics of module
// serialization.

//TEST:COMPILE: tests/serialization/serialized-module.slang -o tests/serialization/serialized-module.slang-module
//TEST:COMPARE_COMPUTE_EX:-slang -compute -xslang -r -xslang tests/serialization/serialized-module.slang-module -shaderobj

//import serialized_module;

// This is fragile - needs match the definition in serialized_module
struct Thing
{
    int a;
    int b;
};

// TODO: need to get the name mangling to line up!
int foo(Thing thing);

//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=4):out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    Thing thing;

    int index = (int)dispatchThreadID.x;
        
    thing.a = index;
    thing.b = -index;

    outputBuffer[index] = foo(thing);
}
back to top