Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions spirv_glsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,10 @@ string CompilerGLSL::compile()
// The body was implemented in lieu of main().
if (interlocked_is_complex)
{
statement("void main()");
if (options.use_entry_point_name)
statement("void ", get_entry_point().name, "()");
else
statement("void main()");
begin_scope();
statement("// Interlocks were used in a way not compatible with GLSL, this is very slow.");
statement("SPIRV_Cross_beginInvocationInterlock();");
Expand All @@ -817,7 +820,8 @@ string CompilerGLSL::compile()
}

// Entry point in GLSL is always main().
get_entry_point().name = "main";
if (!options.use_entry_point_name)
get_entry_point().name = "main";

return buffer.str();
}
Expand Down Expand Up @@ -17383,6 +17387,8 @@ void CompilerGLSL::emit_function_prototype(SPIRFunction &func, const Bitset &ret
// and interlock the entire shader ...
if (interlocked_is_complex)
decl += "spvMainInterlockedBody";
else if (options.use_entry_point_name)
decl += get_entry_point().name;
else
decl += "main";

Expand Down
3 changes: 3 additions & 0 deletions spirv_glsl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ class CompilerGLSL : public Compiler
// If non-zero, controls layout(num_views = N) in; in GL_OVR_multiview2.
uint32_t ovr_multiview_view_count = 0;

// Emit the entry point name in SPIR-V rather than "main".
bool use_entry_point_name = false;

enum Precision
{
DontCare,
Expand Down