mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-14 19:31:25 +00:00
Add a none
format.
This CL adds a `none` format to the tint command in order to allow skipping the emission of the resulting program. This adds a `unknown` format to take the place of the original `none`. Change-Id: Ib25e933857c0acb26e3cf0e04ed8a5d1cca1e633 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110480 Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
4d89ce1a68
commit
c214cbe98b
@ -69,7 +69,8 @@ void PrintHash(uint32_t hash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum class Format {
|
enum class Format {
|
||||||
kNone = -1,
|
kUnknown,
|
||||||
|
kNone,
|
||||||
kSpirv,
|
kSpirv,
|
||||||
kSpvAsm,
|
kSpvAsm,
|
||||||
kWgsl,
|
kWgsl,
|
||||||
@ -118,7 +119,7 @@ struct Options {
|
|||||||
const char kUsage[] = R"(Usage: tint [options] <input-file>
|
const char kUsage[] = R"(Usage: tint [options] <input-file>
|
||||||
|
|
||||||
options:
|
options:
|
||||||
--format <spirv|spvasm|wgsl|msl|hlsl> -- Output format.
|
--format <spirv|spvasm|wgsl|msl|hlsl|none> -- Output format.
|
||||||
If not provided, will be inferred from output
|
If not provided, will be inferred from output
|
||||||
filename extension:
|
filename extension:
|
||||||
.spvasm -> spvasm
|
.spvasm -> spvasm
|
||||||
@ -193,7 +194,11 @@ Format parse_format(const std::string& fmt) {
|
|||||||
}
|
}
|
||||||
#endif // TINT_BUILD_GLSL_WRITER
|
#endif // TINT_BUILD_GLSL_WRITER
|
||||||
|
|
||||||
return Format::kNone;
|
if (fmt == "none") {
|
||||||
|
return Format::kNone;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Format::kUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TINT_BUILD_SPV_WRITER || TINT_BUILD_WGSL_WRITER || TINT_BUILD_MSL_WRITER || \
|
#if TINT_BUILD_SPV_WRITER || TINT_BUILD_WGSL_WRITER || TINT_BUILD_MSL_WRITER || \
|
||||||
@ -401,7 +406,7 @@ bool ParseArgs(const std::vector<std::string>& args, Options* opts) {
|
|||||||
}
|
}
|
||||||
opts->format = parse_format(args[i]);
|
opts->format = parse_format(args[i]);
|
||||||
|
|
||||||
if (opts->format == Format::kNone) {
|
if (opts->format == Format::kUnknown) {
|
||||||
std::cerr << "Unknown output format: " << args[i] << std::endl;
|
std::cerr << "Unknown output format: " << args[i] << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1217,11 +1222,11 @@ int main(int argc, const char** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Implement output format defaults.
|
// Implement output format defaults.
|
||||||
if (options.format == Format::kNone) {
|
if (options.format == Format::kUnknown) {
|
||||||
// Try inferring from filename.
|
// Try inferring from filename.
|
||||||
options.format = infer_format(options.output_file);
|
options.format = infer_format(options.output_file);
|
||||||
}
|
}
|
||||||
if (options.format == Format::kNone) {
|
if (options.format == Format::kUnknown) {
|
||||||
// Ultimately, default to SPIR-V assembly. That's nice for interactive use.
|
// Ultimately, default to SPIR-V assembly. That's nice for interactive use.
|
||||||
options.format = Format::kSpvAsm;
|
options.format = Format::kSpvAsm;
|
||||||
}
|
}
|
||||||
@ -1485,6 +1490,8 @@ int main(int argc, const char** argv) {
|
|||||||
case Format::kGlsl:
|
case Format::kGlsl:
|
||||||
success = GenerateGlsl(program.get(), options);
|
success = GenerateGlsl(program.get(), options);
|
||||||
break;
|
break;
|
||||||
|
case Format::kNone:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
std::cerr << "Unknown output format specified" << std::endl;
|
std::cerr << "Unknown output format specified" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user