I am new to HLSL and is trying to compile a simple test with HLSL Helpers However, it doesn't compile. I want to compile shader for my Win2D UWP app.
The code:
#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_SIMPLE
#include "d2d1effecthelpers.hlsli"
D2D_PS_ENTRY(main)
{
float4 color1 = D2DGetInput(0);
return color1;
}
When compile this with command-line :
fxc /T ps_4_0 /E main_Impl /Fo testShader.ps testShader.hlsl
It give me this compile error
error X3503: 'main_Impl': function return value missing semantics
What did I do wrong here?
Should be fxc /T ps_4_0 /D D2D_ENTRY=main /Fo testShader.ps testShader.hlsl
.
You could/should use Visual Studio, it will do the ground work for you. Or just open "d2d1effecthelpers.hlsli" and it will say this:
// To use these helpers, the following values must be defined before inclusion:
// D2D_INPUT_COUNT - The number of texture inputs to the effect.
// D2D_INPUT[N]_SIMPLE or D2D_INPUT[N]_COMPLEX - How the effect will sample each input. (If unspecificed, defaults to _COMPLEX.)
// D2D_ENTRY - The name of the entry point being compiled. This will usually be defined on the command line at compilation time.