Coverage Report

Created: 2026-11-12 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/spirv-tools/source/spirv_validator_options.h
Line
Count
Source
1
// Copyright (c) 2017 Google 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
#ifndef SOURCE_SPIRV_VALIDATOR_OPTIONS_H_
16
#define SOURCE_SPIRV_VALIDATOR_OPTIONS_H_
17
18
#include "spirv-tools/libspirv.h"
19
20
// Return true if the command line option for the validator limit is valid (Also
21
// returns the Enum for option in this case). Returns false otherwise.
22
bool spvParseUniversalLimitsOptions(const char* s, spv_validator_limit* limit);
23
24
// Default initialization of this structure is to the default Universal Limits
25
// described in the SPIR-V Spec.
26
struct validator_universal_limits_t {
27
  uint32_t max_struct_members{16383};
28
  uint32_t max_struct_depth{255};
29
  uint32_t max_local_variables{524287};
30
  uint32_t max_global_variables{65535};
31
  uint32_t max_switch_branches{16383};
32
  uint32_t max_function_args{255};
33
  uint32_t max_control_flow_nesting_depth{1023};
34
  uint32_t max_access_chain_indexes{255};
35
  uint32_t max_id_bound{0x3FFFFF};
36
};
37
38
struct OpaqueResourceLayout {
39
  uint32_t size{0};
40
  uint32_t alignment{1};
41
};
42
43
// Manages command line options passed to the SPIR-V Validator. New struct
44
// members may be added for any new option.
45
struct spv_validator_options_t {
46
  spv_validator_options_t()
47
34.6k
      : universal_limits_(),
48
34.6k
        relax_struct_store(false),
49
34.6k
        relax_logical_pointer(false),
50
34.6k
        relax_block_layout(false),
51
34.6k
        uniform_buffer_standard_layout(false),
52
34.6k
        scalar_block_layout(false),
53
34.6k
        workgroup_scalar_block_layout(false),
54
34.6k
        skip_block_layout(false),
55
34.6k
        allow_localsizeid(false),
56
34.6k
        allow_offset_texture_operand(false),
57
34.6k
        allow_vulkan_32_bit_bitwise(false),
58
34.6k
        before_hlsl_legalization(false),
59
34.6k
        use_friendly_names(true) {}
60
61
  validator_universal_limits_t universal_limits_;
62
  bool relax_struct_store;
63
  bool relax_logical_pointer;
64
  bool relax_block_layout;
65
  bool uniform_buffer_standard_layout;
66
  bool scalar_block_layout;
67
  bool workgroup_scalar_block_layout;
68
  bool skip_block_layout;
69
  bool allow_localsizeid;
70
  bool allow_offset_texture_operand;
71
  bool allow_vulkan_32_bit_bitwise;
72
  bool before_hlsl_legalization;
73
  bool use_friendly_names;
74
75
  OpaqueResourceLayout buffer_descriptor_layout;
76
  OpaqueResourceLayout image_descriptor_layout;
77
  OpaqueResourceLayout sampler_descriptor_layout;
78
  OpaqueResourceLayout tensor_descriptor_layout;
79
};
80
81
#endif  // SOURCE_SPIRV_VALIDATOR_OPTIONS_H_