chromium/third_party/spirv-tools/src/source/spirv_constant.h

// Copyright (c) 2015-2016 The Khronos Group Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef SOURCE_SPIRV_CONSTANT_H_
#define SOURCE_SPIRV_CONSTANT_H_

#include "source/latest_version_spirv_header.h"
#include "spirv-tools/libspirv.h"

// Version number macros.

// Evaluates to a well-formed version header word, given valid
// SPIR-V version major and minor version numbers.
#define SPV_SPIRV_VERSION_WORD(MAJOR, MINOR)
// Returns the major version extracted from a version header word.
#define SPV_SPIRV_VERSION_MAJOR_PART(WORD)
// Returns the minor version extracted from a version header word.
#define SPV_SPIRV_VERSION_MINOR_PART(WORD)

// Header indices

#define SPV_INDEX_MAGIC_NUMBER
#define SPV_INDEX_VERSION_NUMBER
#define SPV_INDEX_GENERATOR_NUMBER
#define SPV_INDEX_BOUND
#define SPV_INDEX_SCHEMA
#define SPV_INDEX_INSTRUCTION

// Universal limits

// SPIR-V 1.0 limits
#define SPV_LIMIT_INSTRUCTION_WORD_COUNT_MAX
#define SPV_LIMIT_LITERAL_STRING_UTF8_CHARS_MAX

// A single Unicode character in UTF-8 encoding can take
// up 4 bytes.
#define SPV_LIMIT_LITERAL_STRING_BYTES_MAX

// NOTE: These are set to the minimum maximum values
// TODO(dneto): Check these.

// libspirv limits.
#define SPV_LIMIT_RESULT_ID_BOUND
#define SPV_LIMIT_CONTROL_FLOW_NEST_DEPTH
#define SPV_LIMIT_GLOBAL_VARIABLES_MAX
#define SPV_LIMIT_LOCAL_VARIABLES_MAX
// TODO: Decorations per target ID max, depends on decoration table size
#define SPV_LIMIT_EXECUTION_MODE_PER_ENTRY_POINT_MAX
#define SPV_LIMIT_INDICIES_MAX_ACCESS_CHAIN_COMPOSITE_MAX
#define SPV_LIMIT_FUNCTION_PARAMETERS_PER_FUNCTION_DECL
#define SPV_LIMIT_FUNCTION_CALL_ARGUMENTS_MAX
#define SPV_LIMIT_EXT_FUNCTION_CALL_ARGUMENTS_MAX
#define SPV_LIMIT_SWITCH_LITERAL_LABEL_PAIRS_MAX
#define SPV_LIMIT_STRUCT_MEMBERS_MAX
#define SPV_LIMIT_STRUCT_NESTING_DEPTH_MAX

// Enumerations

// Values mapping to registered tools.  See the registry at
// https://www.khronos.org/registry/spir-v/api/spir-v.xml
// These values occupy the higher order 16 bits of the generator magic word.
spv_generator_t;

// Evaluates to a well-formed generator magic word from a tool value and
// miscellaneous 16-bit value.
#define SPV_GENERATOR_WORD(TOOL, MISC)
// Returns the tool component of the generator word.
#define SPV_GENERATOR_TOOL_PART(WORD)
// Returns the misc part of the generator word.
#define SPV_GENERATOR_MISC_PART(WORD)

#endif  // SOURCE_SPIRV_CONSTANT_H_