Coverage Report

Created: 2026-03-31 06:42

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/spirv-tools/source/opt/analyze_live_input_pass.cpp
Line
Count
Source
1
// Copyright (c) 2022 The Khronos Group Inc.
2
// Copyright (c) 2022 LunarG Inc.
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
//
8
//     http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
16
#include "source/opt/analyze_live_input_pass.h"
17
18
#include "source/opt/ir_context.h"
19
20
namespace spvtools {
21
namespace opt {
22
23
0
Pass::Status AnalyzeLiveInputPass::Process() {
24
  // Current functionality assumes shader capability
25
0
  if (!context()->get_feature_mgr()->HasCapability(spv::Capability::Shader))
26
0
    return Status::SuccessWithoutChange;
27
0
  Pass::Status status = DoLiveInputAnalysis();
28
0
  return status;
29
0
}
30
31
0
Pass::Status AnalyzeLiveInputPass::DoLiveInputAnalysis() {
32
  // Current functionality only supports frag, tesc, tese or geom shaders.
33
  // Report failure for any other stage.
34
0
  auto stage = context()->GetStage();
35
0
  if (stage != spv::ExecutionModel::Fragment &&
36
0
      stage != spv::ExecutionModel::TessellationControl &&
37
0
      stage != spv::ExecutionModel::TessellationEvaluation &&
38
0
      stage != spv::ExecutionModel::Geometry)
39
0
    return Status::Failure;
40
0
  context()->get_liveness_mgr()->GetLiveness(live_locs_, live_builtins_);
41
0
  return Status::SuccessWithoutChange;
42
0
}
43
44
}  // namespace opt
45
}  // namespace spvtools