Handle more instructions in spirv analysis pass Most of these are "we know we can just ignore this instruction", but also sanity check for the lowering passes applied before this -- if any of those instructions remain, then we're very likely to do the wrong thing. Bug: b/124388146 Change-Id: I3f8f66121f57f20cc93abdbd26c575baf03d9c94 Reviewed-on: https://swiftshader-review.googlesource.com/c/24597 Reviewed-by: Ben Clayton <bclayton@google.com> Reviewed-by: Nicolas Capens <nicolascapens@google.com> Tested-by: Chris Forbes <chrisforbes@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp index 92439a0..dfc18ce 100644 --- a/src/Pipeline/SpirvShader.cpp +++ b/src/Pipeline/SpirvShader.cpp
@@ -194,7 +194,34 @@ case spv::OpMemoryModel: // Memory model does not affect our code generation until we decide to do Vulkan Memory Model support. case spv::OpEntryPoint: - // Due to preprocessing, the entrypoint provides no value. + case spv::OpFunction: + case spv::OpFunctionEnd: + // Due to preprocessing, the entrypoint and its function provide no value. + break; + case spv::OpExtInstImport: + // We will only support the GLSL 450 extended instruction set, so no point in tracking the ID we assign it. + // Valid shaders will not attempt to import any other instruction sets. + break; + + case spv::OpFunctionParameter: + case spv::OpFunctionCall: + case spv::OpSpecConstant: + case spv::OpSpecConstantComposite: + case spv::OpSpecConstantFalse: + case spv::OpSpecConstantOp: + case spv::OpSpecConstantTrue: + // These should have all been removed by preprocessing passes. If we see them here, + // our assumptions are wrong and we will probably generate wrong code. + UNIMPLEMENTED("These instructions should have already been lowered."); + break; + + case spv::OpStore: + case spv::OpReturn: + // Don't need to do anything during analysis pass + break; + + case spv::OpKill: + modes.ContainsKill = true; break; default: