Skip to content
This repository was archived by the owner on Apr 28, 2026. It is now read-only.

Commit fa2b0d4

Browse files
committed
Version 3.6.0
1 parent 6d8a2e6 commit fa2b0d4

6 files changed

Lines changed: 277 additions & 130 deletions

File tree

3rdparty/spirv-cross/main.cpp

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,17 +1044,17 @@ static void print_help_obscure()
10441044
// clang-format on
10451045
}
10461046

1047-
static void print_help()
1047+
static void print_help_all()
10481048
{
10491049
print_version();
10501050

10511051
// clang-format off
1052-
fprintf(stderr, "Usage: spirv-cross <...>\n"
1052+
fprintf(stderr, "Usage: spirv-cross [SPIR-V file] [options]\n"
10531053
"\nBasic:\n"
10541054
"\t[SPIR-V file] (- is stdin)\n"
10551055
"\t[--output <output path>]: If not provided, prints output to stdout.\n"
10561056
"\t[--dump-resources]:\n\t\tPrints a basic reflection of the SPIR-V module along with other output.\n"
1057-
"\t[--help]:\n\t\tPrints this help message.\n"
1057+
"\t[--help]:\n\t\tPrints a summary help message.\n"
10581058
);
10591059
// clang-format on
10601060

@@ -1066,6 +1066,33 @@ static void print_help()
10661066
print_help_obscure();
10671067
}
10681068

1069+
static void print_help()
1070+
{
1071+
print_version();
1072+
1073+
// clang-format off
1074+
fprintf(stderr, "Usage: spirv-cross [SPIR-V file] [options]\n"
1075+
"\nBasic:\n"
1076+
"\t[SPIR-V file] (- is stdin)\n"
1077+
"\t[--output <output path>]: If not provided, prints output to stdout.\n"
1078+
"\t[--help]:\n\t\tPrints this summary help message.\n"
1079+
"\t[--help-all]:\n\t\tPrints all available help options.\n"
1080+
);
1081+
// clang-format on
1082+
1083+
print_help_backend();
1084+
print_help_common();
1085+
1086+
// clang-format off
1087+
fprintf(stderr, "\nHelp Categories:\n"
1088+
"\t[--help-glsl]\n"
1089+
"\t[--help-msl]\n"
1090+
"\t[--help-hlsl]\n"
1091+
"\t[--help-obscure]\n"
1092+
);
1093+
// clang-format on
1094+
}
1095+
10691096
static bool remap_generic(Compiler &compiler, const SmallVector<Resource> &resources, const Remap &remap)
10701097
{
10711098
auto itr =
@@ -1610,6 +1637,34 @@ static int main_inner(int argc, char *argv[])
16101637
print_help();
16111638
parser.end();
16121639
});
1640+
cbs.add("--help-all", [](CLIParser &parser) {
1641+
print_help_all();
1642+
parser.end();
1643+
});
1644+
cbs.add("--help-backend", [](CLIParser &parser) {
1645+
print_help_backend();
1646+
parser.end();
1647+
});
1648+
cbs.add("--help-common", [](CLIParser &parser) {
1649+
print_help_common();
1650+
parser.end();
1651+
});
1652+
cbs.add("--help-glsl", [](CLIParser &parser) {
1653+
print_help_glsl();
1654+
parser.end();
1655+
});
1656+
cbs.add("--help-msl", [](CLIParser &parser) {
1657+
print_help_msl();
1658+
parser.end();
1659+
});
1660+
cbs.add("--help-hlsl", [](CLIParser &parser) {
1661+
print_help_hlsl();
1662+
parser.end();
1663+
});
1664+
cbs.add("--help-obscure", [](CLIParser &parser) {
1665+
print_help_obscure();
1666+
parser.end();
1667+
});
16131668
cbs.add("--revision", [](CLIParser &parser) {
16141669
print_version();
16151670
parser.end();

3rdparty/spirv-cross/spirv_glsl.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,10 @@ string CompilerGLSL::compile()
807807
// The body was implemented in lieu of main().
808808
if (interlocked_is_complex)
809809
{
810-
statement("void main()");
810+
if (options.use_entry_point_name)
811+
statement("void ", get_entry_point().name, "()");
812+
else
813+
statement("void main()");
811814
begin_scope();
812815
statement("// Interlocks were used in a way not compatible with GLSL, this is very slow.");
813816
statement("SPIRV_Cross_beginInvocationInterlock();");
@@ -817,7 +820,8 @@ string CompilerGLSL::compile()
817820
}
818821

819822
// Entry point in GLSL is always main().
820-
get_entry_point().name = "main";
823+
if (!options.use_entry_point_name)
824+
get_entry_point().name = "main";
821825

822826
return buffer.str();
823827
}
@@ -17388,6 +17392,8 @@ void CompilerGLSL::emit_function_prototype(SPIRFunction &func, const Bitset &ret
1738817392
// and interlock the entire shader ...
1738917393
if (interlocked_is_complex)
1739017394
decl += "spvMainInterlockedBody";
17395+
else if (options.use_entry_point_name)
17396+
decl += get_entry_point().name;
1739117397
else
1739217398
decl += "main";
1739317399

3rdparty/spirv-cross/spirv_glsl.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ class CompilerGLSL : public Compiler
171171
// If non-zero, controls layout(num_views = N) in; in GL_OVR_multiview2.
172172
uint32_t ovr_multiview_view_count = 0;
173173

174+
// Emit the entry point name in SPIR-V rather than "main".
175+
bool use_entry_point_name = false;
176+
174177
enum Precision
175178
{
176179
DontCare,

0 commit comments

Comments
 (0)