summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/slang_link.h
blob: 5f8c4e7335113c2f505461194720e45ce6840aa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
 * Mesa 3-D graphics library
 * Version:  6.5
 *
 * Copyright (C) 2006  Brian Paul   All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#if !defined SLANG_LINK_H
#define SLANG_LINK_H

#include "slang_compile.h"

#if defined __cplusplus
extern "C" {
#endif

enum
{
	SLANG_UNIFORM_BINDING_VERTEX,
	SLANG_UNIFORM_BINDING_FRAGMENT,
	SLANG_UNIFORM_BINDING_MAX
};

typedef struct
{
	slang_export_data_quant *quant;
	char *name;
	GLuint address[SLANG_UNIFORM_BINDING_MAX];
} slang_uniform_binding;

typedef struct
{
	slang_uniform_binding *table;
	GLuint count;
} slang_uniform_bindings;

typedef struct
{
	slang_export_data_quant *quant;
	char *name;
} slang_active_uniform;

typedef struct
{
	slang_active_uniform *table;
	GLuint count;
} slang_active_uniforms;

enum
{
	SLANG_COMMON_FIXED_MODELVIEWMATRIX,
	SLANG_COMMON_FIXED_PROJECTIONMATRIX,
	SLANG_COMMON_FIXED_MODELVIEWPROJECTIONMATRIX,
	SLANG_COMMON_FIXED_TEXTUREMATRIX,
	SLANG_COMMON_FIXED_NORMALMATRIX,
	SLANG_COMMON_FIXED_MODELVIEWMATRIXINVERSE,
	SLANG_COMMON_FIXED_PROJECTIONMATRIXINVERSE,
	SLANG_COMMON_FIXED_MODELVIEWPROJECTIONMATRIXINVERSE,
	SLANG_COMMON_FIXED_TEXTUREMATRIXINVERSE,
	SLANG_COMMON_FIXED_MODELVIEWMATRIXTRANSPOSE,
	SLANG_COMMON_FIXED_PROJECTIONMATRIXTRANSPOSE,
	SLANG_COMMON_FIXED_MODELVIEWPROJECTIONMATRIXTRANSPOSE,
	SLANG_COMMON_FIXED_TEXTUREMATRIXTRANSPOSE,
	SLANG_COMMON_FIXED_MODELVIEWMATRIXINVERSETRANSPOSE,
	SLANG_COMMON_FIXED_PROJECTIONMATRIXINVERSETRANSPOSE,
	SLANG_COMMON_FIXED_MODELVIEWPROJECTIONMATRIXINVERSETRANSPOSE,
	SLANG_COMMON_FIXED_TEXTUREMATRIXINVERSETRANSPOSE,
	SLANG_COMMON_FIXED_NORMALSCALE,
	SLANG_COMMON_FIXED_DEPTHRANGE,
	SLANG_COMMON_FIXED_CLIPPLANE,
	SLANG_COMMON_FIXED_POINT,
	SLANG_COMMON_FIXED_FRONTMATERIAL,
	SLANG_COMMON_FIXED_BACKMATERIAL,
	SLANG_COMMON_FIXED_LIGHTSOURCE,
	SLANG_COMMON_FIXED_LIGHTMODEL,
	SLANG_COMMON_FIXED_FRONTLIGHTMODELPRODUCT,
	SLANG_COMMON_FIXED_BACKLIGHTMODELPRODUCT,
	SLANG_COMMON_FIXED_FRONTLIGHTPRODUCT,
	SLANG_COMMON_FIXED_BACKLIGHTPRODUCT,
	SLANG_COMMON_FIXED_TEXTUREENVCOLOR,
	SLANG_COMMON_FIXED_EYEPLANES,
	SLANG_COMMON_FIXED_EYEPLANET,
	SLANG_COMMON_FIXED_EYEPLANER,
	SLANG_COMMON_FIXED_EYEPLANEQ,
	SLANG_COMMON_FIXED_OBJECTPLANES,
	SLANG_COMMON_FIXED_OBJECTPLANET,
	SLANG_COMMON_FIXED_OBJECTPLANER,
	SLANG_COMMON_FIXED_OBJECTPLANEQ,
	SLANG_COMMON_FIXED_FOG,
	SLANG_COMMON_FIXED_MAX
};

enum
{
	SLANG_VERTEX_FIXED_POSITION,
	SLANG_VERTEX_FIXED_POINTSIZE,
	SLANG_VERTEX_FIXED_CLIPVERTEX,
	SLANG_VERTEX_FIXED_COLOR,
	SLANG_VERTEX_FIXED_SECONDARYCOLOR,
	SLANG_VERTEX_FIXED_NORMAL,
	SLANG_VERTEX_FIXED_VERTEX,
	SLANG_VERTEX_FIXED_MULTITEXCOORD0,
	SLANG_VERTEX_FIXED_MULTITEXCOORD1,
	SLANG_VERTEX_FIXED_MULTITEXCOORD2,
	SLANG_VERTEX_FIXED_MULTITEXCOORD3,
	SLANG_VERTEX_FIXED_MULTITEXCOORD4,
	SLANG_VERTEX_FIXED_MULTITEXCOORD5,
	SLANG_VERTEX_FIXED_MULTITEXCOORD6,
	SLANG_VERTEX_FIXED_MULTITEXCOORD7,
	SLANG_VERTEX_FIXED_FOGCOORD,
	SLANG_VERTEX_FIXED_FRONTCOLOR,
	SLANG_VERTEX_FIXED_BACKCOLOR,
	SLANG_VERTEX_FIXED_FRONTSECONDARYCOLOR,
	SLANG_VERTEX_FIXED_BACKSECONDARYCOLOR,
	SLANG_VERTEX_FIXED_TEXCOORD,
	SLANG_VERTEX_FIXED_FOGFRAGCOORD,
	SLANG_VERTEX_FIXED_MAX
};

enum
{
	SLANG_FRAGMENT_FIXED_FRAGCOORD,
	SLANG_FRAGMENT_FIXED_FRONTFACING,
	SLANG_FRAGMENT_FIXED_FRAGCOLOR,
	SLANG_FRAGMENT_FIXED_FRAGDATA,
	SLANG_FRAGMENT_FIXED_FRAGDEPTH,
	SLANG_FRAGMENT_FIXED_COLOR,
	SLANG_FRAGMENT_FIXED_SECONDARYCOLOR,
	SLANG_FRAGMENT_FIXED_TEXCOORD,
	SLANG_FRAGMENT_FIXED_FOGFRAGCOORD,
	SLANG_FRAGMENT_FIXED_MAX
};

typedef struct
{
	slang_uniform_bindings uniforms;
	slang_active_uniforms active_uniforms;
	GLuint common_fixed_entries[SLANG_UNIFORM_BINDING_MAX][SLANG_COMMON_FIXED_MAX];
	GLuint vertex_fixed_entries[SLANG_VERTEX_FIXED_MAX];
	GLuint fragment_fixed_entries[SLANG_FRAGMENT_FIXED_MAX];
	GLuint code[SLANG_UNIFORM_BINDING_MAX];
	slang_machine *machines[SLANG_UNIFORM_BINDING_MAX];
	slang_assembly_file *assemblies[SLANG_UNIFORM_BINDING_MAX];
} slang_program;

GLvoid slang_program_ctr (slang_program *);
GLvoid slang_program_dtr (slang_program *);

GLboolean _slang_link (slang_program *, slang_translation_unit **, GLuint);

#ifdef __cplusplus
}
#endif

#endif