C++ X3501和x27;主&x27;:在VS2015中编译DirectX11.hlsl着色器时未找到入口点
我正在尝试遵循本教程: 我在我的项目中添加了两个文件,分别名为C++ X3501和x27;主&x27;:在VS2015中编译DirectX11.hlsl着色器时未找到入口点,c++,visual-studio-2015,directx,shader,directx-11,C++,Visual Studio 2015,Directx,Shader,Directx 11,我正在尝试遵循本教程: 我在我的项目中添加了两个文件,分别名为SimplePixelShader.hlsl和`SimpleVertexShader.hlsl,内容如下: 在每个文件上,我进入(右键单击文件->属性), 将其设置为正确配置(调试X64)并更改字段: General->Excluded From build = blank General->Content = blank General->Item Type = HLSL Compiler HLSL Compile
SimplePixelShader.hlsl
和`SimpleVertexShader.hlsl,内容如下:
在每个文件上,我进入(右键单击文件->属性),
将其设置为正确配置(调试X64)并更改字段:
General->Excluded From build = blank
General->Content = blank
General->Item Type = HLSL Compiler
HLSL Compiler->Entrypoint Name = blank (deleted main)
HLSL Compiler->Shader Type = Pixel Shader (/ps)
HLSL Compiler->Shader Model = Shader Model 4 Level 9_1 (/4_0_level_9_1)
All Options->Shader Type = Pixel Shader (/ps)
All Options->Entrypoint Name = blank (deleted main)
All Options->Shader Model = Shader Model 4 Level 9_1 (/4_0_level_9_1)
然后使用SimpleVertexShader.hlsl的相应顶点着色器条目进行sam更改
但无论我怎么做,在编译时仍然会遇到相同的错误:
X3501“主”:未找到入口点
如果我从所有字段中删除入口点,这怎么可能?我错过了什么
谢谢
SimpleVertexShader.hlsl:
struct VertexShaderInput
{
DirectX::XMFLOAT2 pos : POSITION;
};
struct PixelShaderInput
{
float4 pos : SV_POSITION;
};
PixelShaderInput SimpleVertexShader(VertexShaderInput input)
{
PixelShaderInput vertexShaderOutput;
// For this lesson, set the vertex depth value to 0.5, so it is guaranteed to be drawn.
vertexShaderOutput.pos = float4(input.pos, 0.5f, 1.0f);
return vertexShaderOutput;
}
struct PixelShaderInput
{
float4 pos : SV_POSITION;
};
float4 SimplePixelShader(PixelShaderInput input) : SV_TARGET
{
// Draw the entire triangle yellow.
return float4(1.0f, 1.0f, 0.0f, 1.0f);
}
以下是SimplePixelShader.hlsl中的代码:
struct VertexShaderInput
{
DirectX::XMFLOAT2 pos : POSITION;
};
struct PixelShaderInput
{
float4 pos : SV_POSITION;
};
PixelShaderInput SimpleVertexShader(VertexShaderInput input)
{
PixelShaderInput vertexShaderOutput;
// For this lesson, set the vertex depth value to 0.5, so it is guaranteed to be drawn.
vertexShaderOutput.pos = float4(input.pos, 0.5f, 1.0f);
return vertexShaderOutput;
}
struct PixelShaderInput
{
float4 pos : SV_POSITION;
};
float4 SimplePixelShader(PixelShaderInput input) : SV_TARGET
{
// Draw the entire triangle yellow.
return float4(1.0f, 1.0f, 0.0f, 1.0f);
}
好的,我做了一些测试,似乎当您将
入口点名称
字段留空时,它会尝试使用main
。相反,我只是相应地输入了SimpleVertexShader
和SimplePixelShader
,然后它们都进行了编译。谢谢好的,我做了一些测试,似乎当您将入口点名称
字段留空时,它会尝试使用main
。相反,我只是相应地输入了SimpleVertexShader
和SimplePixelShader
,然后它们都进行了编译。谢谢