这是 DirectX9 效果编译器中的错误吗? "Invalid input semantics - POSITIONT0"
Is this a bug in DirectX9 Effect Compiler? "Invalid input semantics - POSITIONT0"
我试图编译一个非常简单的效果着色器针对DirectX9和着色器模型2。我试图直接传递顶点位置的屏幕坐标,而不是乘以世界,视图和投影矩阵,所以我在VertexShaderInput结构中使用POSITIONT语义而不是position0语义。然而,当我尝试使用
编译着色器时fxc.exe /Od /Zi /T fx_2_0 /Fo simple.fxo simple.fx
我得到以下错误:"错误X4502:无效输入语义- POSITIONT0"
由于某种原因,它似乎自动在语义的末尾添加了一个0。这似乎是我的错误,因为POSITIONT在这里被清楚地描述为一个有效的输入语义:https://msdn.microsoft.com/en-us/library/windows/desktop/bb509647 (v = vs.85) . aspx # PS
,它是唯一一个不允许在语义的末尾附加额外整数的。
编辑:我刚刚发现,如果我把POSITIONT改为POSITIONT1,它工作得很好。这似乎与上面的文档所描述的相反。
simple.fx:
目录struct VertexShaderInput
{
float4 Position : POSITIONT;
float4 Color : COLOR0;
};
struct VertexShaderOutput
{
float4 Position : POSITION0;
float4 Color : COLOR0;
};
VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output;
output.Position = input.Position;
output.Color = input.Color;
return output;
}
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
return input.Color;
}
technique Ambient
{
pass Pass1
{
VertexShader = compile vs_2_0 VertexShaderFunction();
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
对于传统的Direct3D9,有一个特殊的D3DDECLUSAGE_POSITIONT
,这意味着只是跳过顶点处理。因此,你只能在PIXEL SHADER输入中使用POSITIONT
。它根本不能在VERTEX SHADER中使用。
将着色器改为POSITION
或POSITION0
相关文章:
- 如何解决"invalid conversion from 'char' to 'const char*'"
- 如何处理 c++ 中类实现中的"invalid use of non-static data member"?
- "input.length();"的目的是什么?
- C++ "error: invalid use of void expression"
- 如何使用"derived input class"创建派生类?
- 收到错误"invalid use of non-static data member 'stu::n' "
- Poloniex API "Invalid command" c++ libcurl
- C++模板错误:"invalid explicitly-specified argument for template parameter"
- SDL_CreateTextureFromSurface() "Invalid texture"错误?
- C++ "Invalid use of 'this' in non-member function" ,
- 为什么gmp会在这里与"invalid next size"重新定位一起崩溃?
- 继承类时"invalid use of incomplete type ‘class tree_node_t’"
- 为什么我会"Invalid read of size 8"?(瓦尔格林德)
- "fast"或"normal"在"free(): invalid next size (fast)"中是什么意思?
- 如何在Arduino程序中解决"invalid operands of types"?
- 如何检查输入是否为字符并显示它是"invalid input",否则它将按原样运行
- 使用 libnl-3-route "Invalid input data or parameter"添加路由
- 如何将数字拆分为其数字并将它们相加,如果存在任何字符,则应"invalid input"输出?
- 这是 DirectX9 效果编译器中的错误吗? "Invalid input semantics - POSITIONT0"
- 是否有事实上的标准例外或最佳实践方法来发出异常"invalid input"信号?