HLSL:空 fx 文件:X3000:意外标记 '{'
出现以下错误: Test.fx(1,1):错误 X3000:语法错误:意外标记“{”
Text.fx 包含以下内容: 没有什么。
我还尝试了一个在另一个测试项目中运行良好的效果文件:
float4x4 mWorld;
struct TInputVertex {
float3 vPosition : POSITION0;
float3 vNormal : NORMAL0;
float2 vTexCoord : TEXCOORD0;
float4 vColor : COLOR0;
};
struct TOutputVertex {
float4 vPosition : POSITION0;
float3 vNormal : TEXCOORD1;
float4 vColor : COLOR0;
};
TOutputVertex vsMain(TInputVertex i) {
TOutputVertex o;
o.vPosition = mul(float4(i.vPosition, 1), mWorld);
o.vColor = i.vColor;
o.vNormal = mul(float4(i.vNormal, 1), mWorld).xyz;
//o.vColor += pow(dot(normal_world, float3(0, 0, 1)) * 2 + 0.3, 10);
return o;
}
struct TInputFragment {
float3 vNormal : TEXCOORD1;
float2 vTexCoord : TEXCOORD0;
float4 vColor : COLOR0;
};
struct TOutputFragment {
float4 vColor : COLOR0;
};
TOutputFragment psMain(TInputFragment i) {
TOutputFragment o;
o.vColor = i.vColor;
o.vColor += pow(dot(i.vNormal, float3(0, 0, 1)) * 2 + 0.3, 10);
return o;
}
technique mytech {
pass p0 {
//ShadeMode = Flat;
//ZEnable = false;
WorldTransform[0] = mWorld;
VertexShader = compile vs_1_1 vsMain();
PixelShader = compile ps_2_0 psMain();
}
}
与结果相同的错误。
在两个项目中包含来自同一 dx sdk 的 dx 文件。包含并链接相同的标头和库。
我从测试项目中复制了加载函数。整个测试项目是我自己写的。
HRESULT res = D3DXCreateEffectFromFile(device, file_name, NULL, NULL, 0, 0, &effect, &error_buffer);
谷歌不会出现这样的事情。如果你能把匕首从我的湿器上取下来,我将不胜感激。
安东
The following error appears:
Test.fx(1,1): error X3000: syntax error: unexpected token '{'
Text.fx contains this:
Nothing.
I also tried it with an effect file that works fine in another test project:
float4x4 mWorld;
struct TInputVertex {
float3 vPosition : POSITION0;
float3 vNormal : NORMAL0;
float2 vTexCoord : TEXCOORD0;
float4 vColor : COLOR0;
};
struct TOutputVertex {
float4 vPosition : POSITION0;
float3 vNormal : TEXCOORD1;
float4 vColor : COLOR0;
};
TOutputVertex vsMain(TInputVertex i) {
TOutputVertex o;
o.vPosition = mul(float4(i.vPosition, 1), mWorld);
o.vColor = i.vColor;
o.vNormal = mul(float4(i.vNormal, 1), mWorld).xyz;
//o.vColor += pow(dot(normal_world, float3(0, 0, 1)) * 2 + 0.3, 10);
return o;
}
struct TInputFragment {
float3 vNormal : TEXCOORD1;
float2 vTexCoord : TEXCOORD0;
float4 vColor : COLOR0;
};
struct TOutputFragment {
float4 vColor : COLOR0;
};
TOutputFragment psMain(TInputFragment i) {
TOutputFragment o;
o.vColor = i.vColor;
o.vColor += pow(dot(i.vNormal, float3(0, 0, 1)) * 2 + 0.3, 10);
return o;
}
technique mytech {
pass p0 {
//ShadeMode = Flat;
//ZEnable = false;
WorldTransform[0] = mWorld;
VertexShader = compile vs_1_1 vsMain();
PixelShader = compile ps_2_0 psMain();
}
}
With the same error as result.
Included dx files from the same dx sdk in both projects. Including and linking the same headers and libraries.
I literally copied the loading function from the test project. I wrote the entire test project myself.
HRESULT res = D3DXCreateEffectFromFile(device, file_name, NULL, NULL, 0, 0, &effect, &error_buffer);
Google doesn't turn up with anything like this. I'd really appreciate it if you could remove the dagger from my wetware.
Antoon
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案:不要创建 RTF 文件,然后重命名并使用写字板进行编辑。写字板仍会将其解释为 rtf,因为该文件以“{\rtf1}”开头。将它拖到 Visual Studio 中向我展示了真实的内容。噢,世界,你真是太有趣了。
Solution: Don't create RTF files and then rename them and edit with wordpad. Wordpad will still interpret it as rtf because the file starts with "{\rtf1}". Dragging it into visual studio showed me the real contents. Oh world, you are so much fun.