summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/modules/gh-5799/HelloTriangleFS.slang
blob: 2d47b5b2b2f045be7887f03976683f41bd142243 (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
31
32
33
34
35
36
37
//TEST:SIMPLE(filecheck=CHECK): -target spirv -I $dirname

//CHECK: OpEntryPoint

// shaders.slang

//
// This file provides a simple vertex and fragment shader that can be compiled
// using Slang. This code should also be valid as HLSL, and thus it does not
// use any of the new language features supported by Slang.
//

import Scene.Scene;

// Output of the vertex shader, and input to the fragment shader.
struct CoarseVertex
{
    float3 color;
};

// Output of the fragment shader
struct Fragment
{
    float4 color;
};


// Fragment Shader

[shader("fragment")]
float4 main(
    CoarseVertex coarseVertex : CoarseVertex) : SV_Target
{
    float3 fragColor = coarseVertex.color;

    return float4(fragColor, 1.0);
}