1 /*  RetroArch - A frontend for libretro.
2  *  Copyright (C) 2010-2017 - Hans-Kristian Arntzen
3  *
4  *  RetroArch is free software: you can redistribute it and/or modify it under the terms
5  *  of the GNU General Public License as published by the Free Software Found-
6  *  ation, either version 3 of the License, or (at your option) any later version.
7  *
8  *  RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9  *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10  *  PURPOSE.  See the GNU General Public License for more details.
11  *
12  *  You should have received a copy of the GNU General Public License along with RetroArch.
13  *  If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #ifndef SLANG_REFLECTION_H_
17 #define SLANG_REFLECTION_H_
18 
19 /* Textures with built-in meaning. */
20 enum slang_texture_semantic
21 {
22    /* The input texture to the filter chain.
23     * Canonical name: "Original". */
24    SLANG_TEXTURE_SEMANTIC_ORIGINAL         = 0,
25 
26    /* The output from pass N - 1 if executing pass N, or ORIGINAL
27     * if pass #0 is executed.
28     * Canonical name: "Source".
29     */
30    SLANG_TEXTURE_SEMANTIC_SOURCE           = 1,
31 
32    /* The original inputs with a history back in time.
33     * Canonical name: "OriginalHistory#", e.g. "OriginalHistory2" <- Two frames back.
34     * "OriginalHistory0" is an alias for SEMANTIC_ORIGINAL.
35     * Size name: "OriginalHistorySize#".
36     */
37    SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY = 2,
38 
39    /* The output from pass #N, where pass #0 is the first pass.
40     * Canonical name: "PassOutput#", e.g. "PassOutput3".
41     * Size name: "PassOutputSize#".
42     */
43    SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT      = 3,
44 
45    /* The output from pass #N, one frame ago where pass #0 is the first pass.
46     * It is not valid to use the pass feedback from a pass which is not offscreen.
47     * Canonical name: "PassFeedback#", e.g. "PassFeedback2".
48     */
49    SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK    = 4,
50 
51    /* Inputs from static textures, defined by the user.
52     * There is no canonical name, and the only way to use these semantics are by
53     * remapping.
54     */
55    SLANG_TEXTURE_SEMANTIC_USER             = 5,
56 
57    SLANG_NUM_TEXTURE_SEMANTICS,
58    SLANG_INVALID_TEXTURE_SEMANTIC       = -1
59 };
60 
61 enum slang_semantic
62 {
63    /* mat4, MVP */
64    SLANG_SEMANTIC_MVP             = 0,
65    /* vec4, viewport size of current pass */
66    SLANG_SEMANTIC_OUTPUT          = 1,
67    /* vec4, viewport size of final pass */
68    SLANG_SEMANTIC_FINAL_VIEWPORT  = 2,
69    /* uint, frame count with modulo */
70    SLANG_SEMANTIC_FRAME_COUNT     = 3,
71    /* int, frame direction */
72    SLANG_SEMANTIC_FRAME_DIRECTION = 4,
73    SLANG_NUM_BASE_SEMANTICS,
74 
75    /* float, user defined parameter, arrayed */
76    SLANG_SEMANTIC_FLOAT_PARAMETER = 5,
77 
78    SLANG_NUM_SEMANTICS,
79    SLANG_INVALID_SEMANTIC         = -1
80 };
81 
82 enum slang_stage
83 {
84    SLANG_STAGE_VERTEX_MASK   = 1 << 0,
85    SLANG_STAGE_FRAGMENT_MASK = 1 << 1
86 };
87 
88 enum slang_constant_buffer
89 {
90    SLANG_CBUFFER_UBO = 0,
91    SLANG_CBUFFER_PC,
92    SLANG_CBUFFER_MAX
93 };
94 
95 /* Vulkan maximum texture bindings inside shader. D3D11 has hard limit of 16 */
96 #define SLANG_NUM_BINDINGS 16
97 
98 struct slang_texture_semantic_map
99 {
100    enum slang_texture_semantic semantic;
101    unsigned index;
102 };
103 
104 struct slang_semantic_map
105 {
106    enum slang_semantic semantic;
107    unsigned index;
108 };
109 
110 
111 #endif
112