Coverage Report

Created: 2026-10-17 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/shaderc/third_party/spirv-tools/source/table.cpp
Line
Count
Source
1
// Copyright (c) 2015-2016 The Khronos Group Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include "source/table.h"
16
17
#include <utility>
18
19
1.04k
spv_context spvContextCreate(spv_target_env env) {
20
1.04k
  switch (env) {
21
0
    case SPV_ENV_UNIVERSAL_1_0:
22
1.04k
    case SPV_ENV_VULKAN_1_0:
23
1.04k
    case SPV_ENV_UNIVERSAL_1_1:
24
1.04k
    case SPV_ENV_OPENCL_1_2:
25
1.04k
    case SPV_ENV_OPENCL_EMBEDDED_1_2:
26
1.04k
    case SPV_ENV_OPENCL_2_0:
27
1.04k
    case SPV_ENV_OPENCL_EMBEDDED_2_0:
28
1.04k
    case SPV_ENV_OPENCL_2_1:
29
1.04k
    case SPV_ENV_OPENCL_EMBEDDED_2_1:
30
1.04k
    case SPV_ENV_OPENCL_2_2:
31
1.04k
    case SPV_ENV_OPENCL_EMBEDDED_2_2:
32
1.04k
    case SPV_ENV_OPENGL_4_0:
33
1.04k
    case SPV_ENV_OPENGL_4_1:
34
1.04k
    case SPV_ENV_OPENGL_4_2:
35
1.04k
    case SPV_ENV_OPENGL_4_3:
36
1.04k
    case SPV_ENV_OPENGL_4_5:
37
1.04k
    case SPV_ENV_UNIVERSAL_1_2:
38
1.04k
    case SPV_ENV_UNIVERSAL_1_3:
39
1.04k
    case SPV_ENV_VULKAN_1_1:
40
1.04k
    case SPV_ENV_VULKAN_1_1_SPIRV_1_4:
41
1.04k
    case SPV_ENV_UNIVERSAL_1_4:
42
1.04k
    case SPV_ENV_UNIVERSAL_1_5:
43
1.04k
    case SPV_ENV_VULKAN_1_2:
44
1.04k
    case SPV_ENV_UNIVERSAL_1_6:
45
1.04k
    case SPV_ENV_VULKAN_1_3:
46
1.04k
    case SPV_ENV_VULKAN_1_4:
47
1.04k
      break;
48
0
    default:
49
0
      return nullptr;
50
1.04k
  }
51
52
1.04k
  return new spv_context_t{env, nullptr /* a null default consumer */};
53
1.04k
}
54
55
1.04k
void spvContextDestroy(spv_context context) { delete context; }
56
57
void spvtools::SetContextMessageConsumer(spv_context context,
58
1.84k
                                         spvtools::MessageConsumer consumer) {
59
1.84k
  context->consumer = std::move(consumer);
60
1.84k
}