| 1 |
/* |
| 2 |
* Copyright 2019-2020 Hans-Kristian Arntzen |
| 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 |
|
| 17 |
#ifndef SPIRV_CROSS_C_API_H |
| 18 |
#define SPIRV_CROSS_C_API_H |
| 19 |
|
| 20 |
#include <stddef.h> |
| 21 |
#include "spirv.h" |
| 22 |
|
| 23 |
/* |
| 24 |
* C89-compatible wrapper for SPIRV-Cross' API. |
| 25 |
* Documentation here is sparse unless the behavior does not map 1:1 with C++ API. |
| 26 |
* It is recommended to look at the canonical C++ API for more detailed information. |
| 27 |
*/ |
| 28 |
|
| 29 |
#ifdef __cplusplus |
| 30 |
extern "C" { |
| 31 |
#endif |
| 32 |
|
| 33 |
/* Bumped if ABI or API breaks backwards compatibility. */ |
| 34 |
#define SPVC_C_API_VERSION_MAJOR 0 |
| 35 |
/* Bumped if APIs or enumerations are added in a backwards compatible way. */ |
| 36 |
#define SPVC_C_API_VERSION_MINOR 42 |
| 37 |
/* Bumped if internal implementation details change. */ |
| 38 |
#define SPVC_C_API_VERSION_PATCH 0 |
| 39 |
|
| 40 |
#if !defined(SPVC_PUBLIC_API) |
| 41 |
#if defined(SPVC_EXPORT_SYMBOLS) |
| 42 |
/* Exports symbols. Standard C calling convention is used. */ |
| 43 |
#if defined(__GNUC__) |
| 44 |
#define SPVC_PUBLIC_API __attribute__((visibility("default"))) |
| 45 |
#elif defined(_MSC_VER) |
| 46 |
#define SPVC_PUBLIC_API __declspec(dllexport) |
| 47 |
#else |
| 48 |
#define SPVC_PUBLIC_API |
| 49 |
#endif |
| 50 |
#else |
| 51 |
#define SPVC_PUBLIC_API |
| 52 |
#endif |
| 53 |
#endif |
| 54 |
|
| 55 |
/* |
| 56 |
* Gets the SPVC_C_API_VERSION_* used to build this library. |
| 57 |
* Can be used to check for ABI mismatch if so-versioning did not catch it. |
| 58 |
*/ |
| 59 |
SPVC_PUBLIC_API void spvc_get_version(unsigned *major, unsigned *minor, unsigned *patch); |
| 60 |
|
| 61 |
/* Gets a human readable version string to identify which commit a particular binary was created from. */ |
| 62 |
SPVC_PUBLIC_API const char *spvc_get_commit_revision_and_timestamp(void); |
| 63 |
|
| 64 |
/* These types are opaque to the user. */ |
| 65 |
typedef struct spvc_context_s *spvc_context; |
| 66 |
typedef struct spvc_parsed_ir_s *spvc_parsed_ir; |
| 67 |
typedef struct spvc_compiler_s *spvc_compiler; |
| 68 |
typedef struct spvc_compiler_options_s *spvc_compiler_options; |
| 69 |
typedef struct spvc_resources_s *spvc_resources; |
| 70 |
struct spvc_type_s; |
| 71 |
typedef const struct spvc_type_s *spvc_type; |
| 72 |
typedef struct spvc_constant_s *spvc_constant; |
| 73 |
struct spvc_set_s; |
| 74 |
typedef const struct spvc_set_s *spvc_set; |
| 75 |
|
| 76 |
/* |
| 77 |
* Shallow typedefs. All SPIR-V IDs are plain 32-bit numbers, but this helps communicate which data is used. |
| 78 |
* Maps to a SPIRType. |
| 79 |
*/ |
| 80 |
typedef SpvId spvc_type_id; |
| 81 |
/* Maps to a SPIRVariable. */ |
| 82 |
typedef SpvId spvc_variable_id; |
| 83 |
/* Maps to a SPIRConstant. */ |
| 84 |
typedef SpvId spvc_constant_id; |
| 85 |
|
| 86 |
/* See C++ API. */ |
| 87 |
typedef struct spvc_reflected_resource |
| 88 |
{ |
| 89 |
spvc_variable_id id; |
| 90 |
spvc_type_id base_type_id; |
| 91 |
spvc_type_id type_id; |
| 92 |
const char *name; |
| 93 |
} spvc_reflected_resource; |
| 94 |
|
| 95 |
/* See C++ API. */ |
| 96 |
typedef struct spvc_entry_point |
| 97 |
{ |
| 98 |
SpvExecutionModel execution_model; |
| 99 |
const char *name; |
| 100 |
} spvc_entry_point; |
| 101 |
|
| 102 |
/* See C++ API. */ |
| 103 |
typedef struct spvc_combined_image_sampler |
| 104 |
{ |
| 105 |
spvc_variable_id combined_id; |
| 106 |
spvc_variable_id image_id; |
| 107 |
spvc_variable_id sampler_id; |
| 108 |
} spvc_combined_image_sampler; |
| 109 |
|
| 110 |
/* See C++ API. */ |
| 111 |
typedef struct spvc_specialization_constant |
| 112 |
{ |
| 113 |
spvc_constant_id id; |
| 114 |
unsigned constant_id; |
| 115 |
} spvc_specialization_constant; |
| 116 |
|
| 117 |
/* See C++ API. */ |
| 118 |
typedef struct spvc_buffer_range |
| 119 |
{ |
| 120 |
unsigned index; |
| 121 |
size_t offset; |
| 122 |
size_t range; |
| 123 |
} spvc_buffer_range; |
| 124 |
|
| 125 |
/* See C++ API. */ |
| 126 |
typedef struct spvc_hlsl_root_constants |
| 127 |
{ |
| 128 |
unsigned start; |
| 129 |
unsigned end; |
| 130 |
unsigned binding; |
| 131 |
unsigned space; |
| 132 |
} spvc_hlsl_root_constants; |
| 133 |
|
| 134 |
/* See C++ API. */ |
| 135 |
typedef struct spvc_hlsl_vertex_attribute_remap |
| 136 |
{ |
| 137 |
unsigned location; |
| 138 |
const char *semantic; |
| 139 |
} spvc_hlsl_vertex_attribute_remap; |
| 140 |
|
| 141 |
/* |
| 142 |
* Be compatible with non-C99 compilers, which do not have stdbool. |
| 143 |
* Only recent MSVC compilers supports this for example, and ideally SPIRV-Cross should be linkable |
| 144 |
* from a wide range of compilers in its C wrapper. |
| 145 |
*/ |
| 146 |
typedef unsigned char spvc_bool; |
| 147 |
#define SPVC_TRUE ((spvc_bool)1) |
| 148 |
#define SPVC_FALSE ((spvc_bool)0) |
| 149 |
|
| 150 |
typedef enum spvc_result |
| 151 |
{ |
| 152 |
/* Success. */ |
| 153 |
SPVC_SUCCESS = 0, |
| 154 |
|
| 155 |
/* The SPIR-V is invalid. Should have been caught by validation ideally. */ |
| 156 |
SPVC_ERROR_INVALID_SPIRV = -1, |
| 157 |
|
| 158 |
/* The SPIR-V might be valid or invalid, but SPIRV-Cross currently cannot correctly translate this to your target language. */ |
| 159 |
SPVC_ERROR_UNSUPPORTED_SPIRV = -2, |
| 160 |
|
| 161 |
/* If for some reason we hit this, new or malloc failed. */ |
| 162 |
SPVC_ERROR_OUT_OF_MEMORY = -3, |
| 163 |
|
| 164 |
/* Invalid API argument. */ |
| 165 |
SPVC_ERROR_INVALID_ARGUMENT = -4, |
| 166 |
|
| 167 |
SPVC_ERROR_INT_MAX = 0x7fffffff |
| 168 |
} spvc_result; |
| 169 |
|
| 170 |
typedef enum spvc_capture_mode |
| 171 |
{ |
| 172 |
/* The Parsed IR payload will be copied, and the handle can be reused to create other compiler instances. */ |
| 173 |
SPVC_CAPTURE_MODE_COPY = 0, |
| 174 |
|
| 175 |
/* |
| 176 |
* The payload will now be owned by the compiler. |
| 177 |
* parsed_ir should now be considered a dead blob and must not be used further. |
| 178 |
* This is optimal for performance and should be the go-to option. |
| 179 |
*/ |
| 180 |
SPVC_CAPTURE_MODE_TAKE_OWNERSHIP = 1, |
| 181 |
|
| 182 |
SPVC_CAPTURE_MODE_INT_MAX = 0x7fffffff |
| 183 |
} spvc_capture_mode; |
| 184 |
|
| 185 |
typedef enum spvc_backend |
| 186 |
{ |
| 187 |
/* This backend can only perform reflection, no compiler options are supported. Maps to spirv_cross::Compiler. */ |
| 188 |
SPVC_BACKEND_NONE = 0, |
| 189 |
SPVC_BACKEND_GLSL = 1, /* spirv_cross::CompilerGLSL */ |
| 190 |
SPVC_BACKEND_HLSL = 2, /* CompilerHLSL */ |
| 191 |
SPVC_BACKEND_MSL = 3, /* CompilerMSL */ |
| 192 |
SPVC_BACKEND_CPP = 4, /* CompilerCPP */ |
| 193 |
SPVC_BACKEND_JSON = 5, /* CompilerReflection w/ JSON backend */ |
| 194 |
SPVC_BACKEND_INT_MAX = 0x7fffffff |
| 195 |
} spvc_backend; |
| 196 |
|
| 197 |
/* Maps to C++ API. */ |
| 198 |
typedef enum spvc_resource_type |
| 199 |
{ |
| 200 |
SPVC_RESOURCE_TYPE_UNKNOWN = 0, |
| 201 |
SPVC_RESOURCE_TYPE_UNIFORM_BUFFER = 1, |
| 202 |
SPVC_RESOURCE_TYPE_STORAGE_BUFFER = 2, |
| 203 |
SPVC_RESOURCE_TYPE_STAGE_INPUT = 3, |
| 204 |
SPVC_RESOURCE_TYPE_STAGE_OUTPUT = 4, |
| 205 |
SPVC_RESOURCE_TYPE_SUBPASS_INPUT = 5, |
| 206 |
SPVC_RESOURCE_TYPE_STORAGE_IMAGE = 6, |
| 207 |
SPVC_RESOURCE_TYPE_SAMPLED_IMAGE = 7, |
| 208 |
SPVC_RESOURCE_TYPE_ATOMIC_COUNTER = 8, |
| 209 |
SPVC_RESOURCE_TYPE_PUSH_CONSTANT = 9, |
| 210 |
SPVC_RESOURCE_TYPE_SEPARATE_IMAGE = 10, |
| 211 |
SPVC_RESOURCE_TYPE_SEPARATE_SAMPLERS = 11, |
| 212 |
SPVC_RESOURCE_TYPE_ACCELERATION_STRUCTURE = 12, |
| 213 |
SPVC_RESOURCE_TYPE_RAY_QUERY = 13, |
| 214 |
SPVC_RESOURCE_TYPE_INT_MAX = 0x7fffffff |
| 215 |
} spvc_resource_type; |
| 216 |
|
| 217 |
/* Maps to spirv_cross::SPIRType::BaseType. */ |
| 218 |
typedef enum spvc_basetype |
| 219 |
{ |
| 220 |
SPVC_BASETYPE_UNKNOWN = 0, |
| 221 |
SPVC_BASETYPE_VOID = 1, |
| 222 |
SPVC_BASETYPE_BOOLEAN = 2, |
| 223 |
SPVC_BASETYPE_INT8 = 3, |
| 224 |
SPVC_BASETYPE_UINT8 = 4, |
| 225 |
SPVC_BASETYPE_INT16 = 5, |
| 226 |
SPVC_BASETYPE_UINT16 = 6, |
| 227 |
SPVC_BASETYPE_INT32 = 7, |
| 228 |
SPVC_BASETYPE_UINT32 = 8, |
| 229 |
SPVC_BASETYPE_INT64 = 9, |
| 230 |
SPVC_BASETYPE_UINT64 = 10, |
| 231 |
SPVC_BASETYPE_ATOMIC_COUNTER = 11, |
| 232 |
SPVC_BASETYPE_FP16 = 12, |
| 233 |
SPVC_BASETYPE_FP32 = 13, |
| 234 |
SPVC_BASETYPE_FP64 = 14, |
| 235 |
SPVC_BASETYPE_STRUCT = 15, |
| 236 |
SPVC_BASETYPE_IMAGE = 16, |
| 237 |
SPVC_BASETYPE_SAMPLED_IMAGE = 17, |
| 238 |
SPVC_BASETYPE_SAMPLER = 18, |
| 239 |
SPVC_BASETYPE_ACCELERATION_STRUCTURE = 19, |
| 240 |
|
| 241 |
SPVC_BASETYPE_INT_MAX = 0x7fffffff |
| 242 |
} spvc_basetype; |
| 243 |
|
| 244 |
#define SPVC_COMPILER_OPTION_COMMON_BIT 0x1000000 |
| 245 |
#define SPVC_COMPILER_OPTION_GLSL_BIT 0x2000000 |
| 246 |
#define SPVC_COMPILER_OPTION_HLSL_BIT 0x4000000 |
| 247 |
#define SPVC_COMPILER_OPTION_MSL_BIT 0x8000000 |
| 248 |
#define SPVC_COMPILER_OPTION_LANG_BITS 0x0f000000 |
| 249 |
#define SPVC_COMPILER_OPTION_ENUM_BITS 0xffffff |
| 250 |
|
| 251 |
#define SPVC_MAKE_MSL_VERSION(major, minor, patch) ((major) * 10000 + (minor) * 100 + (patch)) |
| 252 |
|
| 253 |
/* Maps to C++ API. */ |
| 254 |
typedef enum spvc_msl_platform |
| 255 |
{ |
| 256 |
SPVC_MSL_PLATFORM_IOS = 0, |
| 257 |
SPVC_MSL_PLATFORM_MACOS = 1, |
| 258 |
SPVC_MSL_PLATFORM_MAX_INT = 0x7fffffff |
| 259 |
} spvc_msl_platform; |
| 260 |
|
| 261 |
/* Maps to C++ API. */ |
| 262 |
typedef enum spvc_msl_index_type |
| 263 |
{ |
| 264 |
SPVC_MSL_INDEX_TYPE_NONE = 0, |
| 265 |
SPVC_MSL_INDEX_TYPE_UINT16 = 1, |
| 266 |
SPVC_MSL_INDEX_TYPE_UINT32 = 2, |
| 267 |
SPVC_MSL_INDEX_TYPE_MAX_INT = 0x7fffffff |
| 268 |
} spvc_msl_index_type; |
| 269 |
|
| 270 |
/* Maps to C++ API. */ |
| 271 |
typedef enum spvc_msl_shader_input_format |
| 272 |
{ |
| 273 |
SPVC_MSL_SHADER_INPUT_FORMAT_OTHER = 0, |
| 274 |
SPVC_MSL_SHADER_INPUT_FORMAT_UINT8 = 1, |
| 275 |
SPVC_MSL_SHADER_INPUT_FORMAT_UINT16 = 2, |
| 276 |
SPVC_MSL_SHADER_INPUT_FORMAT_ANY16 = 3, |
| 277 |
SPVC_MSL_SHADER_INPUT_FORMAT_ANY32 = 4, |
| 278 |
|
| 279 |
/* Deprecated names. */ |
| 280 |
SPVC_MSL_VERTEX_FORMAT_OTHER = SPVC_MSL_SHADER_INPUT_FORMAT_OTHER, |
| 281 |
SPVC_MSL_VERTEX_FORMAT_UINT8 = SPVC_MSL_SHADER_INPUT_FORMAT_UINT8, |
| 282 |
SPVC_MSL_VERTEX_FORMAT_UINT16 = SPVC_MSL_SHADER_INPUT_FORMAT_UINT16, |
| 283 |
|
| 284 |
SPVC_MSL_SHADER_INPUT_FORMAT_INT_MAX = 0x7fffffff |
| 285 |
} spvc_msl_shader_input_format, spvc_msl_vertex_format; |
| 286 |
|
| 287 |
/* Maps to C++ API. Deprecated; use spvc_msl_shader_input. */ |
| 288 |
typedef struct spvc_msl_vertex_attribute |
| 289 |
{ |
| 290 |
unsigned location; |
| 291 |
|
| 292 |
/* Obsolete, do not use. Only lingers on for ABI compatibility. */ |
| 293 |
unsigned msl_buffer; |
| 294 |
/* Obsolete, do not use. Only lingers on for ABI compatibility. */ |
| 295 |
unsigned msl_offset; |
| 296 |
/* Obsolete, do not use. Only lingers on for ABI compatibility. */ |
| 297 |
unsigned msl_stride; |
| 298 |
/* Obsolete, do not use. Only lingers on for ABI compatibility. */ |
| 299 |
spvc_bool per_instance; |
| 300 |
|
| 301 |
spvc_msl_vertex_format format; |
| 302 |
SpvBuiltIn builtin; |
| 303 |
} spvc_msl_vertex_attribute; |
| 304 |
|
| 305 |
/* |
| 306 |
* Initializes the vertex attribute struct. |
| 307 |
*/ |
| 308 |
SPVC_PUBLIC_API void spvc_msl_vertex_attribute_init(spvc_msl_vertex_attribute *attr); |
| 309 |
|
| 310 |
/* Maps to C++ API. */ |
| 311 |
typedef struct spvc_msl_shader_input |
| 312 |
{ |
| 313 |
unsigned location; |
| 314 |
spvc_msl_vertex_format format; |
| 315 |
SpvBuiltIn builtin; |
| 316 |
unsigned vecsize; |
| 317 |
} spvc_msl_shader_input; |
| 318 |
|
| 319 |
/* |
| 320 |
* Initializes the shader input struct. |
| 321 |
*/ |
| 322 |
SPVC_PUBLIC_API void spvc_msl_shader_input_init(spvc_msl_shader_input *input); |
| 323 |
|
| 324 |
/* Maps to C++ API. */ |
| 325 |
typedef struct spvc_msl_resource_binding |
| 326 |
{ |
| 327 |
SpvExecutionModel stage; |
| 328 |
unsigned desc_set; |
| 329 |
unsigned binding; |
| 330 |
unsigned msl_buffer; |
| 331 |
unsigned msl_texture; |
| 332 |
unsigned msl_sampler; |
| 333 |
} spvc_msl_resource_binding; |
| 334 |
|
| 335 |
/* |
| 336 |
* Initializes the resource binding struct. |
| 337 |
* The defaults are non-zero. |
| 338 |
*/ |
| 339 |
SPVC_PUBLIC_API void spvc_msl_resource_binding_init(spvc_msl_resource_binding *binding); |
| 340 |
|
| 341 |
#define SPVC_MSL_PUSH_CONSTANT_DESC_SET (~(0u)) |
| 342 |
#define SPVC_MSL_PUSH_CONSTANT_BINDING (0) |
| 343 |
#define SPVC_MSL_SWIZZLE_BUFFER_BINDING (~(1u)) |
| 344 |
#define SPVC_MSL_BUFFER_SIZE_BUFFER_BINDING (~(2u)) |
| 345 |
#define SPVC_MSL_ARGUMENT_BUFFER_BINDING (~(3u)) |
| 346 |
|
| 347 |
/* Obsolete. Sticks around for backwards compatibility. */ |
| 348 |
#define SPVC_MSL_AUX_BUFFER_STRUCT_VERSION 1 |
| 349 |
|
| 350 |
/* Runtime check for incompatibility. Obsolete. */ |
| 351 |
SPVC_PUBLIC_API unsigned spvc_msl_get_aux_buffer_struct_version(void); |
| 352 |
|
| 353 |
/* Maps to C++ API. */ |
| 354 |
typedef enum spvc_msl_sampler_coord |
| 355 |
{ |
| 356 |
SPVC_MSL_SAMPLER_COORD_NORMALIZED = 0, |
| 357 |
SPVC_MSL_SAMPLER_COORD_PIXEL = 1, |
| 358 |
SPVC_MSL_SAMPLER_INT_MAX = 0x7fffffff |
| 359 |
} spvc_msl_sampler_coord; |
| 360 |
|
| 361 |
/* Maps to C++ API. */ |
| 362 |
typedef enum spvc_msl_sampler_filter |
| 363 |
{ |
| 364 |
SPVC_MSL_SAMPLER_FILTER_NEAREST = 0, |
| 365 |
SPVC_MSL_SAMPLER_FILTER_LINEAR = 1, |
| 366 |
SPVC_MSL_SAMPLER_FILTER_INT_MAX = 0x7fffffff |
| 367 |
} spvc_msl_sampler_filter; |
| 368 |
|
| 369 |
/* Maps to C++ API. */ |
| 370 |
typedef enum spvc_msl_sampler_mip_filter |
| 371 |
{ |
| 372 |
SPVC_MSL_SAMPLER_MIP_FILTER_NONE = 0, |
| 373 |
SPVC_MSL_SAMPLER_MIP_FILTER_NEAREST = 1, |
| 374 |
SPVC_MSL_SAMPLER_MIP_FILTER_LINEAR = 2, |
| 375 |
SPVC_MSL_SAMPLER_MIP_FILTER_INT_MAX = 0x7fffffff |
| 376 |
} spvc_msl_sampler_mip_filter; |
| 377 |
|
| 378 |
/* Maps to C++ API. */ |
| 379 |
typedef enum spvc_msl_sampler_address |
| 380 |
{ |
| 381 |
SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_ZERO = 0, |
| 382 |
SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_EDGE = 1, |
| 383 |
SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_BORDER = 2, |
| 384 |
SPVC_MSL_SAMPLER_ADDRESS_REPEAT = 3, |
| 385 |
SPVC_MSL_SAMPLER_ADDRESS_MIRRORED_REPEAT = 4, |
| 386 |
SPVC_MSL_SAMPLER_ADDRESS_INT_MAX = 0x7fffffff |
| 387 |
} spvc_msl_sampler_address; |
| 388 |
|
| 389 |
/* Maps to C++ API. */ |
| 390 |
typedef enum spvc_msl_sampler_compare_func |
| 391 |
{ |
| 392 |
SPVC_MSL_SAMPLER_COMPARE_FUNC_NEVER = 0, |
| 393 |
SPVC_MSL_SAMPLER_COMPARE_FUNC_LESS = 1, |
| 394 |
SPVC_MSL_SAMPLER_COMPARE_FUNC_LESS_EQUAL = 2, |
| 395 |
SPVC_MSL_SAMPLER_COMPARE_FUNC_GREATER = 3, |
| 396 |
SPVC_MSL_SAMPLER_COMPARE_FUNC_GREATER_EQUAL = 4, |
| 397 |
SPVC_MSL_SAMPLER_COMPARE_FUNC_EQUAL = 5, |
| 398 |
SPVC_MSL_SAMPLER_COMPARE_FUNC_NOT_EQUAL = 6, |
| 399 |
SPVC_MSL_SAMPLER_COMPARE_FUNC_ALWAYS = 7, |
| 400 |
SPVC_MSL_SAMPLER_COMPARE_FUNC_INT_MAX = 0x7fffffff |
| 401 |
} spvc_msl_sampler_compare_func; |
| 402 |
|
| 403 |
/* Maps to C++ API. */ |
| 404 |
typedef enum spvc_msl_sampler_border_color |
| 405 |
{ |
| 406 |
SPVC_MSL_SAMPLER_BORDER_COLOR_TRANSPARENT_BLACK = 0, |
| 407 |
SPVC_MSL_SAMPLER_BORDER_COLOR_OPAQUE_BLACK = 1, |
| 408 |
SPVC_MSL_SAMPLER_BORDER_COLOR_OPAQUE_WHITE = 2, |
| 409 |
SPVC_MSL_SAMPLER_BORDER_COLOR_INT_MAX = 0x7fffffff |
| 410 |
} spvc_msl_sampler_border_color; |
| 411 |
|
| 412 |
/* Maps to C++ API. */ |
| 413 |
typedef enum spvc_msl_format_resolution |
| 414 |
{ |
| 415 |
SPVC_MSL_FORMAT_RESOLUTION_444 = 0, |
| 416 |
SPVC_MSL_FORMAT_RESOLUTION_422, |
| 417 |
SPVC_MSL_FORMAT_RESOLUTION_420, |
| 418 |
SPVC_MSL_FORMAT_RESOLUTION_INT_MAX = 0x7fffffff |
| 419 |
} spvc_msl_format_resolution; |
| 420 |
|
| 421 |
/* Maps to C++ API. */ |
| 422 |
typedef enum spvc_msl_chroma_location |
| 423 |
{ |
| 424 |
SPVC_MSL_CHROMA_LOCATION_COSITED_EVEN = 0, |
| 425 |
SPVC_MSL_CHROMA_LOCATION_MIDPOINT, |
| 426 |
SPVC_MSL_CHROMA_LOCATION_INT_MAX = 0x7fffffff |
| 427 |
} spvc_msl_chroma_location; |
| 428 |
|
| 429 |
/* Maps to C++ API. */ |
| 430 |
typedef enum spvc_msl_component_swizzle |
| 431 |
{ |
| 432 |
SPVC_MSL_COMPONENT_SWIZZLE_IDENTITY = 0, |
| 433 |
SPVC_MSL_COMPONENT_SWIZZLE_ZERO, |
| 434 |
SPVC_MSL_COMPONENT_SWIZZLE_ONE, |
| 435 |
SPVC_MSL_COMPONENT_SWIZZLE_R, |
| 436 |
SPVC_MSL_COMPONENT_SWIZZLE_G, |
| 437 |
SPVC_MSL_COMPONENT_SWIZZLE_B, |
| 438 |
SPVC_MSL_COMPONENT_SWIZZLE_A, |
| 439 |
SPVC_MSL_COMPONENT_SWIZZLE_INT_MAX = 0x7fffffff |
| 440 |
} spvc_msl_component_swizzle; |
| 441 |
|
| 442 |
/* Maps to C++ API. */ |
| 443 |
typedef enum spvc_msl_sampler_ycbcr_model_conversion |
| 444 |
{ |
| 445 |
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY = 0, |
| 446 |
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY, |
| 447 |
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_BT_709, |
| 448 |
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_BT_601, |
| 449 |
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_BT_2020, |
| 450 |
SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_INT_MAX = 0x7fffffff |
| 451 |
} spvc_msl_sampler_ycbcr_model_conversion; |
| 452 |
|
| 453 |
/* Maps to C+ API. */ |
| 454 |
typedef enum spvc_msl_sampler_ycbcr_range |
| 455 |
{ |
| 456 |
SPVC_MSL_SAMPLER_YCBCR_RANGE_ITU_FULL = 0, |
| 457 |
SPVC_MSL_SAMPLER_YCBCR_RANGE_ITU_NARROW, |
| 458 |
SPVC_MSL_SAMPLER_YCBCR_RANGE_INT_MAX = 0x7fffffff |
| 459 |
} spvc_msl_sampler_ycbcr_range; |
| 460 |
|
| 461 |
/* Maps to C++ API. */ |
| 462 |
typedef struct spvc_msl_constexpr_sampler |
| 463 |
{ |
| 464 |
spvc_msl_sampler_coord coord; |
| 465 |
spvc_msl_sampler_filter min_filter; |
| 466 |
spvc_msl_sampler_filter mag_filter; |
| 467 |
spvc_msl_sampler_mip_filter mip_filter; |
| 468 |
spvc_msl_sampler_address s_address; |
| 469 |
spvc_msl_sampler_address t_address; |
| 470 |
spvc_msl_sampler_address r_address; |
| 471 |
spvc_msl_sampler_compare_func compare_func; |
| 472 |
spvc_msl_sampler_border_color border_color; |
| 473 |
float lod_clamp_min; |
| 474 |
float lod_clamp_max; |
| 475 |
int max_anisotropy; |
| 476 |
|
| 477 |
spvc_bool compare_enable; |
| 478 |
spvc_bool lod_clamp_enable; |
| 479 |
spvc_bool anisotropy_enable; |
| 480 |
} spvc_msl_constexpr_sampler; |
| 481 |
|
| 482 |
/* |
| 483 |
* Initializes the constexpr sampler struct. |
| 484 |
* The defaults are non-zero. |
| 485 |
*/ |
| 486 |
SPVC_PUBLIC_API void spvc_msl_constexpr_sampler_init(spvc_msl_constexpr_sampler *sampler); |
| 487 |
|
| 488 |
/* Maps to the sampler Y'CbCr conversion-related portions of MSLConstexprSampler. See C++ API for defaults and details. */ |
| 489 |
typedef struct spvc_msl_sampler_ycbcr_conversion |
| 490 |
{ |
| 491 |
unsigned planes; |
| 492 |
spvc_msl_format_resolution resolution; |
| 493 |
spvc_msl_sampler_filter chroma_filter; |
| 494 |
spvc_msl_chroma_location x_chroma_offset; |
| 495 |
spvc_msl_chroma_location y_chroma_offset; |
| 496 |
spvc_msl_component_swizzle swizzle[4]; |
| 497 |
spvc_msl_sampler_ycbcr_model_conversion ycbcr_model; |
| 498 |
spvc_msl_sampler_ycbcr_range ycbcr_range; |
| 499 |
unsigned bpc; |
| 500 |
} spvc_msl_sampler_ycbcr_conversion; |
| 501 |
|
| 502 |
/* |
| 503 |
* Initializes the constexpr sampler struct. |
| 504 |
* The defaults are non-zero. |
| 505 |
*/ |
| 506 |
SPVC_PUBLIC_API void spvc_msl_sampler_ycbcr_conversion_init(spvc_msl_sampler_ycbcr_conversion *conv); |
| 507 |
|
| 508 |
/* Maps to C++ API. */ |
| 509 |
typedef enum spvc_hlsl_binding_flag_bits |
| 510 |
{ |
| 511 |
SPVC_HLSL_BINDING_AUTO_NONE_BIT = 0, |
| 512 |
SPVC_HLSL_BINDING_AUTO_PUSH_CONSTANT_BIT = 1 << 0, |
| 513 |
SPVC_HLSL_BINDING_AUTO_CBV_BIT = 1 << 1, |
| 514 |
SPVC_HLSL_BINDING_AUTO_SRV_BIT = 1 << 2, |
| 515 |
SPVC_HLSL_BINDING_AUTO_UAV_BIT = 1 << 3, |
| 516 |
SPVC_HLSL_BINDING_AUTO_SAMPLER_BIT = 1 << 4, |
| 517 |
SPVC_HLSL_BINDING_AUTO_ALL = 0x7fffffff |
| 518 |
} spvc_hlsl_binding_flag_bits; |
| 519 |
typedef unsigned spvc_hlsl_binding_flags; |
| 520 |
|
| 521 |
#define SPVC_HLSL_PUSH_CONSTANT_DESC_SET (~(0u)) |
| 522 |
#define SPVC_HLSL_PUSH_CONSTANT_BINDING (0) |
| 523 |
|
| 524 |
/* Maps to C++ API. */ |
| 525 |
typedef struct spvc_hlsl_resource_binding_mapping |
| 526 |
{ |
| 527 |
unsigned register_space; |
| 528 |
unsigned register_binding; |
| 529 |
} spvc_hlsl_resource_binding_mapping; |
| 530 |
|
| 531 |
typedef struct spvc_hlsl_resource_binding |
| 532 |
{ |
| 533 |
SpvExecutionModel stage; |
| 534 |
unsigned desc_set; |
| 535 |
unsigned binding; |
| 536 |
|
| 537 |
spvc_hlsl_resource_binding_mapping cbv, uav, srv, sampler; |
| 538 |
} spvc_hlsl_resource_binding; |
| 539 |
|
| 540 |
/* |
| 541 |
* Initializes the resource binding struct. |
| 542 |
* The defaults are non-zero. |
| 543 |
*/ |
| 544 |
SPVC_PUBLIC_API void spvc_hlsl_resource_binding_init(spvc_hlsl_resource_binding *binding); |
| 545 |
|
| 546 |
/* Maps to the various spirv_cross::Compiler*::Option structures. See C++ API for defaults and details. */ |
| 547 |
typedef enum spvc_compiler_option |
| 548 |
{ |
| 549 |
SPVC_COMPILER_OPTION_UNKNOWN = 0, |
| 550 |
|
| 551 |
SPVC_COMPILER_OPTION_FORCE_TEMPORARY = 1 | SPVC_COMPILER_OPTION_COMMON_BIT, |
| 552 |
SPVC_COMPILER_OPTION_FLATTEN_MULTIDIMENSIONAL_ARRAYS = 2 | SPVC_COMPILER_OPTION_COMMON_BIT, |
| 553 |
SPVC_COMPILER_OPTION_FIXUP_DEPTH_CONVENTION = 3 | SPVC_COMPILER_OPTION_COMMON_BIT, |
| 554 |
SPVC_COMPILER_OPTION_FLIP_VERTEX_Y = 4 | SPVC_COMPILER_OPTION_COMMON_BIT, |
| 555 |
|
| 556 |
SPVC_COMPILER_OPTION_GLSL_SUPPORT_NONZERO_BASE_INSTANCE = 5 | SPVC_COMPILER_OPTION_GLSL_BIT, |
| 557 |
SPVC_COMPILER_OPTION_GLSL_SEPARATE_SHADER_OBJECTS = 6 | SPVC_COMPILER_OPTION_GLSL_BIT, |
| 558 |
SPVC_COMPILER_OPTION_GLSL_ENABLE_420PACK_EXTENSION = 7 | SPVC_COMPILER_OPTION_GLSL_BIT, |
| 559 |
SPVC_COMPILER_OPTION_GLSL_VERSION = 8 | SPVC_COMPILER_OPTION_GLSL_BIT, |
| 560 |
SPVC_COMPILER_OPTION_GLSL_ES = 9 | SPVC_COMPILER_OPTION_GLSL_BIT, |
| 561 |
SPVC_COMPILER_OPTION_GLSL_VULKAN_SEMANTICS = 10 | SPVC_COMPILER_OPTION_GLSL_BIT, |
| 562 |
SPVC_COMPILER_OPTION_GLSL_ES_DEFAULT_FLOAT_PRECISION_HIGHP = 11 | SPVC_COMPILER_OPTION_GLSL_BIT, |
| 563 |
SPVC_COMPILER_OPTION_GLSL_ES_DEFAULT_INT_PRECISION_HIGHP = 12 | SPVC_COMPILER_OPTION_GLSL_BIT, |
| 564 |
|
| 565 |
SPVC_COMPILER_OPTION_HLSL_SHADER_MODEL = 13 | SPVC_COMPILER_OPTION_HLSL_BIT, |
| 566 |
SPVC_COMPILER_OPTION_HLSL_POINT_SIZE_COMPAT = 14 | SPVC_COMPILER_OPTION_HLSL_BIT, |
| 567 |
SPVC_COMPILER_OPTION_HLSL_POINT_COORD_COMPAT = 15 | SPVC_COMPILER_OPTION_HLSL_BIT, |
| 568 |
SPVC_COMPILER_OPTION_HLSL_SUPPORT_NONZERO_BASE_VERTEX_BASE_INSTANCE = 16 | SPVC_COMPILER_OPTION_HLSL_BIT, |
| 569 |
|
| 570 |
SPVC_COMPILER_OPTION_MSL_VERSION = 17 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 571 |
SPVC_COMPILER_OPTION_MSL_TEXEL_BUFFER_TEXTURE_WIDTH = 18 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 572 |
|
| 573 |
/* Obsolete, use SWIZZLE_BUFFER_INDEX instead. */ |
| 574 |
SPVC_COMPILER_OPTION_MSL_AUX_BUFFER_INDEX = 19 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 575 |
SPVC_COMPILER_OPTION_MSL_SWIZZLE_BUFFER_INDEX = 19 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 576 |
|
| 577 |
SPVC_COMPILER_OPTION_MSL_INDIRECT_PARAMS_BUFFER_INDEX = 20 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 578 |
SPVC_COMPILER_OPTION_MSL_SHADER_OUTPUT_BUFFER_INDEX = 21 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 579 |
SPVC_COMPILER_OPTION_MSL_SHADER_PATCH_OUTPUT_BUFFER_INDEX = 22 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 580 |
SPVC_COMPILER_OPTION_MSL_SHADER_TESS_FACTOR_OUTPUT_BUFFER_INDEX = 23 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 581 |
SPVC_COMPILER_OPTION_MSL_SHADER_INPUT_WORKGROUP_INDEX = 24 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 582 |
SPVC_COMPILER_OPTION_MSL_ENABLE_POINT_SIZE_BUILTIN = 25 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 583 |
SPVC_COMPILER_OPTION_MSL_DISABLE_RASTERIZATION = 26 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 584 |
SPVC_COMPILER_OPTION_MSL_CAPTURE_OUTPUT_TO_BUFFER = 27 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 585 |
SPVC_COMPILER_OPTION_MSL_SWIZZLE_TEXTURE_SAMPLES = 28 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 586 |
SPVC_COMPILER_OPTION_MSL_PAD_FRAGMENT_OUTPUT_COMPONENTS = 29 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 587 |
SPVC_COMPILER_OPTION_MSL_TESS_DOMAIN_ORIGIN_LOWER_LEFT = 30 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 588 |
SPVC_COMPILER_OPTION_MSL_PLATFORM = 31 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 589 |
SPVC_COMPILER_OPTION_MSL_ARGUMENT_BUFFERS = 32 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 590 |
|
| 591 |
SPVC_COMPILER_OPTION_GLSL_EMIT_PUSH_CONSTANT_AS_UNIFORM_BUFFER = 33 | SPVC_COMPILER_OPTION_GLSL_BIT, |
| 592 |
|
| 593 |
SPVC_COMPILER_OPTION_MSL_TEXTURE_BUFFER_NATIVE = 34 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 594 |
|
| 595 |
SPVC_COMPILER_OPTION_GLSL_EMIT_UNIFORM_BUFFER_AS_PLAIN_UNIFORMS = 35 | SPVC_COMPILER_OPTION_GLSL_BIT, |
| 596 |
|
| 597 |
SPVC_COMPILER_OPTION_MSL_BUFFER_SIZE_BUFFER_INDEX = 36 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 598 |
|
| 599 |
SPVC_COMPILER_OPTION_EMIT_LINE_DIRECTIVES = 37 | SPVC_COMPILER_OPTION_COMMON_BIT, |
| 600 |
|
| 601 |
SPVC_COMPILER_OPTION_MSL_MULTIVIEW = 38 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 602 |
SPVC_COMPILER_OPTION_MSL_VIEW_MASK_BUFFER_INDEX = 39 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 603 |
SPVC_COMPILER_OPTION_MSL_DEVICE_INDEX = 40 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 604 |
SPVC_COMPILER_OPTION_MSL_VIEW_INDEX_FROM_DEVICE_INDEX = 41 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 605 |
SPVC_COMPILER_OPTION_MSL_DISPATCH_BASE = 42 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 606 |
SPVC_COMPILER_OPTION_MSL_DYNAMIC_OFFSETS_BUFFER_INDEX = 43 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 607 |
SPVC_COMPILER_OPTION_MSL_TEXTURE_1D_AS_2D = 44 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 608 |
SPVC_COMPILER_OPTION_MSL_ENABLE_BASE_INDEX_ZERO = 45 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 609 |
|
| 610 |
/* Obsolete. Use MSL_FRAMEBUFFER_FETCH_SUBPASS instead. */ |
| 611 |
SPVC_COMPILER_OPTION_MSL_IOS_FRAMEBUFFER_FETCH_SUBPASS = 46 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 612 |
SPVC_COMPILER_OPTION_MSL_FRAMEBUFFER_FETCH_SUBPASS = 46 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 613 |
|
| 614 |
SPVC_COMPILER_OPTION_MSL_INVARIANT_FP_MATH = 47 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 615 |
SPVC_COMPILER_OPTION_MSL_EMULATE_CUBEMAP_ARRAY = 48 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 616 |
SPVC_COMPILER_OPTION_MSL_ENABLE_DECORATION_BINDING = 49 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 617 |
SPVC_COMPILER_OPTION_MSL_FORCE_ACTIVE_ARGUMENT_BUFFER_RESOURCES = 50 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 618 |
SPVC_COMPILER_OPTION_MSL_FORCE_NATIVE_ARRAYS = 51 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 619 |
|
| 620 |
SPVC_COMPILER_OPTION_ENABLE_STORAGE_IMAGE_QUALIFIER_DEDUCTION = 52 | SPVC_COMPILER_OPTION_COMMON_BIT, |
| 621 |
|
| 622 |
SPVC_COMPILER_OPTION_HLSL_FORCE_STORAGE_BUFFER_AS_UAV = 53 | SPVC_COMPILER_OPTION_HLSL_BIT, |
| 623 |
|
| 624 |
SPVC_COMPILER_OPTION_FORCE_ZERO_INITIALIZED_VARIABLES = 54 | SPVC_COMPILER_OPTION_COMMON_BIT, |
| 625 |
|
| 626 |
SPVC_COMPILER_OPTION_HLSL_NONWRITABLE_UAV_TEXTURE_AS_SRV = 55 | SPVC_COMPILER_OPTION_HLSL_BIT, |
| 627 |
|
| 628 |
SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_OUTPUT_MASK = 56 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 629 |
SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_DEPTH_BUILTIN = 57 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 630 |
SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_STENCIL_REF_BUILTIN = 58 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 631 |
SPVC_COMPILER_OPTION_MSL_ENABLE_CLIP_DISTANCE_USER_VARYING = 59 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 632 |
|
| 633 |
SPVC_COMPILER_OPTION_HLSL_ENABLE_16BIT_TYPES = 60 | SPVC_COMPILER_OPTION_HLSL_BIT, |
| 634 |
|
| 635 |
SPVC_COMPILER_OPTION_MSL_MULTI_PATCH_WORKGROUP = 61 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 636 |
SPVC_COMPILER_OPTION_MSL_SHADER_INPUT_BUFFER_INDEX = 62 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 637 |
SPVC_COMPILER_OPTION_MSL_SHADER_INDEX_BUFFER_INDEX = 63 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 638 |
SPVC_COMPILER_OPTION_MSL_VERTEX_FOR_TESSELLATION = 64 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 639 |
SPVC_COMPILER_OPTION_MSL_VERTEX_INDEX_TYPE = 65 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 640 |
|
| 641 |
SPVC_COMPILER_OPTION_GLSL_FORCE_FLATTENED_IO_BLOCKS = 66 | SPVC_COMPILER_OPTION_GLSL_BIT, |
| 642 |
|
| 643 |
SPVC_COMPILER_OPTION_MSL_MULTIVIEW_LAYERED_RENDERING = 67 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 644 |
SPVC_COMPILER_OPTION_MSL_ARRAYED_SUBPASS_INPUT = 68 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 645 |
SPVC_COMPILER_OPTION_MSL_R32UI_LINEAR_TEXTURE_ALIGNMENT = 69 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 646 |
SPVC_COMPILER_OPTION_MSL_R32UI_ALIGNMENT_CONSTANT_ID = 70 | SPVC_COMPILER_OPTION_MSL_BIT, |
| 647 |
|
| 648 |
SPVC_COMPILER_OPTION_HLSL_FLATTEN_MATRIX_VERTEX_INPUT_SEMANTICS = 71 | SPVC_COMPILER_OPTION_HLSL_BIT, |
| 649 |
|
| 650 |
SPVC_COMPILER_OPTION_INT_MAX = 0x7fffffff |
| 651 |
} spvc_compiler_option; |
| 652 |
|
| 653 |
/* |
| 654 |
* Context is the highest-level API construct. |
| 655 |
* The context owns all memory allocations made by its child object hierarchy, including various non-opaque structs and strings. |
| 656 |
* This means that the API user only has to care about one "destroy" call ever when using the C API. |
| 657 |
* All pointers handed out by the APIs are only valid as long as the context |
| 658 |
* is alive and spvc_context_release_allocations has not been called. |
| 659 |
*/ |
| 660 |
SPVC_PUBLIC_API spvc_result spvc_context_create(spvc_context *context); |
| 661 |
|
| 662 |
/* Frees all memory allocations and objects associated with the context and its child objects. */ |
| 663 |
SPVC_PUBLIC_API void spvc_context_destroy(spvc_context context); |
| 664 |
|
| 665 |
/* Frees all memory allocations and objects associated with the context and its child objects, but keeps the context alive. */ |
| 666 |
SPVC_PUBLIC_API void spvc_context_release_allocations(spvc_context context); |
| 667 |
|
| 668 |
/* Get the string for the last error which was logged. */ |
| 669 |
SPVC_PUBLIC_API const char *spvc_context_get_last_error_string(spvc_context context); |
| 670 |
|
| 671 |
/* Get notified in a callback when an error triggers. Useful for debugging. */ |
| 672 |
typedef void (*spvc_error_callback)(void *userdata, const char *error); |
| 673 |
SPVC_PUBLIC_API void spvc_context_set_error_callback(spvc_context context, spvc_error_callback cb, void *userdata); |
| 674 |
|
| 675 |
/* SPIR-V parsing interface. Maps to Parser which then creates a ParsedIR, and that IR is extracted into the handle. */ |
| 676 |
SPVC_PUBLIC_API spvc_result spvc_context_parse_spirv(spvc_context context, const SpvId *spirv, size_t word_count, |
| 677 |
spvc_parsed_ir *parsed_ir); |
| 678 |
|
| 679 |
/* |
| 680 |
* Create a compiler backend. Capture mode controls if we construct by copy or move semantics. |
| 681 |
* It is always recommended to use SPVC_CAPTURE_MODE_TAKE_OWNERSHIP if you only intend to cross-compile the IR once. |
| 682 |
*/ |
| 683 |
SPVC_PUBLIC_API spvc_result spvc_context_create_compiler(spvc_context context, spvc_backend backend, |
| 684 |
spvc_parsed_ir parsed_ir, spvc_capture_mode mode, |
| 685 |
spvc_compiler *compiler); |
| 686 |
|
| 687 |
/* Maps directly to C++ API. */ |
| 688 |
SPVC_PUBLIC_API unsigned spvc_compiler_get_current_id_bound(spvc_compiler compiler); |
| 689 |
|
| 690 |
/* Create compiler options, which will initialize defaults. */ |
| 691 |
SPVC_PUBLIC_API spvc_result spvc_compiler_create_compiler_options(spvc_compiler compiler, |
| 692 |
spvc_compiler_options *options); |
| 693 |
/* Override options. Will return error if e.g. MSL options are used for the HLSL backend, etc. */ |
| 694 |
SPVC_PUBLIC_API spvc_result spvc_compiler_options_set_bool(spvc_compiler_options options, |
| 695 |
spvc_compiler_option option, spvc_bool value); |
| 696 |
SPVC_PUBLIC_API spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, |
| 697 |
spvc_compiler_option option, unsigned value); |
| 698 |
/* Set compiler options. */ |
| 699 |
SPVC_PUBLIC_API spvc_result spvc_compiler_install_compiler_options(spvc_compiler compiler, |
| 700 |
spvc_compiler_options options); |
| 701 |
|
| 702 |
/* Compile IR into a string. *source is owned by the context, and caller must not free it themselves. */ |
| 703 |
SPVC_PUBLIC_API spvc_result spvc_compiler_compile(spvc_compiler compiler, const char **source); |
| 704 |
|
| 705 |
/* Maps to C++ API. */ |
| 706 |
SPVC_PUBLIC_API spvc_result spvc_compiler_add_header_line(spvc_compiler compiler, const char *line); |
| 707 |
SPVC_PUBLIC_API spvc_result spvc_compiler_require_extension(spvc_compiler compiler, const char *ext); |
| 708 |
SPVC_PUBLIC_API spvc_result spvc_compiler_flatten_buffer_block(spvc_compiler compiler, spvc_variable_id id); |
| 709 |
|
| 710 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_variable_is_depth_or_compare(spvc_compiler compiler, spvc_variable_id id); |
| 711 |
|
| 712 |
/* |
| 713 |
* HLSL specifics. |
| 714 |
* Maps to C++ API. |
| 715 |
*/ |
| 716 |
SPVC_PUBLIC_API spvc_result spvc_compiler_hlsl_set_root_constants_layout(spvc_compiler compiler, |
| 717 |
const spvc_hlsl_root_constants *constant_info, |
| 718 |
size_t count); |
| 719 |
SPVC_PUBLIC_API spvc_result spvc_compiler_hlsl_add_vertex_attribute_remap(spvc_compiler compiler, |
| 720 |
const spvc_hlsl_vertex_attribute_remap *remap, |
| 721 |
size_t remaps); |
| 722 |
SPVC_PUBLIC_API spvc_variable_id spvc_compiler_hlsl_remap_num_workgroups_builtin(spvc_compiler compiler); |
| 723 |
|
| 724 |
SPVC_PUBLIC_API spvc_result spvc_compiler_hlsl_set_resource_binding_flags(spvc_compiler compiler, |
| 725 |
spvc_hlsl_binding_flags flags); |
| 726 |
|
| 727 |
SPVC_PUBLIC_API spvc_result spvc_compiler_hlsl_add_resource_binding(spvc_compiler compiler, |
| 728 |
const spvc_hlsl_resource_binding *binding); |
| 729 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_hlsl_is_resource_used(spvc_compiler compiler, |
| 730 |
SpvExecutionModel model, |
| 731 |
unsigned set, |
| 732 |
unsigned binding); |
| 733 |
|
| 734 |
/* |
| 735 |
* MSL specifics. |
| 736 |
* Maps to C++ API. |
| 737 |
*/ |
| 738 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_msl_is_rasterization_disabled(spvc_compiler compiler); |
| 739 |
|
| 740 |
/* Obsolete. Renamed to needs_swizzle_buffer. */ |
| 741 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_msl_needs_aux_buffer(spvc_compiler compiler); |
| 742 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_msl_needs_swizzle_buffer(spvc_compiler compiler); |
| 743 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_msl_needs_buffer_size_buffer(spvc_compiler compiler); |
| 744 |
|
| 745 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_msl_needs_output_buffer(spvc_compiler compiler); |
| 746 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_msl_needs_patch_output_buffer(spvc_compiler compiler); |
| 747 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_msl_needs_input_threadgroup_mem(spvc_compiler compiler); |
| 748 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_vertex_attribute(spvc_compiler compiler, |
| 749 |
const spvc_msl_vertex_attribute *attrs); |
| 750 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_resource_binding(spvc_compiler compiler, |
| 751 |
const spvc_msl_resource_binding *binding); |
| 752 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_shader_input(spvc_compiler compiler, |
| 753 |
const spvc_msl_shader_input *input); |
| 754 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_discrete_descriptor_set(spvc_compiler compiler, unsigned desc_set); |
| 755 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_set_argument_buffer_device_address_space(spvc_compiler compiler, unsigned desc_set, spvc_bool device_address); |
| 756 |
|
| 757 |
/* Obsolete, use is_shader_input_used. */ |
| 758 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_msl_is_vertex_attribute_used(spvc_compiler compiler, unsigned location); |
| 759 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_msl_is_shader_input_used(spvc_compiler compiler, unsigned location); |
| 760 |
|
| 761 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_msl_is_resource_used(spvc_compiler compiler, |
| 762 |
SpvExecutionModel model, |
| 763 |
unsigned set, |
| 764 |
unsigned binding); |
| 765 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_remap_constexpr_sampler(spvc_compiler compiler, spvc_variable_id id, const spvc_msl_constexpr_sampler *sampler); |
| 766 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_remap_constexpr_sampler_by_binding(spvc_compiler compiler, unsigned desc_set, unsigned binding, const spvc_msl_constexpr_sampler *sampler); |
| 767 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_remap_constexpr_sampler_ycbcr(spvc_compiler compiler, spvc_variable_id id, const spvc_msl_constexpr_sampler *sampler, const spvc_msl_sampler_ycbcr_conversion *conv); |
| 768 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_remap_constexpr_sampler_by_binding_ycbcr(spvc_compiler compiler, unsigned desc_set, unsigned binding, const spvc_msl_constexpr_sampler *sampler, const spvc_msl_sampler_ycbcr_conversion *conv); |
| 769 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_set_fragment_output_components(spvc_compiler compiler, unsigned location, unsigned components); |
| 770 |
|
| 771 |
SPVC_PUBLIC_API unsigned spvc_compiler_msl_get_automatic_resource_binding(spvc_compiler compiler, spvc_variable_id id); |
| 772 |
SPVC_PUBLIC_API unsigned spvc_compiler_msl_get_automatic_resource_binding_secondary(spvc_compiler compiler, spvc_variable_id id); |
| 773 |
|
| 774 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_dynamic_buffer(spvc_compiler compiler, unsigned desc_set, unsigned binding, unsigned index); |
| 775 |
|
| 776 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_inline_uniform_block(spvc_compiler compiler, unsigned desc_set, unsigned binding); |
| 777 |
|
| 778 |
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_set_combined_sampler_suffix(spvc_compiler compiler, const char *suffix); |
| 779 |
SPVC_PUBLIC_API const char *spvc_compiler_msl_get_combined_sampler_suffix(spvc_compiler compiler); |
| 780 |
|
| 781 |
/* |
| 782 |
* Reflect resources. |
| 783 |
* Maps almost 1:1 to C++ API. |
| 784 |
*/ |
| 785 |
SPVC_PUBLIC_API spvc_result spvc_compiler_get_active_interface_variables(spvc_compiler compiler, spvc_set *set); |
| 786 |
SPVC_PUBLIC_API spvc_result spvc_compiler_set_enabled_interface_variables(spvc_compiler compiler, spvc_set set); |
| 787 |
SPVC_PUBLIC_API spvc_result spvc_compiler_create_shader_resources(spvc_compiler compiler, spvc_resources *resources); |
| 788 |
SPVC_PUBLIC_API spvc_result spvc_compiler_create_shader_resources_for_active_variables(spvc_compiler compiler, |
| 789 |
spvc_resources *resources, |
| 790 |
spvc_set active); |
| 791 |
SPVC_PUBLIC_API spvc_result spvc_resources_get_resource_list_for_type(spvc_resources resources, spvc_resource_type type, |
| 792 |
const spvc_reflected_resource **resource_list, |
| 793 |
size_t *resource_size); |
| 794 |
|
| 795 |
/* |
| 796 |
* Decorations. |
| 797 |
* Maps to C++ API. |
| 798 |
*/ |
| 799 |
SPVC_PUBLIC_API void spvc_compiler_set_decoration(spvc_compiler compiler, SpvId id, SpvDecoration decoration, |
| 800 |
unsigned argument); |
| 801 |
SPVC_PUBLIC_API void spvc_compiler_set_decoration_string(spvc_compiler compiler, SpvId id, SpvDecoration decoration, |
| 802 |
const char *argument); |
| 803 |
SPVC_PUBLIC_API void spvc_compiler_set_name(spvc_compiler compiler, SpvId id, const char *argument); |
| 804 |
SPVC_PUBLIC_API void spvc_compiler_set_member_decoration(spvc_compiler compiler, spvc_type_id id, unsigned member_index, |
| 805 |
SpvDecoration decoration, unsigned argument); |
| 806 |
SPVC_PUBLIC_API void spvc_compiler_set_member_decoration_string(spvc_compiler compiler, spvc_type_id id, |
| 807 |
unsigned member_index, SpvDecoration decoration, |
| 808 |
const char *argument); |
| 809 |
SPVC_PUBLIC_API void spvc_compiler_set_member_name(spvc_compiler compiler, spvc_type_id id, unsigned member_index, |
| 810 |
const char *argument); |
| 811 |
SPVC_PUBLIC_API void spvc_compiler_unset_decoration(spvc_compiler compiler, SpvId id, SpvDecoration decoration); |
| 812 |
SPVC_PUBLIC_API void spvc_compiler_unset_member_decoration(spvc_compiler compiler, spvc_type_id id, |
| 813 |
unsigned member_index, SpvDecoration decoration); |
| 814 |
|
| 815 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_has_decoration(spvc_compiler compiler, SpvId id, SpvDecoration decoration); |
| 816 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_has_member_decoration(spvc_compiler compiler, spvc_type_id id, |
| 817 |
unsigned member_index, SpvDecoration decoration); |
| 818 |
SPVC_PUBLIC_API const char *spvc_compiler_get_name(spvc_compiler compiler, SpvId id); |
| 819 |
SPVC_PUBLIC_API unsigned spvc_compiler_get_decoration(spvc_compiler compiler, SpvId id, SpvDecoration decoration); |
| 820 |
SPVC_PUBLIC_API const char *spvc_compiler_get_decoration_string(spvc_compiler compiler, SpvId id, |
| 821 |
SpvDecoration decoration); |
| 822 |
SPVC_PUBLIC_API unsigned spvc_compiler_get_member_decoration(spvc_compiler compiler, spvc_type_id id, |
| 823 |
unsigned member_index, SpvDecoration decoration); |
| 824 |
SPVC_PUBLIC_API const char *spvc_compiler_get_member_decoration_string(spvc_compiler compiler, spvc_type_id id, |
| 825 |
unsigned member_index, SpvDecoration decoration); |
| 826 |
SPVC_PUBLIC_API const char *spvc_compiler_get_member_name(spvc_compiler compiler, spvc_type_id id, unsigned member_index); |
| 827 |
|
| 828 |
/* |
| 829 |
* Entry points. |
| 830 |
* Maps to C++ API. |
| 831 |
*/ |
| 832 |
SPVC_PUBLIC_API spvc_result spvc_compiler_get_entry_points(spvc_compiler compiler, |
| 833 |
const spvc_entry_point **entry_points, |
| 834 |
size_t *num_entry_points); |
| 835 |
SPVC_PUBLIC_API spvc_result spvc_compiler_set_entry_point(spvc_compiler compiler, const char *name, |
| 836 |
SpvExecutionModel model); |
| 837 |
SPVC_PUBLIC_API spvc_result spvc_compiler_rename_entry_point(spvc_compiler compiler, const char *old_name, |
| 838 |
const char *new_name, SpvExecutionModel model); |
| 839 |
SPVC_PUBLIC_API const char *spvc_compiler_get_cleansed_entry_point_name(spvc_compiler compiler, const char *name, |
| 840 |
SpvExecutionModel model); |
| 841 |
SPVC_PUBLIC_API void spvc_compiler_set_execution_mode(spvc_compiler compiler, SpvExecutionMode mode); |
| 842 |
SPVC_PUBLIC_API void spvc_compiler_unset_execution_mode(spvc_compiler compiler, SpvExecutionMode mode); |
| 843 |
SPVC_PUBLIC_API void spvc_compiler_set_execution_mode_with_arguments(spvc_compiler compiler, SpvExecutionMode mode, |
| 844 |
unsigned arg0, unsigned arg1, unsigned arg2); |
| 845 |
SPVC_PUBLIC_API spvc_result spvc_compiler_get_execution_modes(spvc_compiler compiler, const SpvExecutionMode **modes, |
| 846 |
size_t *num_modes); |
| 847 |
SPVC_PUBLIC_API unsigned spvc_compiler_get_execution_mode_argument(spvc_compiler compiler, SpvExecutionMode mode); |
| 848 |
SPVC_PUBLIC_API unsigned spvc_compiler_get_execution_mode_argument_by_index(spvc_compiler compiler, |
| 849 |
SpvExecutionMode mode, unsigned index); |
| 850 |
SPVC_PUBLIC_API SpvExecutionModel spvc_compiler_get_execution_model(spvc_compiler compiler); |
| 851 |
|
| 852 |
/* |
| 853 |
* Type query interface. |
| 854 |
* Maps to C++ API, except it's read-only. |
| 855 |
*/ |
| 856 |
SPVC_PUBLIC_API spvc_type spvc_compiler_get_type_handle(spvc_compiler compiler, spvc_type_id id); |
| 857 |
|
| 858 |
/* Pulls out SPIRType::self. This effectively gives the type ID without array or pointer qualifiers. |
| 859 |
* This is necessary when reflecting decoration/name information on members of a struct, |
| 860 |
* which are placed in the base type, not the qualified type. |
| 861 |
* This is similar to spvc_reflected_resource::base_type_id. */ |
| 862 |
SPVC_PUBLIC_API spvc_type_id spvc_type_get_base_type_id(spvc_type type); |
| 863 |
|
| 864 |
SPVC_PUBLIC_API spvc_basetype spvc_type_get_basetype(spvc_type type); |
| 865 |
SPVC_PUBLIC_API unsigned spvc_type_get_bit_width(spvc_type type); |
| 866 |
SPVC_PUBLIC_API unsigned spvc_type_get_vector_size(spvc_type type); |
| 867 |
SPVC_PUBLIC_API unsigned spvc_type_get_columns(spvc_type type); |
| 868 |
SPVC_PUBLIC_API unsigned spvc_type_get_num_array_dimensions(spvc_type type); |
| 869 |
SPVC_PUBLIC_API spvc_bool spvc_type_array_dimension_is_literal(spvc_type type, unsigned dimension); |
| 870 |
SPVC_PUBLIC_API SpvId spvc_type_get_array_dimension(spvc_type type, unsigned dimension); |
| 871 |
SPVC_PUBLIC_API unsigned spvc_type_get_num_member_types(spvc_type type); |
| 872 |
SPVC_PUBLIC_API spvc_type_id spvc_type_get_member_type(spvc_type type, unsigned index); |
| 873 |
SPVC_PUBLIC_API SpvStorageClass spvc_type_get_storage_class(spvc_type type); |
| 874 |
|
| 875 |
/* Image type query. */ |
| 876 |
SPVC_PUBLIC_API spvc_type_id spvc_type_get_image_sampled_type(spvc_type type); |
| 877 |
SPVC_PUBLIC_API SpvDim spvc_type_get_image_dimension(spvc_type type); |
| 878 |
SPVC_PUBLIC_API spvc_bool spvc_type_get_image_is_depth(spvc_type type); |
| 879 |
SPVC_PUBLIC_API spvc_bool spvc_type_get_image_arrayed(spvc_type type); |
| 880 |
SPVC_PUBLIC_API spvc_bool spvc_type_get_image_multisampled(spvc_type type); |
| 881 |
SPVC_PUBLIC_API spvc_bool spvc_type_get_image_is_storage(spvc_type type); |
| 882 |
SPVC_PUBLIC_API SpvImageFormat spvc_type_get_image_storage_format(spvc_type type); |
| 883 |
SPVC_PUBLIC_API SpvAccessQualifier spvc_type_get_image_access_qualifier(spvc_type type); |
| 884 |
|
| 885 |
/* |
| 886 |
* Buffer layout query. |
| 887 |
* Maps to C++ API. |
| 888 |
*/ |
| 889 |
SPVC_PUBLIC_API spvc_result spvc_compiler_get_declared_struct_size(spvc_compiler compiler, spvc_type struct_type, size_t *size); |
| 890 |
SPVC_PUBLIC_API spvc_result spvc_compiler_get_declared_struct_size_runtime_array(spvc_compiler compiler, |
| 891 |
spvc_type struct_type, size_t array_size, size_t *size); |
| 892 |
SPVC_PUBLIC_API spvc_result spvc_compiler_get_declared_struct_member_size(spvc_compiler compiler, spvc_type type, unsigned index, size_t *size); |
| 893 |
|
| 894 |
SPVC_PUBLIC_API spvc_result spvc_compiler_type_struct_member_offset(spvc_compiler compiler, |
| 895 |
spvc_type type, unsigned index, unsigned *offset); |
| 896 |
SPVC_PUBLIC_API spvc_result spvc_compiler_type_struct_member_array_stride(spvc_compiler compiler, |
| 897 |
spvc_type type, unsigned index, unsigned *stride); |
| 898 |
SPVC_PUBLIC_API spvc_result spvc_compiler_type_struct_member_matrix_stride(spvc_compiler compiler, |
| 899 |
spvc_type type, unsigned index, unsigned *stride); |
| 900 |
|
| 901 |
/* |
| 902 |
* Workaround helper functions. |
| 903 |
* Maps to C++ API. |
| 904 |
*/ |
| 905 |
SPVC_PUBLIC_API spvc_result spvc_compiler_build_dummy_sampler_for_combined_images(spvc_compiler compiler, spvc_variable_id *id); |
| 906 |
SPVC_PUBLIC_API spvc_result spvc_compiler_build_combined_image_samplers(spvc_compiler compiler); |
| 907 |
SPVC_PUBLIC_API spvc_result spvc_compiler_get_combined_image_samplers(spvc_compiler compiler, |
| 908 |
const spvc_combined_image_sampler **samplers, |
| 909 |
size_t *num_samplers); |
| 910 |
|
| 911 |
/* |
| 912 |
* Constants |
| 913 |
* Maps to C++ API. |
| 914 |
*/ |
| 915 |
SPVC_PUBLIC_API spvc_result spvc_compiler_get_specialization_constants(spvc_compiler compiler, |
| 916 |
const spvc_specialization_constant **constants, |
| 917 |
size_t *num_constants); |
| 918 |
SPVC_PUBLIC_API spvc_constant spvc_compiler_get_constant_handle(spvc_compiler compiler, |
| 919 |
spvc_constant_id id); |
| 920 |
|
| 921 |
SPVC_PUBLIC_API spvc_constant_id spvc_compiler_get_work_group_size_specialization_constants(spvc_compiler compiler, |
| 922 |
spvc_specialization_constant *x, |
| 923 |
spvc_specialization_constant *y, |
| 924 |
spvc_specialization_constant *z); |
| 925 |
|
| 926 |
/* |
| 927 |
* Buffer ranges |
| 928 |
* Maps to C++ API. |
| 929 |
*/ |
| 930 |
SPVC_PUBLIC_API spvc_result spvc_compiler_get_active_buffer_ranges(spvc_compiler compiler, |
| 931 |
spvc_variable_id id, |
| 932 |
const spvc_buffer_range **ranges, |
| 933 |
size_t *num_ranges); |
| 934 |
|
| 935 |
/* |
| 936 |
* No stdint.h until C99, sigh :( |
| 937 |
* For smaller types, the result is sign or zero-extended as appropriate. |
| 938 |
* Maps to C++ API. |
| 939 |
* TODO: The SPIRConstant query interface and modification interface is not quite complete. |
| 940 |
*/ |
| 941 |
SPVC_PUBLIC_API float spvc_constant_get_scalar_fp16(spvc_constant constant, unsigned column, unsigned row); |
| 942 |
SPVC_PUBLIC_API float spvc_constant_get_scalar_fp32(spvc_constant constant, unsigned column, unsigned row); |
| 943 |
SPVC_PUBLIC_API double spvc_constant_get_scalar_fp64(spvc_constant constant, unsigned column, unsigned row); |
| 944 |
SPVC_PUBLIC_API unsigned spvc_constant_get_scalar_u32(spvc_constant constant, unsigned column, unsigned row); |
| 945 |
SPVC_PUBLIC_API int spvc_constant_get_scalar_i32(spvc_constant constant, unsigned column, unsigned row); |
| 946 |
SPVC_PUBLIC_API unsigned spvc_constant_get_scalar_u16(spvc_constant constant, unsigned column, unsigned row); |
| 947 |
SPVC_PUBLIC_API int spvc_constant_get_scalar_i16(spvc_constant constant, unsigned column, unsigned row); |
| 948 |
SPVC_PUBLIC_API unsigned spvc_constant_get_scalar_u8(spvc_constant constant, unsigned column, unsigned row); |
| 949 |
SPVC_PUBLIC_API int spvc_constant_get_scalar_i8(spvc_constant constant, unsigned column, unsigned row); |
| 950 |
SPVC_PUBLIC_API void spvc_constant_get_subconstants(spvc_constant constant, const spvc_constant_id **constituents, size_t *count); |
| 951 |
SPVC_PUBLIC_API spvc_type_id spvc_constant_get_type(spvc_constant constant); |
| 952 |
|
| 953 |
/* |
| 954 |
* Misc reflection |
| 955 |
* Maps to C++ API. |
| 956 |
*/ |
| 957 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_get_binary_offset_for_decoration(spvc_compiler compiler, |
| 958 |
spvc_variable_id id, |
| 959 |
SpvDecoration decoration, |
| 960 |
unsigned *word_offset); |
| 961 |
|
| 962 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_buffer_is_hlsl_counter_buffer(spvc_compiler compiler, spvc_variable_id id); |
| 963 |
SPVC_PUBLIC_API spvc_bool spvc_compiler_buffer_get_hlsl_counter_buffer(spvc_compiler compiler, spvc_variable_id id, |
| 964 |
spvc_variable_id *counter_id); |
| 965 |
|
| 966 |
SPVC_PUBLIC_API spvc_result spvc_compiler_get_declared_capabilities(spvc_compiler compiler, |
| 967 |
const SpvCapability **capabilities, |
| 968 |
size_t *num_capabilities); |
| 969 |
SPVC_PUBLIC_API spvc_result spvc_compiler_get_declared_extensions(spvc_compiler compiler, const char ***extensions, |
| 970 |
size_t *num_extensions); |
| 971 |
|
| 972 |
SPVC_PUBLIC_API const char *spvc_compiler_get_remapped_declared_block_name(spvc_compiler compiler, spvc_variable_id id); |
| 973 |
SPVC_PUBLIC_API spvc_result spvc_compiler_get_buffer_block_decorations(spvc_compiler compiler, spvc_variable_id id, |
| 974 |
const SpvDecoration **decorations, |
| 975 |
size_t *num_decorations); |
| 976 |
|
| 977 |
#ifdef __cplusplus |
| 978 |
} |
| 979 |
#endif |
| 980 |
#endif |