我粘贴了一行着色器代码,现在我的项目无法工作。
这个我实在想不通。我很感激您提出的任何建议。
cbuffer CB_PER_FRAME : register(b0)
{
column_major float4x4 view;
column_major float4x4 proj;
float4 eyePosition;
};
struct VertexInput
{
float3 position : POSITION;
float3 normal : NORMAL;
float2 texCoord : TEXCOORD;
row_major float4x4 world : WORLD;
float4 color : COLOR;
uint instanceID : SV_InstanceID;
};
struct PixelInput
{
float4 position : SV_POSITION;
float3 normal : NORMAL;
float2 texCoord : TEXCOORD;
float4 color : COLOR;
};
PixelInput VertexShaderMain( VertexInput vertexInput )
{
PixelInput pixelInput (PixelInput)0;
pixelInput.position = mul( float4( pixelInput.position, 1.0f ), vertexInput.world );
pixelInput.position = mul( pixelInput.position, view );
pixelInput.position = mul( pixelInput.position, proj );
pixelInput.normal = normalize( mul( pixelInput.normal, (float3x3)vertexInput.world ) );
pixelInput.texCoord = vertexInput.color;
pixelInput.color = vertexInput.color;
return pixelInput;
}
float4 PixelShaderMain( PixelInput pixelInput ) : SV_Target
{
return pixelInput.color;
}
It was an encoding problem. When I pasted the line of code it somehow made my compiler treat every text file as UNICODE instead of ASCII. This caused the problem.
The solution was opening the shader file in Visual Studio and go to
File->Save as->Save with Encoding and then choose the correct format and rebuild the solution.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)