1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright 2017 Intel Corporation
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * on the rights to use, copy, modify, merge, publish, distribute, sub
8bf215546Sopenharmony_ci * license, and/or sell copies of the Software, and to permit persons to whom
9bf215546Sopenharmony_ci * the Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE.
22bf215546Sopenharmony_ci */
23bf215546Sopenharmony_ci
24bf215546Sopenharmony_ci/**
25bf215546Sopenharmony_ci * \file
26bf215546Sopenharmony_ci * \brief SPIRV-V extension handling. See ARB_spirv_extensions
27bf215546Sopenharmony_ci */
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ci#ifndef _SPIRVEXTENSIONS_H_
30bf215546Sopenharmony_ci#define _SPIRVEXTENSIONS_H_
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ci#include "mtypes.h"
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ci#ifdef __cplusplus
35bf215546Sopenharmony_ciextern "C" {
36bf215546Sopenharmony_ci#endif
37bf215546Sopenharmony_ci
38bf215546Sopenharmony_cienum SpvExtension {
39bf215546Sopenharmony_ci   SPV_KHR_16bit_storage = 0,
40bf215546Sopenharmony_ci   SPV_KHR_device_group,
41bf215546Sopenharmony_ci   SPV_KHR_multiview,
42bf215546Sopenharmony_ci   SPV_KHR_shader_ballot,
43bf215546Sopenharmony_ci   SPV_KHR_shader_draw_parameters,
44bf215546Sopenharmony_ci   SPV_KHR_storage_buffer_storage_class,
45bf215546Sopenharmony_ci   SPV_KHR_subgroup_vote,
46bf215546Sopenharmony_ci   SPV_KHR_variable_pointers,
47bf215546Sopenharmony_ci   SPV_AMD_gcn_shader,
48bf215546Sopenharmony_ci   SPV_EXTENSIONS_COUNT
49bf215546Sopenharmony_ci};
50bf215546Sopenharmony_ci
51bf215546Sopenharmony_cistruct spirv_supported_extensions {
52bf215546Sopenharmony_ci   /** Flags the supported extensions. Array to make it easier to iterate. */
53bf215546Sopenharmony_ci   bool supported[SPV_EXTENSIONS_COUNT];
54bf215546Sopenharmony_ci
55bf215546Sopenharmony_ci   /** Number of supported extensions */
56bf215546Sopenharmony_ci   unsigned int count;
57bf215546Sopenharmony_ci};
58bf215546Sopenharmony_ci
59bf215546Sopenharmony_ciextern GLuint
60bf215546Sopenharmony_ci_mesa_get_spirv_extension_count(struct gl_context *ctx);
61bf215546Sopenharmony_ci
62bf215546Sopenharmony_ciextern const GLubyte *
63bf215546Sopenharmony_ci_mesa_get_enabled_spirv_extension(struct gl_context *ctx,
64bf215546Sopenharmony_ci                                  GLuint index);
65bf215546Sopenharmony_ci
66bf215546Sopenharmony_ciconst char *_mesa_spirv_extensions_to_string(enum SpvExtension ext);
67bf215546Sopenharmony_ci
68bf215546Sopenharmony_civoid _mesa_fill_supported_spirv_extensions(struct spirv_supported_extensions *ext,
69bf215546Sopenharmony_ci                                           const struct spirv_supported_capabilities *cap);
70bf215546Sopenharmony_ci
71bf215546Sopenharmony_ci#ifdef __cplusplus
72bf215546Sopenharmony_ci}
73bf215546Sopenharmony_ci#endif
74bf215546Sopenharmony_ci
75bf215546Sopenharmony_ci#endif /* SPIRVEXTENSIONS_H */
76