diff --git a/layers/gpu/instrumentation/gpu_shader_instrumentor.h b/layers/gpu/instrumentation/gpu_shader_instrumentor.h index f196dd3bb39..541c5ed2a42 100644 --- a/layers/gpu/instrumentation/gpu_shader_instrumentor.h +++ b/layers/gpu/instrumentation/gpu_shader_instrumentor.h @@ -180,6 +180,7 @@ class GpuShaderInstrumentor : public ValidationStateTracker { const SafeCreateInfo &modified_create_infos, bool passed_in_shader_stage_ci); // GPU-AV and DebugPrint are going to have a different way to do the actual shader instrumentation logic + // Returns if shader was instrumented successfully or not virtual bool InstrumentShader(const vvl::span &input, uint32_t unique_shader_id, const Location &loc, std::vector &out_instrumented_spirv) = 0; diff --git a/layers/gpu/instrumentation/gpuav_instrumentation.cpp b/layers/gpu/instrumentation/gpuav_instrumentation.cpp index f18094dfa1d..82b5a6dd5d1 100644 --- a/layers/gpu/instrumentation/gpuav_instrumentation.cpp +++ b/layers/gpu/instrumentation/gpuav_instrumentation.cpp @@ -94,6 +94,11 @@ bool Validator::InstrumentShader(const vvl::span &input, uint32_ module.RunPassRayQuery(); } + // If nothing was instrumented, leave early to save time + if (!module.IsInstrumented()) { + return false; + } + for (const auto info : module.link_info_) { module.LinkFunction(info); } diff --git a/layers/gpu/spirv/module.h b/layers/gpu/spirv/module.h index a6c9742cb20..5678572dfa2 100644 --- a/layers/gpu/spirv/module.h +++ b/layers/gpu/spirv/module.h @@ -65,6 +65,7 @@ class Module { // Order of functions that will try to be linked in std::vector link_info_; void LinkFunction(const LinkInfo& info); + bool IsInstrumented() const { return !link_info_.empty(); } // The class is designed to be written out to a binary file. void ToBinary(std::vector& out);