From 6dc79a319ebebb3d50bb6c1a33ddb5ee584b8876 Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Fri, 24 Jan 2025 09:52:03 -0800 Subject: [PATCH] filamat: fix spirv remap intialization (#8384) FIXES=390398814 --- libs/filamat/src/GLSLPostProcessor.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libs/filamat/src/GLSLPostProcessor.cpp b/libs/filamat/src/GLSLPostProcessor.cpp index 92675b8dff..8d38ed7cc2 100644 --- a/libs/filamat/src/GLSLPostProcessor.cpp +++ b/libs/filamat/src/GLSLPostProcessor.cpp @@ -297,6 +297,19 @@ GLSLPostProcessor::GLSLPostProcessor(MaterialBuilder::Optimization optimization, spv::spirvbin_t::registerErrorHandler([](const std::string& str) { slog.e << str << io::endl; }); + + // Similar to above, we need to do a no-op remap to init a static table in the remapper before + // the jobs start using remap(). + spv::spirvbin_t remapper(0); + // We need to provide at least a valid header to not crash. + SpirvBlob spirv { + 0x07230203,// MAGIC + 0, // VERSION + 0, // GENERATOR + 0, // BOUND + 0 // SCHEMA, must be 0 + }; + remapper.remap(spirv, 0); } GLSLPostProcessor::~GLSLPostProcessor() = default;