float4 PixelShaderFunction(float2 TexCoord: TEXCOORD0) : COLOR0
{
float4 color1 = tex2D(inputSampler, TexCoord);
float numb = TestFunc( 5 );
float4 color3 = color1 + numb;
return color3;
}
float TestFunc(float numb)
{
return numb + 1;
}
我收到一个错误提示 error x3004: undeclared identifier 'TestFunc'
最佳答案
要么在 PixelShaderFunction 中使用它之前声明 TestFunc()
,要么在此之前完全移动它。即:
float TestFunc(float);
float PixelShaderFunction()
{
// ...
}
float TestFunc(float n)
{
// ...
}
或
float TestFunc(float n)
{
// ...
}
float PixelShaderFunction()
{
// ...
}
关于c - HLSL 函数未被识别?未声明的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11814087/