Skip SPIR-V validation when not generating SPIR-V

Otherwise the sample app crashes when using --dawn-validation with a
non-SPIR-V output format.

Change-Id: Ic6e03e758747602d15f3a1d5b9d9cefee1aad527
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41120
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
James Price 2021-02-08 20:45:11 +00:00 committed by Commit Bot service account
parent b57c19d450
commit 21692def05
1 changed files with 2 additions and 1 deletions

View File

@ -593,7 +593,8 @@ int main(int argc, const char** argv) {
bool dawn_validation_failed = false;
std::ostringstream stream;
if (options.dawn_validation) {
if (options.dawn_validation &&
(options.format == Format::kSpvAsm || options.format == Format::kSpirv)) {
// Use Vulkan 1.1, since this is what Tint, internally, uses.
spvtools::SpirvTools tools(SPV_ENV_VULKAN_1_1);
tools.SetMessageConsumer([&stream](spv_message_level_t, const char*,