google / google/shaderc

Entry point name has to be "main"

Open
#1,066 1 comment 0 reactions 1 assignee Claimed by @dneto0 View on GitHub
Dominant language
C++
Stars
2.2k
Forks
445
Avg merge
11h 6m
Merged PRs (30d)
6

Description

It seems that using anything other than "main" for the entry point name results in the following error, even if the entry point function with that name exists in the shader:
file: error: Linking vertex stage: Missing entry point: Each stage requires one entry point

For example, try to compile this as a vertex shader using text_vs as an entry point name

```#version 450 core
#define ShaderStage_VertexShader 0
#define ShaderStage_HullShader 1
#define ShaderStage_DomainShader 2
#define ShaderStage_GeometryShader 3
#define ShaderStage_PixelShader 4
#define ShaderStage_ComputeShader 5

#define Technique_NormalText 0

#define Pass_p0 0

#define CURRENT_TECHNIQUE 0
#define CURRENT_PASS 0
#define CURRENT_SHADER_STAGE 0

layout (std140, set = 0, binding = 0) uniform FontRenderData
{
uniform mat4 projection;
uniform vec2 textureScale;
};

#if CURRENT_TECHNIQUE == Technique_NormalText && CURRENT_SHADER_STAGE == ShaderStage_VertexShader
layout(location = 0) in uvec4 vsinPosition;
layout(location = 1) in vec4 vsinColour;
layout(location = 2) in uvec2 vsinTexCoord;

layout(location = 0) out vec4 vsoutColour;
layout(location = 1) out vec2 vsoutTexCoord;

void text_vs()
{
vsoutColour = vsinColour;
vsoutTexCoord = vec2(vsinTexCoord) * textureScale;
gl_Position = projection * vec4(vsinPosition.x + 0.5f, vsinPosition.y + 0.5f, vsinPosition.z, 1);
}
#endif

#if CURRENT_TECHNIQUE == Technique_DrawShapes
struct sVSInput
{
vec4 position ;
vec4 colour ;
};

struct sVSOutput
{

vec4 colour ;
vec4 position ;
};

sVSOutput draw_vs ( sVSInput In )
{
sVSOutput Out;

Out.position = projection * vec4 ( In.position.xyz, 1 );
Out.colour = In.colour;

return Out;
}
#endif

#if CURRENT_TECHNIQUE == Technique_NormalText && CURRENT_SHADER_STAGE == ShaderStage_PixelShader
layout(location = 0) in vec4 psinColour;
layout(location = 1) in vec2 psinTexCoord;

layout(location = 0) out vec4 outColour;

void main()
{
vec4 TestSystem_fontSample =vec4(0);// = mapFontTexture.Sample(samplerFontTexture, psinTexCoord);
outColour = vec4 (
TestSystem_fontSample.rgb * psinColour.rgb,
max ( TestSystem_fontSample.r, max ( TestSystem_fontSample.g, TestSystem_fontSample.b )) * psinColour.a
);
}
#endif

#if CURRENT_TECHNIQUE == Technique_DrawShapes
struct sPSInput
{
vec4 colour ;
vec4 position ;
};

struct sPSOutput
{
vec4 colour ;
};

sPSOutput draw_ps ( sPSInput In )
{
sPSOutput Output;
Output.colour = In.colour;

return Output;
}

#endif

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.