summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/zero-initialize/IDefaultExplicitGenerics.slang
blob: edb438c1c1db5809bc06716a9852624e95eaeb00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//TEST:SIMPLE(filecheck=CHECK): -target glsl -stage compute -entry computeMain
// CHECK: vec4(0.0

//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -entry computeMain -emit-spirv-directly -allow-glsl
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cpu -compute -entry computeMain -allow-glsl
//TEST(smoke,compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-dx12 -use-dxil -compute -entry computeMain -allow-glsl -profile sm_6_2

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

__generic<T>
struct idefault1 : IDefaultInitializableType
{
    vector<T,4> data;
};

[numthreads(1, 1, 1)]
void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
{
    // BUF: 1
    idefault1<float> default1;

    outputBuffer[0] = true
        && default1.data[0] == 0
        && default1.data[1] == 0
        && default1.data[2] == 0
        && default1.data[3] == 0
    ;
}