forked from vixorien/D3D11Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPixelShader.hlsl
34 lines (32 loc) · 1.27 KB
/
PixelShader.hlsl
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
// Struct representing the data we expect to receive from earlier pipeline stages
// - Should match the output of our corresponding vertex shader
// - The name of the struct itself is unimportant
// - The variable names don't have to match other shaders (just the semantics)
// - Each variable must have a semantic, which defines its usage
struct VertexToPixel
{
// Data type
// |
// | Name Semantic
// | | |
// v v v
float4 screenPosition : SV_POSITION;
float4 color : COLOR;
};
// --------------------------------------------------------
// The entry point (main method) for our pixel shader
//
// - Input is the data coming down the pipeline (defined by the struct)
// - Output is a single color (float4)
// - Has a special semantic (SV_TARGET), which means
// "put the output of this into the current render target"
// - Named "main" because that's the default the shader compiler looks for
// --------------------------------------------------------
float4 main(VertexToPixel input) : SV_TARGET
{
// Just return the input color
// - This color (like most values passing through the rasterizer) is
// interpolated for each pixel between the corresponding vertices
// of the triangle we're rendering
return input.color;
}