C++ DX9 vertexshader错误X3000:着色器文件中存在非法字符
编译vertexshader时出错C++ DX9 vertexshader错误X3000:着色器文件中存在非法字符,c++,shader,directx-9,C++,Shader,Directx 9,编译vertexshader时出错 loadfilefrommemory(water.vs)(44,2): error X3000: Illegal character in shader file 该文件是ANSI编解码器,我多次创建了新文件。我仍然得到这些带有非法字符的错误。我读了很多问题,但错误只出现在其他问题的(1,1)上。那么我做错了什么 这是我的档案: //------- Constants -------- float4x4 xView; float4x4 xProjection
loadfilefrommemory(water.vs)(44,2): error X3000: Illegal character in shader file
该文件是ANSI编解码器,我多次创建了新文件。我仍然得到这些带有非法字符的错误。我读了很多问题,但错误只出现在其他问题的(1,1)上。那么我做错了什么
这是我的档案:
//------- Constants --------
float4x4 xView;
float4x4 xProjection;
float4x4 xWorld;
float4x4 xReflectionView;
float4x4 xWindDirection;
float xWaveLength;
float xTime;
float xWindForce;
//------- Technique: Water --------
struct WaterVertexToPixel
{
float4 Position : POSITION;
float4 ReflectionMapSamplingPos : TEXCOORD1;
float2 BumpMapSamplingPos : TEXCOORD2;
float4 RefractionMapSamplingPos : TEXCOORD3;
float4 Position3D : TEXCOORD4;
};
WaterVertexToPixel main(float4 inPos : POSITION, float2 inTex: TEXCOORD)
{
WaterVertexToPixel Output = (WaterVertexToPixel)0;
float4x4 preViewProjection = mul (xView, xProjection);
float4x4 preWorldViewProjection = mul (xWorld, preViewProjection);
float4x4 preReflectionViewProjection = mul (xReflectionView, xProjection);
float4x4 preWorldReflectionViewProjection = mul (xWorld, preReflectionViewProjection);
Output.Position = mul(inPos, preWorldViewProjection);
Output.ReflectionMapSamplingPos = mul(inPos, preWorldReflectionViewProjection);
Output.RefractionMapSamplingPos = mul(inPos, preWorldViewProjection);
Output.Position3D = inPos;
float4 absoluteTexCoords = float4(inTex, 0, 1);
float4 rotatedTexCoords = mul(absoluteTexCoords, xWindDirection);
float2 moveVector = float2(0, 1);
// moving the water
Output.BumpMapSamplingPos = rotatedTexCoords.xy/xWaveLength + xTime*xWindForce*moveVector.xy;
return Output;
}
sry主题是pixelshader,但它是vertexshader!你有没有看第44行第2列,看看里面有什么字符?它是文件的结尾。。。最后一个字符是44,1。}我用notepad++编辑了这个文件,显示了所有不可打印的字符,但没有。(这里是一个屏幕截图)可能它期望终止CR/LF?如果我这样做了,我会收到以下错误:(45,1):错误X3000:无法识别的标识符“i”