Alan Baker | 202c8c7 | 2018-08-13 13:47:44 -0400 | [diff] [blame] | 1 | // Copyright 2018 The Clspv Authors. All rights reserved. |
| 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 CLSPV_LIB_CONSTANTS_H_ |
| 16 | #define CLSPV_LIB_CONSTANTS_H_ |
| 17 | |
alan-baker | 9501b32 | 2019-07-16 16:17:15 -0400 | [diff] [blame] | 18 | #include <string> |
| 19 | |
Alan Baker | 202c8c7 | 2018-08-13 13:47:44 -0400 | [diff] [blame] | 20 | namespace clspv { |
| 21 | |
| 22 | // Name for module level metadata storing workgroup argument spec ids. |
SJW | 6153137 | 2020-06-09 07:31:08 -0500 | [diff] [blame] | 23 | const std::string &LocalSpecIdMetadataName(); |
Alan Baker | 202c8c7 | 2018-08-13 13:47:44 -0400 | [diff] [blame] | 24 | |
| 25 | // Base name for workgroup variable accessor function. |
SJW | 6153137 | 2020-06-09 07:31:08 -0500 | [diff] [blame] | 26 | const std::string &WorkgroupAccessorFunction(); |
Alan Baker | 202c8c7 | 2018-08-13 13:47:44 -0400 | [diff] [blame] | 27 | |
| 28 | // Base name for resource variable accessor function. |
SJW | 6153137 | 2020-06-09 07:31:08 -0500 | [diff] [blame] | 29 | const std::string &ResourceAccessorFunction(); |
Alan Baker | 202c8c7 | 2018-08-13 13:47:44 -0400 | [diff] [blame] | 30 | |
Alan Baker | fcda948 | 2018-10-02 17:09:59 -0400 | [diff] [blame] | 31 | // Name for module level metadata storing UBO remapped type offsets. |
SJW | 6153137 | 2020-06-09 07:31:08 -0500 | [diff] [blame] | 32 | const std::string &RemappedTypeOffsetMetadataName(); |
Alan Baker | fcda948 | 2018-10-02 17:09:59 -0400 | [diff] [blame] | 33 | |
| 34 | // Name for module level metadata storing UBO remapped type sizes. |
SJW | 6153137 | 2020-06-09 07:31:08 -0500 | [diff] [blame] | 35 | const std::string &RemappedTypeSizesMetadataName(); |
Alan Baker | fcda948 | 2018-10-02 17:09:59 -0400 | [diff] [blame] | 36 | |
Kévin Petit | df71de3 | 2019-04-09 14:09:50 +0100 | [diff] [blame] | 37 | // Name of the function used to encode literal samplers |
SJW | 6153137 | 2020-06-09 07:31:08 -0500 | [diff] [blame] | 38 | const std::string &LiteralSamplerFunction(); |
| 39 | |
| 40 | // Name of the function used for composite construct |
| 41 | const std::string &CompositeConstructFunction(); |
| 42 | |
| 43 | // Name of the clspv builtin used for register packing (specifically v2f16) |
| 44 | const std::string &PackFunction(); |
| 45 | |
| 46 | // Name of the clspv builtin used for register unpacking (specifically v2f16) |
| 47 | const std::string &UnpackFunction(); |
| 48 | |
| 49 | // Name of the clspv builtin for copy_memory |
| 50 | const std::string &CopyMemoryFunction(); |
Kévin Petit | df71de3 | 2019-04-09 14:09:50 +0100 | [diff] [blame] | 51 | |
Kévin Petit | 617a76d | 2019-04-04 13:54:16 +0100 | [diff] [blame] | 52 | // Base name for SPIR-V intrinsic functions |
SJW | 6153137 | 2020-06-09 07:31:08 -0500 | [diff] [blame] | 53 | const std::string &SPIRVOpIntrinsicFunction(); |
Kévin Petit | 617a76d | 2019-04-04 13:54:16 +0100 | [diff] [blame] | 54 | |
alan-baker | 931d18a | 2019-12-12 08:21:32 -0500 | [diff] [blame] | 55 | // Name of the literal sampler initializer function. |
| 56 | inline std::string TranslateSamplerInitializerFunction() { |
| 57 | return "__translate_sampler_initializer"; |
| 58 | } |
| 59 | |
Kévin Petit | bbbda97 | 2020-03-03 19:16:31 +0000 | [diff] [blame] | 60 | // Name of the global variable storing all push constants |
| 61 | inline std::string PushConstantsVariableName() { return "__push_constants"; } |
| 62 | |
| 63 | // Name for module level metadata storing push constant indices. |
| 64 | inline std::string PushConstantsMetadataName() { return "push_constants"; } |
| 65 | |
alan-baker | a1be332 | 2020-04-20 12:48:18 -0400 | [diff] [blame] | 66 | // Name for module level metadata storing next spec constant id. |
| 67 | inline std::string NextSpecConstantMetadataName() { |
| 68 | return "clspv.next_spec_constant_id"; |
| 69 | } |
| 70 | |
| 71 | // Name for module level metadata store list of allocated spec constants. |
| 72 | inline std::string SpecConstantMetadataName() { |
| 73 | return "clspv.spec_constant_list"; |
| 74 | } |
| 75 | |
alan-baker | c4579bb | 2020-04-29 14:15:50 -0400 | [diff] [blame] | 76 | // Pod args implementation metadata name. |
| 77 | inline std::string PodArgsImplMetadataName() { return "clspv.pod_args_impl"; } |
| 78 | |
alan-baker | ff6c929 | 2020-05-04 08:32:09 -0400 | [diff] [blame] | 79 | // Clustered arguments mapping metadata name. |
| 80 | inline std::string KernelArgMapMetadataName() { return "kernel_arg_map"; } |
| 81 | |
Kévin Petit | 85bcee0 | 2021-08-03 18:21:30 +0100 | [diff] [blame] | 82 | // Clustered constants global variable name. |
| 83 | inline std::string ClusteredConstantsVariableName() { |
| 84 | return "clspv.clustered_constants"; |
| 85 | } |
| 86 | |
Alan Baker | 202c8c7 | 2018-08-13 13:47:44 -0400 | [diff] [blame] | 87 | } // namespace clspv |
| 88 | |
| 89 | #endif |