Skip to content

Commit bcf5302

Browse files
authored
Auto enable -fvk-use-entrypoint-name when there is more than one entrypoint. (shader-slang#6260)
* Auto enable `-fvk-use-entrypoint-name` when there is more than one entrypoint. * Fix.
1 parent bc2f20a commit bcf5302

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

source/slang/slang-ir-glsl-legalize.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -3722,7 +3722,8 @@ void legalizeEntryPointForGLSL(
37223722

37233723
// Rename the entrypoint to "main" to conform to GLSL standard,
37243724
// if the compile options require us to do it.
3725-
if (!shouldUseOriginalEntryPointName(codeGenContext))
3725+
if (!shouldUseOriginalEntryPointName(codeGenContext) &&
3726+
codeGenContext->getEntryPointCount() == 1)
37263727
{
37273728
entryPointDecor->setName(builder.getStringValue(UnownedStringSlice("main")));
37283729
}

source/slang/slang-parser.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2352,6 +2352,7 @@ static Expr* tryParseGenericApp(Parser* parser, Expr* base)
23522352
case TokenType::OpEql:
23532353
case TokenType::OpNeq:
23542354
case TokenType::OpGreater:
2355+
case TokenType::OpRsh:
23552356
case TokenType::EndOfFile:
23562357
{
23572358
return parseGenericApp(parser, base);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//TEST:SIMPLE(filecheck=CHECK): -entry missShader -entry missShader2 -target spirv
2+
//TEST:SIMPLE(filecheck=CHECK): -target spirv
3+
4+
// CHECK: OpEntryPoint MissKHR %missShader "missShader"
5+
// CHECK: OpEntryPoint MissKHR %missShader2 "missShader2"
6+
7+
struct RayPayload{};
8+
[shader("miss")]
9+
void missShader(inout RayPayload payload) { }
10+
11+
[shader("miss")]
12+
void missShader2(inout RayPayload payload) { }

0 commit comments

Comments
 (0)