]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - pr_comp.h
don't try to compile GL_NV_half_float shaders if the extension is missing
[xonotic/darkplaces.git] / pr_comp.h
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20
21 // this file is shared by quake and qcc
22
23 #ifndef PR_COMP_H
24 #define PR_COMP_H
25
26 typedef unsigned int    func_t;
27 typedef int     string_t;
28
29 typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t;
30
31
32 #define OFS_NULL                0
33 #define OFS_RETURN              1
34 #define OFS_PARM0               4               // leave 3 ofs for each parm to hold vectors
35 #define OFS_PARM1               7
36 #define OFS_PARM2               10
37 #define OFS_PARM3               13
38 #define OFS_PARM4               16
39 #define OFS_PARM5               19
40 #define OFS_PARM6               22
41 #define OFS_PARM7               25
42 #define RESERVED_OFS    28
43
44
45 enum {
46         OP_DONE,
47         OP_MUL_F,
48         OP_MUL_V,
49         OP_MUL_FV,
50         OP_MUL_VF,
51         OP_DIV_F,
52         OP_ADD_F,
53         OP_ADD_V,
54         OP_SUB_F,
55         OP_SUB_V,
56         
57         OP_EQ_F,
58         OP_EQ_V,
59         OP_EQ_S,
60         OP_EQ_E,
61         OP_EQ_FNC,
62         
63         OP_NE_F,
64         OP_NE_V,
65         OP_NE_S,
66         OP_NE_E,
67         OP_NE_FNC,
68         
69         OP_LE,
70         OP_GE,
71         OP_LT,
72         OP_GT,
73
74         OP_LOAD_F,
75         OP_LOAD_V,
76         OP_LOAD_S,
77         OP_LOAD_ENT,
78         OP_LOAD_FLD,
79         OP_LOAD_FNC,
80
81         OP_ADDRESS,
82
83         OP_STORE_F,
84         OP_STORE_V,
85         OP_STORE_S,
86         OP_STORE_ENT,
87         OP_STORE_FLD,
88         OP_STORE_FNC,
89
90         OP_STOREP_F,
91         OP_STOREP_V,
92         OP_STOREP_S,
93         OP_STOREP_ENT,
94         OP_STOREP_FLD,
95         OP_STOREP_FNC,
96
97         OP_RETURN,
98         OP_NOT_F,
99         OP_NOT_V,
100         OP_NOT_S,
101         OP_NOT_ENT,
102         OP_NOT_FNC,
103         OP_IF,
104         OP_IFNOT,
105         OP_CALL0,
106         OP_CALL1,
107         OP_CALL2,
108         OP_CALL3,
109         OP_CALL4,
110         OP_CALL5,
111         OP_CALL6,
112         OP_CALL7,
113         OP_CALL8,
114         OP_STATE,
115         OP_GOTO,
116         OP_AND,
117         OP_OR,
118         
119         OP_BITAND,
120         OP_BITOR
121 };
122
123
124 typedef struct statement_s
125 {
126         unsigned short  op;
127         signed short    a,b,c;
128 } dstatement_t;
129
130 typedef struct
131 {
132         unsigned short  type;           // if DEF_SAVEGLOBGAL bit is set
133                                                                 // the variable needs to be saved in savegames
134         unsigned short  ofs;
135         int                     s_name;
136 } ddef_t;
137 #define DEF_SAVEGLOBAL  (1<<15)
138
139 #define MAX_PARMS       8
140
141 typedef struct
142 {
143         int             first_statement;        // negative numbers are builtins
144         int             parm_start;
145         int             locals;                         // total ints of parms + locals
146
147         int             profile;                // runtime
148
149         int             s_name;
150         int             s_file;                 // source file defined in
151
152         int             numparms;
153         qbyte   parm_size[MAX_PARMS];
154 } dfunction_t;
155
156 typedef struct
157 {
158         int             first_statement;        // negative numbers are builtins
159         int             parm_start;
160         int             locals;                         // total ints of parms + locals
161
162         int             profile;                // runtime
163         int             builtinsprofile; // cost of builtin functions called by this function
164         int             callcount; // times the functions has been called since the last profile call
165
166         int             s_name;
167         int             s_file;                 // source file defined in
168
169         int             numparms;
170         qbyte   parm_size[MAX_PARMS];
171 } mfunction_t;
172
173
174 #define PROG_VERSION    6
175 typedef struct
176 {
177         int             version;
178         int             crc;                    // check of header file
179
180         int             ofs_statements;
181         int             numstatements;  // statement 0 is an error
182
183         int             ofs_globaldefs;
184         int             numglobaldefs;
185
186         int             ofs_fielddefs;
187         int             numfielddefs;
188
189         int             ofs_functions;
190         int             numfunctions;   // function 0 is an empty
191
192         int             ofs_strings;
193         int             numstrings;             // first string is a null string
194
195         int             ofs_globals;
196         int             numglobals;
197
198         int             entityfields;
199 } dprograms_t;
200
201 #endif
202